• R/O
  • SSH
  • HTTPS

qrobosdk: コミット


コミットメタ情報

リビジョン1954 (tree)
日時2011-07-18 07:08:18
作者satofumi

ログメッセージ

added Menu::setEnableClickedAndFocus() method

変更サマリ

差分

--- trunk/libs/lua/luabindGui.cpp (revision 1953)
+++ trunk/libs/lua/luabindGui.cpp (revision 1954)
@@ -217,6 +217,7 @@
217217 .def("addButton", &Menu::addButton)
218218 .def("setEnableNoSelect", &Menu::setEnableNoSelect)
219219 .def("setEnableRotate", &Menu::setEnableRotate)
220+ .def("setEnableClickedAndFocus", &Menu::setEnableClickedAndFocus)
220221 .def("indexSize", &Menu::indexSize)
221222 .def("setIndex", &Menu::setIndex)
222223 .def("press", &Menu::press)
--- trunk/libs/gui/Menu.h (revision 1953)
+++ trunk/libs/gui/Menu.h (revision 1954)
@@ -69,6 +69,13 @@
6969 void setEnableNoSelect(bool enable);
7070 void setEnableRotate(bool enable);
7171
72+ /*!
73+ \brief 選択が決定された状態においても他の項目を選択できるようにする
74+
75+ ある項目が選択が行われた場合は、他の選択は無効になる。
76+ */
77+ void setEnableClickedAndFocus(bool enable);
78+
7279 bool empty(void);
7380 size_t indexSize(void);
7481
--- trunk/libs/gui/Button.cpp (revision 1953)
+++ trunk/libs/gui/Button.cpp (revision 1954)
@@ -306,6 +306,7 @@
306306 {
307307 pimpl->is_clicked_ = true;
308308 pimpl->force_focus_ = false;
309+ pimpl->button_state_ = pImpl::Pressed;
309310 pimpl->clicked_event_function_();
310311 }
311312
--- trunk/libs/gui/Menu.cpp (revision 1953)
+++ trunk/libs/gui/Menu.cpp (revision 1954)
@@ -53,6 +53,7 @@
5353
5454 bool enable_no_select_;
5555 bool enable_rotate_;
56+ bool clicked_and_focus_;
5657
5758 CallbackEvent decide_press_event_;
5859 CallbackEvent decide_release_event_;
@@ -72,6 +73,7 @@
7273 step_specified_(false), key_decided_(false),
7374 prev_cursor_(layer_manager_.cursor()), cursor_(prev_cursor_),
7475 enable_no_select_(false), enable_rotate_(false),
76+ clicked_and_focus_(false),
7577 event_acceptable_(true), icon_label_(NULL), icon_draw_front_(true)
7678 {
7779 setAlignBase(align);
@@ -146,9 +148,6 @@
146148
147149 void draw(const Rect<long>& area, const Point<long>& own_position)
148150 {
149- static_cast<void>(area);
150- // !!! area を反映させる
151-
152151 // キー操作の反映
153152 updateKeySelect();
154153
@@ -248,7 +247,7 @@
248247
249248 void detectClicked(void)
250249 {
251- if (clicked_index_ >= 0) {
250+ if ((clicked_index_ >= 0) && !clicked_and_focus_) {
252251 // 既に項目が決定されていれば戻る
253252 return;
254253 }
@@ -257,11 +256,20 @@
257256 for (size_t i = 0; i < n; ++i) {
258257 Button* button = items_[button_order_[i]];
259258 if (button->isClicked()) {
260- clicked_index_ = i;
259+ if (clicked_index_ != static_cast<int>(i)) {
260+ // 直前まで選択されていたボタンの状態を Normal に戻す
261+ Button* pre_button =
262+ buttonResource(button_order_[clicked_index_]);
263+ if (pre_button) {
264+ pre_button->release();
265+ }
266+ clicked_index_ = i;
267+ button->click();
268+ }
261269 }
262270 }
263271
264- if (clicked_index_ >= 0) {
272+ if (!clicked_and_focus_ && (clicked_index_ >= 0)) {
265273 // 今回のチェックで決定が検出された場合、ボタンへの操作を無効にする
266274 setEventAcceptable(false);
267275 setButtonsEnabled(false);
@@ -292,17 +300,18 @@
292300
293301 void updateCursorSelect(void)
294302 {
295- if (clickedId() != InvalidId) {
303+ if ((clickedId() != InvalidId) && !clicked_and_focus_) {
296304 // 決定されていれば、操作を反映させない
297305 return;
298306 }
299307
300308 if ((prev_cursor_.x != cursor_.x) || (prev_cursor_.y != cursor_.y)) {
301-
302- // マウスが移動し、別ボタンにフォーカスが発生したときに選択を無効化
309+ // マウスが移動し、別ボタンにフォーカスが発生したときに
310+ // 選択を無効にする
303311 int focused_index = focusedIndex(index_);
304312 if (focused_index != InvalidIndex) {
305- if (index_ >= 0) {
313+ size_t id = button_order_[index_];
314+ if ((index_ >= 0) && !isClicked(id)) {
306315 release(button_order_[index_]);
307316 }
308317 index_ = default_index_;
@@ -313,7 +322,9 @@
313322 size_t id = button_order_[index_];
314323 Button* focused_button = items_[id];
315324 if (! focused_button->isCursorInner()) {
316- focused_button->release();
325+ if (!focused_button->isClicked()) {
326+ focused_button->release();
327+ }
317328 }
318329 }
319330 }
@@ -324,7 +335,7 @@
324335
325336 void updateKeySelect(void)
326337 {
327- if (clickedId() != InvalidId) {
338+ if ((clickedId() != InvalidId) && !clicked_and_focus_) {
328339 // 決定されていれば、操作を反映させない
329340 return;
330341 }
@@ -347,7 +358,8 @@
347358 key_decided_ = true;
348359
349360 // フォーカス表示のために index と previous_index を違う値にする
350- previous_index_ = index_ - 1;
361+ //previous_index_ = index_ - 1;
362+ previous_index_ = InvalidIndex;
351363 return;
352364 }
353365
@@ -389,10 +401,13 @@
389401 }
390402 }
391403
392- if (index_ != previous_index_) {
404+ if (index_ != previous_index_ && !clicked_and_focus_) {
393405 // 見た目の更新
394406 if (previous_index_ >= 0) {
395- release(button_order_[previous_index_]);
407+ size_t id = button_order_[previous_index_];
408+ if (!isClicked(id)) {
409+ release(button_order_[id]);
410+ }
396411 }
397412 if (index_ >= 0) {
398413 setFocus(button_order_[index_]);
@@ -412,7 +427,8 @@
412427 size_t id = button_order_[i];
413428 Button* button = items_[id];
414429
415- if (button->isFocused()) {
430+ if ((button->isFocused()) &&
431+ (static_cast<int>(i) != clicked_index_)) {
416432 return static_cast<int>(i);
417433 }
418434 }
@@ -625,6 +641,12 @@
625641 }
626642
627643
644+void Menu::setEnableClickedAndFocus(bool enable)
645+{
646+ pimpl->clicked_and_focus_ = enable;
647+}
648+
649+
628650 bool Menu::empty(void)
629651 {
630652 return pimpl->items_.empty();
--- trunk/libs/range_sensor/c/urg_ctrl.h (revision 1953)
+++ trunk/libs/range_sensor/c/urg_ctrl.h (revision 1954)
@@ -417,7 +417,7 @@
417417 \param[in] first_index Index of the first data stored.
418418 \param[in] last_index Index of the last data stored
419419
420- \retval 0 > Number of data received
420+ \retval 0> Number of data received
421421 \retval <0 Error
422422
423423 \see gd_scan.c, md_scan.c
--- trunk/libs/monitor/system/LockGuard.h (revision 1953)
+++ trunk/libs/monitor/system/LockGuard.h (revision 1954)
@@ -27,8 +27,8 @@
2727 LockGuard(const LockGuard& rhs);
2828 LockGuard& operator = (const LockGuard& rhs);
2929
30- void* operator new (size_t);
31- void* operator new[] (size_t);
30+ //void* operator new (size_t);
31+ //void* operator new[] (size_t);
3232
3333 struct pImpl;
3434 std::auto_ptr<pImpl> pimpl;
--- trunk/libs/monitor/system/Lock.h (revision 1953)
+++ trunk/libs/monitor/system/Lock.h (revision 1954)
@@ -28,8 +28,8 @@
2828 Lock& operator = (const Lock& rhs);
2929
3030 // !!!
31- void* operator new (size_t);
32- void* operator new[] (size_t);
31+ //void* operator new (size_t);
32+ //void* operator new[] (size_t);
3333
3434 struct pImpl;
3535 const std::auto_ptr<pImpl> pimpl;
--- trunk/libs/packages/urg/configure.in (revision 1953)
+++ trunk/libs/packages/urg/configure.in (revision 1954)
@@ -3,7 +3,7 @@
33
44 AC_PREREQ(2.59)
55
6-AC_INIT(urg, 0.8.12, satofumi@users.sourceforge.jp)
6+AC_INIT(urg, 0.8.13, satofumi@users.sourceforge.jp)
77 AM_INIT_AUTOMAKE
88 AC_CONFIG_SRCDIR([src/c/urg/urg_ctrl.c])
99 AM_CONFIG_HEADER([config.h])
--- trunk/libs/packages/urg/ChangeLog (revision 1953)
+++ trunk/libs/packages/urg/ChangeLog (revision 1954)
@@ -1,6 +1,13 @@
1+2011-07-13 Satofumi KAMIMURA <satofumi@uers.sourceforge.jp>
2+ * Fixed added UrgDevice.h.
3+ * 0.8.13 released.
4+
5+2011-05-10 Satofumi KAMIMURA <satofumi@uers.sourceforge.jp>
6+ * Fixed size_t errors.
7+ * 0.8.12 released.
8+
19 2010-06-14 Satofumi KAMIMURA <satofumi@uers.sourceforge.jp>
210 * UrgCtrl class was renamed UrgDevice.
3- * 0.8.12 released.
411
512 2010-02-25 Satofumi KAMIMURA <satofumi@uers.sourceforge.jp>
613 * urg_initialize() is added to all C samples.
旧リポジトリブラウザで表示