+ /* If we are going to switch direction, clear all stops here,
+ * regardless of direction.
+ *
+ * Otherwise, just clear this stop */
+ if (direction_ == UP && stops_above == 0)
+ {
+ stops_.remove (Stop(position_, ALL));
+ gui_unpress_request_button (number_, (int)position_);
+ gui_unpress_call_button ((int)position_, UP);
+ gui_unpress_call_button ((int)position_, DOWN);
+ }
+ else if (direction_ == DOWN && stops_below == 0)
+ {
+ stops_.remove (Stop(position_, ALL));
+ gui_unpress_request_button (number_, (int)position_);
+ gui_unpress_call_button ((int)position_, UP);
+ gui_unpress_call_button ((int)position_, DOWN);
+ }
+ else if (direction_ == IDLE)
+ {
+ stops_.remove (Stop(position_, ALL));
+ gui_unpress_request_button (number_, (int)position_);
+ gui_unpress_call_button ((int)position_, UP);
+ gui_unpress_call_button ((int)position_, DOWN);
+ }
+ else
+ {
+ stops_.remove (Stop(position_, direction_));
+ gui_unpress_call_button ((int)position_, direction_);
+ gui_unpress_request_button (number_, (int)position_);
+ }