diff --git a/apps/apps_container.cpp b/apps/apps_container.cpp index 5656aecb9..dc1e6af37 100644 --- a/apps/apps_container.cpp +++ b/apps/apps_container.cpp @@ -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). */ diff --git a/apps/apps_window.cpp b/apps/apps_window.cpp index f3457f515..68a150133 100644 --- a/apps/apps_window.cpp +++ b/apps/apps_window.cpp @@ -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); } } diff --git a/apps/apps_window.h b/apps/apps_window.h index 093d63d74..08f1bb651 100644 --- a/apps/apps_window.h +++ b/apps/apps_window.h @@ -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; diff --git a/apps/calculation/edit_expression_controller.cpp b/apps/calculation/edit_expression_controller.cpp index d0b673ab5..d72b7fc20 100644 --- a/apps/calculation/edit_expression_controller.cpp +++ b/apps/calculation/edit_expression_controller.cpp @@ -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() { diff --git a/apps/calculation/edit_expression_controller.h b/apps/calculation/edit_expression_controller.h index 24fbca013..2fadd126d 100644 --- a/apps/calculation/edit_expression_controller.h +++ b/apps/calculation/edit_expression_controller.h @@ -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; }; diff --git a/apps/calculation/history_view_cell.cpp b/apps/calculation/history_view_cell.cpp index e7e6c8d8a..901795896 100644 --- a/apps/calculation/history_view_cell.cpp +++ b/apps/calculation/history_view_cell.cpp @@ -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) { diff --git a/apps/calculation/history_view_cell.h b/apps/calculation/history_view_cell.h index e1c0f099d..80d9ee593 100644 --- a/apps/calculation/history_view_cell.h +++ b/apps/calculation/history_view_cell.h @@ -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(); diff --git a/apps/code/console_edit_cell.cpp b/apps/code/console_edit_cell.cpp index e2472d8fe..d1b55c9d5 100644 --- a/apps/code/console_edit_cell.cpp +++ b/apps/code/console_edit_cell.cpp @@ -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() { diff --git a/apps/code/console_edit_cell.h b/apps/code/console_edit_cell.h index e98cfba46..2d8fcabb1 100644 --- a/apps/code/console_edit_cell.h +++ b/apps/code/console_edit_cell.h @@ -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; diff --git a/apps/code/console_line_cell.cpp b/apps/code/console_line_cell.cpp index b0181b6a0..784875875 100644 --- a/apps/code/console_line_cell.cpp +++ b/apps/code/console_line_cell.cpp @@ -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() { diff --git a/apps/code/console_line_cell.h b/apps/code/console_line_cell.h index 8cb3ef58a..8a740b913 100644 --- a/apps/code/console_line_cell.h +++ b/apps/code/console_line_cell.h @@ -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; diff --git a/apps/code/editor_view.cpp b/apps/code/editor_view.cpp index 4138b5221..23fcbf9c5 100644 --- a/apps/code/editor_view.cpp +++ b/apps/code/editor_view.cpp @@ -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 */ diff --git a/apps/code/editor_view.h b/apps/code/editor_view.h index 7e4d85ece..817bc5218 100644 --- a/apps/code/editor_view.h +++ b/apps/code/editor_view.h @@ -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: diff --git a/apps/code/script_name_cell.cpp b/apps/code/script_name_cell.cpp index 26792e7f2..d451df130 100644 --- a/apps/code/script_name_cell.cpp +++ b/apps/code/script_name_cell.cpp @@ -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); } } diff --git a/apps/code/script_name_cell.h b/apps/code/script_name_cell.h index ec9831bd8..dfa2c1d36 100644 --- a/apps/code/script_name_cell.h +++ b/apps/code/script_name_cell.h @@ -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()]; diff --git a/apps/exam_pop_up_controller.cpp b/apps/exam_pop_up_controller.cpp index dfe068ef2..79e73fd40 100644 --- a/apps/exam_pop_up_controller.cpp +++ b/apps/exam_pop_up_controller.cpp @@ -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); } diff --git a/apps/exam_pop_up_controller.h b/apps/exam_pop_up_controller.h index 0249e9d3f..61a644a60 100644 --- a/apps/exam_pop_up_controller.h +++ b/apps/exam_pop_up_controller.h @@ -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; diff --git a/apps/graph/list/text_field_function_title_cell.cpp b/apps/graph/list/text_field_function_title_cell.cpp index ecd7a7567..a1d138e24 100644 --- a/apps/graph/list/text_field_function_title_cell.cpp +++ b/apps/graph/list/text_field_function_title_cell.cpp @@ -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, diff --git a/apps/graph/list/text_field_function_title_cell.h b/apps/graph/list/text_field_function_title_cell.h index 0d2b95d9b..dd76523e5 100644 --- a/apps/graph/list/text_field_function_title_cell.h +++ b/apps/graph/list/text_field_function_title_cell.h @@ -34,7 +34,7 @@ public: assert(index == 0); return &m_textField; } - void layoutSubviews() override; + void layoutSubviews(bool force = false) override; // Responder void didBecomeFirstResponder() override; diff --git a/apps/graph/values/abscissa_title_cell.cpp b/apps/graph/values/abscissa_title_cell.cpp index bd174fccd..59ed57aa8 100644 --- a/apps/graph/values/abscissa_title_cell.cpp +++ b/apps/graph/values/abscissa_title_cell.cpp @@ -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() { diff --git a/apps/graph/values/abscissa_title_cell.h b/apps/graph/values/abscissa_title_cell.h index 6c786c638..fd1ca6f1a 100644 --- a/apps/graph/values/abscissa_title_cell.h +++ b/apps/graph/values/abscissa_title_cell.h @@ -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; }; diff --git a/apps/graph/values/interval_parameter_selector_controller.cpp b/apps/graph/values/interval_parameter_selector_controller.cpp index 67c2f57a1..80cd68f74 100644 --- a/apps/graph/values/interval_parameter_selector_controller.cpp +++ b/apps/graph/values/interval_parameter_selector_controller.cpp @@ -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() { diff --git a/apps/hardware_test/battery_test_controller.cpp b/apps/hardware_test/battery_test_controller.cpp index 997a99ea1..37dbd6549 100644 --- a/apps/hardware_test/battery_test_controller.cpp +++ b/apps/hardware_test/battery_test_controller.cpp @@ -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 { diff --git a/apps/hardware_test/battery_test_controller.h b/apps/hardware_test/battery_test_controller.h index 723155abb..2d30757ab 100644 --- a/apps/hardware_test/battery_test_controller.h +++ b/apps/hardware_test/battery_test_controller.h @@ -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; diff --git a/apps/hardware_test/code_128b_view.cpp b/apps/hardware_test/code_128b_view.cpp index 75d011ab6..9d1a30636 100644 --- a/apps/hardware_test/code_128b_view.cpp +++ b/apps/hardware_test/code_128b_view.cpp @@ -20,7 +20,7 @@ void Code128BView::setData(const char * data) { markRectAsDirty(bounds()); } -void Code128BView::layoutSubviews() { +void Code128BView::layoutSubviews(bool force) { updateModuleWidth(); } diff --git a/apps/hardware_test/code_128b_view.h b/apps/hardware_test/code_128b_view.h index c437e8e27..a6894a946 100644 --- a/apps/hardware_test/code_128b_view.h +++ b/apps/hardware_test/code_128b_view.h @@ -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; diff --git a/apps/hardware_test/colors_lcd_test_controller.cpp b/apps/hardware_test/colors_lcd_test_controller.cpp index 25a14f535..cc2ce7f43 100644 --- a/apps/hardware_test/colors_lcd_test_controller.cpp +++ b/apps/hardware_test/colors_lcd_test_controller.cpp @@ -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); } } diff --git a/apps/hardware_test/colors_lcd_test_controller.h b/apps/hardware_test/colors_lcd_test_controller.h index 91cd15e73..005b7a8d8 100644 --- a/apps/hardware_test/colors_lcd_test_controller.h +++ b/apps/hardware_test/colors_lcd_test_controller.h @@ -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); diff --git a/apps/hardware_test/lcd_data_test_controller.cpp b/apps/hardware_test/lcd_data_test_controller.cpp index fbc2cb364..06bbd81bf 100644 --- a/apps/hardware_test/lcd_data_test_controller.cpp +++ b/apps/hardware_test/lcd_data_test_controller.cpp @@ -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); } } diff --git a/apps/hardware_test/lcd_data_test_controller.h b/apps/hardware_test/lcd_data_test_controller.h index 2d261b3b6..507edaa8a 100644 --- a/apps/hardware_test/lcd_data_test_controller.h +++ b/apps/hardware_test/lcd_data_test_controller.h @@ -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); diff --git a/apps/hardware_test/lcd_timing_test_controller.cpp b/apps/hardware_test/lcd_timing_test_controller.cpp index 61492a729..fbdb193cf 100644 --- a/apps/hardware_test/lcd_timing_test_controller.cpp +++ b/apps/hardware_test/lcd_timing_test_controller.cpp @@ -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); } } diff --git a/apps/hardware_test/lcd_timing_test_controller.h b/apps/hardware_test/lcd_timing_test_controller.h index 17cfbf386..75bf7fccc 100644 --- a/apps/hardware_test/lcd_timing_test_controller.h +++ b/apps/hardware_test/lcd_timing_test_controller.h @@ -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); diff --git a/apps/hardware_test/led_test_controller.cpp b/apps/hardware_test/led_test_controller.cpp index 07b3917b1..54c3ec549 100644 --- a/apps/hardware_test/led_test_controller.cpp +++ b/apps/hardware_test/led_test_controller.cpp @@ -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 { diff --git a/apps/hardware_test/led_test_controller.h b/apps/hardware_test/led_test_controller.h index 92d74ed0b..6c339f206 100644 --- a/apps/hardware_test/led_test_controller.h +++ b/apps/hardware_test/led_test_controller.h @@ -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; diff --git a/apps/hardware_test/pop_up_controller.cpp b/apps/hardware_test/pop_up_controller.cpp index 24a0592b5..76afaa19b 100644 --- a/apps/hardware_test/pop_up_controller.cpp +++ b/apps/hardware_test/pop_up_controller.cpp @@ -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); } } diff --git a/apps/hardware_test/pop_up_controller.h b/apps/hardware_test/pop_up_controller.h index bdaa8f1ee..b04724e95 100644 --- a/apps/hardware_test/pop_up_controller.h +++ b/apps/hardware_test/pop_up_controller.h @@ -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; diff --git a/apps/hardware_test/vblank_test_controller.cpp b/apps/hardware_test/vblank_test_controller.cpp index 9736c921c..57845dfa7 100644 --- a/apps/hardware_test/vblank_test_controller.cpp +++ b/apps/hardware_test/vblank_test_controller.cpp @@ -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); } } diff --git a/apps/hardware_test/vblank_test_controller.h b/apps/hardware_test/vblank_test_controller.h index 951394586..f13bae303 100644 --- a/apps/hardware_test/vblank_test_controller.h +++ b/apps/hardware_test/vblank_test_controller.h @@ -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); diff --git a/apps/home/app_cell.cpp b/apps/home/app_cell.cpp index 1b2c1ad8c..cb2875589 100644 --- a/apps/home/app_cell.cpp +++ b/apps/home/app_cell.cpp @@ -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) { diff --git a/apps/home/app_cell.h b/apps/home/app_cell.h index 19dabf6fe..73cb7e0f9 100644 --- a/apps/home/app_cell.h +++ b/apps/home/app_cell.h @@ -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; diff --git a/apps/home/controller.cpp b/apps/home/controller.cpp index 00c2f287a..c6fa7bdcf 100644 --- a/apps/home/controller.cpp +++ b/apps/home/controller.cpp @@ -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) : diff --git a/apps/home/controller.h b/apps/home/controller.h index 4c354bfb5..363b2d93d 100644 --- a/apps/home/controller.h +++ b/apps/home/controller.h @@ -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; diff --git a/apps/on_boarding/logo_view.cpp b/apps/on_boarding/logo_view.cpp index 2756012b0..dd76b95b9 100644 --- a/apps/on_boarding/logo_view.cpp +++ b/apps/on_boarding/logo_view.cpp @@ -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); } } diff --git a/apps/on_boarding/logo_view.h b/apps/on_boarding/logo_view.h index b1d1650d5..7cbfc62a6 100644 --- a/apps/on_boarding/logo_view.h +++ b/apps/on_boarding/logo_view.h @@ -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; }; diff --git a/apps/on_boarding/pop_up_controller.cpp b/apps/on_boarding/pop_up_controller.cpp index 4a057a2b4..c63328b9e 100644 --- a/apps/on_boarding/pop_up_controller.cpp +++ b/apps/on_boarding/pop_up_controller.cpp @@ -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) : diff --git a/apps/on_boarding/pop_up_controller.h b/apps/on_boarding/pop_up_controller.h index 9f1b3d78b..f092e8853 100644 --- a/apps/on_boarding/pop_up_controller.h +++ b/apps/on_boarding/pop_up_controller.h @@ -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; diff --git a/apps/probability/calculation_cell.cpp b/apps/probability/calculation_cell.cpp index ed1981723..d073fd537 100644 --- a/apps/probability/calculation_cell.cpp +++ b/apps/probability/calculation_cell.cpp @@ -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 { diff --git a/apps/probability/calculation_cell.h b/apps/probability/calculation_cell.h index f9432d895..7b78f46ea 100644 --- a/apps/probability/calculation_cell.h +++ b/apps/probability/calculation_cell.h @@ -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; diff --git a/apps/probability/calculation_controller.cpp b/apps/probability/calculation_controller.cpp index 1c2a1b097..a19c66ba8 100644 --- a/apps/probability/calculation_controller.cpp +++ b/apps/probability/calculation_controller.cpp @@ -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) : diff --git a/apps/probability/calculation_controller.h b/apps/probability/calculation_controller.h index 4c49dd9a0..77484a364 100644 --- a/apps/probability/calculation_controller.h +++ b/apps/probability/calculation_controller.h @@ -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; diff --git a/apps/probability/cell.cpp b/apps/probability/cell.cpp index a78a116f2..5e9a80b03 100644 --- a/apps/probability/cell.cpp +++ b/apps/probability/cell.cpp @@ -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() { diff --git a/apps/probability/cell.h b/apps/probability/cell.h index ef692b573..ef980f38d 100644 --- a/apps/probability/cell.h +++ b/apps/probability/cell.h @@ -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 diff --git a/apps/probability/distribution_controller.cpp b/apps/probability/distribution_controller.cpp index ec89a49ac..0ceabf157 100644 --- a/apps/probability/distribution_controller.cpp +++ b/apps/probability/distribution_controller.cpp @@ -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[] = { diff --git a/apps/probability/distribution_controller.h b/apps/probability/distribution_controller.h index d81fca8c7..580f55a36 100644 --- a/apps/probability/distribution_controller.h +++ b/apps/probability/distribution_controller.h @@ -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; }; diff --git a/apps/probability/image_cell.cpp b/apps/probability/image_cell.cpp index dae9db792..abe33fe05 100644 --- a/apps/probability/image_cell.cpp +++ b/apps/probability/image_cell.cpp @@ -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); } } diff --git a/apps/probability/image_cell.h b/apps/probability/image_cell.h index bb65869c4..24daee8e8 100644 --- a/apps/probability/image_cell.h +++ b/apps/probability/image_cell.h @@ -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; diff --git a/apps/probability/parameters_controller.cpp b/apps/probability/parameters_controller.cpp index 3d655dd69..dbafded4a 100644 --- a/apps/probability/parameters_controller.cpp +++ b/apps/probability/parameters_controller.cpp @@ -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 */ diff --git a/apps/probability/parameters_controller.h b/apps/probability/parameters_controller.h index 390b3099d..86e92f9cb 100644 --- a/apps/probability/parameters_controller.h +++ b/apps/probability/parameters_controller.h @@ -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; diff --git a/apps/probability/responder_image_cell.cpp b/apps/probability/responder_image_cell.cpp index a23b65309..263c9369d 100644 --- a/apps/probability/responder_image_cell.cpp +++ b/apps/probability/responder_image_cell.cpp @@ -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); } } diff --git a/apps/probability/responder_image_cell.h b/apps/probability/responder_image_cell.h index acb8ad584..88341f0c7 100644 --- a/apps/probability/responder_image_cell.h +++ b/apps/probability/responder_image_cell.h @@ -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; }; diff --git a/apps/regression/column_title_cell.cpp b/apps/regression/column_title_cell.cpp index 3a97fb4da..a858715cf 100644 --- a/apps/regression/column_title_cell.cpp +++ b/apps/regression/column_title_cell.cpp @@ -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); } } diff --git a/apps/regression/column_title_cell.h b/apps/regression/column_title_cell.h index fa85817a1..d0a14ca49 100644 --- a/apps/regression/column_title_cell.h +++ b/apps/regression/column_title_cell.h @@ -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; diff --git a/apps/regression/even_odd_double_buffer_text_cell_with_separator.cpp b/apps/regression/even_odd_double_buffer_text_cell_with_separator.cpp index 96fbe5b25..e87e506b7 100644 --- a/apps/regression/even_odd_double_buffer_text_cell_with_separator.cpp +++ b/apps/regression/even_odd_double_buffer_text_cell_with_separator.cpp @@ -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) { diff --git a/apps/regression/even_odd_double_buffer_text_cell_with_separator.h b/apps/regression/even_odd_double_buffer_text_cell_with_separator.h index 8f7c8c260..7e263eae3 100644 --- a/apps/regression/even_odd_double_buffer_text_cell_with_separator.h +++ b/apps/regression/even_odd_double_buffer_text_cell_with_separator.h @@ -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; diff --git a/apps/sequence/sequence_title_cell.cpp b/apps/sequence/sequence_title_cell.cpp index e2357959d..f1802b10a 100644 --- a/apps/sequence/sequence_title_cell.cpp +++ b/apps/sequence/sequence_title_cell.cpp @@ -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 { diff --git a/apps/sequence/sequence_title_cell.h b/apps/sequence/sequence_title_cell.h index bcebbd4a9..b858fe1a0 100644 --- a/apps/sequence/sequence_title_cell.h +++ b/apps/sequence/sequence_title_cell.h @@ -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; }; diff --git a/apps/settings/sub_menu/message_table_cell_with_editable_text_with_separator.cpp b/apps/settings/sub_menu/message_table_cell_with_editable_text_with_separator.cpp index 44cf13d25..4057f005c 100644 --- a/apps/settings/sub_menu/message_table_cell_with_editable_text_with_separator.cpp +++ b/apps/settings/sub_menu/message_table_cell_with_editable_text_with_separator.cpp @@ -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); } } diff --git a/apps/settings/sub_menu/message_table_cell_with_editable_text_with_separator.h b/apps/settings/sub_menu/message_table_cell_with_editable_text_with_separator.h index 148da96e5..49e2c8ef0 100644 --- a/apps/settings/sub_menu/message_table_cell_with_editable_text_with_separator.h +++ b/apps/settings/sub_menu/message_table_cell_with_editable_text_with_separator.h @@ -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; }; diff --git a/apps/shared/banner_view.cpp b/apps/shared/banner_view.cpp index 3bbd4d4ab..40d89738f 100644 --- a/apps/shared/banner_view.cpp +++ b/apps/shared/banner_view.cpp @@ -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 diff --git a/apps/shared/banner_view.h b/apps/shared/banner_view.h index 2f16a9e57..86f00cbea 100644 --- a/apps/shared/banner_view.h +++ b/apps/shared/banner_view.h @@ -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; }; diff --git a/apps/shared/buffer_function_title_cell.cpp b/apps/shared/buffer_function_title_cell.cpp index ef9b53e8d..aaf56cbc9 100644 --- a/apps/shared/buffer_function_title_cell.cpp +++ b/apps/shared/buffer_function_title_cell.cpp @@ -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 { diff --git a/apps/shared/buffer_function_title_cell.h b/apps/shared/buffer_function_title_cell.h index 1ee507ade..6d59c14af 100644 --- a/apps/shared/buffer_function_title_cell.h +++ b/apps/shared/buffer_function_title_cell.h @@ -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; } diff --git a/apps/shared/buffer_text_view_with_text_field.cpp b/apps/shared/buffer_text_view_with_text_field.cpp index 78aff5867..2bf40a873 100644 --- a/apps/shared/buffer_text_view_with_text_field.cpp +++ b/apps/shared/buffer_text_view_with_text_field.cpp @@ -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 { diff --git a/apps/shared/buffer_text_view_with_text_field.h b/apps/shared/buffer_text_view_with_text_field.h index f3b207168..64dda0e8d 100644 --- a/apps/shared/buffer_text_view_with_text_field.h +++ b/apps/shared/buffer_text_view_with_text_field.h @@ -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; diff --git a/apps/shared/button_with_separator.cpp b/apps/shared/button_with_separator.cpp index a4d6dec1c..faf1fe013 100644 --- a/apps/shared/button_with_separator.cpp +++ b/apps/shared/button_with_separator.cpp @@ -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); } diff --git a/apps/shared/button_with_separator.h b/apps/shared/button_with_separator.h index e6337b9bb..7f2685902 100644 --- a/apps/shared/button_with_separator.h +++ b/apps/shared/button_with_separator.h @@ -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 diff --git a/apps/shared/cursor_view.h b/apps/shared/cursor_view.h index f0b662954..4590950b2 100644 --- a/apps/shared/cursor_view.h +++ b/apps/shared/cursor_view.h @@ -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: diff --git a/apps/shared/curve_view.cpp b/apps/shared/curve_view.cpp index 7eb87cf9b..ed7cacfe1 100644 --- a/apps/shared/curve_view.cpp +++ b/apps/shared/curve_view.cpp @@ -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); } } diff --git a/apps/shared/curve_view.h b/apps/shared/curve_view.h index 1c4ac72b8..c33f9badf 100644 --- a/apps/shared/curve_view.h +++ b/apps/shared/curve_view.h @@ -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(); diff --git a/apps/shared/function_expression_cell.cpp b/apps/shared/function_expression_cell.cpp index 950ccc2a3..72c4ada5b 100644 --- a/apps/shared/function_expression_cell.cpp +++ b/apps/shared/function_expression_cell.cpp @@ -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); } } diff --git a/apps/shared/function_expression_cell.h b/apps/shared/function_expression_cell.h index 34fc1a2f1..842842688 100644 --- a/apps/shared/function_expression_cell.h +++ b/apps/shared/function_expression_cell.h @@ -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; }; diff --git a/apps/shared/message_view.cpp b/apps/shared/message_view.cpp index 8b5396ee3..819c8dafe 100644 --- a/apps/shared/message_view.cpp +++ b/apps/shared/message_view.cpp @@ -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); } } diff --git a/apps/shared/message_view.h b/apps/shared/message_view.h index bcd110a4d..41fb9e648 100644 --- a/apps/shared/message_view.h +++ b/apps/shared/message_view.h @@ -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; diff --git a/apps/shared/round_cursor_view.cpp b/apps/shared/round_cursor_view.cpp index f3e33078c..d3f6316ce 100644 --- a/apps/shared/round_cursor_view.cpp +++ b/apps/shared/round_cursor_view.cpp @@ -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 diff --git a/apps/shared/round_cursor_view.h b/apps/shared/round_cursor_view.h index b84d7e07b..8bde981ed 100644 --- a/apps/shared/round_cursor_view.h +++ b/apps/shared/round_cursor_view.h @@ -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 diff --git a/apps/shared/scrollable_exact_approximate_expressions_cell.cpp b/apps/shared/scrollable_exact_approximate_expressions_cell.cpp index a3f912ea2..da4bb9881 100644 --- a/apps/shared/scrollable_exact_approximate_expressions_cell.cpp +++ b/apps/shared/scrollable_exact_approximate_expressions_cell.cpp @@ -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); } } diff --git a/apps/shared/scrollable_exact_approximate_expressions_cell.h b/apps/shared/scrollable_exact_approximate_expressions_cell.h index 39c232b16..dfaf7bd20 100644 --- a/apps/shared/scrollable_exact_approximate_expressions_cell.h +++ b/apps/shared/scrollable_exact_approximate_expressions_cell.h @@ -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; }; diff --git a/apps/shared/scrollable_exact_approximate_expressions_view.cpp b/apps/shared/scrollable_exact_approximate_expressions_view.cpp index 4415804a0..548f827ef 100644 --- a/apps/shared/scrollable_exact_approximate_expressions_view.cpp +++ b/apps/shared/scrollable_exact_approximate_expressions_view.cpp @@ -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) : diff --git a/apps/shared/scrollable_exact_approximate_expressions_view.h b/apps/shared/scrollable_exact_approximate_expressions_view.h index b24dd9fa6..45573275f 100644 --- a/apps/shared/scrollable_exact_approximate_expressions_view.h +++ b/apps/shared/scrollable_exact_approximate_expressions_view.h @@ -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: diff --git a/apps/shared/separator_even_odd_buffer_text_cell.cpp b/apps/shared/separator_even_odd_buffer_text_cell.cpp index 10eb5ef83..3117a2f64 100644 --- a/apps/shared/separator_even_odd_buffer_text_cell.cpp +++ b/apps/shared/separator_even_odd_buffer_text_cell.cpp @@ -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); } } diff --git a/apps/shared/separator_even_odd_buffer_text_cell.h b/apps/shared/separator_even_odd_buffer_text_cell.h index eba84ffef..0a5371f0a 100644 --- a/apps/shared/separator_even_odd_buffer_text_cell.h +++ b/apps/shared/separator_even_odd_buffer_text_cell.h @@ -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; }; diff --git a/apps/shared/store_cell.cpp b/apps/shared/store_cell.cpp index 8fe040e25..89fc90ae3 100644 --- a/apps/shared/store_cell.cpp +++ b/apps/shared/store_cell.cpp @@ -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() { diff --git a/apps/shared/store_cell.h b/apps/shared/store_cell.h index c6642f3e9..5e1a0c260 100644 --- a/apps/shared/store_cell.h +++ b/apps/shared/store_cell.h @@ -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; diff --git a/apps/shared/store_controller.cpp b/apps/shared/store_controller.cpp index 876b7682e..c9fff64e4 100644 --- a/apps/shared/store_controller.cpp +++ b/apps/shared/store_controller.cpp @@ -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 { diff --git a/apps/shared/store_controller.h b/apps/shared/store_controller.h index 3158e4715..33eb9de69 100644 --- a/apps/shared/store_controller.h +++ b/apps/shared/store_controller.h @@ -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; diff --git a/apps/shared/store_title_cell.cpp b/apps/shared/store_title_cell.cpp index 473db9912..6a99e60f1 100644 --- a/apps/shared/store_title_cell.cpp +++ b/apps/shared/store_title_cell.cpp @@ -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() { diff --git a/apps/shared/store_title_cell.h b/apps/shared/store_title_cell.h index 05899c24f..375c261eb 100644 --- a/apps/shared/store_title_cell.h +++ b/apps/shared/store_title_cell.h @@ -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; }; diff --git a/apps/shared/sum_graph_controller.cpp b/apps/shared/sum_graph_controller.cpp index babf74e0e..fe3aa001e 100644 --- a/apps/shared/sum_graph_controller.cpp +++ b/apps/shared/sum_graph_controller.cpp @@ -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); } } diff --git a/apps/shared/sum_graph_controller.h b/apps/shared/sum_graph_controller.h index 0915616a5..b6fcad81a 100644 --- a/apps/shared/sum_graph_controller.h +++ b/apps/shared/sum_graph_controller.h @@ -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; diff --git a/apps/shared/zoom_parameter_controller.cpp b/apps/shared/zoom_parameter_controller.cpp index 29ecc8c92..22d053271 100644 --- a/apps/shared/zoom_parameter_controller.cpp +++ b/apps/shared/zoom_parameter_controller.cpp @@ -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; } } diff --git a/apps/shared/zoom_parameter_controller.h b/apps/shared/zoom_parameter_controller.h index 13751a1b2..3d4f566c7 100644 --- a/apps/shared/zoom_parameter_controller.h +++ b/apps/shared/zoom_parameter_controller.h @@ -23,7 +23,7 @@ private: public: constexpr static KDCoordinate k_legendHeight = 30; ContentView(CurveView * curveView); - void layoutSubviews() override; + void layoutSubviews(bool force = false) override; CurveView * curveView(); private: class LegendView : public View { @@ -34,7 +34,7 @@ private: constexpr static int k_numberOfLegends = 3; constexpr static int k_numberOfTokens = 6; constexpr static KDCoordinate k_tokenWidth = 10; - void layoutSubviews() override; + void layoutSubviews(bool force = false) override; int numberOfSubviews() const override; View * subviewAtIndex(int index) override; MessageTextView m_legends[k_numberOfLegends]; diff --git a/apps/shift_alpha_lock_view.cpp b/apps/shift_alpha_lock_view.cpp index ae811e1d3..246ae8ab4 100644 --- a/apps/shift_alpha_lock_view.cpp +++ b/apps/shift_alpha_lock_view.cpp @@ -65,10 +65,10 @@ View * ShiftAlphaLockView::subviewAtIndex(int index) { return &m_lockView; } -void ShiftAlphaLockView::layoutSubviews() { +void ShiftAlphaLockView::layoutSubviews(bool force) { KDSize modifierSize = KDFont::SmallFont->stringSize(I18n::translate(I18n::Message::Alpha)); - m_shiftAlphaView.setFrame(KDRect(bounds().width() - modifierSize.width(), (bounds().height()- modifierSize.height())/2, modifierSize)); + m_shiftAlphaView.setFrame(KDRect(bounds().width() - modifierSize.width(), (bounds().height()- modifierSize.height())/2, modifierSize), force); KDSize lockSize = m_lockView.minimalSizeForOptimalDisplay(); - m_lockView.setFrame(KDRect(bounds().width() - modifierSize.width() - lockSize.width() - k_lockRightMargin, (bounds().height()- lockSize.height())/2, lockSize)); + m_lockView.setFrame(KDRect(bounds().width() - modifierSize.width() - lockSize.width() - k_lockRightMargin, (bounds().height()- lockSize.height())/2, lockSize), force); } diff --git a/apps/shift_alpha_lock_view.h b/apps/shift_alpha_lock_view.h index b3b0bd05d..0e0d85d60 100644 --- a/apps/shift_alpha_lock_view.h +++ b/apps/shift_alpha_lock_view.h @@ -14,7 +14,7 @@ public: private: constexpr static KDCoordinate k_lockRightMargin = 5; int numberOfSubviews() const override; - void layoutSubviews() override; + void layoutSubviews(bool force = false) override; View * subviewAtIndex(int index) override; LockView m_lockView; MessageTextView m_shiftAlphaView; diff --git a/apps/solver/equation_list_view.cpp b/apps/solver/equation_list_view.cpp index 7253374cd..6edfd4092 100644 --- a/apps/solver/equation_list_view.cpp +++ b/apps/solver/equation_list_view.cpp @@ -47,8 +47,8 @@ void EquationListView::didBecomeFirstResponder() { Container::activeApp()->setFirstResponder(&m_listView); } -void EquationListView::layoutSubviews() { - m_listView.setFrame(KDRect(0, 0, bounds().width(), bounds().height())); +void EquationListView::layoutSubviews(bool force) { + m_listView.setFrame(KDRect(0, 0, bounds().width(), bounds().height()), force); if (m_braceStyle != BraceStyle::None) { KDCoordinate braceWidth = m_braceView.minimalSizeForOptimalDisplay().width(); KDCoordinate braceHeight = m_listView.minimalSizeForOptimalDisplay().height()-2*k_margin; @@ -56,9 +56,9 @@ void EquationListView::layoutSubviews() { m_braceView.setSize(KDSize(braceWidth, braceHeight)); KDCoordinate scrollBraceHeight = m_listView.minimalSizeForOptimalDisplay().height()-offset().y(); scrollBraceHeight = m_braceStyle == BraceStyle::OneRowShort ? scrollBraceHeight - Metric::StoreRowHeight : scrollBraceHeight; - m_scrollBraceView.setFrame(KDRect(0, 0, k_braceTotalWidth, scrollBraceHeight)); + m_scrollBraceView.setFrame(KDRect(0, 0, k_braceTotalWidth, scrollBraceHeight), force); } else { - m_scrollBraceView.setFrame(KDRectZero); + m_scrollBraceView.setFrame(KDRectZero, force); } } diff --git a/apps/solver/equation_list_view.h b/apps/solver/equation_list_view.h index 9363c7fe6..a4392ae99 100644 --- a/apps/solver/equation_list_view.h +++ b/apps/solver/equation_list_view.h @@ -23,7 +23,7 @@ public: } constexpr static KDCoordinate k_margin = 10; constexpr static KDCoordinate k_braceTotalWidth = 30;//2*k_margin+BraceView::k_braceWidth; - void layoutSubviews() override; + void layoutSubviews(bool force = false) override; private: int numberOfSubviews() const override; View * subviewAtIndex(int index) override; diff --git a/apps/solver/interval_controller.cpp b/apps/solver/interval_controller.cpp index cb452a0ce..5f1addd34 100644 --- a/apps/solver/interval_controller.cpp +++ b/apps/solver/interval_controller.cpp @@ -32,11 +32,11 @@ View * IntervalController::ContentView::subviewAtIndex(int index) { return m_selectableTableView; } -void IntervalController::ContentView::layoutSubviews() { +void IntervalController::ContentView::layoutSubviews(bool force) { KDCoordinate textHeight = KDFont::SmallFont->glyphSize().height(); - m_instructions0.setFrame(KDRect(0, k_topMargin/2-textHeight, bounds().width(), textHeight)); - m_instructions1.setFrame(KDRect(0, k_topMargin/2, bounds().width(), textHeight)); - m_selectableTableView->setFrame(KDRect(0, k_topMargin, bounds().width(), bounds().height()-k_topMargin)); + m_instructions0.setFrame(KDRect(0, k_topMargin/2-textHeight, bounds().width(), textHeight), force); + m_instructions1.setFrame(KDRect(0, k_topMargin/2, bounds().width(), textHeight), force); + m_selectableTableView->setFrame(KDRect(0, k_topMargin, bounds().width(), bounds().height()-k_topMargin), force); } /* IntervalController Controller */ diff --git a/apps/solver/interval_controller.h b/apps/solver/interval_controller.h index 206f86fd1..ba4f98d21 100644 --- a/apps/solver/interval_controller.h +++ b/apps/solver/interval_controller.h @@ -29,7 +29,7 @@ private: constexpr static KDCoordinate k_topMargin = 50; int numberOfSubviews() const override; View * subviewAtIndex(int index) override; - void layoutSubviews() override; + void layoutSubviews(bool force = false) override; MessageTextView m_instructions0; MessageTextView m_instructions1; SelectableTableView * m_selectableTableView; diff --git a/apps/solver/solutions_controller.cpp b/apps/solver/solutions_controller.cpp index db0657eeb..77997262e 100644 --- a/apps/solver/solutions_controller.cpp +++ b/apps/solver/solutions_controller.cpp @@ -59,14 +59,14 @@ View * SolutionsController::ContentView::subviewAtIndex(int index) { return &m_selectableTableView; } -void SolutionsController::ContentView::layoutSubviews() { +void SolutionsController::ContentView::layoutSubviews(bool force) { if (m_displayWarningMoreSolutions) { KDCoordinate textHeight = KDFont::SmallFont->glyphSize().height(); - m_warningMessageView0.setFrame(KDRect(0, k_topMargin/2-textHeight, bounds().width(), textHeight)); - m_warningMessageView1.setFrame(KDRect(0, k_topMargin/2, bounds().width(), textHeight)); - m_selectableTableView.setFrame(KDRect(0, k_topMargin, bounds().width(), bounds().height()-k_topMargin)); + m_warningMessageView0.setFrame(KDRect(0, k_topMargin/2-textHeight, bounds().width(), textHeight), force); + m_warningMessageView1.setFrame(KDRect(0, k_topMargin/2, bounds().width(), textHeight), force); + m_selectableTableView.setFrame(KDRect(0, k_topMargin, bounds().width(), bounds().height()-k_topMargin), force); } else { - m_selectableTableView.setFrame(bounds()); + m_selectableTableView.setFrame(bounds(), force); } } diff --git a/apps/solver/solutions_controller.h b/apps/solver/solutions_controller.h index 33208d7c2..8b366339d 100644 --- a/apps/solver/solutions_controller.h +++ b/apps/solver/solutions_controller.h @@ -47,7 +47,7 @@ private: constexpr static KDCoordinate k_topMargin = 50; int numberOfSubviews() const override; View * subviewAtIndex(int index) override; - void layoutSubviews() override; + void layoutSubviews(bool force = false) override; MessageTextView m_warningMessageView0; MessageTextView m_warningMessageView1; SelectableTableView m_selectableTableView; diff --git a/apps/statistics/multiple_boxes_view.cpp b/apps/statistics/multiple_boxes_view.cpp index 5fdb64c60..a19fc8bfc 100644 --- a/apps/statistics/multiple_boxes_view.cpp +++ b/apps/statistics/multiple_boxes_view.cpp @@ -26,7 +26,7 @@ int MultipleBoxesView::seriesOfSubviewAtIndex(int index) { return static_cast(subviewAtIndex(index))->series(); } -void MultipleBoxesView::layoutDataSubviews() { +void MultipleBoxesView::layoutDataSubviews(bool force) { int numberOfDataSubviews = m_store->numberOfNonEmptySeries(); assert(numberOfDataSubviews > 0); KDCoordinate bannerHeight = bannerFrame().height(); @@ -35,11 +35,11 @@ void MultipleBoxesView::layoutDataSubviews() { for (int i = 0; i < Store::k_numberOfSeries; i++) { if (!m_store->seriesIsEmpty(i)) { KDRect frame = KDRect(0, displayedSubviewIndex*subviewHeight, bounds().width(), subviewHeight); - dataViewAtIndex(i)->setFrame(frame); + dataViewAtIndex(i)->setFrame(frame, force); displayedSubviewIndex++; } } - m_axisView.setFrame(KDRect(0, displayedSubviewIndex*subviewHeight, bounds().width(), bounds().height() - bannerHeight - displayedSubviewIndex*subviewHeight)); + m_axisView.setFrame(KDRect(0, displayedSubviewIndex*subviewHeight, bounds().width(), bounds().height() - bannerHeight - displayedSubviewIndex*subviewHeight), force); } void MultipleBoxesView::reload() { diff --git a/apps/statistics/multiple_boxes_view.h b/apps/statistics/multiple_boxes_view.h index 3333907a3..3eb6d32c8 100644 --- a/apps/statistics/multiple_boxes_view.h +++ b/apps/statistics/multiple_boxes_view.h @@ -19,7 +19,7 @@ public: int seriesOfSubviewAtIndex(int index) override; BoxBannerView * bannerView() override { return &m_bannerView; } BoxView * dataViewAtIndex(int index) override; - void layoutDataSubviews() override; + void layoutDataSubviews(bool force) override; void reload() override; // View diff --git a/apps/statistics/multiple_data_view.cpp b/apps/statistics/multiple_data_view.cpp index 5caed52eb..c8ad4f1b5 100644 --- a/apps/statistics/multiple_data_view.cpp +++ b/apps/statistics/multiple_data_view.cpp @@ -7,7 +7,7 @@ namespace Statistics { void MultipleDataView::setDisplayBanner(bool display) { m_displayBanner = display; - layoutBanner(); + layoutBanner(false); } void MultipleDataView::reload() { @@ -66,14 +66,14 @@ View * MultipleDataView::subviewAtIndex(int index) { return nullptr; } -void MultipleDataView::layoutSubviews() { +void MultipleDataView::layoutSubviews(bool force) { // We need to set the banner width first, so its height can be computed - bannerView()->setFrame(KDRect(0, 0, bounds().width(), 0)); - layoutDataSubviews(); - layoutBanner(); + bannerView()->setFrame(KDRect(0, 0, bounds().width(), 0), force); + layoutDataSubviews(force); + layoutBanner(force); } -void MultipleDataView::layoutDataSubviews() { +void MultipleDataView::layoutDataSubviews(bool force) { int numberDataSubviews = m_store->numberOfNonEmptySeries(); assert(numberDataSubviews > 0); KDCoordinate bannerHeight = bannerView()->minimalSizeForOptimalDisplay().height(); @@ -83,7 +83,7 @@ void MultipleDataView::layoutDataSubviews() { if (!m_store->seriesIsEmpty(i)) { CurveView * dataView = dataViewAtIndex(i); KDRect frame = KDRect(0, displayedSubviewIndex*subviewHeight, bounds().width(), subviewHeight); - dataView->setFrame(frame); + dataView->setFrame(frame, force); displayedSubviewIndex++; } } @@ -100,13 +100,13 @@ KDRect MultipleDataView::bannerFrame() const { return frame; } -void MultipleDataView::layoutBanner() { +void MultipleDataView::layoutBanner(bool force) { KDCoordinate bannerHeight = bannerView()->minimalSizeForOptimalDisplay().height(); if (m_displayBanner) { - bannerView()->setFrame(bannerFrame()); + bannerView()->setFrame(bannerFrame(), force); } else { KDRect frame = KDRect(0, bounds().height() - bannerHeight, bounds().width(), 0); - bannerView()->setFrame(frame); + bannerView()->setFrame(frame, force); } } diff --git a/apps/statistics/multiple_data_view.h b/apps/statistics/multiple_data_view.h index e2b9eae0b..40c3dcf72 100644 --- a/apps/statistics/multiple_data_view.h +++ b/apps/statistics/multiple_data_view.h @@ -32,14 +32,14 @@ public: int numberOfSubviews() const override; protected: virtual Shared::BannerView * bannerView() = 0; - void layoutSubviews() override; - virtual void layoutDataSubviews(); + void layoutSubviews(bool force = false) override; + virtual void layoutDataSubviews(bool force); View * subviewAtIndex(int index) override; virtual void changeDataViewSelection(int index, bool select); KDRect bannerFrame() const; Store * m_store; private: - void layoutBanner(); + void layoutBanner(bool force); void drawRect(KDContext * ctx, KDRect rect) const override; bool m_displayBanner; }; diff --git a/apps/statistics/multiple_histograms_view.cpp b/apps/statistics/multiple_histograms_view.cpp index b96c2ade1..d5c18899f 100644 --- a/apps/statistics/multiple_histograms_view.cpp +++ b/apps/statistics/multiple_histograms_view.cpp @@ -31,7 +31,7 @@ int MultipleHistogramsView::seriesOfSubviewAtIndex(int index) { return static_cast(subviewAtIndex(index))->series(); } -void MultipleHistogramsView::layoutSubviews() { +void MultipleHistogramsView::layoutSubviews(bool force) { MultipleDataView::layoutSubviews(); int numberHistogramSubviews = m_store->numberOfNonEmptySeries(); assert(numberHistogramSubviews > 0); diff --git a/apps/statistics/multiple_histograms_view.h b/apps/statistics/multiple_histograms_view.h index de41f0d3b..d5cdbb36b 100644 --- a/apps/statistics/multiple_histograms_view.h +++ b/apps/statistics/multiple_histograms_view.h @@ -19,7 +19,7 @@ public: HistogramBannerView * bannerView() override { return &m_bannerView; } HistogramView * dataViewAtIndex(int index) override; private: - void layoutSubviews() override; + void layoutSubviews(bool force = false) override; void changeDataViewSelection(int index, bool select) override; HistogramView m_histogramView1; HistogramView m_histogramView2; diff --git a/apps/title_bar_view.cpp b/apps/title_bar_view.cpp index 53cee9ab5..ed6be0b4a 100644 --- a/apps/title_bar_view.cpp +++ b/apps/title_bar_view.cpp @@ -61,23 +61,23 @@ View * TitleBarView::subviewAtIndex(int index) { return &m_batteryView; } -void TitleBarView::layoutSubviews() { +void TitleBarView::layoutSubviews(bool force) { /* We here cheat to layout the main title. The application title is written * with upper cases. But, as upper letters are on the same baseline as lower * letters, they seem to be slightly above when they are perferctly centered * (because their glyph never cross the baseline). To avoid this effect, we * translate the frame of the title downwards.*/ - m_titleView.setFrame(KDRect(0, 2, bounds().width(), bounds().height()-2)); - m_preferenceView.setFrame(KDRect(Metric::TitleBarExternHorizontalMargin, 0, m_preferenceView.minimalSizeForOptimalDisplay().width(), bounds().height())); + m_titleView.setFrame(KDRect(0, 2, bounds().width(), bounds().height()-2), force); + m_preferenceView.setFrame(KDRect(Metric::TitleBarExternHorizontalMargin, 0, m_preferenceView.minimalSizeForOptimalDisplay().width(), bounds().height()), force); KDSize batterySize = m_batteryView.minimalSizeForOptimalDisplay(); - m_batteryView.setFrame(KDRect(bounds().width() - batterySize.width() - Metric::TitleBarExternHorizontalMargin, (bounds().height()- batterySize.height())/2, batterySize)); + m_batteryView.setFrame(KDRect(bounds().width() - batterySize.width() - Metric::TitleBarExternHorizontalMargin, (bounds().height()- batterySize.height())/2, batterySize), force); if (GlobalPreferences::sharedGlobalPreferences()->isInExamMode()) { - m_examModeIconView.setFrame(KDRect(k_examIconMargin, (bounds().height() - k_examIconHeight)/2, k_examIconWidth, k_examIconHeight)); + m_examModeIconView.setFrame(KDRect(k_examIconMargin, (bounds().height() - k_examIconHeight)/2, k_examIconWidth, k_examIconHeight), force); } else { - m_examModeIconView.setFrame(KDRectZero); + m_examModeIconView.setFrame(KDRectZero, force); } KDSize shiftAlphaLockSize = m_shiftAlphaLockView.minimalSizeForOptimalDisplay(); - m_shiftAlphaLockView.setFrame(KDRect(bounds().width()-batterySize.width()-Metric::TitleBarExternHorizontalMargin-k_alphaRightMargin-shiftAlphaLockSize.width(), (bounds().height()- shiftAlphaLockSize.height())/2, shiftAlphaLockSize)); + m_shiftAlphaLockView.setFrame(KDRect(bounds().width()-batterySize.width()-Metric::TitleBarExternHorizontalMargin-k_alphaRightMargin-shiftAlphaLockSize.width(), (bounds().height()- shiftAlphaLockSize.height())/2, shiftAlphaLockSize), force); } void TitleBarView::refreshPreferences() { diff --git a/apps/title_bar_view.h b/apps/title_bar_view.h index 646b34415..c0b6517f6 100644 --- a/apps/title_bar_view.h +++ b/apps/title_bar_view.h @@ -23,7 +23,7 @@ private: constexpr static KDCoordinate k_examIconHeight = 9; constexpr static KDCoordinate k_examIconMargin = 93; int numberOfSubviews() const override; - void layoutSubviews() override; + void layoutSubviews(bool force = false) override; View * subviewAtIndex(int index) override; MessageTextView m_titleView; BatteryView m_batteryView; diff --git a/apps/variable_box_empty_controller.cpp b/apps/variable_box_empty_controller.cpp index 207642236..6ceb2f452 100644 --- a/apps/variable_box_empty_controller.cpp +++ b/apps/variable_box_empty_controller.cpp @@ -42,20 +42,20 @@ View * VariableBoxEmptyController::VariableBoxEmptyView::subviewAtIndex(int inde return &m_messages[index-1]; } -void VariableBoxEmptyController::VariableBoxEmptyView::layoutSubviews() { +void VariableBoxEmptyController::VariableBoxEmptyView::layoutSubviews(bool force) { KDCoordinate width = bounds().width(); KDCoordinate height = bounds().height(); KDCoordinate textHeight = k_font->glyphSize().height(); KDCoordinate layoutHeight = m_layoutExample.minimalSizeForOptimalDisplay().height(); KDCoordinate margin = (height - k_numberOfMessages*textHeight-layoutHeight)/2; - m_layoutExample.setFrame(KDRect(0, margin+k_layoutRowIndex*textHeight, width, layoutHeight)); + m_layoutExample.setFrame(KDRect(0, margin+k_layoutRowIndex*textHeight, width, layoutHeight), force); KDCoordinate currentHeight = 0; for (uint8_t i = 0; i < k_numberOfMessages; i++) { if (i == k_layoutRowIndex) { currentHeight += layoutHeight; } KDCoordinate h = i == 0 || i == k_numberOfMessages - 1 ? textHeight+margin : textHeight; - m_messages[i].setFrame(KDRect(0, currentHeight, width, h)); + m_messages[i].setFrame(KDRect(0, currentHeight, width, h), force); currentHeight += h; } } diff --git a/apps/variable_box_empty_controller.h b/apps/variable_box_empty_controller.h index b799c6ca9..39719ab07 100644 --- a/apps/variable_box_empty_controller.h +++ b/apps/variable_box_empty_controller.h @@ -28,7 +28,7 @@ private: private: int numberOfSubviews() const override; View * subviewAtIndex(int index) override; - void layoutSubviews() override; + void layoutSubviews(bool force = false) override; constexpr static int k_layoutRowIndex = 2; MessageTextView m_messages[k_numberOfMessages]; ExpressionView m_layoutExample; diff --git a/escher/include/escher/alternate_empty_view_controller.h b/escher/include/escher/alternate_empty_view_controller.h index 1e16d58fc..734cee60c 100644 --- a/escher/include/escher/alternate_empty_view_controller.h +++ b/escher/include/escher/alternate_empty_view_controller.h @@ -21,7 +21,7 @@ private: ContentView(ViewController * mainViewController, AlternateEmptyViewDelegate * delegate); ViewController * mainViewController() const; AlternateEmptyViewDelegate * alternateEmptyViewDelegate() const; - void layoutSubviews() override; + void layoutSubviews(bool force = false) override; private: int numberOfSubviews() const override; View * subviewAtIndex(int index) override; diff --git a/escher/include/escher/bank_view_controller.h b/escher/include/escher/bank_view_controller.h index 90f7270da..d68b9207b 100644 --- a/escher/include/escher/bank_view_controller.h +++ b/escher/include/escher/bank_view_controller.h @@ -31,8 +31,8 @@ private: assert(index == 0); return m_subview; } - void layoutSubviews() override { - m_subview->setFrame(bounds()); + void layoutSubviews(bool force = false) override { + m_subview->setFrame(bounds(), force); } View * m_subview; }; diff --git a/escher/include/escher/button.h b/escher/include/escher/button.h index a163b00a9..f773c5bfc 100644 --- a/escher/include/escher/button.h +++ b/escher/include/escher/button.h @@ -27,7 +27,7 @@ private: constexpr static KDCoordinate k_horizontalMarginLarge = 20; int numberOfSubviews() const override; View * subviewAtIndex(int index) override; - void layoutSubviews() override; + void layoutSubviews(bool force = false) override; Invocation m_invocation; const KDFont * m_font; }; diff --git a/escher/include/escher/button_row_controller.h b/escher/include/escher/button_row_controller.h index dcba3c98f..9006c74bf 100644 --- a/escher/include/escher/button_row_controller.h +++ b/escher/include/escher/button_row_controller.h @@ -45,7 +45,7 @@ private: void reload(); int numberOfSubviews() const override; View * subviewAtIndex(int index) override; - void layoutSubviews() override; + void layoutSubviews(bool force = false) override; void drawRect(KDContext * ctx, KDRect rect) const override; bool setSelectedButton(int selectedButton); int selectedButton() const { return m_selectedButton; } diff --git a/escher/include/escher/editable_text_cell.h b/escher/include/escher/editable_text_cell.h index d2e4df5ee..9aa14217e 100644 --- a/escher/include/escher/editable_text_cell.h +++ b/escher/include/escher/editable_text_cell.h @@ -26,7 +26,7 @@ public: } int numberOfSubviews() const override; View * subviewAtIndex(int index) override; - void layoutSubviews() override; + void layoutSubviews(bool force = false) override; void didBecomeFirstResponder() override; KDSize minimalSizeForOptimalDisplay() const override; private: diff --git a/escher/include/escher/even_odd_buffer_text_cell.h b/escher/include/escher/even_odd_buffer_text_cell.h index eed6f6b2a..917ce71d7 100644 --- a/escher/include/escher/even_odd_buffer_text_cell.h +++ b/escher/include/escher/even_odd_buffer_text_cell.h @@ -26,7 +26,7 @@ protected: static constexpr KDCoordinate k_horizontalMargin = Metric::CellMargin; int numberOfSubviews() const override; View * subviewAtIndex(int index) override; - void layoutSubviews() override; + void layoutSubviews(bool force = false) override; BufferTextView m_bufferTextView; }; diff --git a/escher/include/escher/even_odd_cell_with_ellipsis.h b/escher/include/escher/even_odd_cell_with_ellipsis.h index 971950159..858130760 100644 --- a/escher/include/escher/even_odd_cell_with_ellipsis.h +++ b/escher/include/escher/even_odd_cell_with_ellipsis.h @@ -14,7 +14,7 @@ private: assert(index==0); return &m_ellipsisView; } - void layoutSubviews() override; + void layoutSubviews(bool force = false) override; EllipsisView m_ellipsisView; }; diff --git a/escher/include/escher/even_odd_editable_text_cell.h b/escher/include/escher/even_odd_editable_text_cell.h index f19f9e7d3..b462144c6 100644 --- a/escher/include/escher/even_odd_editable_text_cell.h +++ b/escher/include/escher/even_odd_editable_text_cell.h @@ -21,7 +21,7 @@ public: private: int numberOfSubviews() const override; View * subviewAtIndex(int index) override; - void layoutSubviews() override; + void layoutSubviews(bool force = false) override; EditableTextCell m_editableCell; }; diff --git a/escher/include/escher/even_odd_expression_cell.h b/escher/include/escher/even_odd_expression_cell.h index 5a63bfc36..f558ed9b6 100644 --- a/escher/include/escher/even_odd_expression_cell.h +++ b/escher/include/escher/even_odd_expression_cell.h @@ -23,7 +23,7 @@ public: protected: int numberOfSubviews() const override; View * subviewAtIndex(int index) override; - void layoutSubviews() override; + void layoutSubviews(bool force = false) override; ExpressionView m_expressionView; KDCoordinate m_leftMargin; KDCoordinate m_rightMargin; diff --git a/escher/include/escher/even_odd_message_text_cell.h b/escher/include/escher/even_odd_message_text_cell.h index 4b5e3c63e..9cb246b07 100644 --- a/escher/include/escher/even_odd_message_text_cell.h +++ b/escher/include/escher/even_odd_message_text_cell.h @@ -18,7 +18,7 @@ protected: constexpr static KDCoordinate k_horizontalMargin = Metric::CellMargin; int numberOfSubviews() const override; View * subviewAtIndex(int index) override; - void layoutSubviews() override; + void layoutSubviews(bool force = false) override; MessageTextView m_messageTextView; }; diff --git a/escher/include/escher/expression_field.h b/escher/include/escher/expression_field.h index f072c3791..8b1310fbb 100644 --- a/escher/include/escher/expression_field.h +++ b/escher/include/escher/expression_field.h @@ -30,7 +30,7 @@ public: /* View */ int numberOfSubviews() const override { return 1; } View * subviewAtIndex(int index) override; - void layoutSubviews() override; + void layoutSubviews(bool force = false) override; void drawRect(KDContext * ctx, KDRect rect) const override; KDSize minimalSizeForOptimalDisplay() const override; diff --git a/escher/include/escher/layout_field.h b/escher/include/escher/layout_field.h index 1f5723c4a..c3716b4be 100644 --- a/escher/include/escher/layout_field.h +++ b/escher/include/escher/layout_field.h @@ -60,7 +60,7 @@ private: bool setEditing(bool isEditing); // returns True if LayoutField should reload void setBackgroundColor(KDColor c) { m_expressionView.setBackgroundColor(c); } void setCursor(Poincare::LayoutCursor cursor) { m_cursor = cursor; } - void cursorPositionChanged() { layoutCursorSubview(); } + void cursorPositionChanged() { layoutCursorSubview(false); } KDRect cursorRect() { return m_cursorView.frame(); } Poincare::LayoutCursor * cursor() { return &m_cursor; } const ExpressionView * expressionView() const { return &m_expressionView; } @@ -70,8 +70,8 @@ private: private: int numberOfSubviews() const override { return 2; } View * subviewAtIndex(int index) override; - void layoutSubviews() override; - void layoutCursorSubview(); + void layoutSubviews(bool force = false) override; + void layoutCursorSubview(bool force); Poincare::LayoutCursor m_cursor; ExpressionView m_expressionView; TextCursorView m_cursorView; diff --git a/escher/include/escher/message_table_cell_with_editable_text.h b/escher/include/escher/message_table_cell_with_editable_text.h index 089d165fc..54e0e19c6 100644 --- a/escher/include/escher/message_table_cell_with_editable_text.h +++ b/escher/include/escher/message_table_cell_with_editable_text.h @@ -28,7 +28,7 @@ public: void setAccessoryText(const char * text); void setTextColor(KDColor color) override; private: - void layoutSubviews() override; + void layoutSubviews(bool force = false) override; TextField m_textField; char m_textBody[Poincare::PrintFloat::k_maxFloatCharSize]; }; diff --git a/escher/include/escher/modal_view_controller.h b/escher/include/escher/modal_view_controller.h index 1bce427ad..3de43abbb 100644 --- a/escher/include/escher/modal_view_controller.h +++ b/escher/include/escher/modal_view_controller.h @@ -28,7 +28,7 @@ private: void setMainView(View * regularView); int numberOfSubviews() const override; View * subviewAtIndex(int index) override; - void layoutSubviews() override; + void layoutSubviews(bool force = false) override; void presentModalView(View * modalView, float verticalAlignment, float horizontalAlignment, KDCoordinate topMargin, KDCoordinate leftMargin, KDCoordinate bottomMargin, KDCoordinate rightMargin); void dismissModalView(); diff --git a/escher/include/escher/scroll_view.h b/escher/include/escher/scroll_view.h index 920860fc7..e2c2635ea 100644 --- a/escher/include/escher/scroll_view.h +++ b/escher/include/escher/scroll_view.h @@ -35,7 +35,7 @@ public: virtual ~Decorator() = default; virtual int numberOfIndicators() const { return 0; } virtual View * indicatorAtIndex(int index) { assert(false); return nullptr; } - virtual KDRect layoutIndicators(KDSize content, KDPoint offset, KDRect frame, KDRect * dirtyRect1, KDRect * dirtyRect2) { return frame; } + virtual KDRect layoutIndicators(KDSize content, KDPoint offset, KDRect frame, KDRect * dirtyRect1, KDRect * dirtyRect2, bool force) { return frame; } virtual void setBackgroundColor(KDColor c) {} }; @@ -44,7 +44,7 @@ public: BarDecorator() : m_verticalBar(), m_horizontalBar() {} int numberOfIndicators() const override { return 2; } View * indicatorAtIndex(int index) override; - KDRect layoutIndicators(KDSize content, KDPoint offset, KDRect frame, KDRect * dirtyRect1, KDRect * dirtyRect2) override; + KDRect layoutIndicators(KDSize content, KDPoint offset, KDRect frame, KDRect * dirtyRect1, KDRect * dirtyRect2, bool force) override; ScrollViewVerticalBar * verticalBar() { return &m_verticalBar; } ScrollViewHorizontalBar * horizontalBar() { return &m_horizontalBar; } private: @@ -63,7 +63,7 @@ public: {} int numberOfIndicators() const override { return 4; } View * indicatorAtIndex(int index) override; - KDRect layoutIndicators(KDSize content, KDPoint offset, KDRect frame, KDRect * dirtyRect1, KDRect * dirtyRect2) override; + KDRect layoutIndicators(KDSize content, KDPoint offset, KDRect frame, KDRect * dirtyRect1, KDRect * dirtyRect2, bool force) override; void setBackgroundColor(KDColor c) override; private: ScrollViewArrow m_topArrow; @@ -96,7 +96,7 @@ protected: return m_frame.height() - m_topMargin - m_bottomMargin; } KDRect visibleContentRect(); - void layoutSubviews() override; + void layoutSubviews(bool force = false) override; virtual KDSize contentSize() const { return m_contentView->minimalSizeForOptimalDisplay(); } #if ESCHER_VIEW_LOGGING virtual const char * className() const override; diff --git a/escher/include/escher/stack_view_controller.h b/escher/include/escher/stack_view_controller.h index 7675072c4..47addd0ea 100644 --- a/escher/include/escher/stack_view_controller.h +++ b/escher/include/escher/stack_view_controller.h @@ -57,7 +57,7 @@ private: private: int numberOfSubviews() const override; View * subviewAtIndex(int index) override; - void layoutSubviews() override; + void layoutSubviews(bool force = false) override; StackView m_stackViews[kMaxNumberOfStacks]; View * m_contentView; diff --git a/escher/include/escher/tab_view.h b/escher/include/escher/tab_view.h index ab662d356..ebfaba6af 100644 --- a/escher/include/escher/tab_view.h +++ b/escher/include/escher/tab_view.h @@ -27,7 +27,7 @@ private: constexpr static KDCoordinate k_activeTabHeight = 5; int numberOfSubviews() const override; View * subviewAtIndex(int index) override; - void layoutSubviews() override; + void layoutSubviews(bool force = false) override; constexpr static uint8_t k_maxNumberOfTabs = 4; TabViewCell m_cells[k_maxNumberOfTabs]; diff --git a/escher/include/escher/tab_view_controller.h b/escher/include/escher/tab_view_controller.h index f7bed6244..11d193b38 100644 --- a/escher/include/escher/tab_view_controller.h +++ b/escher/include/escher/tab_view_controller.h @@ -37,7 +37,7 @@ private: private: int numberOfSubviews() const override; View * subviewAtIndex(int index) override; - void layoutSubviews() override; + void layoutSubviews(bool force = false) override; View * m_activeView; }; diff --git a/escher/include/escher/table_cell.h b/escher/include/escher/table_cell.h index 8058a090d..e5f7cb730 100644 --- a/escher/include/escher/table_cell.h +++ b/escher/include/escher/table_cell.h @@ -20,7 +20,7 @@ public: protected: int numberOfSubviews() const override; View * subviewAtIndex(int index) override; - void layoutSubviews() override; + void layoutSubviews(bool force = false) override; constexpr static KDCoordinate k_separatorThickness = Metric::CellSeparatorThickness; private: constexpr static KDCoordinate k_accessoryBottomMargin = 3; diff --git a/escher/include/escher/table_view.h b/escher/include/escher/table_view.h index 5c16a8c30..b7eb77ae5 100644 --- a/escher/include/escher/table_view.h +++ b/escher/include/escher/table_view.h @@ -25,7 +25,7 @@ protected: const char * className() const override; #endif TableViewDataSource * dataSource(); - void layoutSubviews() override; + void layoutSubviews(bool force = false) override; class ContentView : public View { public: ContentView(TableView * tableView, TableViewDataSource * dataSource, KDCoordinate horizontalCellOverlap, KDCoordinate verticalCellOverlap); @@ -42,7 +42,7 @@ protected: int numberOfDisplayableRows() const; int numberOfDisplayableColumns() const; KDRect cellFrame(int i, int j) const; - void layoutSubviews() override; + void layoutSubviews(bool force = false) override; protected: #if ESCHER_VIEW_LOGGING const char * className() const override; diff --git a/escher/include/escher/text_field.h b/escher/include/escher/text_field.h index 2c6e97211..1bc8efbdf 100644 --- a/escher/include/escher/text_field.h +++ b/escher/include/escher/text_field.h @@ -75,7 +75,7 @@ protected: * = 212 characters. */ constexpr static int k_maxBufferSize = 220; private: - void layoutSubviews() override; + void layoutSubviews(bool force = false) override; KDRect glyphFrameAtPosition(const char * buffer, const char * position) const override; bool m_isEditing; char * m_textBuffer; diff --git a/escher/include/escher/text_input.h b/escher/include/escher/text_input.h index 633fcd790..90cd79a1e 100644 --- a/escher/include/escher/text_input.h +++ b/escher/include/escher/text_input.h @@ -34,7 +34,7 @@ protected: virtual bool removeEndOfLine() = 0; KDRect cursorRect(); protected: - virtual void layoutSubviews() override; + virtual void layoutSubviews(bool force = false) override; void reloadRectFromPosition(const char * position, bool lineBreak = false); virtual KDRect glyphFrameAtPosition(const char * buffer, const char * position) const = 0; TextCursorView m_cursorView; diff --git a/escher/include/escher/view.h b/escher/include/escher/view.h index a5fa14056..e0cd46d34 100644 --- a/escher/include/escher/view.h +++ b/escher/include/escher/view.h @@ -54,7 +54,7 @@ public: } void setSize(KDSize size); - void setFrame(KDRect frame); + void setFrame(KDRect frame, bool force); KDPoint pointFromPointInView(View * view, KDPoint point); KDRect bounds() const; diff --git a/escher/include/escher/warning_controller.h b/escher/include/escher/warning_controller.h index 464e1509a..c9cbec7f8 100644 --- a/escher/include/escher/warning_controller.h +++ b/escher/include/escher/warning_controller.h @@ -20,7 +20,7 @@ private: void setLabels(I18n::Message message1, I18n::Message message2); int numberOfSubviews() const override; View * subviewAtIndex(int index) override; - void layoutSubviews() override; + void layoutSubviews(bool force = false) override; KDSize minimalSizeForOptimalDisplay() const override; private: constexpr static KDCoordinate k_topAndBottomMargin = 20; diff --git a/escher/include/escher/window.h b/escher/include/escher/window.h index 931f07e3e..553b386f4 100644 --- a/escher/include/escher/window.h +++ b/escher/include/escher/window.h @@ -13,7 +13,7 @@ protected: const char * className() const override; #endif virtual int numberOfSubviews() const override; - virtual void layoutSubviews() override; + virtual void layoutSubviews(bool force = false) override; virtual View * subviewAtIndex(int index) override; View * m_contentView; private: diff --git a/escher/src/alternate_empty_view_controller.cpp b/escher/src/alternate_empty_view_controller.cpp index 9dc3c33d4..be61f67f2 100644 --- a/escher/src/alternate_empty_view_controller.cpp +++ b/escher/src/alternate_empty_view_controller.cpp @@ -22,11 +22,11 @@ View * AlternateEmptyViewController::ContentView::subviewAtIndex(int index) { return m_mainViewController->view(); } -void AlternateEmptyViewController::ContentView::layoutSubviews() { +void AlternateEmptyViewController::ContentView::layoutSubviews(bool force) { if (alternateEmptyViewDelegate()->isEmpty()) { - m_delegate->emptyView()->setFrame(bounds()); + m_delegate->emptyView()->setFrame(bounds(), force); } else { - m_mainViewController->view()->setFrame(bounds()); + m_mainViewController->view()->setFrame(bounds(), force); } } diff --git a/escher/src/button.cpp b/escher/src/button.cpp index 3c9551f2e..91a09c318 100644 --- a/escher/src/button.cpp +++ b/escher/src/button.cpp @@ -24,8 +24,8 @@ View * Button::subviewAtIndex(int index) { return &m_messageTextView; } -void Button::layoutSubviews() { - m_messageTextView.setFrame(bounds()); +void Button::layoutSubviews(bool force) { + m_messageTextView.setFrame(bounds(), force); } bool Button::handleEvent(Ion::Events::Event event) { diff --git a/escher/src/button_row_controller.cpp b/escher/src/button_row_controller.cpp index 479d1c140..4a0633764 100644 --- a/escher/src/button_row_controller.cpp +++ b/escher/src/button_row_controller.cpp @@ -49,12 +49,12 @@ View * ButtonRowController::ContentView::subviewAtIndex(int index) { } } -void ButtonRowController::ContentView::layoutSubviews() { +void ButtonRowController::ContentView::layoutSubviews(bool force) { /* Position the main view */ if (numberOfButtons() == 0) { KDCoordinate margin = m_position == Position::Top ? 1 : 0; KDRect mainViewFrame(0, margin, bounds().width(), bounds().height()-margin); - m_mainViewController->view()->setFrame(mainViewFrame); + m_mainViewController->view()->setFrame(mainViewFrame, force); return; } KDCoordinate rowHeight; @@ -65,7 +65,7 @@ void ButtonRowController::ContentView::layoutSubviews() { } KDCoordinate frameOrigin = m_position == Position::Top ? rowHeight+1 : 0; KDRect mainViewFrame(0, frameOrigin, bounds().width(), bounds().height() - rowHeight - 1); - m_mainViewController->view()->setFrame(mainViewFrame); + m_mainViewController->view()->setFrame(mainViewFrame, force); /* Position buttons */ int nbOfButtons = numberOfButtons(); @@ -88,7 +88,7 @@ void ButtonRowController::ContentView::layoutSubviews() { Button * button = buttonAtIndex(i); KDCoordinate buttonWidth = button->minimalSizeForOptimalDisplay().width(); KDRect buttonFrame(currentXOrigin, yOrigin, buttonWidth, buttonHeight); - button->setFrame(buttonFrame); + button->setFrame(buttonFrame, force); currentXOrigin += buttonWidth + widthMargin; } } diff --git a/escher/src/editable_text_cell.cpp b/escher/src/editable_text_cell.cpp index 98f47e1ad..85960ef75 100644 --- a/escher/src/editable_text_cell.cpp +++ b/escher/src/editable_text_cell.cpp @@ -43,12 +43,13 @@ View * EditableTextCell::subviewAtIndex(int index) { return &m_textField; } -void EditableTextCell::layoutSubviews() { +void EditableTextCell::layoutSubviews(bool force) { KDRect cellBounds = bounds(); m_textField.setFrame(KDRect(cellBounds.x() + m_leftMargin, cellBounds.y() + m_topMargin, cellBounds.width() - m_leftMargin - m_rightMargin, - cellBounds.height() - m_topMargin - m_bottomMargin)); + cellBounds.height() - m_topMargin - m_bottomMargin), + force); } void EditableTextCell::didBecomeFirstResponder() { diff --git a/escher/src/even_odd_buffer_text_cell.cpp b/escher/src/even_odd_buffer_text_cell.cpp index 48e3ba1ea..f5c2d7968 100644 --- a/escher/src/even_odd_buffer_text_cell.cpp +++ b/escher/src/even_odd_buffer_text_cell.cpp @@ -38,8 +38,8 @@ View * EvenOddBufferTextCell::subviewAtIndex(int index) { return &m_bufferTextView; } -void EvenOddBufferTextCell::layoutSubviews() { +void EvenOddBufferTextCell::layoutSubviews(bool force) { KDRect boundsThis = bounds(); KDRect boundsBuffer = KDRect(boundsThis.left() + k_horizontalMargin, boundsThis.top(), boundsThis.width() - 2*k_horizontalMargin, boundsThis.height()); - m_bufferTextView.setFrame(boundsBuffer); + m_bufferTextView.setFrame(boundsBuffer, force); } diff --git a/escher/src/even_odd_cell_with_ellipsis.cpp b/escher/src/even_odd_cell_with_ellipsis.cpp index 4a43cc5f9..53a85c298 100644 --- a/escher/src/even_odd_cell_with_ellipsis.cpp +++ b/escher/src/even_odd_cell_with_ellipsis.cpp @@ -5,6 +5,6 @@ EvenOddCellWithEllipsis::EvenOddCellWithEllipsis() : { } -void EvenOddCellWithEllipsis::layoutSubviews() { - m_ellipsisView.setFrame(bounds()); +void EvenOddCellWithEllipsis::layoutSubviews(bool force) { + m_ellipsisView.setFrame(bounds(), force); } diff --git a/escher/src/even_odd_editable_text_cell.cpp b/escher/src/even_odd_editable_text_cell.cpp index 1f1c96030..819b05892 100644 --- a/escher/src/even_odd_editable_text_cell.cpp +++ b/escher/src/even_odd_editable_text_cell.cpp @@ -32,8 +32,8 @@ View * EvenOddEditableTextCell::subviewAtIndex(int index) { return &m_editableCell; } -void EvenOddEditableTextCell::layoutSubviews() { - m_editableCell.setFrame(bounds()); +void EvenOddEditableTextCell::layoutSubviews(bool force) { + m_editableCell.setFrame(bounds(), force); } void EvenOddEditableTextCell::didBecomeFirstResponder() { diff --git a/escher/src/even_odd_expression_cell.cpp b/escher/src/even_odd_expression_cell.cpp index 8709cc829..0ceaeb51c 100644 --- a/escher/src/even_odd_expression_cell.cpp +++ b/escher/src/even_odd_expression_cell.cpp @@ -65,6 +65,6 @@ View * EvenOddExpressionCell::subviewAtIndex(int index) { return &m_expressionView; } -void EvenOddExpressionCell::layoutSubviews() { - m_expressionView.setFrame(KDRect(m_leftMargin, 0, bounds().width() - m_leftMargin - m_rightMargin, bounds().height())); +void EvenOddExpressionCell::layoutSubviews(bool force) { + m_expressionView.setFrame(KDRect(m_leftMargin, 0, bounds().width() - m_leftMargin - m_rightMargin, bounds().height()), force); } diff --git a/escher/src/even_odd_message_text_cell.cpp b/escher/src/even_odd_message_text_cell.cpp index 359a8b38b..873ad9285 100644 --- a/escher/src/even_odd_message_text_cell.cpp +++ b/escher/src/even_odd_message_text_cell.cpp @@ -35,7 +35,7 @@ View * EvenOddMessageTextCell::subviewAtIndex(int index) { return &m_messageTextView; } -void EvenOddMessageTextCell::layoutSubviews() { +void EvenOddMessageTextCell::layoutSubviews(bool force) { KDRect boundsThis = bounds(); - m_messageTextView.setFrame(KDRect(k_horizontalMargin, 0, boundsThis.width() - 2*k_horizontalMargin, boundsThis.height())); + m_messageTextView.setFrame(KDRect(k_horizontalMargin, 0, boundsThis.width() - 2*k_horizontalMargin, boundsThis.height()), force); } diff --git a/escher/src/expression_field.cpp b/escher/src/expression_field.cpp index c9c87a32d..7d274ed8f 100644 --- a/escher/src/expression_field.cpp +++ b/escher/src/expression_field.cpp @@ -62,15 +62,15 @@ View * ExpressionField::subviewAtIndex(int index) { return &m_layoutField; } -void ExpressionField::layoutSubviews() { +void ExpressionField::layoutSubviews(bool force) { KDRect inputViewFrame(0, k_separatorThickness, bounds().width(), bounds().height() - k_separatorThickness); if (editionIsInTextField()) { - m_textField.setFrame(inputViewFrame); - m_layoutField.setFrame(KDRectZero); + m_textField.setFrame(inputViewFrame, force); + m_layoutField.setFrame(KDRectZero, force); return; } - m_layoutField.setFrame(inputViewFrame); - m_textField.setFrame(KDRectZero); + m_layoutField.setFrame(inputViewFrame, force); + m_textField.setFrame(KDRectZero, force); } void ExpressionField::reload() { diff --git a/escher/src/layout_field.cpp b/escher/src/layout_field.cpp index 705631002..27ac646b5 100644 --- a/escher/src/layout_field.cpp +++ b/escher/src/layout_field.cpp @@ -53,14 +53,14 @@ View * LayoutField::ContentView::subviewAtIndex(int index) { return m_views[index]; } -void LayoutField::ContentView::layoutSubviews() { - m_expressionView.setFrame(bounds()); - layoutCursorSubview(); +void LayoutField::ContentView::layoutSubviews(bool force) { + m_expressionView.setFrame(bounds(), force); + layoutCursorSubview(force); } -void LayoutField::ContentView::layoutCursorSubview() { +void LayoutField::ContentView::layoutCursorSubview(bool force) { if (!m_isEditing) { - m_cursorView.setFrame(KDRectZero); + m_cursorView.setFrame(KDRectZero, force); return; } KDPoint expressionViewOrigin = m_expressionView.absoluteDrawingOrigin(); @@ -77,7 +77,7 @@ void LayoutField::ContentView::layoutCursorSubview() { cursorX += pointedLayoutR.layoutSize().width(); } KDPoint cursorTopLeftPosition(cursorX, expressionViewOrigin.y() + cursoredExpressionViewOrigin.y() + pointedLayoutR.baseline() - m_cursor.baseline()); - m_cursorView.setFrame(KDRect(cursorTopLeftPosition, LayoutCursor::k_cursorWidth, m_cursor.cursorHeight())); + m_cursorView.setFrame(KDRect(cursorTopLeftPosition, LayoutCursor::k_cursorWidth, m_cursor.cursorHeight()), force); } void LayoutField::setEditing(bool isEditing) { diff --git a/escher/src/message_table_cell_with_editable_text.cpp b/escher/src/message_table_cell_with_editable_text.cpp index 64b1d1629..09c7d49a0 100644 --- a/escher/src/message_table_cell_with_editable_text.cpp +++ b/escher/src/message_table_cell_with_editable_text.cpp @@ -46,12 +46,17 @@ void MessageTableCellWithEditableText::setTextColor(KDColor color) { MessageTableCell::setTextColor(color); } -void MessageTableCellWithEditableText::layoutSubviews() { - TableCell::layoutSubviews(); +void MessageTableCellWithEditableText::layoutSubviews(bool force) { + TableCell::layoutSubviews(force); KDSize textFieldSize = m_textField.minimalSizeForOptimalDisplay(); KDSize labelSize = labelView()->minimalSizeForOptimalDisplay(); /* Handle textfield that has no defined width (as their width evolves with * the length of edited text */ textFieldSize = KDSize(bounds().width() - 2*k_separatorThickness - labelSize.width()-2*k_labelMargin-k_accessoryMargin, textFieldSize.height()); - m_textField.setFrame(KDRect(bounds().width() - textFieldSize.width() - k_separatorThickness-k_accessoryMargin, (bounds().height()-textFieldSize.height()-k_accessoryMargin)/2, textFieldSize.width(), textFieldSize.height()+k_accessoryMargin)); + m_textField.setFrame(KDRect( + bounds().width() - textFieldSize.width() - k_separatorThickness-k_accessoryMargin, + (bounds().height()-textFieldSize.height()-k_accessoryMargin)/2, + textFieldSize.width(), + textFieldSize.height()+k_accessoryMargin), + force); } diff --git a/escher/src/modal_view_controller.cpp b/escher/src/modal_view_controller.cpp index 699d75436..57e3d5c1a 100644 --- a/escher/src/modal_view_controller.cpp +++ b/escher/src/modal_view_controller.cpp @@ -54,15 +54,15 @@ KDRect ModalViewController::ContentView::modalViewFrame() const { return modalViewFrame; } -void ModalViewController::ContentView::layoutSubviews() { +void ModalViewController::ContentView::layoutSubviews(bool force) { assert(m_regularView != nullptr); - m_regularView->setFrame(bounds()); + m_regularView->setFrame(bounds(), force); if (m_isDisplayingModal) { assert(m_currentModalView != nullptr); - m_currentModalView->setFrame(modalViewFrame()); + m_currentModalView->setFrame(modalViewFrame(), force); } else { if (m_currentModalView) { - m_currentModalView->setFrame(KDRectZero); + m_currentModalView->setFrame(KDRectZero, force); } } } diff --git a/escher/src/scroll_view.cpp b/escher/src/scroll_view.cpp index e6947cde7..834aae7c0 100644 --- a/escher/src/scroll_view.cpp +++ b/escher/src/scroll_view.cpp @@ -93,20 +93,20 @@ KDRect ScrollView::visibleContentRect() { m_frame.height() - m_topMargin - m_bottomMargin); } -void ScrollView::layoutSubviews() { +void ScrollView::layoutSubviews(bool force) { KDRect r1 = KDRectZero; KDRect r2 = KDRectZero; - KDRect innerFrame = decorator()->layoutIndicators(minimalSizeForOptimalDisplay(), contentOffset(), bounds(), &r1, &r2); + KDRect innerFrame = decorator()->layoutIndicators(minimalSizeForOptimalDisplay(), contentOffset(), bounds(), &r1, &r2, force); if (!r1.isEmpty()) { markRectAsDirty(r1); } if (!r2.isEmpty()) { markRectAsDirty(r2); } - m_innerView.setFrame(innerFrame); + m_innerView.setFrame(innerFrame, force); KDPoint absoluteOffset = contentOffset().opposite().translatedBy(KDPoint(m_leftMargin - innerFrame.x(), m_topMargin - innerFrame.y())); KDRect contentFrame = KDRect(absoluteOffset, contentSize()); - m_contentView->setFrame(contentFrame); + m_contentView->setFrame(contentFrame, force); } void ScrollView::setContentOffset(KDPoint offset, bool forceRelayout) { @@ -136,7 +136,7 @@ View * ScrollView::BarDecorator::indicatorAtIndex(int index) { return &m_horizontalBar; } -KDRect ScrollView::BarDecorator::layoutIndicators(KDSize content, KDPoint offset, KDRect frame, KDRect * dirtyRect1, KDRect * dirtyRect2) { +KDRect ScrollView::BarDecorator::layoutIndicators(KDSize content, KDPoint offset, KDRect frame, KDRect * dirtyRect1, KDRect * dirtyRect2, bool force) { bool hBarWasVisible = m_horizontalBar.visible(); bool hBarIsVisible = m_horizontalBar.update(content.width(), offset.x(), frame.width()); bool vBarWasVisible = m_verticalBar.visible(); @@ -152,13 +152,13 @@ KDRect ScrollView::BarDecorator::layoutIndicators(KDSize content, KDPoint offset /* If the two indicators are visible, we leave an empty rectangle in the right * bottom corner. Otherwise, the only indicator uses all the height/width. */ m_verticalBar.setFrame(KDRect( - frame.width() - vBarFrameBreadth, 0, - vBarFrameBreadth, frame.height() - hBarFrameBreadth - )); + frame.width() - vBarFrameBreadth, 0, + vBarFrameBreadth, frame.height() - hBarFrameBreadth), + force); m_horizontalBar.setFrame(KDRect( - 0, frame.height() - hBarFrameBreadth, - frame.width() - vBarFrameBreadth, hBarFrameBreadth - )); + 0, frame.height() - hBarFrameBreadth, + frame.width() - vBarFrameBreadth, hBarFrameBreadth), + force); return frame; } @@ -176,7 +176,7 @@ View * ScrollView::ArrowDecorator::indicatorAtIndex(int index) { } } -KDRect ScrollView::ArrowDecorator::layoutIndicators(KDSize content, KDPoint offset, KDRect frame, KDRect * dirtyRect1, KDRect * dirtyRect2) { +KDRect ScrollView::ArrowDecorator::layoutIndicators(KDSize content, KDPoint offset, KDRect frame, KDRect * dirtyRect1, KDRect * dirtyRect2, bool force) { // There is no need to dirty the rects KDSize arrowSize = KDFont::LargeFont->glyphSize(); KDCoordinate topArrowFrameBreadth = arrowSize.height() * m_topArrow.update(0 < offset.y()); @@ -184,21 +184,21 @@ KDRect ScrollView::ArrowDecorator::layoutIndicators(KDSize content, KDPoint offs KDCoordinate bottomArrowFrameBreadth = arrowSize.height() * m_bottomArrow.update(offset.y() + frame.height() < content.height()); KDCoordinate leftArrowFrameBreadth = arrowSize.width() * m_leftArrow.update(0 < offset.x()); m_topArrow.setFrame(KDRect( - 0, 0, - frame.width(), topArrowFrameBreadth - )); + 0, 0, + frame.width(), topArrowFrameBreadth), + force); m_rightArrow.setFrame(KDRect( - frame.width() - rightArrowFrameBreadth, 0, - rightArrowFrameBreadth, frame.height() - )); + frame.width() - rightArrowFrameBreadth, 0, + rightArrowFrameBreadth, frame.height()), + force); m_bottomArrow.setFrame(KDRect( - 0, frame.height() - bottomArrowFrameBreadth, - frame.width(), bottomArrowFrameBreadth - )); + 0, frame.height() - bottomArrowFrameBreadth, + frame.width(), bottomArrowFrameBreadth), + force); m_leftArrow.setFrame(KDRect( - 0, 0, - leftArrowFrameBreadth, frame.height() - )); + 0, 0, + leftArrowFrameBreadth, frame.height()), + force); return KDRect( frame.x() + leftArrowFrameBreadth, frame.y() + topArrowFrameBreadth, diff --git a/escher/src/stack_view_controller.cpp b/escher/src/stack_view_controller.cpp index f19ee1261..8aa337d17 100644 --- a/escher/src/stack_view_controller.cpp +++ b/escher/src/stack_view_controller.cpp @@ -36,20 +36,20 @@ void StackViewController::ControllerView::popStack() { m_numberOfStacks--; } -void StackViewController::ControllerView::layoutSubviews() { +void StackViewController::ControllerView::layoutSubviews(bool force) { KDCoordinate width = m_frame.width(); if (m_displayStackHeaders) { for (int i=0; i 0 ? 1 : 0; - KDRect contentViewFrame = KDRect( 0, + KDRect contentViewFrame = KDRect(0, m_displayStackHeaders * (m_numberOfStacks * Metric::StackTitleHeight + separatorHeight), width, m_frame.height() - m_displayStackHeaders * m_numberOfStacks * Metric::StackTitleHeight); - m_contentView->setFrame(contentViewFrame); + m_contentView->setFrame(contentViewFrame, force); } } diff --git a/escher/src/tab_view.cpp b/escher/src/tab_view.cpp index 46c458810..e0c9691ee 100644 --- a/escher/src/tab_view.cpp +++ b/escher/src/tab_view.cpp @@ -66,7 +66,7 @@ View * TabView::subviewAtIndex(int index) { return &m_cells[index]; } -void TabView::layoutSubviews() { +void TabView::layoutSubviews(bool force) { KDCoordinate emptyWidth = bounds().width(); for (int i=0; isetFrame(activeViewFrame); + m_activeView->setFrame(activeViewFrame, force); } } diff --git a/escher/src/table_cell.cpp b/escher/src/table_cell.cpp index 14a2a3de3..40e70235b 100644 --- a/escher/src/table_cell.cpp +++ b/escher/src/table_cell.cpp @@ -38,7 +38,7 @@ View * TableCell::subviewAtIndex(int index) { * margins (like ExpressionView), sometimes the subview has no margins (like * MessageView) which prevents us to handle margins only here. */ -void TableCell::layoutSubviews() { +void TableCell::layoutSubviews(bool force) { KDCoordinate width = bounds().width(); KDCoordinate height = bounds().height(); View * label = labelView(); @@ -50,14 +50,16 @@ void TableCell::layoutSubviews() { k_separatorThickness+k_labelMargin, k_separatorThickness+Metric::TableCellLabelTopMargin, width-2*k_separatorThickness-k_labelMargin, - labelSize.height())); + labelSize.height()), + force); break; default: label->setFrame(KDRect( k_separatorThickness+k_labelMargin, k_separatorThickness, labelSize.width(), - height - 2*k_separatorThickness)); + height - 2*k_separatorThickness), + force); break; } } @@ -70,7 +72,8 @@ void TableCell::layoutSubviews() { k_separatorThickness+k_accessoryMargin, height-k_separatorThickness-accessorySize.height()-k_accessoryBottomMargin, width-2*k_separatorThickness - k_accessoryMargin, - accessorySize.height())); + accessorySize.height()), + force); break; default: // In some cases, the accessory view cannot take all the size it can @@ -81,13 +84,15 @@ void TableCell::layoutSubviews() { wantedX, k_separatorThickness, accessorySize.width(), - height-2*k_separatorThickness)); + height-2*k_separatorThickness), + force); } else { accessory->setFrame(KDRect( minX, k_separatorThickness, accessorySize.width(), - height-2*k_separatorThickness)); + height-2*k_separatorThickness), + force); } break; } @@ -97,7 +102,7 @@ void TableCell::layoutSubviews() { KDSize accessorySize = accessory->minimalSizeForOptimalDisplay(); KDSize subAccessorySize = subAccessory->minimalSizeForOptimalDisplay(); subAccessory->setFrame(KDRect(width-k_separatorThickness-k_accessoryMargin-accessorySize.width()-subAccessorySize.width(), k_separatorThickness, - subAccessorySize.width(), height-2*k_separatorThickness)); + subAccessorySize.width(), height-2*k_separatorThickness), force); } } diff --git a/escher/src/table_view.cpp b/escher/src/table_view.cpp index 1172ecbf0..f4c72317e 100644 --- a/escher/src/table_view.cpp +++ b/escher/src/table_view.cpp @@ -33,7 +33,7 @@ const char * TableView::className() const { } #endif -void TableView::layoutSubviews() { +void TableView::layoutSubviews(bool force) { /* On the one hand, ScrollView::layoutSubviews() * calls setFrame(...) over m_contentView, * which typically calls layoutSubviews() over m_contentView. @@ -49,8 +49,8 @@ void TableView::layoutSubviews() { * FIXME: * Finally, this solution is not optimal at all since * layoutSubviews is called twice over m_contentView. */ - m_contentView.layoutSubviews(); - ScrollView::layoutSubviews(); + m_contentView.layoutSubviews(force); + ScrollView::layoutSubviews(force); } void TableView::reloadCellAtLocation(int i, int j) { @@ -166,7 +166,7 @@ View * TableView::ContentView::subviewAtIndex(int index) { return m_dataSource->reusableCell(typeIndex, type); } -void TableView::ContentView::layoutSubviews() { +void TableView::ContentView::layoutSubviews(bool force) { /* The number of subviews might change during the layouting so it needs to be * recomputed at each step of the for loop. */ for (int index = 0; index < numberOfSubviews(); index++) { @@ -174,7 +174,7 @@ void TableView::ContentView::layoutSubviews() { int i = absoluteColumnNumberFromSubviewIndex(index); int j = absoluteRowNumberFromSubviewIndex(index); m_dataSource->willDisplayCellAtLocation((HighlightCell *)cell, i, j); - cell->setFrame(cellFrame(i,j)); + cell->setFrame(cellFrame(i,j), force); } } diff --git a/escher/src/text_field.cpp b/escher/src/text_field.cpp index 78bf2dbe3..267fb18d6 100644 --- a/escher/src/text_field.cpp +++ b/escher/src/text_field.cpp @@ -209,12 +209,12 @@ void TextField::ContentView::didModifyTextBuffer() { layoutSubviews(); } -void TextField::ContentView::layoutSubviews() { +void TextField::ContentView::layoutSubviews(bool force) { if (!m_isEditing) { - m_cursorView.setFrame(KDRectZero); + m_cursorView.setFrame(KDRectZero, force); return; } - TextInput::ContentView::layoutSubviews(); + TextInput::ContentView::layoutSubviews(force); } KDRect TextField::ContentView::glyphFrameAtPosition(const char * buffer, const char * position) const { diff --git a/escher/src/text_input.cpp b/escher/src/text_input.cpp index cb9789a93..b3c392efa 100644 --- a/escher/src/text_input.cpp +++ b/escher/src/text_input.cpp @@ -25,8 +25,8 @@ KDRect TextInput::ContentView::cursorRect() { return glyphFrameAtPosition(editedText(), m_cursorLocation); } -void TextInput::ContentView::layoutSubviews() { - m_cursorView.setFrame(cursorRect()); +void TextInput::ContentView::layoutSubviews(bool force) { + m_cursorView.setFrame(cursorRect(), force); } void TextInput::ContentView::reloadRectFromPosition(const char * position, bool lineBreak) { diff --git a/escher/src/view.cpp b/escher/src/view.cpp index 2542aa0f3..6dcfb4b76 100644 --- a/escher/src/view.cpp +++ b/escher/src/view.cpp @@ -93,11 +93,11 @@ View * View::subview(int index) { } void View::setSize(KDSize size) { - setFrame(KDRect(m_frame.origin(), size)); + setFrame(KDRect(m_frame.origin(), size), false); } -void View::setFrame(KDRect frame) { - if (frame == m_frame) { +void View::setFrame(KDRect frame, bool force) { + if (frame == m_frame && !force) { return; } /* CAUTION: This code is not resilient to multiple consecutive setFrame() @@ -121,7 +121,7 @@ void View::setFrame(KDRect frame) { // FIXME: m_dirtyRect = bounds(); would be more correct (in case the view is being shrinked) if (!m_frame.isEmpty()) { - layoutSubviews(); + layoutSubviews(force); } } diff --git a/escher/src/warning_controller.cpp b/escher/src/warning_controller.cpp index 07bc18f22..a07c11dbf 100644 --- a/escher/src/warning_controller.cpp +++ b/escher/src/warning_controller.cpp @@ -25,18 +25,18 @@ View * WarningController::ContentView::subviewAtIndex(int index) { return views[index]; } -void WarningController::ContentView::layoutSubviews() { +void WarningController::ContentView::layoutSubviews(bool force) { if (numberOfSubviews() == 1) { - m_textView1.setFrame(bounds()); + m_textView1.setFrame(bounds(), force); m_textView1.setAlignment(k_middleAlignment, k_middleAlignment); return; } assert(numberOfSubviews() == 2); KDRect fullBounds = bounds(); KDCoordinate halfHeight = fullBounds.height()/2; - m_textView1.setFrame(KDRect(fullBounds.topLeft(), fullBounds.width(), halfHeight)); + m_textView1.setFrame(KDRect(fullBounds.topLeft(), fullBounds.width(), halfHeight), force); m_textView1.setAlignment(k_middleAlignment, k_shiftedAlignment); - m_textView2.setFrame(KDRect(fullBounds.left(), fullBounds.top()+halfHeight, fullBounds.width(), halfHeight)); + m_textView2.setFrame(KDRect(fullBounds.left(), fullBounds.top()+halfHeight, fullBounds.width(), halfHeight), force); } KDSize WarningController::ContentView::minimalSizeForOptimalDisplay() const { diff --git a/escher/src/window.cpp b/escher/src/window.cpp index 15807f017..b516571c4 100644 --- a/escher/src/window.cpp +++ b/escher/src/window.cpp @@ -31,9 +31,9 @@ View * Window::subviewAtIndex(int index) { return m_contentView; } -void Window::layoutSubviews() { +void Window::layoutSubviews(bool force) { if (m_contentView != nullptr) { - m_contentView->setFrame(bounds()); + m_contentView->setFrame(bounds(), force); } }