mirror of
https://github.com/c3d/DB48X-on-DM42.git
synced 2024-09-28 03:20:53 +02:00
undo: Connect Undo and LastArg
Implement the `Undo` and `LastArg` commands Fixes: #379 Fixes: #380 Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
This commit is contained in:
parent
2c43a47adf
commit
a0bff89b06
8 changed files with 40 additions and 12 deletions
|
@ -7,7 +7,7 @@ extern const unsigned char EditorFont_sparse_font_data[];
|
|||
const unsigned char EditorFont_sparse_font_data[73676] FONT_QSPI =
|
||||
{
|
||||
|
||||
0xBA, 0x02, 0xC7, 0xBF, 0x04, 0x36, 0x00, 0x01, 0x00, 0x2C, 0x01, 0x01, 0x00, 0x00, 0x0D, 0x01,
|
||||
0xBC, 0x02, 0xC7, 0xBF, 0x04, 0x36, 0x00, 0x01, 0x00, 0x2C, 0x01, 0x01, 0x00, 0x00, 0x0D, 0x01,
|
||||
0x00, 0x2C, 0x01, 0x01, 0x08, 0x00, 0x20, 0x5F, 0x00, 0x2C, 0x01, 0x01, 0x08, 0x00, 0x02, 0x0B,
|
||||
0x05, 0x21, 0x09, 0xEF, 0xBD, 0xF7, 0xDE, 0x7B, 0xEF, 0xBD, 0xF7, 0xDE, 0x7B, 0xEF, 0xBD, 0xF7,
|
||||
0x1E, 0x00, 0x00, 0xB8, 0xFF, 0xFF, 0xFF, 0x0E, 0x03, 0x0B, 0x0B, 0x0F, 0x11, 0x8F, 0x7F, 0xFC,
|
||||
|
|
|
@ -7,7 +7,7 @@ extern const unsigned char HelpFont_sparse_font_data[];
|
|||
const unsigned char HelpFont_sparse_font_data[15010] FONT_QSPI =
|
||||
{
|
||||
|
||||
0xBA, 0x02, 0x9E, 0x75, 0x14, 0x00, 0x01, 0x00, 0x11, 0x01, 0x01, 0x00, 0x00, 0x0D, 0x01, 0x00,
|
||||
0xBC, 0x02, 0x9E, 0x75, 0x14, 0x00, 0x01, 0x00, 0x11, 0x01, 0x01, 0x00, 0x00, 0x0D, 0x01, 0x00,
|
||||
0x11, 0x01, 0x01, 0x03, 0x00, 0x20, 0x5F, 0x00, 0x11, 0x01, 0x01, 0x03, 0x00, 0x01, 0x04, 0x02,
|
||||
0x0D, 0x04, 0xFF, 0xFF, 0xF3, 0x03, 0x01, 0x04, 0x04, 0x05, 0x06, 0xFF, 0xFF, 0x0F, 0x01, 0x04,
|
||||
0x08, 0x0D, 0x0A, 0x12, 0x12, 0x14, 0x7F, 0x7F, 0x24, 0x24, 0x24, 0xFE, 0xFE, 0x28, 0x48, 0x48,
|
||||
|
|
|
@ -7,7 +7,7 @@ extern const unsigned char StackFont_sparse_font_data[];
|
|||
const unsigned char StackFont_sparse_font_data[36409] FONT_QSPI =
|
||||
{
|
||||
|
||||
0xBA, 0x02, 0xB4, 0x9C, 0x02, 0x24, 0x00, 0x01, 0x00, 0x1C, 0x01, 0x01, 0x00, 0x00, 0x0D, 0x01,
|
||||
0xBC, 0x02, 0xB4, 0x9C, 0x02, 0x24, 0x00, 0x01, 0x00, 0x1C, 0x01, 0x01, 0x00, 0x00, 0x0D, 0x01,
|
||||
0x00, 0x1C, 0x01, 0x01, 0x06, 0x00, 0x20, 0x5F, 0x00, 0x1C, 0x01, 0x01, 0x06, 0x00, 0x02, 0x05,
|
||||
0x03, 0x17, 0x06, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0xC0, 0xFF, 0x1F, 0x02, 0x05, 0x08, 0x0A,
|
||||
0x0C, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7, 0x01, 0x05, 0x0E, 0x17, 0x10,
|
||||
|
|
|
@ -651,3 +651,25 @@ COMMAND_BODY(LastMenu)
|
|||
ui.menu_pop();
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
COMMAND_BODY(LastArg)
|
||||
// ----------------------------------------------------------------------------
|
||||
// Return the last arguments
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
if (!rt.last())
|
||||
return ERROR;
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
COMMAND_BODY(Undo)
|
||||
// ----------------------------------------------------------------------------
|
||||
// Return the undo stack
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
if (!rt.undo())
|
||||
return ERROR;
|
||||
return OK;
|
||||
}
|
||||
|
|
|
@ -145,6 +145,8 @@ COMMAND_DECLARE(SaveState); // Save state to disk
|
|||
COMMAND_DECLARE(SystemSetup); // Select the system menu
|
||||
COMMAND_DECLARE(Version); // Return a version string
|
||||
COMMAND_DECLARE(Help); // Activate online help
|
||||
COMMAND_DECLARE(LastArg); // Return last arguments
|
||||
COMMAND_DECLARE(Undo); // Revert to the Undo stack
|
||||
COMMAND_DECLARE(ToolsMenu); // Automatic selection of the right menu
|
||||
COMMAND_DECLARE(LastMenu); // Return to
|
||||
COMMAND_DECLARE(ToList); // Build a list from stack
|
||||
|
|
|
@ -79,7 +79,7 @@ FLAGS(is_complex, rectangular, polar)
|
|||
FLAGS(is_command, Drop, Unimplemented)
|
||||
FLAGS(is_symbolic, local, equation, pi, ImaginaryUnit)
|
||||
FLAGS(is_algebraic, add, ToFraction)
|
||||
FLAGS(is_immediate, MainMenu, LastMenu)
|
||||
FLAGS(is_immediate, MainMenu, Unimplemented)
|
||||
|
||||
|
||||
|
||||
|
@ -280,6 +280,7 @@ CMD(ForStep)
|
|||
//
|
||||
// ============================================================================
|
||||
|
||||
NAMED(LastArg, "LastArguments")
|
||||
CMD(Depth)
|
||||
NAMED(ToList, "→List")
|
||||
CMD(Get)
|
||||
|
@ -545,6 +546,7 @@ NAMED(Off, "PowerOff")
|
|||
CMD(SaveState)
|
||||
CMD(SystemSetup)
|
||||
CMD(Help)
|
||||
CMD(Undo)
|
||||
|
||||
CMD(Unimplemented)
|
||||
|
||||
|
|
12
src/menu.cc
12
src/menu.cc
|
@ -798,8 +798,8 @@ MENU(StackMenu,
|
|||
ID_RollD,
|
||||
|
||||
ID_Depth,
|
||||
"LastStk", ID_Unimplemented,
|
||||
"LastArg", ID_Unimplemented,
|
||||
"LastStk", ID_Undo,
|
||||
"LastArg", ID_LastArg,
|
||||
"ClrStk", ID_Unimplemented,
|
||||
"FillStk", ID_Unimplemented,
|
||||
|
||||
|
@ -948,12 +948,10 @@ MENU(LastThingsMenu,
|
|||
// ----------------------------------------------------------------------------
|
||||
// Menu with the last things
|
||||
// ----------------------------------------------------------------------------
|
||||
"Arg", ID_Unimplemented,
|
||||
"Stack", ID_Unimplemented,
|
||||
"Arg", ID_LastArg,
|
||||
"Stack", ID_Undo,
|
||||
"Menu", ID_LastMenu,
|
||||
"Cmd", ID_Unimplemented,
|
||||
"Undo", ID_Unimplemented,
|
||||
"Redo", ID_Unimplemented);
|
||||
"Cmd", ID_Unimplemented);
|
||||
|
||||
MENU(CharsMenu,
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
|
@ -302,6 +302,7 @@ bool user_interface::end_edit()
|
|||
// We successfully parsed the line
|
||||
clear_editor();
|
||||
this->editing = nullptr;
|
||||
rt.save();
|
||||
cmds->execute();
|
||||
}
|
||||
else
|
||||
|
@ -3560,7 +3561,8 @@ bool user_interface::handle_functions(int key)
|
|||
if (!key)
|
||||
return false;
|
||||
|
||||
record(user_interface, "Handle function for key %d (plane %d) ", key, shift_plane());
|
||||
record(user_interface,
|
||||
"Handle function for key %d (plane %d) ", key, shift_plane());
|
||||
if (object_p obj = object_for_key(key))
|
||||
{
|
||||
evaluating = key;
|
||||
|
@ -3610,6 +3612,8 @@ bool user_interface::handle_functions(int key)
|
|||
|
||||
}
|
||||
draw_busy_cursor();
|
||||
if (!imm)
|
||||
rt.save();
|
||||
obj->execute();
|
||||
draw_idle();
|
||||
dirtyStack = true;
|
||||
|
|
Loading…
Reference in a new issue