q-lang-cvs Mailing List for Q - Equational Programming Language (Page 19)
Brought to you by:
agraef
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(106) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(219) |
Feb
(152) |
Mar
|
Apr
(92) |
May
(45) |
Jun
(3) |
Jul
|
Aug
(3) |
Sep
(111) |
Oct
(52) |
Nov
|
Dec
|
2005 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
(2) |
May
(23) |
Jun
(46) |
Jul
(158) |
Aug
(22) |
Sep
|
Oct
(26) |
Nov
(11) |
Dec
(49) |
2006 |
Jan
(57) |
Feb
(196) |
Mar
(10) |
Apr
(41) |
May
(149) |
Jun
(308) |
Jul
(11) |
Aug
(25) |
Sep
(15) |
Oct
|
Nov
|
Dec
(15) |
2007 |
Jan
|
Feb
|
Mar
|
Apr
(15) |
May
(204) |
Jun
(112) |
Jul
(7) |
Aug
(16) |
Sep
(134) |
Oct
(313) |
Nov
(262) |
Dec
(83) |
2008 |
Jan
(81) |
Feb
(83) |
Mar
(21) |
Apr
|
May
|
Jun
(1) |
Jul
(2) |
Aug
(6) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Albert G. <ag...@us...> - 2007-11-08 21:31:04
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv8192 Modified Files: qcalc.q Log Message: more code refactoring and bugfixes; also added some optional code useful for debugging slot invocations Index: qcalc.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/qcalc.q,v retrieving revision 1.111 retrieving revision 1.112 diff -C2 -d -r1.111 -r1.112 *** qcalc.q 8 Nov 2007 05:17:44 -0000 1.111 --- qcalc.q 8 Nov 2007 21:30:58 -0000 1.112 *************** *** 305,316 **** where P = qt MAIN "pos" (); - /* Uncomment this for debugging purposes. */ - - // @1 - // qt_invoke OBJ SLOT ARGS - // = printf "invoke: %s %s %s\n" (str OBJ,str SLOT,str ARGS) || - // fail if neq SLOT timer; - // @0 - /* Helper functions for string manipulation. */ --- 305,308 ---- *************** *** 552,555 **** --- 544,588 ---- manual A _ _ _ = assistant (which "doc/qdoc.html"++A); + /* This flag is set iff we're processing events in the global loop. If it is + unset, we're being invoked recursively through a local event loop, in which + most operations (except aborting an evaluation) are temporarily disabled. */ + + def GLOBAL = ref true; + + is_global = get GLOBAL; + begin_local = GLOBAL := false; + end_local = GLOBAL := true; + + special local X; + local X = begin_local || X || end_local; + + /* Similarly, evaluations triggered by updates of cell and GUI elements are + inhibited during recursive edits and while an evaluation is already in + progress. */ + + def RECURSIVE = ref false; + + is_recursive = get RECURSIVE; + begin_recursive = RECURSIVE := true; + end_recursive = RECURSIVE := false; + + special recursive X; + recursive X = begin_recursive || X || end_recursive; + + @1 + /* Our last line of defence: Override qt_invoke to reject any "unsafe" + callbacks (i.e., everything except abort) during evaluations. */ + + qt_invoke OBJ SLOT ARGS + = _FAIL_ if is_recursive and then neq SLOT abort; + @0 + + /* Uncomment this for debugging purposes. (Qt/Q needs to be configured with + -DDEBUG_INVOKE to make this work.) */ + + // debug_invoke OBJ SLOT ARGS + // = printf "qt_invoke: %s %s %s\n" (str OBJ,str SLOT,str ARGS) + // if neq SLOT timer; + /* Allow the user to abort a runaway computation. */ *************** *** 571,582 **** abort _ _ _ = ABORTED := true; - /* Evaluations triggered by updates of cell and GUI elements are inhibited - during recursive edits. */ - - def REDIT = ref false, LAST_EDIT = ref (); - - special recursive X; - recursive X = REDIT := true || X || REDIT := false; - /* XXXFIXME: A horrible kludge to set the current cell to the one which holds one of our GUI elements if it gets the focus. Unfortunately, this isn't --- 604,607 ---- *************** *** 615,619 **** do check_lastW (get LASTW) || LASTW := [] || check_focus 0 (qt APP "focusWidget" ()) || ! digest_loop where HAVE_TABLE = (qt TABW "currentPageIndex" () = 0), --- 640,644 ---- do check_lastW (get LASTW) || LASTW := [] || check_focus 0 (qt APP "focusWidget" ()) || ! if not is_recursive then digest_loop where HAVE_TABLE = (qt TABW "currentPageIndex" () = 0), *************** *** 632,646 **** // where HAVE_TEXT = neg null $ qt CLIP "text" $ // qt_val "QClipboard" "Clipboard" ! if global; ! ! /* This flag is set iff we're processing events in the global loop. If it is ! unset, we're being invoked recursively through a local event loop, in which ! most operations (except aborting an evaluation) are temporarily disabled. */ ! ! def GLOBAL = ref true; ! ! global = get GLOBAL; ! begin_local = GLOBAL := false; ! end_local = GLOBAL := true; digest_loop = digest S || digest_loop where S = get MSGS if #MSGS>0; --- 657,661 ---- // where HAVE_TEXT = neg null $ qt CLIP "text" $ // qt_val "QClipboard" "Clipboard" ! if is_global; digest_loop = digest S || digest_loop where S = get MSGS if #MSGS>0; *************** *** 701,707 **** = if null S0 then delete_cells (I,J) else insert_cells ((I,J),S0) || ! clear_cell (I,J) || set_cell (I,J) S || ! //delete_eval (I,J) || ! S0 where (S0,S1) = unquote S; --- 716,720 ---- = if null S0 then delete_cells (I,J) else insert_cells ((I,J),S0) || ! clear_cell (I,J) || set_cell (I,J) S || S0 where (S0,S1) = unquote S; *************** *** 738,742 **** where RES = waitmsg "Compiling..." || init_interp, _ = highlight_rebuild_cache ! if global; init_interp = TASK := (TMP|NEW_TASK) || --- 751,755 ---- where RES = waitmsg "Compiling..." || init_interp, _ = highlight_rebuild_cache ! if is_global; init_interp = TASK := (TMP|NEW_TASK) || *************** *** 782,787 **** // No output yet, take a short nap and try again. = startup_loop (H,PID,MASTER) ! if begin_local || qt APP "processEvents" 100 || ! end_local || not get ABORTED; // User aborted compilation, bail out. = fini_interp || statusmsg "Compilation aborted" || false; --- 795,799 ---- // No output yet, take a short nap and try again. = startup_loop (H,PID,MASTER) ! if local (qt APP "processEvents" 100) || not get ABORTED; // User aborted compilation, bail out. = fini_interp || statusmsg "Compilation aborted" || false; *************** *** 845,850 **** /* Editing table cells and evaluation. */ eval _ _ (I,J) ! if global and then not get REDIT: = process_gui (I,J) X || digest_loop where X:QtObject = gui_elem (I,J); --- 857,864 ---- /* Editing table cells and evaluation. */ + def LAST_EDIT = ref (); + eval _ _ (I,J) ! if is_global and then not is_recursive: = process_gui (I,J) X || digest_loop where X:QtObject = gui_elem (I,J); *************** *** 862,866 **** edit S D () where (I,J) = current_cell ! if global and then (qt TABW "currentPageIndex" () = 0): = LAST_EDIT := (I,J) || insert_cells ((I,J),true) || --- 876,880 ---- edit S D () where (I,J) = current_cell ! if is_global and then (qt TABW "currentPageIndex" () = 0): = LAST_EDIT := (I,J) || insert_cells ((I,J),true) || *************** *** 883,891 **** qt TABLE "editCell" (I,J) where (S,_,_) = get EVAL!(I,J) ! if global and then not is_gui_elem (I,J) and then (qt TABW "currentPageIndex" () = 0); accept _ _ _ ! where (I,J) = current_cell if global: = doprocess (I,J) || digest_loop if is_gui_elem (I,J); --- 897,905 ---- qt TABLE "editCell" (I,J) where (S,_,_) = get EVAL!(I,J) ! if is_global and then not is_gui_elem (I,J) and then (qt TABW "currentPageIndex" () = 0); accept _ _ _ ! where (I,J) = current_cell if is_global: = doprocess (I,J) || digest_loop if is_gui_elem (I,J); *************** *** 901,905 **** accept2 S D A where (I,J) = current_cell, N = num_rows ! if global and then (qt TABW "currentPageIndex" () = 0): = gui_enter (I,J) X where X:QtObject = gui_elem (I,J); --- 915,919 ---- accept2 S D A where (I,J) = current_cell, N = num_rows ! if is_global and then (qt TABW "currentPageIndex" () = 0): = gui_enter (I,J) X where X:QtObject = gui_elem (I,J); *************** *** 921,928 **** (qt TABW "currentPageIndex" () = 0) where (I,J) = current_cell ! if global; ! gui_update X (I,J) _ if global and then not get REDIT: ! = if (I,J)<>current_cell then (qt TABLE "setCurrentCell" (I,J) || qt TABLE "clearSelection" ()) || --- 935,944 ---- (qt TABW "currentPageIndex" () = 0) where (I,J) = current_cell ! if is_global; ! gui_update X (I,J) _ ! if is_global and then not is_recursive and then not is_nil X: ! = puts "gui_update\n" || ! if (I,J)<>current_cell then (qt TABLE "setCurrentCell" (I,J) || qt TABLE "clearSelection" ()) || *************** *** 944,951 **** activate _ _ (I,J) ! = updatemsg (I,J) if check_editing || global; clicked _ _ (I,J) ! = updatemsg (I,J) if global; updatemsg (I,J) = statusmsg $ sprintf "%s%d = %s" (colstr J,I+1,S) --- 960,967 ---- activate _ _ (I,J) ! = updatemsg (I,J) if check_editing || is_global; clicked _ _ (I,J) ! = updatemsg (I,J) if is_global; updatemsg (I,J) = statusmsg $ sprintf "%s%d = %s" (colstr J,I+1,S) *************** *** 992,999 **** def REPLS = ref 0; ! find _ _ _ if global: = find_dg || REPLS := 0 || find_clearmsg || show_editor; ! find_prev _ _ _ if global: = savestr FIND_TEXT S || find_statusmsg "Found previous occurrence" || --- 1008,1015 ---- def REPLS = ref 0; ! find _ _ _ if is_global: = find_dg || REPLS := 0 || find_clearmsg || show_editor; ! find_prev _ _ _ if is_global: = savestr FIND_TEXT S || find_statusmsg "Found previous occurrence" || *************** *** 1008,1012 **** otherwise; ! find_next _ _ _ if global: = savestr FIND_TEXT S || find_statusmsg "Found next occurrence" || --- 1024,1028 ---- otherwise; ! find_next _ _ _ if is_global: = savestr FIND_TEXT S || find_statusmsg "Found next occurrence" || *************** *** 1026,1030 **** REPLS := 0 otherwise; ! find_repl X D A if global: = qt EDIT "insert" S || REPLS := get REPLS+1 || savestr REPL_TEXT S0 || --- 1042,1046 ---- REPLS := 0 otherwise; ! find_repl X D A if is_global: = qt EDIT "insert" S || REPLS := get REPLS+1 || savestr REPL_TEXT S0 || *************** *** 1088,1092 **** /* Various editing operations. */ ! edit_undo _ _ _ if global: = undo || updatemsg (I,J) where (I,J) = current_cell --- 1104,1108 ---- /* Various editing operations. */ ! edit_undo _ _ _ if is_global: = undo || updatemsg (I,J) where (I,J) = current_cell *************** *** 1096,1100 **** if qt TABW "currentPageIndex" () = 1; ! edit_redo _ _ _ if global: = redo || updatemsg (I,J) where (I,J) = current_cell --- 1112,1116 ---- if qt TABW "currentPageIndex" () = 1; ! edit_redo _ _ _ if is_global: = redo || updatemsg (I,J) where (I,J) = current_cell *************** *** 1104,1108 **** if qt TABW "currentPageIndex" () = 1; ! insert_row _ _ _ if global: = adjust_rows (N+2) || EDITED := true || update_title || process_sel SEL || --- 1120,1124 ---- if qt TABW "currentPageIndex" () = 1; ! insert_row _ _ _ if is_global: = adjust_rows (N+2) || EDITED := true || update_title || process_sel SEL || *************** *** 1119,1123 **** if qt TABW "currentPageIndex" () = 0; ! delete_row _ _ _ if global: = EDITED := true || update_title || process_sel SEL || --- 1135,1139 ---- if qt TABW "currentPageIndex" () = 0; ! delete_row _ _ _ if is_global: = EDITED := true || update_title || process_sel SEL || *************** *** 1134,1138 **** if qt TABW "currentPageIndex" () = 0; ! insert_col _ _ _ if global: = adjust_cols (N+2) || EDITED := true || update_title || process_sel SEL || --- 1150,1154 ---- if qt TABW "currentPageIndex" () = 0; ! insert_col _ _ _ if is_global: = adjust_cols (N+2) || EDITED := true || update_title || process_sel SEL || *************** *** 1149,1153 **** if qt TABW "currentPageIndex" () = 0; ! delete_col _ _ _ if global: = EDITED := true || update_title || process_sel SEL || --- 1165,1169 ---- if qt TABW "currentPageIndex" () = 0; ! delete_col _ _ _ if is_global: = EDITED := true || update_title || process_sel SEL || *************** *** 1209,1213 **** = (I<N) and then (J<M); ! del _ _ _ if global: = EDITED := get EDITED or else not null CELLS || update_title || --- 1225,1229 ---- = (I<N) and then (J<M); ! del _ _ _ if is_global: = EDITED := get EDITED or else not null CELLS || update_title || *************** *** 1221,1225 **** if qt TABW "currentPageIndex" () = 1; ! cut _ _ _ if global: = EDITED := get EDITED or else not null CELLS || update_title || --- 1237,1241 ---- if qt TABW "currentPageIndex" () = 1; ! cut _ _ _ if is_global: = EDITED := get EDITED or else not null CELLS || update_title || *************** *** 1234,1238 **** if qt TABW "currentPageIndex" () = 1; ! copy _ _ _ if global: = set_clipboard X S where SEL = check_editing || selection, --- 1250,1254 ---- if qt TABW "currentPageIndex" () = 1; ! copy _ _ _ if is_global: = set_clipboard X S where SEL = check_editing || selection, *************** *** 1242,1246 **** if qt TABW "currentPageIndex" () = 1; ! copy_selection _ _ _ if global: = set_clipboard2 S where S = sel_cellcvals SEL --- 1258,1262 ---- if qt TABW "currentPageIndex" () = 1; ! copy_selection _ _ _ if is_global: = set_clipboard2 S where S = sel_cellcvals SEL *************** *** 1250,1254 **** if qt TABW "currentPageIndex" () = 0; ! paste _ _ _ if global: = EDITED := get EDITED or else not null SEL || adjust_table (N,M) || --- 1266,1270 ---- if qt TABW "currentPageIndex" () = 0; ! paste _ _ _ if is_global: = EDITED := get EDITED or else not null SEL || adjust_table (N,M) || *************** *** 1269,1273 **** if qt TABW "currentPageIndex" () = 1; ! paste_text _ _ _ if global: = EDITED := get EDITED or else not null SEL || update_title || process_sel SEL || --- 1285,1289 ---- if qt TABW "currentPageIndex" () = 1; ! paste_text _ _ _ if is_global: = EDITED := get EDITED or else not null SEL || update_title || process_sel SEL || *************** *** 1283,1287 **** if qt TABW "currentPageIndex" () = 0; ! fill _ _ _ if global: = EDITED := true || update_title || process_sel $ tl $ cat $ fill_vals VALS || --- 1299,1303 ---- if qt TABW "currentPageIndex" () = 0; ! fill _ _ _ if is_global: = EDITED := true || update_title || process_sel $ tl $ cat $ fill_vals VALS || *************** *** 1516,1520 **** where FONT = qt_new "QFont" (); ! choose_font _ _ _ if global: = do (flip set_font FONT) (if qt TABW "currentPageIndex" () = 0 then [TABLE] --- 1532,1536 ---- where FONT = qt_new "QFont" (); ! choose_font _ _ _ if is_global: = do (flip set_font FONT) (if qt TABW "currentPageIndex" () = 0 then [TABLE] *************** *** 1525,1529 **** (FONT,true) = font_dg FONT; ! enlarge_font _ _ _ if global: = statusmsg $ sprintf "New point size: %dpt" $ change_pointsize succ TABLE --- 1541,1545 ---- (FONT,true) = font_dg FONT; ! enlarge_font _ _ _ if is_global: = statusmsg $ sprintf "New point size: %dpt" $ change_pointsize succ TABLE *************** *** 1534,1538 **** otherwise; ! reduce_font _ _ _ if global: = statusmsg $ sprintf "New point size: %dpt" $ change_pointsize pred TABLE --- 1550,1554 ---- otherwise; ! reduce_font _ _ _ if is_global: = statusmsg $ sprintf "New point size: %dpt" $ change_pointsize pred TABLE *************** *** 1543,1552 **** otherwise; ! increase_prec _ _ _ if global: = FPREC := get FPREC+1 || FFORMAT := sprintf "%%0.%dg" (get FPREC) || do update_fformat $ list $ get CELLS; ! decrease_prec _ _ _ if global: = FPREC := get FPREC-1 || FFORMAT := sprintf "%%0.%dg" (get FPREC) || --- 1559,1568 ---- otherwise; ! increase_prec _ _ _ if is_global: = FPREC := get FPREC+1 || FFORMAT := sprintf "%%0.%dg" (get FPREC) || do update_fformat $ list $ get CELLS; ! decrease_prec _ _ _ if is_global: = FPREC := get FPREC-1 || FFORMAT := sprintf "%%0.%dg" (get FPREC) || *************** *** 1565,1569 **** save S D A = save_as S D A if eq (get FILENAME) (); ! save _ _ _ if global: = EDITED := false || qt EDIT "setModified" false || update_title || --- 1581,1585 ---- save S D A = save_as S D A if eq (get FILENAME) (); ! save _ _ _ if is_global: = EDITED := false || qt EDIT "setModified" false || update_title || *************** *** 1598,1602 **** = (I1<I2) or else (I1=I2) and then (J1<J2); ! save_as X D A if global: = FILENAME := S || save X D A if not isfile (fopen S "r") or else --- 1614,1618 ---- = (I1<I2) or else (I1=I2) and then (J1<J2); ! save_as X D A if is_global: = FILENAME := S || save X D A if not isfile (fopen S "r") or else *************** *** 1612,1616 **** if not null NAME where NAME:String = open_dg ! if check_editing || check_edited if global: = () where () = open_file NAME; = msgbox $ sprintf --- 1628,1632 ---- if not null NAME where NAME:String = open_dg ! if check_editing || check_edited if is_global: = () where () = open_file NAME; = msgbox $ sprintf *************** *** 1623,1627 **** recent_file I _ _ _ if not null NAME where NAME:String = get FILES!(I-1) ! if check_editing || check_edited if global: = () where () = open_file NAME; = msgbox $ sprintf --- 1639,1643 ---- recent_file I _ _ _ if not null NAME where NAME:String = get FILES!(I-1) ! if check_editing || check_edited if is_global: = () where () = open_file NAME; = msgbox $ sprintf *************** *** 1639,1645 **** --- 1655,1663 ---- if RES then digest_loop || statusmsg "Done" || + qt TIMER "start" 300 || () where OLD_KEYS = keys $ get CELLS, _ = // initializations + qt TIMER "stop" () || CELLS := emptyhdict || EVAL := emptyhdict || *************** *** 1727,1731 **** ROWS = [0..num_rows-1], COLS = [0..num_cols-1] ! if check_editing || check_edited if global; /* Encoding tag. FIXME: This currently requires nl_langinfo to get the system --- 1745,1749 ---- ROWS = [0..num_rows-1], COLS = [0..num_cols-1] ! if check_editing || check_edited if is_global; /* Encoding tag. FIXME: This currently requires nl_langinfo to get the system *************** *** 2002,2006 **** bail_out _ _ _ = qt APP "exit" 1 ! if check_editing || check_edited if global; edited = get EDITED or else qt EDIT "isModified" (); --- 2020,2024 ---- bail_out _ _ _ = qt APP "exit" 1 ! if check_editing || check_edited if is_global; edited = get EDITED or else qt EDIT "isModified" (); *************** *** 2577,2585 **** if get STATE=4; ! collect_results U [] // we're finished; process any pending cell updates ! = if not null U then ! post MSGS $ zipwith append (keys U) (vals U); ! collect_results U [(I,J)|V] if get ABORTED: // user aborted the computation, flag all remaining cells --- 2595,2606 ---- if get STATE=4; ! collect_results U V ! = begin_recursive || results_loop U V || end_recursive; ! ! results_loop U [] // we're finished; process any pending cell updates ! = post MSGS $ zipwith append (keys U) (vals U) if not null U; ! = () otherwise; ! results_loop U [(I,J)|V] if get ABORTED: // user aborted the computation, flag all remaining cells *************** *** 2591,2604 **** where S:String = try2 MSGS: // evaluation succeeded, we're good ! = update_cell (I,J) S || collect_results U V where [S] = regex "" "^\\+\\+\\+ Result: (.*)$" S (reg 1); // errors during evaluation (these get the red flag) = flag (I,J) || ! collect_results U V if (S = "+++ Syntax error.") or else not null (regex "" "^\\+\\+\\+ Exception: (.*)$" S ()); /* Asynchronous message to change a cell. We update the cell right now, but defer triggering of dependent cells until we have finished processing. */ ! = collect_results (insert U ((I1,J1),X)) [(I,J)|V] where X = process_update2 (I1,J1) S1 where [(K1,S1)] = regex "" --- 2612,2625 ---- where S:String = try2 MSGS: // evaluation succeeded, we're good ! = update_cell (I,J) S || results_loop U V where [S] = regex "" "^\\+\\+\\+ Result: (.*)$" S (reg 1); // errors during evaluation (these get the red flag) = flag (I,J) || ! results_loop U V if (S = "+++ Syntax error.") or else not null (regex "" "^\\+\\+\\+ Exception: (.*)$" S ()); /* Asynchronous message to change a cell. We update the cell right now, but defer triggering of dependent cells until we have finished processing. */ ! = results_loop (insert U ((I1,J1),X)) [(I,J)|V] where X = process_update2 (I1,J1) S1 where [(K1,S1)] = regex "" *************** *** 2606,2616 **** (reg 1,reg 2), (I1,J1) = val K1; ! /* Messages to create GUI elements in cells. Note that we inhibit recursive ! updates during initialization of the GUI elements, to prevent looping on ! cascades of update messages. */ ! = recursive (qt IT "setChecked" INIT) || qt TABLE "setItem" (I1,J1,IT) || insert_cells ((I1,J1),IT) || ! collect_results (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Checkbox: (\\([0-9]+,[0-9]+\\)) (.*)$" S --- 2627,2635 ---- (reg 1,reg 2), (I1,J1) = val K1; ! /* Messages to create GUI elements in cells. */ ! = qt IT "setChecked" INIT || qt TABLE "setItem" (I1,J1,IT) || insert_cells ((I1,J1),IT) || ! results_loop (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Checkbox: (\\([0-9]+,[0-9]+\\)) (.*)$" S *************** *** 2621,2625 **** qt TABLE "setCellWidget" (I1,J1,X) || insert_cells ((I1,J1),IT) || ! collect_results (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Pushbutton: (\\([0-9]+,[0-9]+\\)) (.*)$" S --- 2640,2644 ---- qt TABLE "setCellWidget" (I1,J1,X) || insert_cells ((I1,J1),IT) || ! results_loop (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Pushbutton: (\\([0-9]+,[0-9]+\\)) (.*)$" S *************** *** 2648,2652 **** qt TABLE "setCellWidget" (I1,J1,X) || insert_cells ((I1,J1),IT) || ! collect_results (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Togglebutton: (\\([0-9]+,[0-9]+\\)) (.*)$" S --- 2667,2671 ---- qt TABLE "setCellWidget" (I1,J1,X) || insert_cells ((I1,J1),IT) || ! results_loop (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Togglebutton: (\\([0-9]+,[0-9]+\\)) (.*)$" S *************** *** 2668,2678 **** _ = qt_connect X (SIGNAL "toggled(bool)") X (SLOT "guiUpdate()") || - qt_connect X (SIGNAL "released()") - X (SLOT "guiUpdate()") || qt IT "setReplaceable" false; ! = recursive (qt IT "setCurrentItem" INIT) || qt TABLE "setItem" (I1,J1,IT) || insert_cells ((I1,J1),IT) || ! collect_results (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Combobox: (\\([0-9]+,[0-9]+\\)) (.*)$" S --- 2687,2695 ---- _ = qt_connect X (SIGNAL "toggled(bool)") X (SLOT "guiUpdate()") || qt IT "setReplaceable" false; ! = qt IT "setCurrentItem" INIT || qt TABLE "setItem" (I1,J1,IT) || insert_cells ((I1,J1),IT) || ! results_loop (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Combobox: (\\([0-9]+,[0-9]+\\)) (.*)$" S *************** *** 2680,2687 **** (I1,J1) = val K1, (SL,INIT) = val S1, IT = qt_new "QComboTableItem" (TABLE,SL,false); ! = recursive (qt IT "setCurrentItem" INIT) || qt TABLE "setItem" (I1,J1,IT) || insert_cells ((I1,J1),IT) || ! collect_results (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Comboedit: (\\([0-9]+,[0-9]+\\)) (.*)$" S --- 2697,2704 ---- (I1,J1) = val K1, (SL,INIT) = val S1, IT = qt_new "QComboTableItem" (TABLE,SL,false); ! = qt IT "setCurrentItem" INIT || qt TABLE "setItem" (I1,J1,IT) || insert_cells ((I1,J1),IT) || ! results_loop (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Comboedit: (\\([0-9]+,[0-9]+\\)) (.*)$" S *************** *** 2689,2704 **** (I1,J1) = val K1, (SL,INIT) = val S1, IT = qt_new "QComboTableItem" (TABLE,SL,true); ! = recursive ! (qt X "setValue" INIT || ! if not null SPECIAL then ! qt X "setSpecialValueText" SPECIAL || ! if not null PREF then ! qt X "setPrefix" PREF || ! if not null SUFF then ! qt X "setSuffix" SUFF) || qt TABLE "setItem" (I1,J1,IT) || qt TABLE "setCellWidget" (I1,J1,X) || insert_cells ((I1,J1),IT) || ! collect_results (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Spinbox: (\\([0-9]+,[0-9]+\\)) (.*)$" S --- 2706,2720 ---- (I1,J1) = val K1, (SL,INIT) = val S1, IT = qt_new "QComboTableItem" (TABLE,SL,true); ! = qt X "setValue" INIT || ! if not null SPECIAL then ! qt X "setSpecialValueText" SPECIAL || ! if not null PREF then ! qt X "setPrefix" PREF || ! if not null SUFF then ! qt X "setSuffix" SUFF || qt TABLE "setItem" (I1,J1,IT) || qt TABLE "setCellWidget" (I1,J1,X) || insert_cells ((I1,J1),IT) || ! results_loop (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Spinbox: (\\([0-9]+,[0-9]+\\)) (.*)$" S *************** *** 2721,2729 **** qt X "setValidator" nil || qt IT "setReplaceable" false; ! = recursive (qt X "setLineStep" LSTEP) || qt TABLE "setItem" (I1,J1,IT) || qt TABLE "setCellWidget" (I1,J1,X) || insert_cells ((I1,J1),IT) || ! collect_results (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Slider: (\\([0-9]+,[0-9]+\\)) (.*)$" S --- 2737,2745 ---- qt X "setValidator" nil || qt IT "setReplaceable" false; ! = qt X "setLineStep" LSTEP || qt TABLE "setItem" (I1,J1,IT) || qt TABLE "setCellWidget" (I1,J1,X) || insert_cells ((I1,J1),IT) || ! results_loop (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Slider: (\\([0-9]+,[0-9]+\\)) (.*)$" S *************** *** 2745,2758 **** qt IT "setReplaceable" false; // anything else just gets passed to the digest function, and we try again ! = begin_local || digest S || end_local || ! collect_results U [(I,J)|V]; otherwise: /* No result yet. Process some pending GUI events, to give the user a chance to abort the computation. */ = do flag [(I,J)|V] ! if wait_cursor || begin_local || ! qt APP "processEvents" 100 || ! end_local || get ABORTED; ! = collect_results U [(I,J)|V] otherwise; /* Note that we try the semaphore *two* times before we give up and hand it --- 2761,2772 ---- qt IT "setReplaceable" false; // anything else just gets passed to the digest function, and we try again ! = local (digest S) || results_loop U [(I,J)|V]; otherwise: /* No result yet. Process some pending GUI events, to give the user a chance to abort the computation. */ = do flag [(I,J)|V] ! if wait_cursor || local (qt APP "processEvents" 100) || ! get ABORTED; ! = results_loop U [(I,J)|V] otherwise; /* Note that we try the semaphore *two* times before we give up and hand it |
From: Albert G. <ag...@us...> - 2007-11-08 21:02:07
|
Update of /cvsroot/q-lang/qt-q In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv26713 Modified Files: ChangeLog Log Message: update ChangeLog Index: ChangeLog =================================================================== RCS file: /cvsroot/q-lang/qt-q/ChangeLog,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ChangeLog 3 Nov 2007 22:27:34 -0000 1.13 --- ChangeLog 8 Nov 2007 21:02:02 -0000 1.14 *************** *** 1,2 **** --- 1,17 ---- + 2007-11-08 Albert Graef <Dr....@t-...> + + + Release 1.2 + + * src/smokeqt.i: critical bugfix in QtQSmokeBinding::deleted() + + A silly typo prevented deleted objects to be removed from the + pointer hash table, subsequently causing make_qt_object() (and + thereby the qt_new interface routine) to return nil objects for + non-nil pointers, wreaking havoc in applications. + + Also added some useful code for debugging slot invocations in user + programs. This is enabled with the -DDEBUG_INVOKE compiler flag + (see src/Makefile). + 2007-11-03 Albert Graef <Dr....@t-...> |
From: Albert G. <ag...@us...> - 2007-11-08 20:55:34
|
Update of /cvsroot/q-lang/qt-q/src In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv24144/src Modified Files: Makefile Log Message: disable slot debugging by default Index: Makefile =================================================================== RCS file: /cvsroot/q-lang/qt-q/src/Makefile,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Makefile 8 Nov 2007 07:29:10 -0000 1.5 --- Makefile 8 Nov 2007 20:55:31 -0000 1.6 *************** *** 7,11 **** # uncomment this to add some code for debugging slot invokations (see the # callMethod method in smokeqt.i) ! DEFS=-DDEBUG_INVOKE INCPATH=-I$(QTDIR)/include -I$(SMOKEDIR)/include --- 7,11 ---- # uncomment this to add some code for debugging slot invokations (see the # callMethod method in smokeqt.i) ! #DEFS=-DDEBUG_INVOKE INCPATH=-I$(QTDIR)/include -I$(SMOKEDIR)/include |
From: Albert G. <ag...@us...> - 2007-11-08 20:54:28
|
Update of /cvsroot/q-lang/qt-q/src In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv23701/src Modified Files: smokeqt.i Log Message: critical bugfix: silly typo in QtQSmokeBinding::deleted() prevented deleted objects to be removed from the pointer table Index: smokeqt.i =================================================================== RCS file: /cvsroot/q-lang/qt-q/src/smokeqt.i,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** smokeqt.i 8 Nov 2007 09:26:20 -0000 1.28 --- smokeqt.i 8 Nov 2007 20:54:25 -0000 1.29 *************** *** 4444,4448 **** nobj->ptr = NULL; nobj->cid = 0; } ! qtobj_map.remove(obj->ptr); } } --- 4444,4448 ---- nobj->ptr = NULL; nobj->cid = 0; } ! qtobj_map.remove(ptr); } } |
From: Albert G. <ag...@us...> - 2007-11-08 09:26:24
|
Update of /cvsroot/q-lang/qt-q/src In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv17312/src Modified Files: smokeqt.i Log Message: bugfix in new debugging code Index: smokeqt.i =================================================================== RCS file: /cvsroot/q-lang/qt-q/src/smokeqt.i,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** smokeqt.i 8 Nov 2007 07:29:10 -0000 1.27 --- smokeqt.i 8 Nov 2007 09:26:20 -0000 1.28 *************** *** 4485,4491 **** #ifdef DEBUG_INVOKE if (!isSignal) { ! dispose(callback(mksym(__sym(debug_invoke)), ! newref(y), newref(name), newref(args))); ! unref(y); unref(name); unref(args); } #endif --- 4485,4491 ---- #ifdef DEBUG_INVOKE if (!isSignal) { ! expr f = mksym(__sym(debug_invoke)); ! dispose(callback(newref(f), newref(y), newref(name), newref(args))); ! unref(f); unref(y); unref(name); unref(args); } #endif |
From: Albert G. <ag...@us...> - 2007-11-08 07:29:16
|
Update of /cvsroot/q-lang/qt-q/src In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv11072/src Modified Files: Makefile smokeqt.i Log Message: add some optional extra code for debugging slot invokations Index: Makefile =================================================================== RCS file: /cvsroot/q-lang/qt-q/src/Makefile,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Makefile 29 Sep 2007 17:20:41 -0000 1.4 --- Makefile 8 Nov 2007 07:29:10 -0000 1.5 *************** *** 5,8 **** --- 5,12 ---- #SMOKELIBS=-lsmokekde + # uncomment this to add some code for debugging slot invokations (see the + # callMethod method in smokeqt.i) + DEFS=-DDEBUG_INVOKE + INCPATH=-I$(QTDIR)/include -I$(SMOKEDIR)/include LIBPATH=-L$(QTDIR)/lib -L$(SMOKEDIR)/lib Index: smokeqt.i =================================================================== RCS file: /cvsroot/q-lang/qt-q/src/smokeqt.i,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** smokeqt.i 3 Nov 2007 22:26:49 -0000 1.26 --- smokeqt.i 8 Nov 2007 07:29:10 -0000 1.27 *************** *** 696,699 **** --- 696,706 ---- %stubs %{ + /* If the smokeqt module is configured for this (by adding -DDEBUG_INVOKE to + the compilation command), you can define this function in your script to + debug slot invocations. The function will be called right before each slot + invocation. */ + + public debug_invoke OBJ SLOT ARGS; + /* Widget factory interface. */ *************** *** 4474,4477 **** --- 4481,4493 ---- name, isSignal); expr y = make_qt_obj(obj->ptr, obj->cid); + /* Define this symbol when compiling the Qt/Q module and define the + 'debug_invoke' function in your script to debug slot invocations. */ + #ifdef DEBUG_INVOKE + if (!isSignal) { + dispose(callback(mksym(__sym(debug_invoke)), + newref(y), newref(name), newref(args))); + unref(y); unref(name); unref(args); + } + #endif if (args) x = callback(f, y, name, args); } else { |
From: Albert G. <ag...@us...> - 2007-11-08 05:17:50
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv29721 Modified Files: qcalc.q Log Message: overhauled spreadsheet load/new code, added some code for debugging callbacks Index: qcalc.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/qcalc.q,v retrieving revision 1.110 retrieving revision 1.111 diff -C2 -d -r1.110 -r1.111 *** qcalc.q 7 Nov 2007 22:08:45 -0000 1.110 --- qcalc.q 8 Nov 2007 05:17:44 -0000 1.111 *************** *** 305,308 **** --- 305,316 ---- where P = qt MAIN "pos" (); + /* Uncomment this for debugging purposes. */ + + // @1 + // qt_invoke OBJ SLOT ARGS + // = printf "invoke: %s %s %s\n" (str OBJ,str SLOT,str ARGS) || + // fail if neq SLOT timer; + // @0 + /* Helper functions for string manipulation. */ *************** *** 486,490 **** statusmsg S = qt STATUS "message" S; // like statusmsg, but must be processed immediately: ! waitmsg S = statusmsg S || qt APP "processEvents" 0; /* Application cursor. */ --- 494,500 ---- statusmsg S = qt STATUS "message" S; // like statusmsg, but must be processed immediately: ! waitmsg S = statusmsg S || GLOBAL := false || ! qt APP "processEvents" () || GLOBAL := G ! where G = get GLOBAL; /* Application cursor. */ *************** *** 1625,1640 **** where F:File = fopen NAME "r": = add_recent_file NAME || ! if RES then process_all || mark_undo L1 || if RES then digest_loop || () ! where _ = // initializations ! highlight_clear_cache || ! qt EDIT "setText" SCRIPT || ! highlight_flush_cache || ! qt EDIT "setCursorPosition" (0,0) || ! EDITED := false || qt EDIT "setModified" false || ! FILENAME := NAME || update_title || ! do (qt TABLE "clearCell") (keys (get CELLS)) || CELLS := hdict (zip KEYS (map (cst true) KEYS)) || EVAL := hdict (zip KEYS2 (zip3 VALS2 XVALS2 DEPS)) || --- 1635,1648 ---- where F:File = fopen NAME "r": = add_recent_file NAME || ! if RES then (waitmsg "Computing..." || process_all) || mark_undo L1 || if RES then digest_loop || + statusmsg "Done" || () ! where OLD_KEYS = keys $ get CELLS, ! _ = // initializations ! CELLS := emptyhdict || ! EVAL := emptyhdict || ! do (qt TABLE "clearCell") OLD_KEYS || CELLS := hdict (zip KEYS (map (cst true) KEYS)) || EVAL := hdict (zip KEYS2 (zip3 VALS2 XVALS2 DEPS)) || *************** *** 1643,1647 **** do (\J.qt TABLE "setColumnWidth" (J,DEF_WD)) COLS || do (qt TABLE "setRowHeight") HT || ! do (qt TABLE "setColumnWidth") WD, RES = // give the interpreter some time to start up waitmsg "Compiling..." || init_interp --- 1651,1661 ---- do (\J.qt TABLE "setColumnWidth" (J,DEF_WD)) COLS || do (qt TABLE "setRowHeight") HT || ! do (qt TABLE "setColumnWidth") WD || ! EDITED := false || qt EDIT "setModified" false || ! FILENAME := NAME || update_title || ! highlight_clear_cache || ! qt EDIT "setText" SCRIPT || ! highlight_flush_cache || ! qt EDIT "setCursorPosition" (0,0), RES = // give the interpreter some time to start up waitmsg "Compiling..." || init_interp *************** *** 1676,1690 **** MYMAGIC = "// qcalc"; // no qcalc header, read as ordinary script ! = highlight_clear_cache || qt EDIT "setText" SCRIPT || highlight_flush_cache || qt EDIT "setCursorPosition" (0,0) || - EDITED := false || qt EDIT "setModified" false || - FILENAME := NAME || update_title || - do (qt TABLE "clearCell") (keys (get CELLS)) || - do (\I.qt TABLE "setRowHeight" (I,DEF_HT)) ROWS || - do (\J.qt TABLE "setColumnWidth" (J,DEF_WD)) COLS || - CELLS := emptyhdict || - EVAL := emptyhdict || init_interp || mark_undo [] || --- 1690,1704 ---- MYMAGIC = "// qcalc"; // no qcalc header, read as ordinary script ! = do (qt TABLE "clearCell") (keys (get CELLS)) || ! CELLS := emptyhdict || ! EVAL := emptyhdict || ! do (\I.qt TABLE "setRowHeight" (I,DEF_HT)) ROWS || ! do (\J.qt TABLE "setColumnWidth" (J,DEF_WD)) COLS || ! EDITED := false || qt EDIT "setModified" false || ! FILENAME := NAME || update_title || ! highlight_clear_cache || qt EDIT "setText" SCRIPT || highlight_flush_cache || qt EDIT "setCursorPosition" (0,0) || init_interp || mark_undo [] || *************** *** 1696,1709 **** fread_data F = fread F where () = fscanf F "//"; ! new _ _ _ = highlight_clear_cache || ! qt EDIT "setText" "" || ! highlight_flush_cache || ! EDITED := false || qt EDIT "setModified" false || ! FILENAME := () || update_title || ! do (qt TABLE "clearCell") (keys (get CELLS)) || ! do (\I.qt TABLE "setRowHeight" (I,DEF_HT)) ROWS || ! do (\J.qt TABLE "setColumnWidth" (J,DEF_WD)) COLS || CELLS := emptyhdict || EVAL := emptyhdict || init_interp || mark_undo [] || --- 1710,1724 ---- fread_data F = fread F where () = fscanf F "//"; ! new _ _ _ = do (qt TABLE "clearCell") (keys (get CELLS)) || CELLS := emptyhdict || EVAL := emptyhdict || + do (\I.qt TABLE "setRowHeight" (I,DEF_HT)) ROWS || + do (\J.qt TABLE "setColumnWidth" (J,DEF_WD)) COLS || + EDITED := false || qt EDIT "setModified" false || + FILENAME := () || update_title || + highlight_clear_cache || + qt EDIT "setText" "" || + highlight_flush_cache || + qt EDIT "setCursorPosition" (0,0) || init_interp || mark_undo [] || |
From: Albert G. <ag...@us...> - 2007-11-07 22:17:32
|
Update of /cvsroot/q-lang/qcalc/examples In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv27400/examples Modified Files: guiexamples.qcalc Log Message: update GUI example Index: guiexamples.qcalc =================================================================== RCS file: /cvsroot/q-lang/qcalc/examples/guiexamples.qcalc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** guiexamples.qcalc 7 Nov 2007 10:07:27 -0000 1.1 --- guiexamples.qcalc 7 Nov 2007 22:17:29 -0000 1.2 *************** *** 1,5 **** ! // qcalc 1.0, created Wed Nov 7 11:04:34 2007 -*-Q-*- -*- coding: UTF-8 -*- ! // [((0,1),"GUI element"),((0,2),"Value"),((2,0),"Checkbox"),((2,1),"= checkbox (\"test\",true)"),((2,2),"= B3"),((4,0),"Combobox"),((4,1),"= combobox ([\"apples\",\"bananas\",\"oranges\"],\"oranges\")"),((4,2),"= B5"),((5,0),"Comboedit"),((5,1),"= comboedit ([\"apples\",\"bananas\",\"oranges\"],\"bananas\")"),((5,2),"= B6"),((6,0),"Int Spinbox"),((6,1),"= spinbox (0,100,5,40)"),((6,2),"= B7"),((7,0),"Float Spinbox"),((7,1),"= spinbox (0.0,10.0,0.5,4.0)"),((7,2),"= B8"),((9,0),"Spinbox with special value"),((9,1),"= spinbox (-1,10,1,0,\"Any\")"),((9,2),"= B10"),((10,0),"Spinbox with prefix"),((10,1),"= spinbox (-0.1,10,0.1,0,\"Any\",\"$ \")"),((10,2),"= B11"),((11,0),"Spinbox with suffix"),((11,1),"= spinbox (-1,72,1,10,\"Any\",\"\",\"pt\")"),((11,2),"= B12"),((13,0),"Horizontal slider"),((13,1),"= hslider (0,100,1,50)"),((13,2),"= B14"),((14,0),"Vertical slider"),((14,1),"= vslider (0,100,1,50)"),((14,2),"= B15"),((16,0),"Pushbutton"),((16,1),"= pushbutton \"Push me!\""),((16,2),"= B17"),((17,0),"Pushbutton with icon"),((17,1),"= pushbutton (\"Push me!\",which \"pixmaps/1rightarrow.png\")"),((17,2),"= B18"),((18,0),"Togglebutton"),((18,1),"= togglebutton (\"Toggle me!\",which \"pixmaps/flag.png\")"),((18,2),"= B19"),((20,0),"GUI element A (click here)"),((20,1),"Transfer A -> B"),((20,2),"GUI element B"),((20,3),"Value of B"),((22,0),"= checkbox \"A\""),((22,1),"= setval 'C23 A23 || A23"),((22,2),"false"),((22,3),"= C23"),((23,0),"= spinbox (-0.1,10,0.1,0,\"Any\")"),((23,1),"= setval 'C24 A24 || A24"),((23,2),"= spinbox (-0.1,10,0.1,0,\"Any\")"),((23,3),"= C24"),((24,0),"= spinbox (-5,100,5,40,\"Any\")"),((24,1),"= setval 'C25 A25 || A25"),((24,2),"= spinbox (-5,100,5,40,\"Any\")"),((24,3),"= C25"),((25,0),"= combobox ([\"apples\",\"bananas\",\"oranges\"],\"oranges\")"),((25,1),"= setval 'C26 A26 || A26"),((25,2),"= combobox ([\"apples\",\"bananas\",\"oranges\"],\"oranges\")"),((25,3),"= C26"),((26,0),"= togglebutton (\"Toggle me!\",which \"pixmaps/flag.png\")"),((26,1),"= setval 'C27 A27 || A27"),((26,2),"= togglebutton (\"Toggle me!\",which \"pixmaps/flag.png\")"),((26,3),"= C27")] // [(14,55)] ! // [(0,151)] // Start of script. Please do not remove this line. --- 1,5 ---- ! // qcalc 1.0, created Wed Nov 7 23:18:25 2007 -*-Q-*- -*- coding: UTF-8 -*- ! // [((0,1),"GUI element"),((0,2),"Value"),((2,0),"Checkbox"),((2,1),"= checkbox (\"test\",true)"),((2,2),"= B3"),((4,0),"Combobox"),((4,1),"= combobox ([\"apples\",\"bananas\",\"oranges\"],\"oranges\")"),((4,2),"= B5"),((5,0),"Comboedit"),((5,1),"= comboedit ([\"apples\",\"bananas\",\"oranges\"],\"bananas\")"),((5,2),"= B6"),((6,0),"Int Spinbox"),((6,1),"= spinbox (0,100,5,40)"),((6,2),"= B7"),((7,0),"Float Spinbox"),((7,1),"= spinbox (0.0,10.0,0.5,4.0)"),((7,2),"= B8"),((9,0),"Spinbox with special value"),((9,1),"= spinbox (-1,10,1,0,\"Any\")"),((9,2),"= B10"),((10,0),"Spinbox with prefix"),((10,1),"= spinbox (-0.1,10,0.1,0,\"Any\",\"$ \")"),((10,2),"= B11"),((11,0),"Spinbox with suffix"),((11,1),"= spinbox (-1,72,1,10,\"Any\",\"\",\"pt\")"),((11,2),"= B12"),((13,0),"Horizontal slider"),((13,1),"= hslider (0,100,1,50)"),((13,2),"= B14"),((14,0),"Vertical slider"),((14,1),"= vslider (0,100,1,50)"),((14,2),"= B15"),((16,0),"Pushbutton"),((16,1),"= pushbutton \"Push me!\""),((16,2),"= B17"),((17,0),"Pushbutton with icon"),((17,1),"= pushbutton (\"Push me!\",which \"pixmaps/1rightarrow.png\")"),((17,2),"= B18"),((18,0),"Togglebutton with icon"),((18,1),"= togglebutton (\"Toggle me!\",which \"pixmaps/flag.png\")"),((18,2),"= B19"),((20,0),"Remote control of GUI elements"),((22,0),"GUI element A (click here)"),((22,1),"Transfer A -> B"),((22,2),"GUI element B (display)"),((22,3),"Value of B"),((24,0),"= checkbox \"A\""),((24,1),"= setval 'C25 A25 || A25"),((24,2),"= checkbox \"B\""),((24,3),"= C25"),((25,0),"= spinbox (-0.1,10,0.1,0,\"Any\")"),((25,1),"= setval 'C26 A26 || A26"),((25,2),"= spinbox (-0.1,10,0.1,0,\"Any\")"),((25,3),"= C26"),((26,0),"= spinbox (-5,100,5,40,\"Any\")"),((26,1),"= setval 'C27 A27 || A27"),((26,2),"= spinbox (-1,100,1,40,\"Any\")"),((26,3),"= C27"),((27,0),"= combobox ([\"apples\",\"bananas\",\"oranges\"],\"oranges\")"),((27,1),"= setval 'C28 A28 || A28"),((27,2),"= combobox ([\"apples\",\"bananas\",\"oranges\"],\"oranges\")"),((27,3),"= C28"),((28,0),"= togglebutton (\"Toggle me!\",which \"pixmaps/flag.png\")"),((28,1),"= setval 'C29 A29 || A29"),((28,2),"= togglebutton (\"Toggle me!\",which \"pixmaps/flag.png\")"),((28,3),"= C29")] // [(14,55)] ! // [(0,151),(2,139)] // Start of script. Please do not remove this line. |
From: Albert G. <ag...@us...> - 2007-11-07 22:08:52
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv23428 Modified Files: qcalc.q Log Message: bugfixes Index: qcalc.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/qcalc.q,v retrieving revision 1.109 retrieving revision 1.110 diff -C2 -d -r1.109 -r1.110 *** qcalc.q 7 Nov 2007 21:57:22 -0000 1.109 --- qcalc.q 7 Nov 2007 22:08:45 -0000 1.110 *************** *** 2564,2568 **** collect_results U [] // we're finished; process any pending cell updates ! = post MSGS $ zipwith append (keys U) (vals U); collect_results U [(I,J)|V] if get ABORTED: --- 2564,2569 ---- collect_results U [] // we're finished; process any pending cell updates ! = if not null U then ! post MSGS $ zipwith append (keys U) (vals U); collect_results U [(I,J)|V] if get ABORTED: |
From: Albert G. <ag...@us...> - 2007-11-07 21:57:27
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv18396 Modified Files: qcalc.q Log Message: code cleanup Index: qcalc.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/qcalc.q,v retrieving revision 1.108 retrieving revision 1.109 diff -C2 -d -r1.108 -r1.109 *** qcalc.q 7 Nov 2007 21:41:42 -0000 1.108 --- qcalc.q 7 Nov 2007 21:57:22 -0000 1.109 *************** *** 663,667 **** where [S] = regex "" "^\\+\\+\\+ Message: (.*)$" S (reg 1); = if is_qt_object X then ! (process_gui (I,J) X || digest_loop) else (process_sel2 [(I,J,X)] || merge_undo (I,J)) --- 663,667 ---- where [S] = regex "" "^\\+\\+\\+ Message: (.*)$" S (reg 1); = if is_qt_object X then ! (process_gui (I,J) (gui_elem (I,J)) || digest_loop) else (process_sel2 [(I,J,X)] || merge_undo (I,J)) *************** *** 678,682 **** process_update (I,J) S ! = gui_setval X S || X where X:QtObject = gui_elem (I,J); = if null S0 then delete_cells (I,J) else insert_cells ((I,J),S0) || S0 --- 678,683 ---- process_update (I,J) S ! = gui_setval X S || get CELLS!(I,J) ! where X:QtObject = gui_elem (I,J); = if null S0 then delete_cells (I,J) else insert_cells ((I,J),S0) || S0 *************** *** 686,690 **** process_update2 (I,J) S ! = gui_setval X S || X where X:QtObject = gui_elem (I,J); = if null S0 then delete_cells (I,J) else insert_cells ((I,J),S0) || --- 687,692 ---- process_update2 (I,J) S ! = gui_setval X S || get CELLS!(I,J) ! where X:QtObject = gui_elem (I,J); = if null S0 then delete_cells (I,J) else insert_cells ((I,J),S0) || *************** *** 2603,2607 **** qt TABLE "setCellWidget" (I1,J1,X) || insert_cells ((I1,J1),IT) || ! collect_results (insert U ((I1,J1),X)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Pushbutton: (\\([0-9]+,[0-9]+\\)) (.*)$" S --- 2605,2609 ---- qt TABLE "setCellWidget" (I1,J1,X) || insert_cells ((I1,J1),IT) || ! collect_results (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Pushbutton: (\\([0-9]+,[0-9]+\\)) (.*)$" S *************** *** 2630,2634 **** qt TABLE "setCellWidget" (I1,J1,X) || insert_cells ((I1,J1),IT) || ! collect_results (insert U ((I1,J1),X)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Togglebutton: (\\([0-9]+,[0-9]+\\)) (.*)$" S --- 2632,2636 ---- qt TABLE "setCellWidget" (I1,J1,X) || insert_cells ((I1,J1),IT) || ! collect_results (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Togglebutton: (\\([0-9]+,[0-9]+\\)) (.*)$" S *************** *** 2682,2686 **** qt TABLE "setCellWidget" (I1,J1,X) || insert_cells ((I1,J1),IT) || ! collect_results (insert U ((I1,J1),X)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Spinbox: (\\([0-9]+,[0-9]+\\)) (.*)$" S --- 2684,2688 ---- qt TABLE "setCellWidget" (I1,J1,X) || insert_cells ((I1,J1),IT) || ! collect_results (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Spinbox: (\\([0-9]+,[0-9]+\\)) (.*)$" S *************** *** 2707,2711 **** qt TABLE "setCellWidget" (I1,J1,X) || insert_cells ((I1,J1),IT) || ! collect_results (insert U ((I1,J1),X)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Slider: (\\([0-9]+,[0-9]+\\)) (.*)$" S --- 2709,2713 ---- qt TABLE "setCellWidget" (I1,J1,X) || insert_cells ((I1,J1),IT) || ! collect_results (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Slider: (\\([0-9]+,[0-9]+\\)) (.*)$" S |
From: Albert G. <ag...@us...> - 2007-11-07 21:41:49
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv10422 Modified Files: qcalc.q Log Message: code cleanup Index: qcalc.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/qcalc.q,v retrieving revision 1.107 retrieving revision 1.108 diff -C2 -d -r1.107 -r1.108 *** qcalc.q 7 Nov 2007 10:04:26 -0000 1.107 --- qcalc.q 7 Nov 2007 21:41:42 -0000 1.108 *************** *** 589,595 **** def LASTW = ref []; ! check_lastW (I,J,X:QtObject) = doprocess (I,J) ! if is_nil (qt TABLE "cellWidget" (I,J)); /* Timer processing. */ --- 589,595 ---- def LASTW = ref []; ! check_lastW (I,J,IT:QtObject) = doprocess (I,J) ! if is_nil X where X:QtObject = gui_elem (I,J); /* Timer processing. */ *************** *** 678,682 **** process_update (I,J) S ! = gui_setval X S || X where X:QtObject = get CELLS!(I,J); = if null S0 then delete_cells (I,J) else insert_cells ((I,J),S0) || S0 --- 678,682 ---- process_update (I,J) S ! = gui_setval X S || X where X:QtObject = gui_elem (I,J); = if null S0 then delete_cells (I,J) else insert_cells ((I,J),S0) || S0 *************** *** 686,690 **** process_update2 (I,J) S ! = gui_setval X S || X where X:QtObject = get CELLS!(I,J); = if null S0 then delete_cells (I,J) else insert_cells ((I,J),S0) || --- 686,690 ---- process_update2 (I,J) S ! = gui_setval X S || X where X:QtObject = gui_elem (I,J); = if null S0 then delete_cells (I,J) else insert_cells ((I,J),S0) || *************** *** 800,803 **** --- 800,817 ---- /* Some convenience functions for accessing the table. */ + is_empty (I,J) = false if member (get EVAL) (I,J); + = false if is_gui_elem (I,J); + = null S where S:String = qt TABLE "text" (I,J); + = true otherwise; + + is_gui_elem (I,J) + = true where _:QtObject = get CELLS!(I,J); + = false otherwise; + + gui_elem (I,J) + where IT:QtObject = get CELLS!(I,J): + = X where X:QtObject = qt_data IT; + = IT otherwise; + current_edited = (qt TABLE "currEditRow" (),qt TABLE "currEditCol" ()) if qt TABLE "isEditing" (); *************** *** 822,826 **** if global and then not get REDIT: = process_gui (I,J) X || digest_loop ! where X:QtObject = get CELLS!(I,J); = finish_edit true (I,J); --- 836,840 ---- if global and then not get REDIT: = process_gui (I,J) X || digest_loop ! where X:QtObject = gui_elem (I,J); = finish_edit true (I,J); *************** *** 877,881 **** if global and then (qt TABW "currentPageIndex" () = 0): = gui_enter (I,J) X ! where X:QtObject = get CELLS!(I,J); = accept S D A || qt TABLE "setCurrentCell" --- 891,895 ---- if global and then (qt TABW "currentPageIndex" () = 0): = gui_enter (I,J) X ! where X:QtObject = gui_elem (I,J); = accept S D A || qt TABLE "setCurrentCell" *************** *** 1445,1449 **** sel_cellcvals ()= []; sel_cval (I,J) ! where X:QtObject = get CELLS!(I,J): = str B where B:Bool = qt X "isChecked" (); = str B if not qt X "isToggleButton" () --- 1459,1463 ---- sel_cellcvals ()= []; sel_cval (I,J) ! where X:QtObject = gui_elem (I,J): = str B where B:Bool = qt X "isChecked" (); = str B if not qt X "isToggleButton" () *************** *** 2505,2509 **** cellval (I,J) ! where X:QtObject = get CELLS!(I,J): // these values come from the GUI elements in the table = 'Y where Y = gui_getval X; --- 2519,2523 ---- cellval (I,J) ! where X:QtObject = gui_elem (I,J): // these values come from the GUI elements in the table = 'Y where Y = gui_getval X; *************** *** 2588,2592 **** = qt TABLE "setItem" (I1,J1,IT) || qt TABLE "setCellWidget" (I1,J1,X) || ! insert_cells ((I1,J1),X) || collect_results (insert U ((I1,J1),X)) [(I,J)|V] where [(K1,S1)] = regex "" --- 2602,2606 ---- = qt TABLE "setItem" (I1,J1,IT) || qt TABLE "setCellWidget" (I1,J1,X) || ! insert_cells ((I1,J1),IT) || collect_results (insert U ((I1,J1),X)) [(I,J)|V] where [(K1,S1)] = regex "" *************** *** 2594,2599 **** (reg 1,reg 2), (I1,J1) = val K1, (TEXT,ICON) = val S1, - IT = qt_new "QTableItem" - (TABLE,qt_val "QTableItem" "Never"), ICONSET = if null ICON then () --- 2608,2611 ---- *************** *** 2606,2617 **** // slots [("guiUpdate()",gui_update)] [], _ = qt_connect X (SIGNAL "pressed()") X (SLOT "guiUpdate()") || qt_connect X (SIGNAL "released()") ! X (SLOT "guiUpdate()"); = qt X "setToggleButton" true || qt TABLE "setItem" (I1,J1,IT) || qt TABLE "setCellWidget" (I1,J1,X) || ! insert_cells ((I1,J1),X) || collect_results (insert U ((I1,J1),X)) [(I,J)|V] where [(K1,S1)] = regex "" --- 2618,2633 ---- // slots [("guiUpdate()",gui_update)] [], + IT = qt_object "QTableItem" + (TABLE,qt_val "QTableItem" "Never") + "MyTableItem" X [] [] [], _ = qt_connect X (SIGNAL "pressed()") X (SLOT "guiUpdate()") || qt_connect X (SIGNAL "released()") ! X (SLOT "guiUpdate()") || ! qt IT "setReplaceable" false; = qt X "setToggleButton" true || qt TABLE "setItem" (I1,J1,IT) || qt TABLE "setCellWidget" (I1,J1,X) || ! insert_cells ((I1,J1),IT) || collect_results (insert U ((I1,J1),X)) [(I,J)|V] where [(K1,S1)] = regex "" *************** *** 2619,2624 **** (reg 1,reg 2), (I1,J1) = val K1, (TEXT,ICON) = val S1, - IT = qt_new "QTableItem" - (TABLE,qt_val "QTableItem" "Never"), ICONSET = if null ICON then () --- 2635,2638 ---- *************** *** 2631,2638 **** // slots [("guiUpdate()",gui_update)] [], _ = qt_connect X (SIGNAL "toggled(bool)") X (SLOT "guiUpdate()") || qt_connect X (SIGNAL "released()") ! X (SLOT "guiUpdate()"); = recursive (qt IT "setCurrentItem" INIT) || qt TABLE "setItem" (I1,J1,IT) || --- 2645,2656 ---- // slots [("guiUpdate()",gui_update)] [], + IT = qt_object "QTableItem" + (TABLE,qt_val "QTableItem" "Never") + "MyTableItem" X [] [] [], _ = qt_connect X (SIGNAL "toggled(bool)") X (SLOT "guiUpdate()") || qt_connect X (SIGNAL "released()") ! X (SLOT "guiUpdate()") || ! qt IT "setReplaceable" false; = recursive (qt IT "setCurrentItem" INIT) || qt TABLE "setItem" (I1,J1,IT) || *************** *** 2663,2667 **** qt TABLE "setItem" (I1,J1,IT) || qt TABLE "setCellWidget" (I1,J1,X) || ! insert_cells ((I1,J1),X) || collect_results (insert U ((I1,J1),X)) [(I,J)|V] where [(K1,S1)] = regex "" --- 2681,2685 ---- qt TABLE "setItem" (I1,J1,IT) || qt TABLE "setCellWidget" (I1,J1,X) || ! insert_cells ((I1,J1),IT) || collect_results (insert U ((I1,J1),X)) [(I,J)|V] where [(K1,S1)] = regex "" *************** *** 2670,2675 **** (I1,J1) = val K1, (MIN,MAX,STEP,INIT,SPECIAL,PREF,SUFF,V2T,T2V) = val S1, - IT = qt_new "QTableItem" - (TABLE,qt_val "QTableItem" "Never"), X = qt_object "QSpinBox" (MIN,MAX,STEP,TABLE) "MySpinBox" (I1,J1) --- 2688,2691 ---- *************** *** 2678,2690 **** // slots [("guiUpdate()",gui_update)] [], _ = qt_connect X (SIGNAL "valueChanged(int)") X (SLOT "guiUpdate()") || // FIXME: implement more appropriate validation here // currently we just switch it off ! qt X "setValidator" nil; = recursive (qt X "setLineStep" LSTEP) || qt TABLE "setItem" (I1,J1,IT) || qt TABLE "setCellWidget" (I1,J1,X) || ! insert_cells ((I1,J1),X) || collect_results (insert U ((I1,J1),X)) [(I,J)|V] where [(K1,S1)] = regex "" --- 2694,2710 ---- // slots [("guiUpdate()",gui_update)] [], + IT = qt_object "QTableItem" + (TABLE,qt_val "QTableItem" "Never") + "MyTableItem" X [] [] [], _ = qt_connect X (SIGNAL "valueChanged(int)") X (SLOT "guiUpdate()") || // FIXME: implement more appropriate validation here // currently we just switch it off ! qt X "setValidator" nil || ! qt IT "setReplaceable" false; = recursive (qt X "setLineStep" LSTEP) || qt TABLE "setItem" (I1,J1,IT) || qt TABLE "setCellWidget" (I1,J1,X) || ! insert_cells ((I1,J1),IT) || collect_results (insert U ((I1,J1),X)) [(I,J)|V] where [(K1,S1)] = regex "" *************** *** 2693,2698 **** (I1,J1) = val K1, (MIN,MAX,STEP,INIT,VERT) = val S1, - IT = qt_new "QTableItem" - (TABLE,qt_val "QTableItem" "Never"), X = qt_object "QSlider" (MIN,MAX,STEP,INIT, --- 2713,2716 ---- *************** *** 2702,2707 **** // slots [("guiUpdate()",gui_update)] [], _ = qt_connect X (SIGNAL "valueChanged(int)") ! X (SLOT "guiUpdate()"); // anything else just gets passed to the digest function, and we try again = begin_local || digest S || end_local || --- 2720,2729 ---- // slots [("guiUpdate()",gui_update)] [], + IT = qt_object "QTableItem" + (TABLE,qt_val "QTableItem" "Never") + "MyTableItem" X [] [] [], _ = qt_connect X (SIGNAL "valueChanged(int)") ! X (SLOT "guiUpdate()") || ! qt IT "setReplaceable" false; // anything else just gets passed to the digest function, and we try again = begin_local || digest S || end_local || *************** *** 2805,2817 **** /* Process cell values after edits or after loading a new file. */ - is_empty (I,J) = false if member (get EVAL) (I,J); - = false where _:QtObject = get CELLS!(I,J); - = null S where S:String = qt TABLE "text" (I,J); - = true otherwise; - - is_gui_elem (I,J) - = true where _:QtObject = get CELLS!(I,J); - = false otherwise; - process_all = do flag U || compute_all V where (V,U) = eval_list --- 2827,2830 ---- |
From: Albert G. <ag...@us...> - 2007-11-07 10:07:31
|
Update of /cvsroot/q-lang/qcalc/examples In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13479/examples Added Files: guiexamples.qcalc Log Message: add gui element examples --- NEW FILE: guiexamples.qcalc --- // qcalc 1.0, created Wed Nov 7 11:04:34 2007 -*-Q-*- -*- coding: UTF-8 -*- // [((0,1),"GUI element"),((0,2),"Value"),((2,0),"Checkbox"),((2,1),"= checkbox (\"test\",true)"),((2,2),"= B3"),((4,0),"Combobox"),((4,1),"= combobox ([\"apples\",\"bananas\",\"oranges\"],\"oranges\")"),((4,2),"= B5"),((5,0),"Comboedit"),((5,1),"= comboedit ([\"apples\",\"bananas\",\"oranges\"],\"bananas\")"),((5,2),"= B6"),((6,0),"Int Spinbox"),((6,1),"= spinbox (0,100,5,40)"),((6,2),"= B7"),((7,0),"Float Spinbox"),((7,1),"= spinbox (0.0,10.0,0.5,4.0)"),((7,2),"= B8"),((9,0),"Spinbox with special value"),((9,1),"= spinbox (-1,10,1,0,\"Any\")"),((9,2),"= B10"),((10,0),"Spinbox with prefix"),((10,1),"= spinbox (-0.1,10,0.1,0,\"Any\",\"$ \")"),((10,2),"= B11"),((11,0),"Spinbox with suffix"),((11,1),"= spinbox (-1,72,1,10,\"Any\",\"\",\"pt\")"),((11,2),"= B12"),((13,0),"Horizontal slider"),((13,1),"= hslider (0,100,1,50)"),((13,2),"= B14"),((14,0),"Vertical slider"),((14,1),"= vslider (0,100,1,50)"),((14,2),"= B15"),((16,0),"Pushbutton"),((16,1),"= pushbutton \"Push me!\""),((16,2),"= B17"),((17,0),"Pushbutton with icon"),((17,1),"= pushbutton (\"Push me!\",which \"pixmaps/1rightarrow.png\")"),((17,2),"= B18"),((18,0),"Togglebutton"),((18,1),"= togglebutton (\"Toggle me!\",which \"pixmaps/flag.png\")"),((18,2),"= B19"),((20,0),"GUI element A (click here)"),((20,1),"Transfer A -> B"),((20,2),"GUI element B"),((20,3),"Value of B"),((22,0),"= checkbox \"A\""),((22,1),"= setval 'C23 A23 || A23"),((22,2),"false"),((22,3),"= C23"),((23,0),"= spinbox (-0.1,10,0.1,0,\"Any\")"),((23,1),"= setval 'C24 A24 || A24"),((23,2),"= spinbox (-0.1,10,0.1,0,\"Any\")"),((23,3),"= C24"),((24,0),"= spinbox (-5,100,5,40,\"Any\")"),((24,1),"= setval 'C25 A25 || A25"),((24,2),"= spinbox (-5,100,5,40,\"Any\")"),((24,3),"= C25"),((25,0),"= combobox ([\"apples\",\"bananas\",\"oranges\"],\"oranges\")"),((25,1),"= setval 'C26 A26 || A26"),((25,2),"= combobox ([\"apples\",\"bananas\",\"oranges\"],\"oranges\")"),((25,3),"= C26"),((26,0),"= togglebutton (\"Toggle me!\",which \"pixmaps/flag.png\")"),((26,1),"= setval 'C27 A27 || A27"),((26,2),"= togglebutton (\"Toggle me!\",which \"pixmaps/flag.png\")"),((26,3),"= C27")] // [(14,55)] // [(0,151)] // Start of script. Please do not remove this line. |
From: Albert G. <ag...@us...> - 2007-11-07 10:06:36
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13042 Modified Files: calclib.q Log Message: comment change Index: calclib.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/calclib.q,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** calclib.q 7 Nov 2007 03:50:39 -0000 1.15 --- calclib.q 7 Nov 2007 10:06:32 -0000 1.16 *************** *** 53,59 **** /* Definition of GUI elements in table cells. Currently supported are ! checkboxes, comboboxes (both non-editable and editable), spinboxes, hslider ! and vslider. You can find examples for all of these in guiexample.qcalc ! included in the QCalc distribution. The argument tuple ARGS depends on the specific kind of widget: --- 53,59 ---- /* Definition of GUI elements in table cells. Currently supported are ! checkboxes, comboboxes (both non-editable and editable), spinboxes, ! hslider, vslider, push buttons and toggle buttons. You can find examples ! for all of these in guiexamples.qcalc included in the QCalc distribution. The argument tuple ARGS depends on the specific kind of widget: |
From: Albert G. <ag...@us...> - 2007-11-07 10:04:29
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv12831 Modified Files: qcalc.q Log Message: more bugfixes Index: qcalc.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/qcalc.q,v retrieving revision 1.106 retrieving revision 1.107 diff -C2 -d -r1.106 -r1.107 *** qcalc.q 7 Nov 2007 09:24:48 -0000 1.106 --- qcalc.q 7 Nov 2007 10:04:26 -0000 1.107 *************** *** 404,412 **** = CELLS := Xs; insert_cells ((I,J),X) ! = chk (I,J) || CELLS := insert (get CELLS) ((I,J),X); insert_cells Xs:List = CELLS := foldl insert (get CELLS) Xs; delete_cells (I,J) ! = chk (I,J) || CELLS := delete (get CELLS) (I,J); delete_cells Xs:List = CELLS := foldl delete (get CELLS) Xs; --- 404,412 ---- = CELLS := Xs; insert_cells ((I,J),X) ! = CELLS := insert (get CELLS) ((I,J),X); insert_cells Xs:List = CELLS := foldl insert (get CELLS) Xs; delete_cells (I,J) ! = CELLS := delete (get CELLS) (I,J); delete_cells Xs:List = CELLS := foldl delete (get CELLS) Xs; *************** *** 416,433 **** = EVAL := Xs; insert_eval ((I,J),X) ! = chk (I,J) || EVAL := insert (get EVAL) ((I,J),X); insert_eval Xs:List = EVAL := foldl insert (get EVAL) Xs; delete_eval (I,J) ! = chk (I,J) || EVAL := delete (get EVAL) (I,J); delete_eval Xs:List = EVAL := foldl delete (get EVAL) Xs; filter_eval P = EVAL := hdict $ filter P $ list $ get EVAL; - chk (I,J) = printf "warning: overwriting GUI object %s at %s\n" - (str X,str (I,J)) - if not is_nil X - where X:QtObject = get CELLS!(I,J); - /* Dialogs. */ --- 416,428 ---- = EVAL := Xs; insert_eval ((I,J),X) ! = EVAL := insert (get EVAL) ((I,J),X); insert_eval Xs:List = EVAL := foldl insert (get EVAL) Xs; delete_eval (I,J) ! = EVAL := delete (get EVAL) (I,J); delete_eval Xs:List = EVAL := foldl delete (get EVAL) Xs; filter_eval P = EVAL := hdict $ filter P $ list $ get EVAL; /* Dialogs. */ *************** *** 695,699 **** else insert_cells ((I,J),S0) || clear_cell (I,J) || set_cell (I,J) S || ! delete_eval (I,J) || S0 where (S0,S1) = unquote S; --- 690,695 ---- else insert_cells ((I,J),S0) || clear_cell (I,J) || set_cell (I,J) S || ! //delete_eval (I,J) || ! S0 where (S0,S1) = unquote S; |
From: Albert G. <ag...@us...> - 2007-11-07 09:24:51
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv9029 Modified Files: qcalc.q Log Message: fix some of the problems with vanishing GUI elements Index: qcalc.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/qcalc.q,v retrieving revision 1.105 retrieving revision 1.106 diff -C2 -d -r1.105 -r1.106 *** qcalc.q 7 Nov 2007 08:17:18 -0000 1.105 --- qcalc.q 7 Nov 2007 09:24:48 -0000 1.106 *************** *** 427,430 **** --- 427,431 ---- chk (I,J) = printf "warning: overwriting GUI object %s at %s\n" (str X,str (I,J)) + if not is_nil X where X:QtObject = get CELLS!(I,J); *************** *** 573,579 **** recursive X = REDIT := true || X || REDIT := false; ! /* XXXFIXME: Yet another horrible kludge to set the current cell to the one ! which holds one of our GUI elements if it gets the focus. Unfortunately, ! this isn't handled automatically by Qt. */ check_focus N X = qt TABLE "setCurrentCell" (I,J) || --- 574,580 ---- recursive X = REDIT := true || X || REDIT := false; ! /* XXXFIXME: A horrible kludge to set the current cell to the one which holds ! one of our GUI elements if it gets the focus. Unfortunately, this isn't ! handled automatically by Qt. */ check_focus N X = qt TABLE "setCurrentCell" (I,J) || *************** *** 587,590 **** --- 588,601 ---- if N < 5; + /* FIXME: And yet another desperate kludge. For some reasons I don't + understand, Qt sometimes "looses" the cell widgets created with + doprocess. We make up for that by just running doprocess again. */ + + def LASTW = ref []; + + check_lastW (I,J,X:QtObject) + = doprocess (I,J) + if is_nil (qt TABLE "cellWidget" (I,J)); + /* Timer processing. */ *************** *** 597,601 **** set_status HAVE_UNDO EDIT_UNDO || set_status HAVE_REDO EDIT_REDO || ! check_focus 0 (qt APP "focusWidget" ()) || digest_loop where HAVE_TABLE = (qt TABW "currentPageIndex" () = 0), --- 608,614 ---- set_status HAVE_UNDO EDIT_UNDO || set_status HAVE_REDO EDIT_REDO || ! do check_lastW (get LASTW) || LASTW := [] || ! check_focus 0 (qt APP "focusWidget" ()) || ! digest_loop where HAVE_TABLE = (qt TABW "currentPageIndex" () = 0), *************** *** 646,650 **** digest "+++ Exiting." = STATE := 0; ! digest W:List = process_sel2 W || merge_undo $ map (flip (flip sub 0) 1) W if get STATE = 4; digest S:String = /* The program generated output before we got the "Ready" --- 659,664 ---- digest "+++ Exiting." = STATE := 0; ! digest W:List = process_sel2 W || merge_undo $ map (flip (flip sub 0) 1) W || ! LASTW := filter (is_qt_object.trd) W if get STATE = 4; digest S:String = /* The program generated output before we got the "Ready" |
From: Albert G. <ag...@us...> - 2007-11-07 08:17:26
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv522 Modified Files: qcalc.q Log Message: code cleanup, bugfixes, code to debug vanishing gui elements Index: qcalc.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/qcalc.q,v retrieving revision 1.104 retrieving revision 1.105 diff -C2 -d -r1.104 -r1.105 *** qcalc.q 7 Nov 2007 05:34:08 -0000 1.104 --- qcalc.q 7 Nov 2007 08:17:18 -0000 1.105 *************** *** 404,412 **** = CELLS := Xs; insert_cells ((I,J),X) ! = CELLS := insert (get CELLS) ((I,J),X); insert_cells Xs:List = CELLS := foldl insert (get CELLS) Xs; delete_cells (I,J) ! = CELLS := delete (get CELLS) (I,J); delete_cells Xs:List = CELLS := foldl delete (get CELLS) Xs; --- 404,412 ---- = CELLS := Xs; insert_cells ((I,J),X) ! = chk (I,J) || CELLS := insert (get CELLS) ((I,J),X); insert_cells Xs:List = CELLS := foldl insert (get CELLS) Xs; delete_cells (I,J) ! = chk (I,J) || CELLS := delete (get CELLS) (I,J); delete_cells Xs:List = CELLS := foldl delete (get CELLS) Xs; *************** *** 416,428 **** = EVAL := Xs; insert_eval ((I,J),X) ! = EVAL := insert (get EVAL) ((I,J),X); insert_eval Xs:List = EVAL := foldl insert (get EVAL) Xs; delete_eval (I,J) ! = EVAL := delete (get EVAL) (I,J); delete_eval Xs:List = EVAL := foldl delete (get EVAL) Xs; filter_eval P = EVAL := hdict $ filter P $ list $ get EVAL; /* Dialogs. */ --- 416,432 ---- = EVAL := Xs; insert_eval ((I,J),X) ! = chk (I,J) || EVAL := insert (get EVAL) ((I,J),X); insert_eval Xs:List = EVAL := foldl insert (get EVAL) Xs; delete_eval (I,J) ! = chk (I,J) || EVAL := delete (get EVAL) (I,J); delete_eval Xs:List = EVAL := foldl delete (get EVAL) Xs; filter_eval P = EVAL := hdict $ filter P $ list $ get EVAL; + chk (I,J) = printf "warning: overwriting GUI object %s at %s\n" + (str X,str (I,J)) + where X:QtObject = get CELLS!(I,J); + /* Dialogs. */ *************** *** 593,602 **** set_status HAVE_UNDO EDIT_UNDO || set_status HAVE_REDO EDIT_REDO || - /* KLUDGE ALERT: We sometimes don't get a proper callback if - the user navigates away (using the mouse) from a formula - cell being edited, so make sure that we properly finalize - the edit here. */ - if not EDITING and then neq () (get LAST_EDIT) then - finish_edit true (get LAST_EDIT) || check_focus 0 (qt APP "focusWidget" ()) || digest_loop --- 597,600 ---- *************** *** 680,686 **** process_update2 (I,J) S = gui_setval X S || X where X:QtObject = get CELLS!(I,J); ! = clear_cell (I,J) || set_cell (I,J) S || ! if null S0 then delete_cells (I,J) else insert_cells ((I,J),S0) || delete_eval (I,J) || S0 where (S0,S1) = unquote S; --- 678,684 ---- process_update2 (I,J) S = gui_setval X S || X where X:QtObject = get CELLS!(I,J); ! = if null S0 then delete_cells (I,J) else insert_cells ((I,J),S0) || + clear_cell (I,J) || set_cell (I,J) S || delete_eval (I,J) || S0 where (S0,S1) = unquote S; *************** *** 792,795 **** --- 790,795 ---- /* Some convenience functions for accessing the table. */ + current_edited = (qt TABLE "currEditRow" (),qt TABLE "currEditCol" ()) + if qt TABLE "isEditing" (); current_cell = (current_row,current_col); current_row = qt TABLE "currentRow" (); *************** *** 799,812 **** clear_cell (I,J) - /* KLUDGE: Stop editing a GUI element before we clear the cell. - Otherwise the cell seems to be stuck in editing mode (Qt bug?). */ - // This doesn't appear to work (causes segfaults). Disabled for now. - // = qt TABLE "clearCellWidget" (I,J) || - // qt TABLE "takeItem" X || - // qt TABLE "setEditMode" (qt_val "QTable" "NotEditing",I,J) || - // //if qt TABLE "isEditing" () then puts "PANIC!\n" || - // fail // falls through to default case below - // where X:QtObject = get CELLS!(I,J) - // if qt TABLE "isEditing" () and then ((I,J)=current_cell); = qt TABLE "clearCell" (I,J); --- 799,802 ---- *************** *** 904,918 **** check_editing ! where (I,J) = current_cell: = // Try to force the table out of edit mode when a GUI // element is being edited. ! if qt TABW "currentPageIndex" () = 0 then ! qt TABLE "setEditMode" (I,J,qt_val "QTable" "NotEditing") ! if qt TABLE "isEditing" () and then is_gui_elem (I,J); = EDITED := true || recursive (qt TABLE "endEdit" (I,J,true,false)) || ! finish_edit true (I,J) ! if qt TABLE "isEditing" (); ! = finish_edit true (I,J) where (I,J) = get LAST_EDIT; /* Various status updates. */ --- 894,907 ---- check_editing ! where (I,J) = current_edited: = // Try to force the table out of edit mode when a GUI // element is being edited. ! qt TABLE "setEditMode" (qt_val "QTable" "NotEditing",I,J) ! if is_gui_elem (I,J); = EDITED := true || recursive (qt TABLE "endEdit" (I,J,true,false)) || ! finish_edit true (I,J); ! where (I,J) = get LAST_EDIT: ! = finish_edit true (I,J); /* Various status updates. */ *************** *** 2852,2864 **** process1 (CELLS,EVAL) (I,J,S) ! = clear_cell (I,J) || ! (insert CELLS ((I,J),true),insert EVAL (I,J;S,'X,DEPS)) where ("=",S) = (hd S,trim (tl S)), ! 'X = parse S, DEPS = deps 'X; ! = clear_cell (I,J) || set_cell (I,J) S || ! (insert CELLS ((I,J),true),delete EVAL (I,J)) if not null S; ! = clear_cell (I,J) || ! (delete CELLS (I,J),delete EVAL (I,J)) otherwise; --- 2841,2856 ---- process1 (CELLS,EVAL) (I,J,S) ! = clear_cell (I,J) || (CELLS,EVAL) where ("=",S) = (hd S,trim (tl S)), ! 'X = parse S, DEPS = deps 'X, ! (CELLS,EVAL) = ! (insert CELLS ((I,J),true),insert EVAL (I,J;S,'X,DEPS)); ! = clear_cell (I,J) || set_cell (I,J) S || (CELLS,EVAL) ! where (CELLS,EVAL) = ! (insert CELLS ((I,J),true),delete EVAL (I,J)) if not null S; ! = clear_cell (I,J) || (CELLS,EVAL) ! where (CELLS,EVAL) = ! (delete CELLS (I,J),delete EVAL (I,J)) otherwise; *************** *** 2872,2886 **** process2 (CELLS,EVAL) (I,J,S) = (CELLS,EVAL) if is_qt_object S; ! = clear_cell (I,J) || ! (insert CELLS ((I,J),true),insert EVAL (I,J;S,'X,DEPS)) where ("=",S) = (hd S,trim (tl S)), ! 'X = parse S, DEPS = deps 'X; ! = clear_cell (I,J) || set_cell (I,J) S1 || ! (insert CELLS ((I,J),S0),delete EVAL (I,J)) where S0 = CELLS!(I,J), ! (S0,S1) = if isstr S0 then unquote S else (true,S) if not null S; ! = clear_cell (I,J) || ! (delete CELLS (I,J),delete EVAL (I,J)) otherwise; --- 2864,2881 ---- process2 (CELLS,EVAL) (I,J,S) = (CELLS,EVAL) if is_qt_object S; ! = clear_cell (I,J) || (CELLS,EVAL) where ("=",S) = (hd S,trim (tl S)), ! 'X = parse S, DEPS = deps 'X, ! (CELLS,EVAL) = ! (insert CELLS ((I,J),true),insert EVAL (I,J;S,'X,DEPS)); ! = clear_cell (I,J) || set_cell (I,J) S1 || (CELLS,EVAL) where S0 = CELLS!(I,J), ! (S0,S1) = if isstr S0 then unquote S else (true,S), ! (CELLS,EVAL) = ! (insert CELLS ((I,J),S0),delete EVAL (I,J)) if not null S; ! = clear_cell (I,J) || (CELLS,EVAL) ! where (CELLS,EVAL) = ! (delete CELLS (I,J),delete EVAL (I,J)) otherwise; |
From: Albert G. <ag...@us...> - 2007-11-07 05:34:14
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv3108 Modified Files: qcalc.q Log Message: cosmetic changes Index: qcalc.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/qcalc.q,v retrieving revision 1.103 retrieving revision 1.104 diff -C2 -d -r1.103 -r1.104 *** qcalc.q 7 Nov 2007 05:31:09 -0000 1.103 --- qcalc.q 7 Nov 2007 05:34:08 -0000 1.104 *************** *** 577,583 **** if (I,J)<>current_cell where (I,J) = qt_data X; = check_focus (N+1) X if not is_nil X where X:QtObject = qt_parent X ! if N <= 4; // check for a maximum of 4 levels /* Timer processing. */ --- 577,585 ---- if (I,J)<>current_cell where (I,J) = qt_data X; + // check for a maximum of 5 levels; this should be good enough for most + // purposes = check_focus (N+1) X if not is_nil X where X:QtObject = qt_parent X ! if N < 5; /* Timer processing. */ |
From: Albert G. <ag...@us...> - 2007-11-07 05:31:14
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv2726 Modified Files: qcalc.q Log Message: code cleanup Index: qcalc.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/qcalc.q,v retrieving revision 1.102 retrieving revision 1.103 diff -C2 -d -r1.102 -r1.103 *** qcalc.q 7 Nov 2007 04:37:46 -0000 1.102 --- qcalc.q 7 Nov 2007 05:31:09 -0000 1.103 *************** *** 189,196 **** FFORMAT = ref $ sprintf "%%0.%dg" DEF_PREC; ! check () = (); ! check _ = statusmsg $ sprintf "Error loading file: %s" $ ARGV!1 || ! mark_undo [] || init_interp ! otherwise; def RED = qt_color (128,0,0), GREEN = qt_color (0,128,0), --- 189,193 ---- FFORMAT = ref $ sprintf "%%0.%dg" DEF_PREC; ! /* Some color values for the highlighting engine. */ def RED = qt_color (128,0,0), GREEN = qt_color (0,128,0), *************** *** 290,293 **** --- 287,295 ---- HL = highlighting_enabled; + check () = (); + check _ = statusmsg $ sprintf "Error loading file: %s" $ ARGV!1 || + mark_undo [] || init_interp + otherwise; + /* Horrible kludge to allow the user to abort a window close action. This is necessary since currently we cannot override the close method of a *************** *** 347,351 **** qadic B N = list $ map (mod B) $ takewhile (>0) $ iterate (div B) N; ! // manage defaults save_defaults DEFAULTS VALS --- 349,353 ---- qadic B N = list $ map (mod B) $ takewhile (>0) $ iterate (div B) N; ! /* Manage the application defaults. */ save_defaults DEFAULTS VALS *************** *** 370,374 **** = VAL otherwise; ! // manage the Recent files menu def FILES = ref []; --- 372,376 ---- = VAL otherwise; ! /* Manage the Recent files menu. */ def FILES = ref []; *************** *** 397,400 **** --- 399,428 ---- (get FILES) [1..#get FILES]; + /* Manage the internal representation of the cell data. */ + + set_cells Xs:HDict + = CELLS := Xs; + insert_cells ((I,J),X) + = CELLS := insert (get CELLS) ((I,J),X); + insert_cells Xs:List + = CELLS := foldl insert (get CELLS) Xs; + delete_cells (I,J) + = CELLS := delete (get CELLS) (I,J); + delete_cells Xs:List + = CELLS := foldl delete (get CELLS) Xs; + filter_cells P = CELLS := hdict $ filter P $ list $ get CELLS; + + set_eval Xs:HDict + = EVAL := Xs; + insert_eval ((I,J),X) + = EVAL := insert (get EVAL) ((I,J),X); + insert_eval Xs:List + = EVAL := foldl insert (get EVAL) Xs; + delete_eval (I,J) + = EVAL := delete (get EVAL) (I,J); + delete_eval Xs:List + = EVAL := foldl delete (get EVAL) Xs; + filter_eval P = EVAL := hdict $ filter P $ list $ get EVAL; + /* Dialogs. */ *************** *** 642,648 **** process_update (I,J) S = gui_setval X S || X where X:QtObject = get CELLS!(I,J); ! = CELLS := ! (if null S0 then delete (get CELLS) (I,J) ! else insert (get CELLS) ((I,J),S0)) || S0 where (S0,S1) = unquote S; --- 670,675 ---- process_update (I,J) S = gui_setval X S || X where X:QtObject = get CELLS!(I,J); ! = if null S0 then delete_cells (I,J) ! else insert_cells ((I,J),S0) || S0 where (S0,S1) = unquote S; *************** *** 652,658 **** = gui_setval X S || X where X:QtObject = get CELLS!(I,J); = clear_cell (I,J) || set_cell (I,J) S || ! CELLS := (if null S0 then delete (get CELLS) (I,J) ! else insert (get CELLS) ((I,J),S0)) || ! EVAL := delete (get EVAL) (I,J) || S0 where (S0,S1) = unquote S; --- 679,685 ---- = gui_setval X S || X where X:QtObject = get CELLS!(I,J); = clear_cell (I,J) || set_cell (I,J) S || ! if null S0 then delete_cells (I,J) ! else insert_cells ((I,J),S0) || ! delete_eval (I,J) || S0 where (S0,S1) = unquote S; *************** *** 809,813 **** if global and then (qt TABW "currentPageIndex" () = 0): = LAST_EDIT := (I,J) || ! CELLS := insert (get CELLS) ((I,J),true) || clear_cell (I,J) || set_cell (I,J) (sprintf "= %s" S) || --- 836,840 ---- if global and then (qt TABW "currentPageIndex" () = 0): = LAST_EDIT := (I,J) || ! insert_cells ((I,J),true) || clear_cell (I,J) || set_cell (I,J) (sprintf "= %s" S) || *************** *** 875,879 **** check_editing ! if not is_gui_elem (I,J) where (I,J) = current_cell: = EDITED := true || recursive (qt TABLE "endEdit" (I,J,true,false)) || --- 902,911 ---- check_editing ! where (I,J) = current_cell: ! = // Try to force the table out of edit mode when a GUI ! // element is being edited. ! if qt TABW "currentPageIndex" () = 0 then ! qt TABLE "setEditMode" (I,J,qt_val "QTable" "NotEditing") ! if qt TABLE "isEditing" () and then is_gui_elem (I,J); = EDITED := true || recursive (qt TABLE "endEdit" (I,J,true,false)) || *************** *** 1144,1151 **** validate_cell_data (N,M) ! = CELLS := (hdict $ filter (valid_cell (N,M).fst) $ list $ ! get CELLS) || ! EVAL := (hdict $ filter (valid_cell (N,M).fst) $ list $ ! get EVAL); valid_cell (N,M) (I,J|_) --- 1176,1181 ---- validate_cell_data (N,M) ! = filter_cells (valid_cell (N,M).fst) || ! filter_eval (valid_cell (N,M).fst); valid_cell (N,M) (I,J|_) *************** *** 1589,1595 **** EDITED := false || qt EDIT "setModified" false || FILENAME := NAME || update_title || - // clear the current cell first, to finish off any - // pending GUI element interaction - clear_cell current_cell || do (qt TABLE "clearCell") (keys (get CELLS)) || CELLS := hdict (zip KEYS (map (cst true) KEYS)) || --- 1619,1622 ---- *************** *** 1638,1642 **** EDITED := false || qt EDIT "setModified" false || FILENAME := NAME || update_title || - clear_cell current_cell || do (qt TABLE "clearCell") (keys (get CELLS)) || do (\I.qt TABLE "setRowHeight" (I,DEF_HT)) ROWS || --- 1665,1668 ---- *************** *** 1658,1662 **** EDITED := false || qt EDIT "setModified" false || FILENAME := () || update_title || - clear_cell current_cell || do (qt TABLE "clearCell") (keys (get CELLS)) || do (\I.qt TABLE "setRowHeight" (I,DEF_HT)) ROWS || --- 1684,1687 ---- *************** *** 2553,2557 **** = recursive (qt IT "setChecked" INIT) || qt TABLE "setItem" (I1,J1,IT) || ! CELLS := insert (get CELLS) ((I1,J1),IT) || collect_results (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" --- 2578,2582 ---- = recursive (qt IT "setChecked" INIT) || qt TABLE "setItem" (I1,J1,IT) || ! insert_cells ((I1,J1),IT) || collect_results (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" *************** *** 2562,2566 **** = qt TABLE "setItem" (I1,J1,IT) || qt TABLE "setCellWidget" (I1,J1,X) || ! CELLS := insert (get CELLS) ((I1,J1),X) || collect_results (insert U ((I1,J1),X)) [(I,J)|V] where [(K1,S1)] = regex "" --- 2587,2591 ---- = qt TABLE "setItem" (I1,J1,IT) || qt TABLE "setCellWidget" (I1,J1,X) || ! insert_cells ((I1,J1),X) || collect_results (insert U ((I1,J1),X)) [(I,J)|V] where [(K1,S1)] = regex "" *************** *** 2587,2591 **** qt TABLE "setItem" (I1,J1,IT) || qt TABLE "setCellWidget" (I1,J1,X) || ! CELLS := insert (get CELLS) ((I1,J1),X) || collect_results (insert U ((I1,J1),X)) [(I,J)|V] where [(K1,S1)] = regex "" --- 2612,2616 ---- qt TABLE "setItem" (I1,J1,IT) || qt TABLE "setCellWidget" (I1,J1,X) || ! insert_cells ((I1,J1),X) || collect_results (insert U ((I1,J1),X)) [(I,J)|V] where [(K1,S1)] = regex "" *************** *** 2611,2615 **** = recursive (qt IT "setCurrentItem" INIT) || qt TABLE "setItem" (I1,J1,IT) || ! CELLS := insert (get CELLS) ((I1,J1),IT) || collect_results (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" --- 2636,2640 ---- = recursive (qt IT "setCurrentItem" INIT) || qt TABLE "setItem" (I1,J1,IT) || ! insert_cells ((I1,J1),IT) || collect_results (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" *************** *** 2620,2624 **** = recursive (qt IT "setCurrentItem" INIT) || qt TABLE "setItem" (I1,J1,IT) || ! CELLS := insert (get CELLS) ((I1,J1),IT) || collect_results (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" --- 2645,2649 ---- = recursive (qt IT "setCurrentItem" INIT) || qt TABLE "setItem" (I1,J1,IT) || ! insert_cells ((I1,J1),IT) || collect_results (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" *************** *** 2637,2641 **** qt TABLE "setItem" (I1,J1,IT) || qt TABLE "setCellWidget" (I1,J1,X) || ! CELLS := insert (get CELLS) ((I1,J1),X) || collect_results (insert U ((I1,J1),X)) [(I,J)|V] where [(K1,S1)] = regex "" --- 2662,2666 ---- qt TABLE "setItem" (I1,J1,IT) || qt TABLE "setCellWidget" (I1,J1,X) || ! insert_cells ((I1,J1),X) || collect_results (insert U ((I1,J1),X)) [(I,J)|V] where [(K1,S1)] = regex "" *************** *** 2660,2664 **** qt TABLE "setItem" (I1,J1,IT) || qt TABLE "setCellWidget" (I1,J1,X) || ! CELLS := insert (get CELLS) ((I1,J1),X) || collect_results (insert U ((I1,J1),X)) [(I,J)|V] where [(K1,S1)] = regex "" --- 2685,2689 ---- qt TABLE "setItem" (I1,J1,IT) || qt TABLE "setCellWidget" (I1,J1,X) || ! insert_cells ((I1,J1),X) || collect_results (insert U ((I1,J1),X)) [(I,J)|V] where [(K1,S1)] = regex "" *************** *** 2701,2705 **** update_cell (I,J) S = () if is_gui_elem (I,J); ! = CELLS := insert (get CELLS) ((I,J),S) || set_cell (I,J) (fformat S) || set_pixmap (I,J) RES; --- 2726,2730 ---- update_cell (I,J) S = () if is_gui_elem (I,J); ! = insert_cells ((I,J),S) || set_cell (I,J) (fformat S) || set_pixmap (I,J) RES; *************** *** 2792,2796 **** if check_interp; ! doprocess (I,J) = CELLS := insert (get CELLS) ((I,J),true) || clear_cell (I,J) || // flag "bad" cells (cyclic computations) --- 2817,2821 ---- if check_interp; ! doprocess (I,J) = insert_cells ((I,J),true) || clear_cell (I,J) || // flag "bad" cells (cyclic computations) *************** *** 2801,2805 **** V = dropwhile (<>(I,J)) V; ! process (I,J) S = EVAL := insert (get EVAL) (I,J;S,'X,DEPS) || doprocess (I,J) where ("=",S) = (hd S,trim (tl S)), --- 2826,2830 ---- V = dropwhile (<>(I,J)) V; ! process (I,J) S = insert_eval (I,J;S,'X,DEPS) || doprocess (I,J) where ("=",S) = (hd S,trim (tl S)), *************** *** 2807,2818 **** = clear (I,J) otherwise; ! clear (I,J) = CELLS := ! (if is_empty (I,J) then delete (get CELLS) (I,J) ! else insert (get CELLS) ((I,J),true)) || clear_cell (I,J) || set_cell (I,J) S || if check_interp then compute (I,J) V where S = qt TABLE "text" (I,J), ! _ = EVAL := delete (get EVAL) (I,J), (V,U) = eval_list; --- 2832,2842 ---- = clear (I,J) otherwise; ! clear (I,J) = if is_empty (I,J) then delete_cells (I,J) ! else insert_cells ((I,J),true) || clear_cell (I,J) || set_cell (I,J) S || if check_interp then compute (I,J) V where S = qt TABLE "text" (I,J), ! _ = delete_eval (I,J), (V,U) = eval_list; *************** *** 2839,2843 **** process_sel W = do flag U || if check_interp then compute W V where (C,E) = foldl process1 (get CELLS,get EVAL) W, ! _ = CELLS := C || EVAL := E, W = map (flip (flip sub 0) 1) W, (V,U) = eval_list --- 2863,2867 ---- process_sel W = do flag U || if check_interp then compute W V where (C,E) = foldl process1 (get CELLS,get EVAL) W, ! _ = set_cells C || set_eval E, W = map (flip (flip sub 0) 1) W, (V,U) = eval_list *************** *** 2862,2866 **** where //_ = printf "*** pending updates: %s\n" $ str W, (C,E) = foldl process2 (get CELLS,get EVAL) W, ! _ = CELLS := C || EVAL := E, W = map (flip (flip sub 0) 1) W, (V,U) = eval_list --- 2886,2890 ---- where //_ = printf "*** pending updates: %s\n" $ str W, (C,E) = foldl process2 (get CELLS,get EVAL) W, ! _ = set_cells C || set_eval E, W = map (flip (flip sub 0) 1) W, (V,U) = eval_list *************** *** 2868,2873 **** clear_sel W = do clear_cell W || compute W V ! where _ = CELLS := foldl delete (get CELLS) W || ! EVAL := foldl delete (get EVAL) W, (V,U) = eval_list if not null W and then check_interp; --- 2892,2896 ---- clear_sel W = do clear_cell W || compute W V ! where _ = delete_cells W || delete_eval W, (V,U) = eval_list if not null W and then check_interp; |
From: Albert G. <ag...@us...> - 2007-11-07 04:37:52
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv12254 Modified Files: qcalc.q Log Message: bugfixes Index: qcalc.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/qcalc.q,v retrieving revision 1.101 retrieving revision 1.102 diff -C2 -d -r1.101 -r1.102 *** qcalc.q 7 Nov 2007 03:50:40 -0000 1.101 --- qcalc.q 7 Nov 2007 04:37:46 -0000 1.102 *************** *** 772,782 **** /* KLUDGE: Stop editing a GUI element before we clear the cell. Otherwise the cell seems to be stuck in editing mode (Qt bug?). */ ! = qt TABLE "clearCellWidget" (I,J) || ! qt TABLE "takeItem" X || ! qt TABLE "setEditMode" (qt_val "QTable" "NotEditing",I,J) || ! //if qt TABLE "isEditing" () then puts "PANIC!\n" || ! fail // falls through to default case below ! where X:QtObject = get CELLS!(I,J) ! if qt TABLE "isEditing" () and then ((I,J)=current_cell); = qt TABLE "clearCell" (I,J); --- 772,783 ---- /* KLUDGE: Stop editing a GUI element before we clear the cell. Otherwise the cell seems to be stuck in editing mode (Qt bug?). */ ! // This doesn't appear to work (causes segfaults). Disabled for now. ! // = qt TABLE "clearCellWidget" (I,J) || ! // qt TABLE "takeItem" X || ! // qt TABLE "setEditMode" (qt_val "QTable" "NotEditing",I,J) || ! // //if qt TABLE "isEditing" () then puts "PANIC!\n" || ! // fail // falls through to default case below ! // where X:QtObject = get CELLS!(I,J) ! // if qt TABLE "isEditing" () and then ((I,J)=current_cell); = qt TABLE "clearCell" (I,J); *************** *** 1404,1408 **** sel_val (I,J) = sprintf "= %s" S where (S,_,_) = get EVAL!(I,J); ! = qt TABLE "text" (I,J) otherwise; sel_cvals (I0,J0;I1,J1;I2,J2) = [[sel_cval (I,J) : J in [J1..J2]] : I in [I1..I2]]; --- 1405,1409 ---- sel_val (I,J) = sprintf "= %s" S where (S,_,_) = get EVAL!(I,J); ! = sel_cval (I,J) otherwise; sel_cvals (I0,J0;I1,J1;I2,J2) = [[sel_cval (I,J) : J in [J1..J2]] : I in [I1..I2]]; *************** *** 1518,1522 **** statusmsg "Done" where KEYS = keys (get CELLS), ! D = hdict (zip KEYS (map (qt TABLE "text") KEYS)), (KEYS,VALS) = unzip (list (get EVAL)), VALS = map (sprintf "= %s".fst) VALS, --- 1519,1523 ---- statusmsg "Done" where KEYS = keys (get CELLS), ! D = hdict (zip KEYS (map sel_cval KEYS)), (KEYS,VALS) = unzip (list (get EVAL)), VALS = map (sprintf "= %s".fst) VALS, *************** *** 2092,2096 **** where [L0|UL] = get UNDO_LIST if not null L ! where L = undo_cellvals L; undo_cellvals (I,J) --- 2093,2097 ---- where [L0|UL] = get UNDO_LIST if not null L ! where L = filter (neg is_gui_elem.fst) $ undo_cellvals L; undo_cellvals (I,J) |
From: Albert G. <ag...@us...> - 2007-11-07 03:50:49
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv22911 Modified Files: calclib.q qcalc.q Log Message: add support for symbolic (quoted) cell indices in formulas Index: qcalc.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/qcalc.q,v retrieving revision 1.100 retrieving revision 1.101 diff -C2 -d -r1.100 -r1.101 *** qcalc.q 7 Nov 2007 02:28:45 -0000 1.100 --- qcalc.q 7 Nov 2007 03:50:40 -0000 1.101 *************** *** 2391,2395 **** tokenize S = cat $ regex "gn" ! "\"([^\\\"\\\\]|\\\\.|\\\\\n)*\"|//.*|[$A-Za-z_][$A-Za-z_0-9:]+" S [regskip,reg 0] ++ [[regskip]]; --- 2391,2395 ---- tokenize S = cat $ regex "gn" ! "\"([^\\\"\\\\]|\\\\.|\\\\\n)*\"|//.*|'[(]?[$A-Za-z_][$A-Za-z_0-9:]+[)]?|[$A-Za-z_][$A-Za-z_0-9:]+" S [regskip,reg 0] ++ [[regskip]]; *************** *** 2415,2418 **** --- 2415,2420 ---- special deps X; + deps ''X = []; + deps '(X Y) = deps 'X ++ deps 'Y; deps '(X|Y) = deps 'X ++ deps 'Y; *************** *** 2438,2441 **** --- 2440,2446 ---- special subst X; + // don't perform replacements in quoted parts + subst ''X = ''X; + subst '(X Y) = '(`(subst 'X) `(subst 'Y)); subst '(X|Y) = '(`(subst 'X)|`(subst 'Y)); Index: calclib.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/calclib.q,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** calclib.q 6 Nov 2007 20:08:50 -0000 1.14 --- calclib.q 7 Nov 2007 03:50:39 -0000 1.15 *************** *** 9,13 **** lives. Otherwise you will have to set your QPATH accordingly. */ ! import hdict; /* The following should be considered private; this data is for use by the --- 9,13 ---- lives. Otherwise you will have to set your QPATH accordingly. */ ! from hdict import emptyhdict; /* The following should be considered private; this data is for use by the *************** *** 26,29 **** --- 26,50 ---- public index, row, column; + /* The following functions can be used to convert between numeric cell indices + like (0,0) and symbolic ones, either in string form ("A1") or as a quoted + symbol ('A1). The cellindex function converts from a string or a quoted + symbol to the numeric index of the form (I,J), whereas cellstr and cellname + convert a numeric index back to a string or a quoted symbol, respectively. + + In the string and quoted symbol form, the '$' symbol is permitted as well. + Note that constructions like '(A$4) aren't really symbols in Q, but + applications of the built-in $ operator, so they have to be surrounded with + parentheses as indicated. Also note that, when converting from a numeric + index back to its symbolic form, the $ indicators are lost since they + aren't included in the numeric representation. + + The most useful routine is the cellindex function which can be used with a + quoted cell symbol to embed symbolic cell names used as parameters to + functions like setval into formulas, where they are adjusted automatically + when copied or filled (actually, this conversion is done by setval et al + automagically). */ + + public cellindex X, cellstr KEY, cellname KEY; + /* Send a status message. The message will be shown in the QCalc status line. This can be used to provide some feedback during longer computations. */ *************** *** 109,122 **** hslider ARGS, vslider ARGS, pushbutton ARGS, togglebutton ARGS; ! /* Set a cell value. The given cell index KEY is in the same format as ! returned by the index function (see above), and X may be any Q expression. ! If the given cell is an ordinary cell (no GUI element), then the current ! cell value is overwritten, so you should make sure that you do not have ! important data there. For GUI elements, the value of the element is changed ! accordingly, instead of overwriting the cell. In both cases, after changing ! the cell value QCalc will update its display and trigger updates in ! dependent cells as usual. Note, however, that the triggered changes will ! *not* take effect immediately, rather they are processed by QCalc when the ! current computation is finished. */ public setval KEY X; --- 130,144 ---- hslider ARGS, vslider ARGS, pushbutton ARGS, togglebutton ARGS; ! /* Set a cell value. The given cell index KEY can either be in the numeric ! format as returned by the index function or in any of the symbolic formats ! supported by the cellindex routine (see above), and X may be any Q ! expression. If the given cell is an ordinary cell (no GUI element), then ! the current cell value is overwritten, so you should make sure that you do ! not have important data there. For GUI elements, the value of the element ! is changed accordingly, instead of overwriting the cell. In both cases, ! after changing the cell value QCalc will update its display and trigger ! updates in dependent cells as usual. Note, however, that the triggered ! changes will *not* take effect immediately, rather they are processed by ! QCalc when the current computation is finished. */ public setval KEY X; *************** *** 127,131 **** convenience functions to create matrices with just one row or column for a given list of values, respectively. In any case the matrix or vector is ! inserted into the table starting at the given index KEY. */ public matrix KEY Xs, rowvect KEY Xs, colvect KEY Xs; --- 149,154 ---- convenience functions to create matrices with just one row or column for a given list of values, respectively. In any case the matrix or vector is ! inserted into the table starting at the given index KEY (given in any of ! the formats supported by setval). */ public matrix KEY Xs, rowvect KEY Xs, colvect KEY Xs; *************** *** 137,143 **** --- 160,202 ---- column = J where (I,J) = get YYKEY; + /* Some helper routines. */ + + from system import regex, reg; + + private colno C, cno C, colstr N, qadic; + + colno C = pred $ foldl ((+).(*26)) 0 $ map cno $ chars C; + cno C = C-"A"+1; + + colstr N = strcat $ reverse ["A"+X|map (("A"+).pred) L] + where [X|L] = qadic 26 N; + = "A" otherwise; + + qadic B N = list $ map (mod B) $ takewhile (>0) $ iterate (div B) N; + + /* Conversions cell indices <-> string or quoted symbol. */ + + cellindex S:String + = (I,J) + where [(C,R)] = + regex "" "^[$]?([A-Z][A-Z]?)[$]?([0-9]+)$" S + (reg 1,reg 2), + I:Int = val R-1, J:Int = colno C; + cellindex 'X = (I,J) + where (I,J) = cellindex $ strcat $ + filter ((<0).flip pos " ()") $ chars $ strq 'X; + + cellstr (I:Int,J:Int) + = sprintf "%s%d" (colstr J,I+1) + if (I>=0) and then (J>=0); + cellname (I,J) = valq S where S:String = cellstr (I,J); + + /* Message display */ + message S:String = printf "\f+++ Message: %s\n" (str S); + /* GUI elements. */ + checkbox S:String = checkbox (S,false); *************** *** 270,287 **** where (I,J) = get YYKEY; ! setval (I:Int,J:Int) X ! = printf "\f+++ Update: %s %s\n" (str (I,J),str X) ! if (I>=0) and then (J>=0); ! matrix (I0:Int,J0:Int) Xs:List = dowith setval Ks (cat Xs) where Ks = [(I0+I,J0+J) : I in [0..N-1], J in [0..M-1]] if all islist Xs and then all ((=M).(#)) Xs where Ys:List = hd Xs, N = #Xs, M = #Ys ! if (I0>=0) and then (J0>=0); ! rowvect (I0:Int,J0:Int) Xs:List ! = matrix (I0,J0) [Xs]; ! colvect (I0:Int,J0:Int) Xs:List ! = matrix (I0,J0) $ map (push []) Xs; --- 329,357 ---- where (I,J) = get YYKEY; ! /* setval and friends. */ ! private indexarg KEY; ! ! indexarg (I:Int,J:Int) ! = (I,J) if (I>=0) and then (J>=0); ! indexarg S:String ! = (I,J) where (I,J) = cellindex S; ! indexarg 'X = (I,J) where (I,J) = cellindex 'X; ! ! setval KEY X = printf "\f+++ Update: %s %s\n" (str (I,J),str X) ! where (I:Int,J:Int) = indexarg KEY; ! ! matrix KEY Xs:List = dowith setval Ks (cat Xs) where Ks = [(I0+I,J0+J) : I in [0..N-1], J in [0..M-1]] if all islist Xs and then all ((=M).(#)) Xs where Ys:List = hd Xs, N = #Xs, M = #Ys ! where (I0:Int,J0:Int) = indexarg KEY; ! rowvect KEY Xs:List ! = matrix (I0,J0) [Xs] ! where (I0:Int,J0:Int) = indexarg KEY; ! colvect KEY Xs:List ! = matrix (I0,J0) $ map (push []) Xs ! where (I0:Int,J0:Int) = indexarg KEY; |
From: Albert G. <ag...@us...> - 2007-11-07 02:28:50
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13866 Modified Files: qcalc.q Log Message: bugixes in evaluation routine (triggered updates on GUI elements) Index: qcalc.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/qcalc.q,v retrieving revision 1.99 retrieving revision 1.100 diff -C2 -d -r1.99 -r1.100 *** qcalc.q 7 Nov 2007 01:42:01 -0000 1.99 --- qcalc.q 7 Nov 2007 02:28:45 -0000 1.100 *************** *** 2548,2552 **** qt TABLE "setItem" (I1,J1,IT) || CELLS := insert (get CELLS) ((I1,J1),IT) || ! collect_results U [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Checkbox: (\\([0-9]+,[0-9]+\\)) (.*)$" S --- 2548,2552 ---- qt TABLE "setItem" (I1,J1,IT) || CELLS := insert (get CELLS) ((I1,J1),IT) || ! collect_results (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Checkbox: (\\([0-9]+,[0-9]+\\)) (.*)$" S *************** *** 2557,2561 **** qt TABLE "setCellWidget" (I1,J1,X) || CELLS := insert (get CELLS) ((I1,J1),X) || ! collect_results U [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Pushbutton: (\\([0-9]+,[0-9]+\\)) (.*)$" S --- 2557,2561 ---- qt TABLE "setCellWidget" (I1,J1,X) || CELLS := insert (get CELLS) ((I1,J1),X) || ! collect_results (insert U ((I1,J1),X)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Pushbutton: (\\([0-9]+,[0-9]+\\)) (.*)$" S *************** *** 2582,2586 **** qt TABLE "setCellWidget" (I1,J1,X) || CELLS := insert (get CELLS) ((I1,J1),X) || ! collect_results U [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Togglebutton: (\\([0-9]+,[0-9]+\\)) (.*)$" S --- 2582,2586 ---- qt TABLE "setCellWidget" (I1,J1,X) || CELLS := insert (get CELLS) ((I1,J1),X) || ! collect_results (insert U ((I1,J1),X)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Togglebutton: (\\([0-9]+,[0-9]+\\)) (.*)$" S *************** *** 2606,2610 **** qt TABLE "setItem" (I1,J1,IT) || CELLS := insert (get CELLS) ((I1,J1),IT) || ! collect_results U [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Combobox: (\\([0-9]+,[0-9]+\\)) (.*)$" S --- 2606,2610 ---- qt TABLE "setItem" (I1,J1,IT) || CELLS := insert (get CELLS) ((I1,J1),IT) || ! collect_results (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Combobox: (\\([0-9]+,[0-9]+\\)) (.*)$" S *************** *** 2615,2619 **** qt TABLE "setItem" (I1,J1,IT) || CELLS := insert (get CELLS) ((I1,J1),IT) || ! collect_results U [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Comboedit: (\\([0-9]+,[0-9]+\\)) (.*)$" S --- 2615,2619 ---- qt TABLE "setItem" (I1,J1,IT) || CELLS := insert (get CELLS) ((I1,J1),IT) || ! collect_results (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Comboedit: (\\([0-9]+,[0-9]+\\)) (.*)$" S *************** *** 2632,2636 **** qt TABLE "setCellWidget" (I1,J1,X) || CELLS := insert (get CELLS) ((I1,J1),X) || ! collect_results U [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Spinbox: (\\([0-9]+,[0-9]+\\)) (.*)$" S --- 2632,2636 ---- qt TABLE "setCellWidget" (I1,J1,X) || CELLS := insert (get CELLS) ((I1,J1),X) || ! collect_results (insert U ((I1,J1),X)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Spinbox: (\\([0-9]+,[0-9]+\\)) (.*)$" S *************** *** 2655,2659 **** qt TABLE "setCellWidget" (I1,J1,X) || CELLS := insert (get CELLS) ((I1,J1),X) || ! collect_results U [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Slider: (\\([0-9]+,[0-9]+\\)) (.*)$" S --- 2655,2659 ---- qt TABLE "setCellWidget" (I1,J1,X) || CELLS := insert (get CELLS) ((I1,J1),X) || ! collect_results (insert U ((I1,J1),X)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Slider: (\\([0-9]+,[0-9]+\\)) (.*)$" S *************** *** 2726,2733 **** /* Same as above, but exclude GUI elements unless they are triggered. */ ! compute2 U V = begin_compute || do submit_clear U || collect_results emptyhdict U || end_compute_test ! where U = all_deps2 U V, U = filter (member (get EVAL)) U; submit_clear (I,J) --- 2726,2735 ---- /* Same as above, but exclude GUI elements unless they are triggered. */ ! compute2 U V = //printf " -> %s\n" $ str U || ! begin_compute || do submit_clear U || collect_results emptyhdict U || end_compute_test ! where //_ = printf "*** triggered updates: %s" $ str U, ! U = all_deps2 U V, U = filter (member (get EVAL)) U; submit_clear (I,J) *************** *** 2852,2856 **** process_sel2 W = do flag U || if check_interp then compute2 W V ! where (C,E) = foldl process2 (get CELLS,get EVAL) W, _ = CELLS := C || EVAL := E, W = map (flip (flip sub 0) 1) W, --- 2854,2859 ---- process_sel2 W = do flag U || if check_interp then compute2 W V ! where //_ = printf "*** pending updates: %s\n" $ str W, ! (C,E) = foldl process2 (get CELLS,get EVAL) W, _ = CELLS := C || EVAL := E, W = map (flip (flip sub 0) 1) W, |
From: Albert G. <ag...@us...> - 2007-11-07 01:42:05
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14362 Modified Files: qcalc.q Log Message: comment change Index: qcalc.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/qcalc.q,v retrieving revision 1.98 retrieving revision 1.99 diff -C2 -d -r1.98 -r1.99 *** qcalc.q 7 Nov 2007 01:39:14 -0000 1.98 --- qcalc.q 7 Nov 2007 01:42:01 -0000 1.99 *************** *** 2038,2041 **** --- 2038,2043 ---- () otherwise; + // Convert a spinbox value; use the special value text and the text->value + // converter if available. make_spinbox_value X S:String = MIN if not null S and then (S=S1) |
From: Albert G. <ag...@us...> - 2007-11-07 01:39:19
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13310 Modified Files: qcalc.q Log Message: proper conversion of spinbox values set from calclib::setval Index: qcalc.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/qcalc.q,v retrieving revision 1.97 retrieving revision 1.98 diff -C2 -d -r1.97 -r1.98 *** qcalc.q 6 Nov 2007 20:08:50 -0000 1.97 --- qcalc.q 7 Nov 2007 01:39:14 -0000 1.98 *************** *** 1988,1993 **** = qt X "isDown" () if C = "QPushButton"; ! = printf "unkown GUI element %s\n" C || 0 ! otherwise; spinbox_value S = X if checknum 'X where 'X = valq S; --- 1988,1993 ---- = qt X "isDown" () if C = "QPushButton"; ! = //printf "unknown GUI element %s\n" C || ! 0 otherwise; // default value spinbox_value S = X if checknum 'X where 'X = valq S; *************** *** 2022,2027 **** STEP = qt X "lineStep" (), Y = min MAX $ (Y-MIN) div STEP*STEP+MIN ! // XXXFIXME: need to convert floats first ! if checknum 'Y where 'Y = valq S if C = "QSpinBox"; = if Y<>Y0 then recursive (qt X "setValue" Y) --- 2022,2026 ---- STEP = qt X "lineStep" (), Y = min MAX $ (Y-MIN) div STEP*STEP+MIN ! where Y:Int = make_spinbox_value X S if C = "QSpinBox"; = if Y<>Y0 then recursive (qt X "setValue" Y) *************** *** 2036,2041 **** if (C = "QPushButton") and then qt X "isToggleButton" (); = () if C = "QPushButton"; ! = printf "unkown GUI element %s\n" C ! otherwise; /* Finish off editing a GUI element when the user hits Return. */ --- 2035,2048 ---- if (C = "QPushButton") and then qt X "isToggleButton" (); = () if C = "QPushButton"; ! = //printf "bad value %s for GUI element %s\n" (str S,C) || ! () otherwise; ! ! make_spinbox_value X S:String ! = MIN if not null S and then (S=S1) ! where S1:String = qt X "specialValueText" (), ! MIN = qt X "minValue" () ! if checkstr 'S where 'S = valq S; ! = V where t2v T2V = qt_cb X "mapTextToValue", V:Int = T2V S; ! = val S otherwise; /* Finish off editing a GUI element when the user hits Return. */ |
From: Albert G. <ag...@us...> - 2007-11-06 20:08:54
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv17629 Modified Files: calclib.q qcalc.q Log Message: add support for push and toggle buttons Index: qcalc.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/qcalc.q,v retrieving revision 1.96 retrieving revision 1.97 diff -C2 -d -r1.96 -r1.97 *** qcalc.q 6 Nov 2007 19:02:06 -0000 1.96 --- qcalc.q 6 Nov 2007 20:08:50 -0000 1.97 *************** *** 1415,1418 **** --- 1415,1422 ---- where X:QtObject = get CELLS!(I,J): = str B where B:Bool = qt X "isChecked" (); + = str B if not qt X "isToggleButton" () + where B:Bool = qt X "isDown" (); + = str B if qt X "isToggleButton" () + where B:Bool = qt X "isOn" (); = S where S:String = qt X "cleanText" (); = S where S:String = qt X "text" (); *************** *** 1980,1983 **** --- 1984,1991 ---- = qt X "value" () if C = "QSlider"; + = qt X "isOn" () + if (C = "QPushButton") and then qt X "isToggleButton" (); + = qt X "isDown" () + if C = "QPushButton"; = printf "unkown GUI element %s\n" C || 0 otherwise; *************** *** 2024,2027 **** --- 2032,2039 ---- if checknum 'Y where 'Y = valq S if C = "QSlider"; + = recursive (qt X "setOn" Y) + if checkbool 'Y where 'Y = valq S + if (C = "QPushButton") and then qt X "isToggleButton" (); + = () if C = "QPushButton"; = printf "unkown GUI element %s\n" C otherwise; *************** *** 2533,2536 **** --- 2545,2597 ---- (I1,J1) = val K1, (S1,INIT) = val S1, IT = qt_new "QCheckTableItem" (TABLE,S1); + = qt TABLE "setItem" (I1,J1,IT) || + qt TABLE "setCellWidget" (I1,J1,X) || + CELLS := insert (get CELLS) ((I1,J1),X) || + collect_results U [(I,J)|V] + where [(K1,S1)] = regex "" + "^\\+\\+\\+ Pushbutton: (\\([0-9]+,[0-9]+\\)) (.*)$" S + (reg 1,reg 2), + (I1,J1) = val K1, (TEXT,ICON) = val S1, + IT = qt_new "QTableItem" + (TABLE,qt_val "QTableItem" "Never"), + ICONSET = + if null ICON then () + else qt_new "QIconSet" $ qt_new "QPixmap" ICON, + X = qt_object "QPushButton" + (if is_qt_object ICONSET + then (ICONSET,TEXT,TABLE) + else (TEXT,TABLE)) + "MyPushButton" (I1,J1) [] + // slots + [("guiUpdate()",gui_update)] [], + _ = qt_connect X (SIGNAL "pressed()") + X (SLOT "guiUpdate()") || + qt_connect X (SIGNAL "released()") + X (SLOT "guiUpdate()"); + = qt X "setToggleButton" true || + qt TABLE "setItem" (I1,J1,IT) || + qt TABLE "setCellWidget" (I1,J1,X) || + CELLS := insert (get CELLS) ((I1,J1),X) || + collect_results U [(I,J)|V] + where [(K1,S1)] = regex "" + "^\\+\\+\\+ Togglebutton: (\\([0-9]+,[0-9]+\\)) (.*)$" S + (reg 1,reg 2), + (I1,J1) = val K1, (TEXT,ICON) = val S1, + IT = qt_new "QTableItem" + (TABLE,qt_val "QTableItem" "Never"), + ICONSET = + if null ICON then () + else qt_new "QIconSet" $ qt_new "QPixmap" ICON, + X = qt_object "QPushButton" + (if is_qt_object ICONSET + then (ICONSET,TEXT,TABLE) + else (TEXT,TABLE)) + "MyToggleButton" (I1,J1) [] + // slots + [("guiUpdate()",gui_update)] [], + _ = qt_connect X (SIGNAL "toggled(bool)") + X (SLOT "guiUpdate()") || + qt_connect X (SIGNAL "released()") + X (SLOT "guiUpdate()"); = recursive (qt IT "setCurrentItem" INIT) || qt TABLE "setItem" (I1,J1,IT) || Index: calclib.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/calclib.q,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** calclib.q 6 Nov 2007 18:52:45 -0000 1.13 --- calclib.q 6 Nov 2007 20:08:50 -0000 1.14 *************** *** 33,38 **** /* Definition of GUI elements in table cells. Currently supported are checkboxes, comboboxes (both non-editable and editable), spinboxes, hslider ! and vslider. The argument tuple ARGS depends on the specific kind of ! widget: - checkbox S or checkbox (S,INIT), where S is the label (a string) to be --- 33,40 ---- /* Definition of GUI elements in table cells. Currently supported are checkboxes, comboboxes (both non-editable and editable), spinboxes, hslider ! and vslider. You can find examples for all of these in guiexample.qcalc ! included in the QCalc distribution. ! ! The argument tuple ARGS depends on the specific kind of widget: - checkbox S or checkbox (S,INIT), where S is the label (a string) to be *************** *** 43,46 **** --- 45,63 ---- true if checked, false otherwise. + - pushbutton S or pushbutton (S,ICON), where S is the text of the button + and ICON is the name of a pixmap file. Both arguments are strings. + + The value of a push button is true as long as the button is pressed and + false otherwise. + + - togglebutton S or togglebutton (S,ICON): Analogous to push buttons, but + toggle buttons are switched on and off by clicking them. + + The value of a toggle button is true if it is currently on and false + otherwise. (Note that a toggle button changes its state after being + clicked, whereas a push button changes its state when it is pressed or + released. Also note that a toggle button provides essentially the same + functionality as a checkbox, using a different visual appearance.) + - combobox L or combobox (L,INIT), where L denotes the list of items (strings) to choose, and INIT (optionally) is the initial item. *************** *** 90,94 **** public checkbox ARGS, combobox ARGS, comboedit ARGS, spinbox ARGS, ! hslider ARGS, vslider ARGS; /* Set a cell value. The given cell index KEY is in the same format as --- 107,111 ---- public checkbox ARGS, combobox ARGS, comboedit ARGS, spinbox ARGS, ! hslider ARGS, vslider ARGS, pushbutton ARGS, togglebutton ARGS; /* Set a cell value. The given cell index KEY is in the same format as *************** *** 145,148 **** --- 162,179 ---- where (I,J) = get YYKEY; + pushbutton S:String + = pushbutton (S,""); + pushbutton (S:String,ICON:String) + = printf "\f+++ Pushbutton: %s %s\n" + (str (I,J),str (S,ICON)) || false + where (I,J) = get YYKEY; + + togglebutton S:String + = togglebutton (S,""); + togglebutton (S:String,ICON:String) + = printf "\f+++ Togglebutton: %s %s\n" + (str (I,J),str (S,ICON)) || false + where (I,J) = get YYKEY; + private slider ARGS; |
From: Albert G. <ag...@us...> - 2007-11-06 19:02:12
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv21420 Modified Files: qcalc.q Log Message: only update the current cell when necessary Index: qcalc.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/qcalc.q,v retrieving revision 1.95 retrieving revision 1.96 diff -C2 -d -r1.95 -r1.96 *** qcalc.q 6 Nov 2007 18:52:45 -0000 1.95 --- qcalc.q 6 Nov 2007 19:02:06 -0000 1.96 *************** *** 868,873 **** gui_update X (I,J) _ if global and then not get REDIT: ! = qt TABLE "setCurrentCell" (I,J) || ! qt TABLE "clearSelection" () || process_gui (I,J) X || digest_loop; --- 868,874 ---- gui_update X (I,J) _ if global and then not get REDIT: ! = if (I,J)<>current_cell then ! (qt TABLE "setCurrentCell" (I,J) || ! qt TABLE "clearSelection" ()) || process_gui (I,J) X || digest_loop; |