reverse cField::handleInput() default argument
This commit is contained in:
@@ -547,7 +547,7 @@ void cDialog::handle_events() {
|
||||
}else if(replaying && has_next_action("field_input")){
|
||||
Element& next_action = pop_next_action();
|
||||
cKey key = key_from_action(next_action);
|
||||
dynamic_cast<cTextField&>(getControl(currentFocus)).handleInput(key);
|
||||
dynamic_cast<cTextField&>(getControl(currentFocus)).handleInput(key, true);
|
||||
}else if(replaying && has_next_action("handleTab")){
|
||||
Element& next_action = pop_next_action();
|
||||
handleTab(boost::lexical_cast<bool>(next_action.GetText()));
|
||||
@@ -677,7 +677,7 @@ void cDialog::handle_one_event(const sf::Event& currentEvent, cFramerateLimiter&
|
||||
// we have an upcoming TextEntered event which contains more information.
|
||||
// Otherwise, handle it right away. But never handle enter or escape.
|
||||
if((key.spec && key.k != key_enter && key.k != key_esc) || mod_contains(key.mod, mod_ctrl))
|
||||
dynamic_cast<cTextField&>(getControl(currentFocus)).handleInput(key);
|
||||
dynamic_cast<cTextField&>(getControl(currentFocus)).handleInput(key, true);
|
||||
pendingKey = key;
|
||||
if(key.k != key_enter && key.k != key_esc) itemHit = "";
|
||||
}
|
||||
@@ -686,7 +686,7 @@ void cDialog::handle_one_event(const sf::Event& currentEvent, cFramerateLimiter&
|
||||
if(!pendingKey.spec && !currentFocus.empty()) {
|
||||
pendingKey.c = currentEvent.text.unicode;
|
||||
if(pendingKey.c != '\t')
|
||||
dynamic_cast<cTextField&>(getControl(currentFocus)).handleInput(pendingKey);
|
||||
dynamic_cast<cTextField&>(getControl(currentFocus)).handleInput(pendingKey, true);
|
||||
}
|
||||
break;
|
||||
case sf::Event::MouseButtonPressed:
|
||||
|
@@ -153,10 +153,10 @@ bool cTextField::handleClick(location clickLoc, cFramerateLimiter& fps_limiter)
|
||||
if(is_double && !is_shift && !hadSelection) {
|
||||
cKey key = {true, key_word_right, mod_none};
|
||||
if(insertionPoint < contents.size() && contents[insertionPoint] != ' ')
|
||||
handleInput(key, false);
|
||||
handleInput(key);
|
||||
key.k = key_word_left;
|
||||
key.mod += mod_shift;
|
||||
handleInput(key, false);
|
||||
handleInput(key);
|
||||
}
|
||||
bool done = false;
|
||||
sf::Event e;
|
||||
@@ -439,7 +439,7 @@ void cTextField::handleInput(cKey key, bool record) {
|
||||
cKey deleteKey = key;
|
||||
deleteKey.spec = true;
|
||||
deleteKey.k = key_bsp;
|
||||
handleInput(deleteKey, false);
|
||||
handleInput(deleteKey);
|
||||
contents = getText();
|
||||
}
|
||||
if(aTextInsert* ins = dynamic_cast<aTextInsert*>(current_action.get()))
|
||||
@@ -493,7 +493,7 @@ void cTextField::handleInput(cKey key, bool record) {
|
||||
if(snippets[ip_row].at.y == snippets[0].at.y) {
|
||||
key.k = key_top;
|
||||
if(select) key.mod += mod_shift;
|
||||
handleInput(key, false);
|
||||
handleInput(key);
|
||||
} else {
|
||||
int x = snippets[ip_row].at.x + ip_col, y = snippets[ip_row].at.y - 10;
|
||||
set_ip(loc(x,y), select ? &cTextField::selectionPoint : &cTextField::insertionPoint);
|
||||
@@ -507,7 +507,7 @@ void cTextField::handleInput(cKey key, bool record) {
|
||||
if(snippets[ip_row].at.y == snippets.back().at.y) {
|
||||
key.k = key_bottom;
|
||||
if(select) key.mod += mod_shift;
|
||||
handleInput(key, false);
|
||||
handleInput(key);
|
||||
} else {
|
||||
int x = snippets[ip_row].at.x + ip_col, y = snippets[ip_row].at.y + 20;
|
||||
set_ip(loc(x,y), select ? &cTextField::selectionPoint : &cTextField::insertionPoint);
|
||||
@@ -518,9 +518,9 @@ void cTextField::handleInput(cKey key, bool record) {
|
||||
case key_del: case key_word_del:
|
||||
if(haveSelection) {
|
||||
if(key.k == key_word_bsp)
|
||||
handleInput({true, key_word_left, mod_shift}, false);
|
||||
handleInput({true, key_word_left, mod_shift});
|
||||
else if(key.k == key_word_del)
|
||||
handleInput({true, key_word_right, mod_shift}, false);
|
||||
handleInput({true, key_word_right, mod_shift});
|
||||
auto begin = contents.begin() + std::min(selectionPoint, insertionPoint);
|
||||
auto end = contents.begin() + std::max(selectionPoint, insertionPoint);
|
||||
std::string removed(begin, end);
|
||||
@@ -534,9 +534,9 @@ void cTextField::handleInput(cKey key, bool record) {
|
||||
selectKey.k = key_word_left;
|
||||
selectKey.mod = mod_shift;
|
||||
key.k = key_bsp;
|
||||
handleInput(selectKey, false);
|
||||
handleInput(selectKey);
|
||||
if(selectionPoint != insertionPoint)
|
||||
handleInput(key, false);
|
||||
handleInput(key);
|
||||
return;
|
||||
} else if(key.k == key_bsp) {
|
||||
if(insertionPoint == 0) break;
|
||||
@@ -556,9 +556,9 @@ void cTextField::handleInput(cKey key, bool record) {
|
||||
selectKey.k = key_word_right;
|
||||
selectKey.mod = mod_shift;
|
||||
key.k = key_del;
|
||||
handleInput(selectKey, false);
|
||||
handleInput(selectKey);
|
||||
if(selectionPoint != insertionPoint)
|
||||
handleInput(key, false);
|
||||
handleInput(key);
|
||||
return;
|
||||
} else if(key.k == key_del) {
|
||||
if(insertionPoint == contents.length()) break;
|
||||
@@ -618,7 +618,7 @@ void cTextField::handleInput(cKey key, bool record) {
|
||||
if(key.k == key_cut) {
|
||||
cKey deleteKey = key;
|
||||
deleteKey.k = key_bsp;
|
||||
handleInput(deleteKey, false);
|
||||
handleInput(deleteKey);
|
||||
contents = getText();
|
||||
}
|
||||
break;
|
||||
@@ -627,7 +627,7 @@ void cTextField::handleInput(cKey key, bool record) {
|
||||
if(!get_clipboard().empty()) {
|
||||
if(haveSelection) {
|
||||
cKey deleteKey = {true, key_bsp, mod_none};
|
||||
handleInput(deleteKey, false);
|
||||
handleInput(deleteKey);
|
||||
}
|
||||
contents = getText();
|
||||
std::string toInsert = get_clipboard();
|
||||
|
@@ -65,7 +65,7 @@ public:
|
||||
bool hasFocus() const;
|
||||
/// Handle keyboard input.
|
||||
/// @param key The keypress to handle.
|
||||
void handleInput(cKey key, bool record = true);
|
||||
void handleInput(cKey key, bool record = false);
|
||||
cTextField& operator=(cTextField& other) = delete;
|
||||
cTextField(cTextField& other) = delete;
|
||||
/// This field is only used by cDialog during the loading process. Changing it will have no effect.
|
||||
|
Reference in New Issue
Block a user