OSDN Git Service

Table (ListCtrl) support in Molby::Dialog is improved.
authortoshinagata1964 <toshinagata1964@a2be9bc6-48de-4e38-9406-05402d4bc13c>
Sat, 10 Aug 2013 01:17:20 +0000 (01:17 +0000)
committertoshinagata1964 <toshinagata1964@a2be9bc6-48de-4e38-9406-05402d4bc13c>
Sat, 10 Aug 2013 01:17:20 +0000 (01:17 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/molby/trunk@384 a2be9bc6-48de-4e38-9406-05402d4bc13c

MolLib/Ruby_bind/ruby_dialog.c
wxSources/MyListCtrl.cpp

index f85137c..bea542e 100644 (file)
@@ -1658,11 +1658,13 @@ s_RubyDialog_doTableAction(VALUE val)
                        return Qnil;
                retval = rb_ary_to_ary(retval);
                if (RARRAY_LEN(retval) >= 1 && fg != NULL) {
-                       cval = rb_ary_to_ary(RARRAY_PTR(retval)[0]);
-                       for (i = 0; i < 4 && i < RARRAY_LEN(cval); i++) {
-                               fg[i] = NUM2DBL(rb_Float(RARRAY_PTR(cval)[i]));
-                       }
-                       n = 1;
+                       if (RARRAY_PTR(retval)[0] != Qnil) {
+                               cval = rb_ary_to_ary(RARRAY_PTR(retval)[0]);
+                               for (i = 0; i < 4 && i < RARRAY_LEN(cval); i++) {
+                                       fg[i] = NUM2DBL(rb_Float(RARRAY_PTR(cval)[i]));
+                               }
+                               n = 1;
+                       } else n = 0;
                }
                if (RARRAY_LEN(retval) >= 2 && bg != NULL) {
                        cval = rb_ary_to_ary(RARRAY_PTR(retval)[1]);
@@ -1756,11 +1758,11 @@ int
 RubyDialog_IsTableItemEditable(RubyValue self, RDItem *ip, int row, int column)
 {
        int status;
-       void *vp[4] = { (void *)self, (void *)ip, (void *)sIsItemEditableSymbol, NULL };
+       void *vp[6] = { (void *)self, (void *)ip, (void *)sIsItemEditableSymbol, (void *)row, (void *)column, NULL };
        VALUE val = rb_protect(s_RubyDialog_doTableAction, (VALUE)vp, &status);
        if (status != 0 || val == Qnil)
                return 0;
-       else return (int)vp[3]; 
+       else return (int)vp[5]; 
 }
 
 int
index d899f40..1c8103a 100644 (file)
@@ -583,6 +583,10 @@ MyListCtrl::OnMouseDown(wxMouseEvent &event)
                lastPopUpRow = row;
                mnu.Connect(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MyListCtrl::OnPopUpMenuSelected), NULL, this);
                PopupMenu(&mnu);
+               n = dataSource->GetItemCount(this);
+               for (i = 0; i < n; i++)
+                       SetItemState(i, (i == row ? wxLIST_STATE_SELECTED : 0), wxLIST_STATE_SELECTED);
+               PostSelectionChangeNotification();
                return;
        }