mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/code] Shift + OK don't quit toolbox
This commit is contained in:
@@ -696,14 +696,13 @@ KDCoordinate PythonToolbox::rowHeight(int j) {
|
||||
return Toolbox::rowHeight(j);
|
||||
}
|
||||
|
||||
bool PythonToolbox::selectLeaf(int selectedRow) {
|
||||
bool PythonToolbox::selectLeaf(int selectedRow, bool quitToolbox) {
|
||||
ToolboxMessageTree * node = (ToolboxMessageTree *)m_messageTreeModel->childAtIndex(selectedRow);
|
||||
#if defined(INCLUDE_ULAB)
|
||||
if(node->text() == I18n::Message::UlabDocumentationLink){
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
m_selectableTableView.deselectTable();
|
||||
if(node->insertedText() == I18n::Message::IonSelector){
|
||||
m_ionKeys.setSender(sender());
|
||||
Container::activeApp()->displayModalViewController(static_cast<ViewController*>(&m_ionKeys), 0.f, 0.f, Metric::PopUpTopMargin, Metric::PopUpLeftMargin, 0, Metric::PopUpRightMargin);
|
||||
@@ -719,7 +718,10 @@ bool PythonToolbox::selectLeaf(int selectedRow) {
|
||||
editedText = strippedEditedText;
|
||||
}
|
||||
sender()->handleEventWithText(editedText, true);
|
||||
Container::activeApp()->dismissModalViewController();
|
||||
if (quitToolbox) {
|
||||
m_selectableTableView.deselectTable();
|
||||
Container::activeApp()->dismissModalViewController();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,10 +20,11 @@ public:
|
||||
const ToolboxMessageTree * rootModel() const override;
|
||||
protected:
|
||||
KDCoordinate rowHeight(int j) override;
|
||||
bool selectLeaf(int selectedRow) override;
|
||||
bool selectLeaf(int selectedRow, bool quitToolbox) override;
|
||||
MessageTableCellWithMessage * leafCellAtIndex(int index) override;
|
||||
MessageTableCellWithChevron* nodeCellAtIndex(int index) override;
|
||||
int maxNumberOfDisplayedRows() override;
|
||||
bool canStayInMenu() override { return true; }
|
||||
constexpr static int k_maxNumberOfDisplayedRows = 13; // = 240/(13+2*3)
|
||||
// 13 = minimal string height size
|
||||
// 3 = vertical margins
|
||||
|
||||
@@ -365,7 +365,7 @@ int VariableBoxController::typeAndOriginAtLocation(int i, NodeOrigin * resultOri
|
||||
|
||||
}
|
||||
|
||||
bool VariableBoxController::selectLeaf(int rowIndex) {
|
||||
bool VariableBoxController::selectLeaf(int rowIndex, bool quitToolbox) {
|
||||
assert(rowIndex >= 0 && rowIndex < numberOfRows());
|
||||
m_selectableTableView.deselectTable();
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ private:
|
||||
// NestedMenuController
|
||||
HighlightCell * leafCellAtIndex(int index) override { assert(false); return nullptr; }
|
||||
HighlightCell * nodeCellAtIndex(int index) override { assert(false); return nullptr; }
|
||||
bool selectLeaf(int rowIndex) override;
|
||||
bool selectLeaf(int rowIndex, bool quitToolbox) override;
|
||||
void insertTextInCaller(const char * text, int textLength = -1);
|
||||
|
||||
// Loading
|
||||
|
||||
@@ -877,7 +877,7 @@ MathToolbox::MathToolbox() :
|
||||
{
|
||||
}
|
||||
|
||||
bool MathToolbox::selectLeaf(int selectedRow) {
|
||||
bool MathToolbox::selectLeaf(int selectedRow, bool quitToolbox) {
|
||||
ToolboxMessageTree * messageTree = (ToolboxMessageTree *)m_messageTreeModel->childAtIndex(selectedRow);
|
||||
m_selectableTableView.deselectTable();
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ public:
|
||||
MathToolbox();
|
||||
const ToolboxMessageTree * rootModel() const override;
|
||||
protected:
|
||||
bool selectLeaf(int selectedRow) override;
|
||||
bool selectLeaf(int selectedRow, bool quitToolbox) override;
|
||||
MessageTableCellWithMessage * leafCellAtIndex(int index) override;
|
||||
MessageTableCellWithChevron* nodeCellAtIndex(int index) override;
|
||||
int maxNumberOfDisplayedRows() override;
|
||||
|
||||
@@ -193,7 +193,7 @@ bool MathVariableBoxController::returnToPreviousMenu() {
|
||||
return AlternateEmptyNestedMenuController::returnToPreviousMenu();
|
||||
}
|
||||
|
||||
bool MathVariableBoxController::selectLeaf(int selectedRow) {
|
||||
bool MathVariableBoxController::selectLeaf(int selectedRow, bool quitToolbox) {
|
||||
if (isDisplayingEmptyController()) {
|
||||
/* We do not want to handle OK/EXE events in that case. */
|
||||
return false;
|
||||
|
||||
@@ -42,7 +42,7 @@ private:
|
||||
void setPage(Page page);
|
||||
bool selectSubMenu(int selectedRow) override;
|
||||
bool returnToPreviousMenu() override;
|
||||
bool selectLeaf(int selectedRow) override;
|
||||
bool selectLeaf(int selectedRow, bool quitToolbox) override;
|
||||
I18n::Message nodeLabelAtIndex(int index);
|
||||
Poincare::Layout expressionLayoutForRecord(Ion::Storage::Record record, int index);
|
||||
const char * extension() const;
|
||||
|
||||
@@ -65,7 +65,8 @@ protected:
|
||||
bool handleEventForRow(Ion::Events::Event event, int selectedRow);
|
||||
virtual bool selectSubMenu(int selectedRow);
|
||||
virtual bool returnToPreviousMenu();
|
||||
virtual bool selectLeaf(int selectedRow) = 0;
|
||||
virtual bool selectLeaf(int selectedRow, bool quitToolbox) = 0;
|
||||
virtual bool canStayInMenu() { return false; };
|
||||
virtual int stackRowOffset() const { return 0; }
|
||||
InputEventHandler * sender() { return m_sender; }
|
||||
virtual HighlightCell * leafCellAtIndex(int index) = 0;
|
||||
|
||||
@@ -156,8 +156,11 @@ bool NestedMenuController::handleEventForRow(Ion::Events::Event event, int rowIn
|
||||
if ((event == Ion::Events::OK || event == Ion::Events::EXE || event == Ion::Events::Right) && typeAtLocation(0, selectedRow()) == NodeCellType) {
|
||||
return selectSubMenu(rowIndex);
|
||||
}
|
||||
if (canStayInMenu() && ((event == Ion::Events::ShiftOK || event == Ion::Events::ShiftEXE) && typeAtLocation(0, selectedRow()) == LeafCellType)) {
|
||||
return selectLeaf(rowIndex, false);
|
||||
}
|
||||
if ((event == Ion::Events::OK || event == Ion::Events::EXE) && typeAtLocation(0, selectedRow()) == LeafCellType) {
|
||||
return selectLeaf(rowIndex);
|
||||
return selectLeaf(rowIndex, true);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -141,6 +141,7 @@ constexpr Event ShiftLeft = Event::ShiftKey(Keyboard::Key::Left);
|
||||
constexpr Event ShiftRight = Event::ShiftKey(Keyboard::Key::Right);
|
||||
constexpr Event ShiftUp = Event::ShiftKey(Keyboard::Key::Up);
|
||||
constexpr Event ShiftDown = Event::ShiftKey(Keyboard::Key::Down);
|
||||
constexpr Event ShiftOK = Event::ShiftKey(Keyboard::Key::OK);
|
||||
|
||||
constexpr Event AlphaLock = Event::ShiftKey(Keyboard::Key::Alpha);
|
||||
constexpr Event Cut = Event::ShiftKey(Keyboard::Key::XNT);
|
||||
@@ -183,6 +184,8 @@ constexpr Event ShiftSeven = Event::ShiftKey(Keyboard::Key::Seven);
|
||||
constexpr Event ShiftEight = Event::ShiftKey(Keyboard::Key::Eight);
|
||||
constexpr Event ShiftNine = Event::ShiftKey(Keyboard::Key::Nine);
|
||||
|
||||
constexpr Event ShiftEXE = Event::ShiftKey(Keyboard::Key::EXE);
|
||||
|
||||
// Alpha
|
||||
|
||||
constexpr Event AlphaLeft = Event::AlphaKey(Keyboard::Key::Left);
|
||||
|
||||
@@ -16,7 +16,7 @@ const EventData s_dataForEvent[4 * Event::PageSize] = {
|
||||
T("1"), T("2"), T("3"), T("+"), T("-"), U(),
|
||||
T("0"), T("."), T("ᴇ"), TL(), TL(), U(),
|
||||
// Shift
|
||||
TL(), TL(), TL(), TL(), U(), U(),
|
||||
TL(), TL(), TL(), TL(), TL(), U(),
|
||||
TL(), U(), U(), U(), U(), U(),
|
||||
U(), U(), TL(), TL(), TL(), TL(),
|
||||
T("["), T("]"), T("{"), T("}"), T("_"), T("→"),
|
||||
@@ -24,7 +24,7 @@ const EventData s_dataForEvent[4 * Event::PageSize] = {
|
||||
T("μ"), TL(), T("Ω"), T("(\x11)"), U(), U(),
|
||||
TL(), TL(), TL(), TL(), TL(), U(),
|
||||
TL(), TL(), TL(), TL(), TL(), U(),
|
||||
TL(), TL(), TL(), TL(), U(), U(),
|
||||
TL(), TL(), TL(), TL(), TL(), U(),
|
||||
// Alpha
|
||||
TL(), TL(), TL(), TL(), U(), U(),
|
||||
U(), U(), U(), U(), U(), U(),
|
||||
@@ -61,7 +61,7 @@ const char * const s_nameForEvent[255] = {
|
||||
"One", "Two", "Three", "Plus", "Minus", nullptr,
|
||||
"Zero", "Dot", "EE", "Ans", "EXE", nullptr,
|
||||
//Shift,
|
||||
"ShiftLeft", "ShiftUp", "ShiftDown", "ShiftRight", nullptr, nullptr,
|
||||
"ShiftLeft", "ShiftUp", "ShiftDown", "ShiftRight", "ShiftOK", nullptr,
|
||||
"ShiftHome", nullptr, nullptr, nullptr, nullptr, nullptr,
|
||||
nullptr, "AlphaLock", "Cut", "Copy", "Paste", "Clear",
|
||||
"LeftBracket", "RightBracket", "LeftBrace", "RightBrace", "Underscore", "Sto",
|
||||
@@ -69,7 +69,7 @@ const char * const s_nameForEvent[255] = {
|
||||
"Micro", nullptr, "Omega", nullptr, "DoubleParenthesis", nullptr,
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr, "BrightnessPlus", "BrightnessMinus", nullptr,
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr, nullptr, "ShiftEXE", nullptr,
|
||||
//Alpha,
|
||||
"AlphaLeft", "AlphaUp", "AlphaDown", "AlphaRight", nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
||||
|
||||
@@ -16,7 +16,7 @@ const EventData s_dataForEvent[4 * Event::PageSize] = {
|
||||
T("1"), T("2"), T("3"), T("+"), T("-"), U(),
|
||||
T("0"), T("."), T("ᴇ"), TL(), TL(), U(),
|
||||
// Shift
|
||||
TL(), TL(), TL(), TL(), U(), U(),
|
||||
TL(), TL(), TL(), TL(), TL(), U(),
|
||||
TL(), U(), U(), U(), U(), U(),
|
||||
U(), U(), TL(), TL(), TL(), TL(),
|
||||
T("["), T("]"), T("{"), T("}"), T("_"), T("→"),
|
||||
@@ -24,7 +24,7 @@ const EventData s_dataForEvent[4 * Event::PageSize] = {
|
||||
T("μ"), TL(), T("Ω"), T("(\x11)"), U(), U(),
|
||||
TL(), TL(), TL(), TL(), TL(), U(),
|
||||
TL(), TL(), TL(), TL(), TL(), U(),
|
||||
TL(), TL(), TL(), TL(), U(), U(),
|
||||
TL(), TL(), TL(), TL(), TL(), U(),
|
||||
// Alpha
|
||||
TL(), TL(), TL(), TL(), U(), U(),
|
||||
U(), U(), U(), U(), U(), U(),
|
||||
@@ -61,7 +61,7 @@ const char * const s_nameForEvent[255] = {
|
||||
"One", "Two", "Three", "Plus", "Minus", nullptr,
|
||||
"Zero", "Dot", "EE", "Ans", "EXE", nullptr,
|
||||
//Shift,
|
||||
"ShiftLeft", "ShiftUp", "ShiftDown", "ShiftRight", nullptr, nullptr,
|
||||
"ShiftLeft", "ShiftUp", "ShiftDown", "ShiftRight", "ShiftOK", nullptr,
|
||||
"ShiftHome", nullptr, nullptr, nullptr, nullptr, nullptr,
|
||||
nullptr, "AlphaLock", "Cut", "Copy", "Paste", "Clear",
|
||||
"LeftBracket", "RightBracket", "LeftBrace", "RightBrace", "Underscore", "Sto",
|
||||
@@ -69,7 +69,7 @@ const char * const s_nameForEvent[255] = {
|
||||
"Micro", nullptr, "Omega", nullptr, nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr, "BrightnessPlus", "BrightnessMinus", nullptr,
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr, nullptr, "ShiftEXE", nullptr,
|
||||
//Alpha,
|
||||
"AlphaLeft", "AlphaUp", "AlphaDown", "AlphaRight", nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
||||
|
||||
Reference in New Issue
Block a user