OSDN Git Service

Hitting Return in non-modal Ruby dialog now does not cause closing the window
authortoshinagata1964 <toshinagata1964@a2be9bc6-48de-4e38-9406-05402d4bc13c>
Mon, 6 Oct 2014 13:44:07 +0000 (13:44 +0000)
committertoshinagata1964 <toshinagata1964@a2be9bc6-48de-4e38-9406-05402d4bc13c>
Mon, 6 Oct 2014 13:44:07 +0000 (13:44 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/molby/trunk@578 a2be9bc6-48de-4e38-9406-05402d4bc13c

MolLib/Ruby_bind/ruby_dialog.c
MolLib/Ruby_bind/ruby_dialog.h
wxSources/RubyDialogFrame.cpp

index 3e46aee..ee1686c 100644 (file)
@@ -2101,14 +2101,18 @@ s_RubyDialog_doItemAction(VALUE val)
                rb_funcall(itval, SYM2ID(aval), 0);
        } else if (aval == sReturnActionSym || aval == sEscapeActionSym) {
                /*  Enter or escape is pressed on text field  */
-               rb_ivar_set(itval, SYM2ID(sIsProcessingActionSymbol), Qfalse);
-               itval = s_RubyDialog_ItemAtIndex(self, (aval == sReturnActionSym ? INT2FIX(0) : INT2FIX(1)));
-               s_RubyDialog_EndModal(1, &itval, self);         
+               if (RubyDialogCallback_isModal(dref)) {
+                       rb_ivar_set(itval, SYM2ID(sIsProcessingActionSymbol), Qfalse);
+                       itval = s_RubyDialog_ItemAtIndex(self, (aval == sReturnActionSym ? INT2FIX(0) : INT2FIX(1)));
+                       s_RubyDialog_EndModal(1, &itval, self);         
+               }
        } else {
                /*  Default action (only for default buttons)  */
-               if (idx == 0 || idx == 1) {
-                       rb_ivar_set(itval, SYM2ID(sIsProcessingActionSymbol), Qfalse);
-                       s_RubyDialog_EndModal(1, &itval, self);
+               if (RubyDialogCallback_isModal(dref)) {
+                       if (idx == 0 || idx == 1) {
+                               rb_ivar_set(itval, SYM2ID(sIsProcessingActionSymbol), Qfalse);
+                               s_RubyDialog_EndModal(1, &itval, self);
+                       }
                }
        }
 
index d87c0cf..5b8b5ec 100644 (file)
@@ -99,6 +99,7 @@ STUB void RubyDialogCallback_release(RubyDialog *dref);
 STUB void RubyDialogCallback_setRubyObject(RubyDialog *dref, RubyValue val);
 STUB void RubyDialogCallback_setWindowTitle(RubyDialog *dref, const char *title);
 STUB int RubyDialogCallback_runModal(RubyDialog *dref);
+STUB int RubyDialogCallback_isModal(RubyDialog *dref);
 STUB void RubyDialogCallback_endModal(RubyDialog *dref, int status);
 STUB void RubyDialogCallback_destroy(RubyDialog *dref);
 STUB void RubyDialogCallback_close(RubyDialog *dref);
index 7068d49..e0e8897 100644 (file)
@@ -758,6 +758,12 @@ RubyDialogCallback_runModal(RubyDialog *dref)
        else return 1;  /* Cancel */
 }
 
+int
+RubyDialogCallback_isModal(RubyDialog *dref)
+{
+       return ((RubyDialogFrame *)dref)->IsModal();
+}
+
 void
 RubyDialogCallback_endModal(RubyDialog *dref, int status)
 {