[code] Rename Code::Toolbox in Code::PythonToolbox for more clarity.

Change-Id: I3729fedd8a26531edcd17105ed5fc177c06a8fcb
This commit is contained in:
Léa Saviot
2017-11-30 13:48:11 +01:00
parent dd1fe77832
commit 53d2ae2c46
8 changed files with 33 additions and 33 deletions

View File

@@ -12,12 +12,12 @@ app_objs += $(addprefix apps/code/,\
editor_controller.o\
helpers.o\
menu_controller.o\
python_toolbox.o\
sandbox_controller.o\
script.o\
script_parameter_controller.o\
script_store.o\
script_template.o\
toolbox.o\
variable_box_controller.o\
)

View File

@@ -6,7 +6,7 @@
#include "../shared/message_controller.h"
#include "menu_controller.h"
#include "script_store.h"
#include "toolbox.h"
#include "python_toolbox.h"
#include "variable_box_controller.h"
namespace Code {
@@ -30,17 +30,17 @@ public:
};
StackViewController * stackViewController() { return &m_codeStackViewController; }
VariableBoxController * scriptsVariableBoxController() { return &m_variableBoxController; }
Toolbox * pythonToolbox() { return &m_toolbox; }
Toolbox::Action toolboxActionForTextArea() { return m_toolboxActionForTextArea; }
Toolbox::Action toolboxActionForTextField() { return m_toolboxActionForTextField; }
PythonToolbox * pythonToolbox() { return &m_toolbox; }
PythonToolbox::Action toolboxActionForTextArea() { return m_toolboxActionForTextArea; }
PythonToolbox::Action toolboxActionForTextField() { return m_toolboxActionForTextField; }
private:
App(Container * container, Snapshot * snapshot);
ButtonRowController m_listFooter;
MenuController m_menuController;
StackViewController m_codeStackViewController;
Toolbox m_toolbox;
Toolbox::Action m_toolboxActionForTextArea;
Toolbox::Action m_toolboxActionForTextField;
PythonToolbox m_toolbox;
PythonToolbox::Action m_toolboxActionForTextArea;
PythonToolbox::Action m_toolboxActionForTextField;
VariableBoxController m_variableBoxController;
};

View File

@@ -242,7 +242,7 @@ bool ConsoleController::textFieldDidAbortEditing(TextField * textField, const ch
return true;
}
::Toolbox * ConsoleController::toolboxForTextField(TextField * textField) {
Toolbox * ConsoleController::toolboxForTextField(TextField * textField) {
Code::App * codeApp = static_cast<Code::App *>(app());
codeApp->pythonToolbox()->setAction(codeApp->toolboxActionForTextField());
return codeApp->pythonToolbox();

View File

@@ -57,7 +57,7 @@ public:
bool textFieldDidReceiveEvent(TextField * textField, Ion::Events::Event event) override;
bool textFieldDidFinishEditing(TextField * textField, const char * text, Ion::Events::Event event) override;
bool textFieldDidAbortEditing(TextField * textField, const char * text) override;
::Toolbox * toolboxForTextField(TextField * textField) override;
Toolbox * toolboxForTextField(TextField * textField) override;
// MicroPython::ExecutionEnvironment
void displaySandbox() override;

View File

@@ -128,7 +128,7 @@ bool EditorController::textAreaDidReceiveEvent(TextArea * textArea, Ion::Events:
return false;
}
::Toolbox * EditorController::toolboxForTextArea(TextArea * textArea) {
Toolbox * EditorController::toolboxForTextArea(TextArea * textArea) {
Code::App * codeApp = static_cast<Code::App *>(app());
codeApp->pythonToolbox()->setAction(codeApp->toolboxActionForTextArea());
return codeApp->pythonToolbox();

View File

@@ -25,7 +25,7 @@ public:
/* TextAreaDelegate */
bool textAreaShouldFinishEditing(TextArea * textArea, Ion::Events::Event event) override;
bool textAreaDidReceiveEvent(TextArea * textArea, Ion::Events::Event event) override;
::Toolbox * toolboxForTextArea(TextArea * textArea) override;
Toolbox * toolboxForTextArea(TextArea * textArea) override;
private:
static constexpr int k_indentationSpacesNumber = 2;

View File

@@ -1,4 +1,4 @@
#include "toolbox.h"
#include "python_toolbox.h"
#include "../shared/toolbox_helpers.h"
#include <assert.h>
extern "C" {
@@ -226,17 +226,17 @@ const ToolboxMessageTree menu[menuChildrenCount] = {
const ToolboxMessageTree toolboxModel = ToolboxMessageTree(I18n::Message::Toolbox, I18n::Message::Default, I18n::Message::Default, menu, menuChildrenCount);
Toolbox::Toolbox() :
::Toolbox(nullptr, I18n::translate(rootModel()->label()))
PythonToolbox::PythonToolbox() :
Toolbox(nullptr, I18n::translate(rootModel()->label()))
{
}
void Toolbox::setAction(Action action) {
void PythonToolbox::setAction(Action action) {
m_action = action;
}
bool Toolbox::handleEvent(Ion::Events::Event event) {
if (::Toolbox::handleEvent(event)) {
bool PythonToolbox::handleEvent(Ion::Events::Event event) {
if (Toolbox::handleEvent(event)) {
return true;
}
if (event.hasText() && strlen(event.text()) == 1) {
@@ -246,8 +246,8 @@ bool Toolbox::handleEvent(Ion::Events::Event event) {
return false;
}
KDCoordinate Toolbox::rowHeight(int j) {
if (typeAtLocation(0, j) == ::Toolbox::LeafCellType && m_messageTreeModel->label() == I18n::Message::IfStatementMenu) {
KDCoordinate PythonToolbox::rowHeight(int j) {
if (typeAtLocation(0, j) == Toolbox::LeafCellType && m_messageTreeModel->label() == I18n::Message::IfStatementMenu) {
/* To get the exact height needed for each cell, we have to compute its
* text size, which means scan the text char by char to look for '\n'
* chars. This is very costly and ruins the speed performance when
@@ -258,12 +258,12 @@ KDCoordinate Toolbox::rowHeight(int j) {
* children of the toolbox, which is the only menu that has special height
* rows. */
const ToolboxMessageTree * messageTree = static_cast<const ToolboxMessageTree *>(m_messageTreeModel->children(j));
return KDText::stringSize(I18n::translate(messageTree->label()), k_fontSize).height() + 2*Metric::TableCellLabelTopMargin + (messageTree->text() == I18n::Message::Default ? 0 : ::Toolbox::rowHeight(j));
return KDText::stringSize(I18n::translate(messageTree->label()), k_fontSize).height() + 2*Metric::TableCellLabelTopMargin + (messageTree->text() == I18n::Message::Default ? 0 : Toolbox::rowHeight(j));
}
return ::Toolbox::rowHeight(j);
return Toolbox::rowHeight(j);
}
bool Toolbox::selectLeaf(ToolboxMessageTree * selectedMessageTree) {
bool PythonToolbox::selectLeaf(ToolboxMessageTree * selectedMessageTree) {
m_selectableTableView.deselectTable();
ToolboxMessageTree * node = selectedMessageTree;
const char * editedText = I18n::translate(node->insertedText());
@@ -274,25 +274,25 @@ bool Toolbox::selectLeaf(ToolboxMessageTree * selectedMessageTree) {
return true;
}
const ToolboxMessageTree * Toolbox::rootModel() {
const ToolboxMessageTree * PythonToolbox::rootModel() {
return &toolboxModel;
}
MessageTableCellWithMessage * Toolbox::leafCellAtIndex(int index) {
MessageTableCellWithMessage * PythonToolbox::leafCellAtIndex(int index) {
assert(index >= 0 && index < k_maxNumberOfDisplayedRows);
return &m_leafCells[index];
}
MessageTableCellWithChevron* Toolbox::nodeCellAtIndex(int index) {
MessageTableCellWithChevron* PythonToolbox::nodeCellAtIndex(int index) {
assert(index >= 0 && index < k_maxNumberOfDisplayedRows);
return &m_nodeCells[index];
}
int Toolbox::maxNumberOfDisplayedRows() {
int PythonToolbox::maxNumberOfDisplayedRows() {
return k_maxNumberOfDisplayedRows;
}
void Toolbox::scrollToLetter(char letter) {
void PythonToolbox::scrollToLetter(char letter) {
char lowerLetter = tolower(letter);
// We look for a child MessageTree that starts with the wanted letter.
for (int i = 0; i < m_messageTreeModel->numberOfChildren(); i++) {
@@ -314,7 +314,7 @@ void Toolbox::scrollToLetter(char letter) {
}
}
void Toolbox::scrollToAndSelectChild(int i) {
void PythonToolbox::scrollToAndSelectChild(int i) {
assert(i >=0 && i<m_messageTreeModel->numberOfChildren());
m_selectableTableView.deselectTable();
m_selectableTableView.scrollToCell(0, i);

View File

@@ -1,5 +1,5 @@
#ifndef CODE_TOOLBOX_H
#define CODE_TOOLBOX_H
#ifndef CODE_PYTHON_TOOLBOX_H
#define CODE_PYTHON_TOOLBOX_H
#include <apps/i18n.h>
#include <escher.h>
@@ -8,10 +8,10 @@
namespace Code {
class Toolbox : public ::Toolbox {
class PythonToolbox : public Toolbox {
public:
typedef void (*Action)(void * sender, const char * text);
Toolbox();
PythonToolbox();
void setAction(Action action);
// StackViewController