• R/O
  • HTTP
  • SSH
  • HTTPS

Molby: コミット

Molecular Modeling Software


コミットメタ情報

リビジョン6f32fdc6ad1b1981c7ac49183f22a9b49d35aae3 (tree)
日時2022-09-28 22:23:02
作者Toshi Nagata <alchemist.2005@nift...>
コミッターToshi Nagata

ログメッセージ

Edit GAMESS/Psi4 input was not working correctly (Enter is ignored). Fixed.

変更サマリ

差分

--- a/MolLib/Ruby_bind/ruby_dialog.c
+++ b/MolLib/Ruby_bind/ruby_dialog.c
@@ -2033,6 +2033,7 @@ s_RubyDialog_doItemAction(VALUE val)
20332033 int nitems = RARRAY_LEN(items);
20342034 int idx = RubyDialogCallback_indexOfItem(dref, ip);
20352035 static VALUE sTextActionSym = Qfalse, sEscapeActionSym, sReturnActionSym;
2036+ VALUE retval;
20362037
20372038 if (sTextActionSym == Qfalse) {
20382039 sTextActionSym = ID2SYM(rb_intern("text_action"));
@@ -2093,6 +2094,7 @@ s_RubyDialog_doItemAction(VALUE val)
20932094 }
20942095
20952096 /* If the item has the "action" attribute, call it */
2097+ retval = Qtrue;
20962098 actval = s_RubyDialogItem_Attr(itval, aval);
20972099 if (actval != Qnil) {
20982100 if (TYPE(actval) == T_SYMBOL)
@@ -2111,34 +2113,34 @@ s_RubyDialog_doItemAction(VALUE val)
21112113 }
21122114 } else {
21132115 /* Default action (only for default buttons) */
2114- if (RubyDialogCallback_isModal(dref)) {
2115- if (idx == 0 || idx == 1) {
2116- rb_ivar_set(itval, SYM2ID(sIsProcessingActionSymbol), Qfalse);
2117- s_RubyDialog_EndModal(1, &itval, self);
2118- }
2119- }
2116+ if (RubyDialogCallback_isModal(dref) && (idx == 0 || idx == 1)) {
2117+ rb_ivar_set(itval, SYM2ID(sIsProcessingActionSymbol), Qfalse);
2118+ s_RubyDialog_EndModal(1, &itval, self);
2119+ } else retval = Qnil;
21202120 }
21212121
21222122 rb_ivar_set(itval, SYM2ID(sIsProcessingActionSymbol), Qfalse);
21232123
2124- return Qnil;
2124+ return retval; /* Qtrue: some action was performed, Qnil: none was performed */
21252125 }
21262126
21272127 /* Action for dialog items.
21282128 Get the item number, and call "action" method of the RubyDialog object with
21292129 the item number (integer) as the argument. The default "action" method is
21302130 defined as s_RubyDialog_action. */
2131-void
2131+int
21322132 RubyDialog_doItemAction(RubyValue self, RDItem *ip, int options)
21332133 {
21342134 int status;
2135+ VALUE retval;
21352136 void *vp[3];
21362137 vp[0] = (void *)(uintptr_t)self;
21372138 vp[1] = ip;
21382139 vp[2] = (void *)(intptr_t)options;
2139- rb_protect(s_RubyDialog_doItemAction, (VALUE)vp, &status);
2140+ retval = rb_protect(s_RubyDialog_doItemAction, (VALUE)vp, &status);
21402141 if (status != 0)
21412142 Ruby_showError(status);
2143+ return (retval == Qnil ? 0 : 1);
21422144 }
21432145
21442146 static VALUE
--- a/MolLib/Ruby_bind/ruby_dialog.h
+++ b/MolLib/Ruby_bind/ruby_dialog.h
@@ -72,7 +72,7 @@ extern const RDRect gZeroRect;
7272
7373 /* Utility function */
7474 extern int RubyDialog_validateItemContent(RubyValue self, RDItem *ip, const char *s);
75-extern void RubyDialog_doItemAction(RubyValue self, RDItem *ip, int options);
75+extern int RubyDialog_doItemAction(RubyValue self, RDItem *ip, int options);
7676 extern void RubyDialog_doTimerAction(RubyValue self);
7777 extern void RubyDialog_doKeyAction(RubyValue self, int keyCode);
7878 extern int RubyDialog_getFlexFlags(RubyValue self, RDItem *ip);
--- a/wxSources/RubyDialogFrame.cpp
+++ b/wxSources/RubyDialogFrame.cpp
@@ -269,7 +269,8 @@ RubyDialogFrame::OnTextUpdated(wxCommandEvent &event)
269269 void
270270 RubyDialogFrame::OnEnterProcessedOnText(wxCommandEvent &event)
271271 {
272- RubyDialog_doItemAction((RubyValue)dval, (RDItem *)(event.GetEventObject()), 2);
272+ if (RubyDialog_doItemAction((RubyValue)dval, (RDItem *)(event.GetEventObject()), 2) == 0)
273+ event.Skip();
273274 }
274275
275276 void
@@ -282,7 +283,8 @@ RubyDialogFrame::OnKillFocusOnText(wxFocusEvent &event)
282283 void
283284 RubyDialogFrame::OnEscapeProcessedOnText(wxCommandEvent &event)
284285 {
285- RubyDialog_doItemAction((RubyValue)dval, (RDItem *)(event.GetEventObject()), 4);
286+ if (RubyDialog_doItemAction((RubyValue)dval, (RDItem *)(event.GetEventObject()), 4) == 0)
287+ event.Skip();
286288 }
287289
288290 void
旧リポジトリブラウザで表示