Confirm object cancellation (#15660)
This commit is contained in:
parent
78899fc241
commit
9aff30da0c
|
@ -42,6 +42,13 @@ void CancelObject::set_active_object(const int8_t obj) {
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
skipping = false;
|
skipping = false;
|
||||||
|
|
||||||
|
#if HAS_DISPLAY
|
||||||
|
if (active_object >= 0)
|
||||||
|
ui.status_printf_P(0, PSTR(S_FMT " %i"), GET_TEXT(MSG_PRINTING_OBJECT), int(active_object + 1));
|
||||||
|
else
|
||||||
|
ui.reset_status();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CancelObject::cancel_object(const int8_t obj) {
|
void CancelObject::cancel_object(const int8_t obj) {
|
||||||
|
|
|
@ -32,6 +32,7 @@ public:
|
||||||
static void cancel_object(const int8_t obj);
|
static void cancel_object(const int8_t obj);
|
||||||
static void uncancel_object(const int8_t obj);
|
static void uncancel_object(const int8_t obj);
|
||||||
static void report();
|
static void report();
|
||||||
|
static inline bool is_canceled(const int8_t obj) { return TEST(canceled, obj); }
|
||||||
static inline void clear_active_object() { set_active_object(-1); }
|
static inline void clear_active_object() { set_active_object(-1); }
|
||||||
static inline void cancel_active_object() { cancel_object(active_object); }
|
static inline void cancel_active_object() { cancel_object(active_object); }
|
||||||
static inline void reset() { canceled = 0x0000; object_count = 0; clear_active_object(); }
|
static inline void reset() { canceled = 0x0000; object_count = 0; clear_active_object(); }
|
||||||
|
|
|
@ -427,6 +427,7 @@ namespace Language_en {
|
||||||
PROGMEM Language_Str MSG_PAUSE_PRINT = _UxGT("Pause Print");
|
PROGMEM Language_Str MSG_PAUSE_PRINT = _UxGT("Pause Print");
|
||||||
PROGMEM Language_Str MSG_RESUME_PRINT = _UxGT("Resume Print");
|
PROGMEM Language_Str MSG_RESUME_PRINT = _UxGT("Resume Print");
|
||||||
PROGMEM Language_Str MSG_STOP_PRINT = _UxGT("Stop Print");
|
PROGMEM Language_Str MSG_STOP_PRINT = _UxGT("Stop Print");
|
||||||
|
PROGMEM Language_Str MSG_PRINTING_OBJECT = _UxGT("Printing Object");
|
||||||
PROGMEM Language_Str MSG_CANCEL_OBJECT = _UxGT("Cancel Object");
|
PROGMEM Language_Str MSG_CANCEL_OBJECT = _UxGT("Cancel Object");
|
||||||
PROGMEM Language_Str MSG_OUTAGE_RECOVERY = _UxGT("Outage Recovery");
|
PROGMEM Language_Str MSG_OUTAGE_RECOVERY = _UxGT("Outage Recovery");
|
||||||
PROGMEM Language_Str MSG_MEDIA_MENU = _UxGT("Print from Media");
|
PROGMEM Language_Str MSG_MEDIA_MENU = _UxGT("Print from Media");
|
||||||
|
|
|
@ -299,10 +299,7 @@ class MenuItem_bool {
|
||||||
} \
|
} \
|
||||||
screen_items = _thisItemNr
|
screen_items = _thisItemNr
|
||||||
|
|
||||||
#define END_MENU() \
|
#define END_MENU() END_SCREEN(); UNUSED(_skipStatic)
|
||||||
} \
|
|
||||||
screen_items = _thisItemNr; \
|
|
||||||
UNUSED(_skipStatic)
|
|
||||||
|
|
||||||
#if ENABLED(ENCODER_RATE_MULTIPLIER)
|
#if ENABLED(ENCODER_RATE_MULTIPLIER)
|
||||||
#define ENCODER_RATE_MULTIPLY(F) (ui.encoderRateMultiplierEnabled = F)
|
#define ENCODER_RATE_MULTIPLY(F) (ui.encoderRateMultiplierEnabled = F)
|
||||||
|
|
|
@ -33,41 +33,45 @@
|
||||||
|
|
||||||
#include "../../feature/cancel_object.h"
|
#include "../../feature/cancel_object.h"
|
||||||
|
|
||||||
//
|
static void lcd_cancel_object_confirm() {
|
||||||
// TODO: Select the active object
|
const int8_t v = editable.int8;
|
||||||
// upon entry to the menu and present
|
const char item_num[] = {
|
||||||
// a confirmation screen.
|
' ',
|
||||||
//
|
char((v > 9) ? '0' + (v / 10) : ' '),
|
||||||
|
char('0' + (v % 10)),
|
||||||
|
'\0'
|
||||||
|
};
|
||||||
|
do_select_screen_yn(
|
||||||
|
[]{
|
||||||
|
cancelable.cancel_object(editable.int8 - 1);
|
||||||
|
#if HAS_BUZZER
|
||||||
|
ui.completion_feedback();
|
||||||
|
#endif
|
||||||
|
},
|
||||||
|
ui.goto_previous_screen,
|
||||||
|
GET_TEXT(MSG_CANCEL_OBJECT), item_num, PSTR("?")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void menu_cancelobject() {
|
void menu_cancelobject() {
|
||||||
START_MENU();
|
START_MENU();
|
||||||
BACK_ITEM(MSG_MAIN);
|
BACK_ITEM(MSG_MAIN);
|
||||||
|
|
||||||
GCODES_ITEM(MSG_CANCEL_OBJECT, PSTR("M486 C"));
|
|
||||||
|
|
||||||
// Draw cancelable items in a loop
|
// Draw cancelable items in a loop
|
||||||
for (int8_t i = 0; i < cancelable.object_count; i++) {
|
int8_t a = cancelable.active_object;
|
||||||
if (!TEST(cancelable.canceled, i)) {
|
for (int8_t i = -1; i < cancelable.object_count; i++) {
|
||||||
editable.int8 = i;
|
if (i == a) continue;
|
||||||
ACTION_ITEM(MSG_CANCEL_OBJECT, [](){
|
int8_t j = i < 0 ? a : i;
|
||||||
cancelable.cancel_object(editable.int8);
|
if (!cancelable.is_canceled(j)) {
|
||||||
ui.quick_feedback();
|
editable.int8 = j + 1;
|
||||||
});
|
SUBMENU(MSG_CANCEL_OBJECT, lcd_cancel_object_confirm);
|
||||||
MENU_ITEM_ADDON_START(LCD_WIDTH - 2 - (i >= 10));
|
MENU_ITEM_ADDON_START(LCD_WIDTH - 2 - (j >= 9));
|
||||||
lcd_put_int(i);
|
lcd_put_int(editable.int8);
|
||||||
MENU_ITEM_ADDON_END();
|
MENU_ITEM_ADDON_END();
|
||||||
}
|
}
|
||||||
|
if (i < 0) SKIP_ITEM();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_CANCEL_OBJECT, &editable.int8, -1, 32, [](){
|
|
||||||
if (editable.int8 > -1) {
|
|
||||||
cancelable.cancel_object(editable.int8);
|
|
||||||
ui.quick_feedback();
|
|
||||||
editable.int8 = -1;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
|
|
||||||
END_MENU();
|
END_MENU();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue