From 151caf049c95368347a6243e85e04a50c87d0e5e Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Mon, 12 Oct 2015 13:22:12 +0200 Subject: Fix missing 'direction' type changes (int to enum). --- plugingui/button.cc | 4 ++-- plugingui/checkbox.cc | 4 ++-- plugingui/combobox.cc | 4 ++-- plugingui/knob.cc | 6 +++--- plugingui/lineedit.cc | 4 ++-- plugingui/listboxbasic.cc | 10 +++++----- plugingui/scrollbar.cc | 8 ++++---- plugingui/slider.cc | 4 ++-- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/plugingui/button.cc b/plugingui/button.cc index dea376c..be5f82e 100644 --- a/plugingui/button.cc +++ b/plugingui/button.cc @@ -83,7 +83,7 @@ Button::~Button() void Button::buttonEvent(ButtonEvent *e) { - if(e->direction == 1) + if(e->direction == ButtonEvent::Down) { draw_state = down; button_state = down; @@ -91,7 +91,7 @@ void Button::buttonEvent(ButtonEvent *e) repaintEvent(nullptr); } - if(e->direction == -1) + if(e->direction == ButtonEvent::Up) { draw_state = up; button_state = up; diff --git a/plugingui/checkbox.cc b/plugingui/checkbox.cc index 54e0787..c085be9 100644 --- a/plugingui/checkbox.cc +++ b/plugingui/checkbox.cc @@ -44,7 +44,7 @@ CheckBox::CheckBox(Widget *parent) void CheckBox::buttonEvent(ButtonEvent *e) { - if(e->direction == -1 || e->doubleclick) + if(e->direction == ButtonEvent::Up || e->doubleclick) { middle = false; internalSetChecked(!state); @@ -67,7 +67,7 @@ void CheckBox::keyEvent(KeyEvent *e) { if(e->keycode == KeyEvent::KEY_CHARACTER && e->text == " ") { - if(e->direction == -1) + if(e->direction == KeyEvent::Up) { middle = false; internalSetChecked(!state); diff --git a/plugingui/combobox.cc b/plugingui/combobox.cc index c627b05..cae854a 100644 --- a/plugingui/combobox.cc +++ b/plugingui/combobox.cc @@ -166,7 +166,7 @@ void ComboBox::scrollEvent(ScrollEvent *e) void ComboBox::keyEvent(KeyEvent *e) { - if(e->direction != -1) + if(e->direction != KeyEvent::Up) { return; } @@ -226,7 +226,7 @@ void ComboBox::keyEvent(KeyEvent *e) void ComboBox::buttonEvent(ButtonEvent *e) { - if(e->direction != 1) + if(e->direction != ButtonEvent::Down) { return; } diff --git a/plugingui/knob.cc b/plugingui/knob.cc index 765d401..ec35af0 100644 --- a/plugingui/knob.cc +++ b/plugingui/knob.cc @@ -89,7 +89,7 @@ void Knob::mouseMoveEvent(MouseMoveEvent *e) void Knob::keyEvent(KeyEvent *e) { - if(e->direction != -1) + if(e->direction != KeyEvent::Up) { return; } @@ -123,13 +123,13 @@ void Knob::keyEvent(KeyEvent *e) void Knob::buttonEvent(ButtonEvent *e) { - if(e->direction == 1) + if(e->direction == ButtonEvent::Down) { state = down; mouse_offset_x = e->x + -1*e->y; } - if(e->direction == -1) + if(e->direction == ButtonEvent::Up) { state = up; mouse_offset_x = e->x + -1*e->y; diff --git a/plugingui/lineedit.cc b/plugingui/lineedit.cc index 5e1eb9b..17d62bb 100644 --- a/plugingui/lineedit.cc +++ b/plugingui/lineedit.cc @@ -91,7 +91,7 @@ void GUI::LineEdit::buttonEvent(ButtonEvent *e) if(readOnly()) return; - if(e->direction == 1) { + if(e->direction == ButtonEvent::Down) { for(int i = 0; i < (int)_visibletext.length(); i++) { if(e->x < (int)(font.textWidth(_visibletext.substr(0, i)) + BORDER)) { pos = i + offsetpos; @@ -108,7 +108,7 @@ void GUI::LineEdit::keyEvent(GUI::KeyEvent *e) bool change = false; - if(e->direction == -1) { + if(e->direction == KeyEvent::Up) { if(e->keycode == GUI::KeyEvent::KEY_LEFT) { if(pos) pos--; diff --git a/plugingui/listboxbasic.cc b/plugingui/listboxbasic.cc index 4e57807..2aae943 100644 --- a/plugingui/listboxbasic.cc +++ b/plugingui/listboxbasic.cc @@ -195,7 +195,7 @@ void ListBoxBasic::scrollEvent(ScrollEvent *e) void ListBoxBasic::keyEvent(KeyEvent *e) { - if(e->direction != -1) + if(e->direction != KeyEvent::Up) { return; } @@ -279,7 +279,7 @@ void ListBoxBasic::buttonEvent(ButtonEvent *e) { if(e->y > 0 && e->y < btn_size) { - if(e->direction == -1) + if(e->direction == ButtonEvent::Up) { return; } @@ -289,7 +289,7 @@ void ListBoxBasic::buttonEvent(ButtonEvent *e) if(e->y > ((int)height() - btn_size) && e->y < ((int)height() - 1)) { - if(e->direction == -1) + if(e->direction == ButtonEvent::Up) { return; } @@ -298,7 +298,7 @@ void ListBoxBasic::buttonEvent(ButtonEvent *e) } } - if(e->direction == -1) + if(e->direction == ButtonEvent::Up) { int skip = scroll.value(); size_t yoffset = padding / 2; @@ -317,7 +317,7 @@ void ListBoxBasic::buttonEvent(ButtonEvent *e) repaintEvent(nullptr); } - if(e->direction != -1) + if(e->direction != ButtonEvent::Up) { int skip = scroll.value(); size_t yoffset = padding / 2; diff --git a/plugingui/scrollbar.cc b/plugingui/scrollbar.cc index 07dc36b..0b10972 100644 --- a/plugingui/scrollbar.cc +++ b/plugingui/scrollbar.cc @@ -150,21 +150,21 @@ void GUI::ScrollBar::mouseMoveEvent(MouseMoveEvent *e) void GUI::ScrollBar::buttonEvent(ButtonEvent *e) { if(e->y < (int)width() && e->y > 0) { - if(e->direction == -1) setValue(value() - 1); + if(e->direction == ButtonEvent::Up) setValue(value() - 1); return; } if(e->y > (int)height() - (int)width() && e->y < (int)height()) { - if(e->direction == -1) setValue(value() + 1); + if(e->direction == ButtonEvent::Up) setValue(value() + 1); return; } - if(e->direction == 1) { + if(e->direction == ButtonEvent::Down) { yoffset = e->y; value_offset = value(); } - dragging = (e->direction == 1); + dragging = (e->direction == ButtonEvent::Down); } #ifdef TEST_SCROLLBAR diff --git a/plugingui/slider.cc b/plugingui/slider.cc index 953c8e6..311497a 100644 --- a/plugingui/slider.cc +++ b/plugingui/slider.cc @@ -77,7 +77,7 @@ void GUI::Slider::mouseMoveEvent(MouseMoveEvent *e) void GUI::Slider::buttonEvent(ButtonEvent *e) { - if(e->direction == 1) { + if(e->direction == ButtonEvent::Down) { state = down; val = maximum / (float)width() * (float)e->x; @@ -87,7 +87,7 @@ void GUI::Slider::buttonEvent(ButtonEvent *e) if(handler) handler(ptr); repaintEvent(NULL); } - if(e->direction == -1) { + if(e->direction == ButtonEvent::Up) { state = up; val = maximum / (float)width() * (float)e->x; -- cgit v1.2.3