mirror of
https://github.com/c3d/DB48X-on-DM42.git
synced 2024-09-28 03:20:53 +02:00
ui: Do not persistently hide stack with current equation
Add support for a "transient object" to be shown for context. This object will be hidden the next time the stack is redrawn. That way, we only see the equation when it's useful. Fixes: #1077 Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
This commit is contained in:
parent
cbd5386248
commit
d9a58af96a
3 changed files with 41 additions and 4 deletions
|
@ -591,6 +591,10 @@ MENU_BODY(SolvingMenu)
|
|||
ui.marker(k + 1 * ui.NUM_SOFTKEYS, L'?', false);
|
||||
ui.marker(k + 2 * ui.NUM_SOFTKEYS, L'▶', false);
|
||||
}
|
||||
|
||||
if (expression_p expr = expression::current_equation(false, true, true))
|
||||
ui.transient_object(expr);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -2600,10 +2600,8 @@ bool user_interface::draw_stack()
|
|||
draw_busy();
|
||||
uint top = HeaderFont->height() + 2;
|
||||
uint bottom = Stack.draw_stack();
|
||||
if (menu_p m = menu())
|
||||
if (m->type() == object::ID_SolvingMenu)
|
||||
if (expression_p expr = expression::current_equation(false, true, true))
|
||||
draw_object(expr, top, bottom);
|
||||
if (object_p transient = transient_object())
|
||||
draw_object(transient, top, bottom);
|
||||
draw_dirty(0, top, stack, LCD_H-1);
|
||||
draw_idle();
|
||||
dirtyStack = false;
|
||||
|
@ -2647,6 +2645,38 @@ bool user_interface::draw_object(object_p obj, uint top, uint bottom)
|
|||
}
|
||||
|
||||
|
||||
object_p user_interface::transient_object()
|
||||
// ----------------------------------------------------------------------------
|
||||
// Return transient object to display if any
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
object_p result = editing;
|
||||
if (result)
|
||||
{
|
||||
if (!rt.editing())
|
||||
editing = nullptr;
|
||||
else
|
||||
result = nullptr;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
bool user_interface::transient_object(object_p obj)
|
||||
// ----------------------------------------------------------------------------
|
||||
// Set transient object to draw on screen
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
if (obj && !editing && !rt.editing())
|
||||
{
|
||||
editing = obj;
|
||||
dirtyStack = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void user_interface::load_help(utf8 topic, size_t len)
|
||||
// ----------------------------------------------------------------------------
|
||||
// Find the help message associated with the topic
|
||||
|
|
|
@ -143,6 +143,9 @@ struct user_interface
|
|||
bool draw_menus();
|
||||
bool draw_cursor(int show, uint ncursor);
|
||||
|
||||
object_p transient_object();
|
||||
bool transient_object(object_p obj);
|
||||
|
||||
modes editing_mode() { return mode; }
|
||||
int stack_screen_bottom() { return stack; }
|
||||
int menu_screen_bottom() { return menuHeight; }
|
||||
|
|
Loading…
Reference in a new issue