mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-21 14:50:44 +01:00
[expression_editor] Use ExpressionEditorView.
Change-Id: Ib4080fd76f7040be6ad8ebfda10d2e2070c7381c
This commit is contained in:
@@ -2,29 +2,26 @@
|
||||
|
||||
namespace ExpressionEditor {
|
||||
|
||||
Controller::ContentView::ContentView(ExpressionAndLayout * expressionAndLayout) :
|
||||
SolidColorView(KDColorWhite),
|
||||
m_expressionView()
|
||||
{
|
||||
m_expressionView.setExpressionLayout(expressionAndLayout->expressionLayout());
|
||||
}
|
||||
|
||||
void Controller::ContentView::layoutSubviews() {
|
||||
m_expressionView.setFrame(KDRect(
|
||||
k_margin,
|
||||
k_margin,
|
||||
bounds().width() - 2 * k_margin,
|
||||
bounds().height() - 2 * k_margin));
|
||||
}
|
||||
|
||||
KDSize Controller::ContentView::minimalSizeForOptimalDisplay() const {
|
||||
return m_expressionView.minimalSizeForOptimalDisplay();
|
||||
}
|
||||
|
||||
Controller::Controller(Responder * parentResponder, ExpressionAndLayout * expressionAndLayout) :
|
||||
Controller::Controller(Responder * parentResponder, Poincare::ExpressionLayout * expressionLayout) :
|
||||
ViewController(parentResponder),
|
||||
m_view(expressionAndLayout)
|
||||
m_view(parentResponder, expressionLayout, &m_cursor)
|
||||
{
|
||||
m_cursor.setPointedExpressionLayout(expressionLayout);
|
||||
}
|
||||
|
||||
void Controller::didBecomeFirstResponder() {
|
||||
m_view.layoutSubviews();
|
||||
/* TODO We need the layout to be done in order to scroll to the cursor. We
|
||||
* thus made ExpressionViewWithCursor's layoutSubviews() public, which is the
|
||||
* solution used in ModalViewController for instance. A cleaner solution would
|
||||
* be to split viewWillAppear into loadViewIfNeeded() and viewWillAppear(), in
|
||||
* order to change App::didBecomeActive to:
|
||||
* m_modalViewController.loadViewIfNeeded();
|
||||
* window->setContentView(view);
|
||||
* m_modalViewController.viewWillAppear();
|
||||
* The scrolling could then be done in viewWillAppear(), without calling
|
||||
* layoutSubviews() manually. */
|
||||
m_view.scrollableExpressionViewWithCursor()->scrollToCursor();
|
||||
}
|
||||
|
||||
bool Controller::handleEvent(Ion::Events::Event event) {
|
||||
|
||||
Reference in New Issue
Block a user