[q-lang-cvs] qcalc qcalc.q,1.128,1.129
Brought to you by:
agraef
From: Albert G. <ag...@us...> - 2007-11-12 12:18:55
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv26020 Modified Files: qcalc.q Log Message: bugfixes Index: qcalc.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/qcalc.q,v retrieving revision 1.128 retrieving revision 1.129 diff -C2 -d -r1.128 -r1.129 *** qcalc.q 12 Nov 2007 09:59:29 -0000 1.128 --- qcalc.q 12 Nov 2007 12:18:47 -0000 1.129 *************** *** 677,680 **** --- 677,683 ---- qt_invoke OBJ SLOT ARGS = _FAIL_ if is_recursive and then neq SLOT abort; + // Use this for debugging if debug_invoke doesn't work (see below). + // = printf "qt_invoke: %s %s %s\n" (str OBJ,str SLOT,str ARGS) || + // fail if neq SLOT timer; @0 *************** *** 719,739 **** if N < 5; - /* XXXFIXME: Another desperate kludge. For some reasons I don't understand - (probably a Qt bug), cell widgets created with doprocess sometimes - mysteriously become nil between one callback invocation and the next - one. At least with my Qt version this seems to happen whenever I end a cell - edit by clicking on another cell. Currently we make up for that by just - running doprocess again which recreates the element -- not very elegant but - it has the desired effect. This still doesn't resolve similar issues with - checkbox and combobox items, though, which appear to be completely disabled - and rejecting mouse focus under the same circumstances, until they are - double-clicked. If anyone knows what causes this please let me know... */ - - def LASTW = ref []; - - check_lastW (I,J,IT:QtObject) - = doprocess (I,J) - if is_nil X where (_,_,_,X:QtObject|_) = qt_data IT; - /* Timer processing. */ --- 722,725 ---- *************** *** 746,751 **** set_status HAVE_UNDO EDIT_UNDO || set_status HAVE_REDO EDIT_REDO || - if not null (get LASTW) then - (do check_lastW (get LASTW) || LASTW := []) || check_focus 0 (qt APP "focusWidget" ()) || if not is_recursive then digest_loop --- 732,735 ---- *************** *** 788,791 **** --- 772,776 ---- digest "+++ Exiting." = STATE := 0; + digest 'X = X; // background task digest W:List = process_sel2 W || merge_undo $ map (flip (flip sub 0) 1) W if get STATE = 4; *************** *** 993,997 **** [] [] []; ! /* Cell editors. */ create_editor IT DATA ARGS --- 978,986 ---- [] [] []; ! /* Cell editor. This is basically just the standard cell editor, but with the ! added feature that the contents of computed cells is replaced by the ! corresponding formula for editing. */ ! ! def LAST_EDIT = ref (); create_editor IT DATA ARGS *************** *** 999,1008 **** = // editing a GUI element, keep the sentinel value set_cell (I,J) $ sprintf "= %s" S || qt_super IT "createEditor" ARGS ! where '_ = cell_gettmp (I,J); = // ordinary formula cell_settmp (I,J) $ cell_text (I,J) || ! set_cell (I,J) $ sprintf "= %s" S || ! qt_super IT "createEditor" ARGS; otherwise: = // ordinary text, use standard editor --- 988,1000 ---- = // editing a GUI element, keep the sentinel value set_cell (I,J) $ sprintf "= %s" S || + LAST_EDIT := (I,J,S1) || qt_super IT "createEditor" ARGS ! where 'S1 = cell_gettmp (I,J); = // ordinary formula cell_settmp (I,J) $ cell_text (I,J) || ! set_cell (I,J) S1 || ! LAST_EDIT := (I,J,S1) || ! qt_super IT "createEditor" ARGS ! where S1 = sprintf "= %s" S; otherwise: = // ordinary text, use standard editor *************** *** 1074,1081 **** clear_cell (I,J) = qt TABLE "clearCell" (I,J) if not has_table_item (I,J); ! = qt TABLE "clearCellWidget" (I,J) || ! clear_gui_elem (I,J) || ! set_cell (I,J) "" || set_pixmap (I,J) NULLPM; set_cell (I,J) S --- 1066,1081 ---- clear_cell (I,J) + where (I,J) = real_index (I,J): = qt TABLE "clearCell" (I,J) if not has_table_item (I,J); ! // = qt TABLE "clearCellWidget" (I,J) || ! // clear_gui_elem (I,J) || ! // set_cell (I,J) "" || set_pixmap (I,J) NULLPM; ! = qt TABLE "clearCell" (I,J) || ! spanned_table_item (I,J) (N,M) ! if (N>1) or else (M>1) ! where (N,M) = cell_span (I,J); ! = qt TABLE "clearCell" (I,J) || ! get_table_item (I,J) ! otherwise; set_cell (I,J) S *************** *** 1108,1121 **** = process_gui (I,J) X || digest_loop where X:QtObject = gui_elem (I,J); ! = finish_edit true (I,J); finish_edit ACCEPT (I,J) ! if not ACCEPT: ! = cell_settmp (I,J) () || ! set_cell (I,J) S || updatemsg (I,J) ! where S:String = cell_gettmp (I,J); = cell_settmp (I,J) () || process (I,J) S || updatemsg (I,J) || digest_loop ! where 'S:String = cell_gettmp (I,J); otherwise: = cell_settmp (I,J) () || --- 1108,1133 ---- = process_gui (I,J) X || digest_loop where X:QtObject = gui_elem (I,J); ! = post MSGS '(check_last_gui (I,J,X)) ! where X:QtObject = finish_edit true (I,J) || ! gui_elem (I,J); ! = (); ! ! /* FIXME: If we created a GUI object in the edited cell, it will be destroyed ! when editing is finished, as the cell editor is also implemented as a cell ! widget. We currently work around this by rerunning the formula later in the ! timer routine. */ ! ! check_last_gui (I,J,X) ! = doprocess (I,J) if is_nil X; finish_edit ACCEPT (I,J) ! where S = cell_gettmp (I,J) if not ACCEPT where _ = LAST_EDIT := (): = cell_settmp (I,J) () || process (I,J) S || updatemsg (I,J) || digest_loop ! where 'S:String = S; ! = cell_settmp (I,J) () || ! set_cell (I,J) S || updatemsg (I,J) ! if isstr S; ! = () otherwise; otherwise: = cell_settmp (I,J) () || *************** *** 1149,1153 **** accept _ _ _ ! where (I,J) = real_current_cell if is_global: = doprocess (I,J) || digest_loop if is_gui_elem (I,J); --- 1161,1165 ---- accept _ _ _ ! where _ = LAST_EDIT := (), (I,J) = real_current_cell if is_global: = doprocess (I,J) || digest_loop if is_gui_elem (I,J); *************** *** 1162,1166 **** accept2 S D A ! where (I,J) = real_current_cell, N = num_rows if is_global and then (qt TABW "currentPageIndex" () = 0): = gui_enter (I,J) X --- 1174,1178 ---- accept2 S D A ! where _ = LAST_EDIT := (), (I,J) = real_current_cell, N = num_rows if is_global and then (qt TABW "currentPageIndex" () = 0): = gui_enter (I,J) X *************** *** 1182,1186 **** qt TABLE "isEditing" () and then (qt TABW "currentPageIndex" () = 0) ! where (I,J) = real_current_cell if is_global; --- 1194,1198 ---- qt TABLE "isEditing" () and then (qt TABW "currentPageIndex" () = 0) ! where _ = LAST_EDIT := (), (I,J) = real_current_cell if is_global; *************** *** 1198,1201 **** --- 1210,1214 ---- if not is_gui_elem (I,J) where (I,J) = current_edited; + = finish_edit true (I,J) where (I,J,S) = get LAST_EDIT; /* Various status updates. */ *************** *** 3044,3049 **** collect_results U V ! = LASTW := [] || ! begin_recursive || results_loop U V || end_recursive; results_loop U [] --- 3057,3061 ---- collect_results U V ! = begin_recursive || results_loop U V || end_recursive; results_loop U [] *************** *** 3076,3081 **** (I1,J1) = val K1; /* Messages to create GUI elements in cells (calclib::combobox et al). */ ! = LASTW := [(I1,J1,IT)|get LASTW] || ! results_loop (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Checkbox: (\\([0-9]+,[0-9]+\\)) (.*)$" S --- 3088,3092 ---- (I1,J1) = val K1; /* Messages to create GUI elements in cells (calclib::combobox et al). */ ! = results_loop (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Checkbox: (\\([0-9]+,[0-9]+\\)) (.*)$" S *************** *** 3083,3088 **** (I1,J1) = val K1, (S1,INIT) = val S1, IT:QtObject = make_gui checkbox_gui (I1,J1) (S1,INIT); ! = LASTW := [(I1,J1,IT)|get LASTW] || ! results_loop (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Pushbutton: (\\([0-9]+,[0-9]+\\)) (.*)$" S --- 3094,3098 ---- (I1,J1) = val K1, (S1,INIT) = val S1, IT:QtObject = make_gui checkbox_gui (I1,J1) (S1,INIT); ! = results_loop (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Pushbutton: (\\([0-9]+,[0-9]+\\)) (.*)$" S *************** *** 3091,3096 **** IT:QtObject = make_gui pushbutton_gui (I1,J1) (TEXT,ICON); ! = LASTW := [(I1,J1,IT)|get LASTW] || ! results_loop (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Togglebutton: (\\([0-9]+,[0-9]+\\)) (.*)$" S --- 3101,3105 ---- IT:QtObject = make_gui pushbutton_gui (I1,J1) (TEXT,ICON); ! = results_loop (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Togglebutton: (\\([0-9]+,[0-9]+\\)) (.*)$" S *************** *** 3099,3104 **** IT:QtObject = make_gui togglebutton_gui (I1,J1) (TEXT,ICON,INIT); ! = LASTW := [(I1,J1,IT)|get LASTW] || ! results_loop (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Combobox: (\\([0-9]+,[0-9]+\\)) (.*)$" S --- 3108,3112 ---- IT:QtObject = make_gui togglebutton_gui (I1,J1) (TEXT,ICON,INIT); ! = results_loop (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Combobox: (\\([0-9]+,[0-9]+\\)) (.*)$" S *************** *** 3106,3111 **** (I1,J1) = val K1, (SL,INIT) = val S1, IT:QtObject = make_gui combobox_gui (I1,J1) (SL,INIT); ! = LASTW := [(I1,J1,IT)|get LASTW] || ! results_loop (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Comboedit: (\\([0-9]+,[0-9]+\\)) (.*)$" S --- 3114,3118 ---- (I1,J1) = val K1, (SL,INIT) = val S1, IT:QtObject = make_gui combobox_gui (I1,J1) (SL,INIT); ! = results_loop (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Comboedit: (\\([0-9]+,[0-9]+\\)) (.*)$" S *************** *** 3113,3118 **** (I1,J1) = val K1, (SL,INIT) = val S1, IT:QtObject = make_gui comboedit_gui (I1,J1) (SL,INIT); ! = LASTW := [(I1,J1,IT)|get LASTW] || ! results_loop (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Spinbox: (\\([0-9]+,[0-9]+\\)) (.*)$" S --- 3120,3124 ---- (I1,J1) = val K1, (SL,INIT) = val S1, IT:QtObject = make_gui comboedit_gui (I1,J1) (SL,INIT); ! = results_loop (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Spinbox: (\\([0-9]+,[0-9]+\\)) (.*)$" S *************** *** 3122,3127 **** IT:QtObject = make_gui spinbox_gui (I1,J1) (MIN,MAX,STEP,INIT,SPECIAL,PREF,SUFF,V2T,T2V); ! = LASTW := [(I1,J1,IT)|get LASTW] || ! results_loop (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Slider: (\\([0-9]+,[0-9]+\\)) (.*)$" S --- 3128,3132 ---- IT:QtObject = make_gui spinbox_gui (I1,J1) (MIN,MAX,STEP,INIT,SPECIAL,PREF,SUFF,V2T,T2V); ! = results_loop (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Slider: (\\([0-9]+,[0-9]+\\)) (.*)$" S |