[q-lang-cvs] qcalc calclib.q,1.43,1.44 qcalc.q,1.190,1.191
Brought to you by:
agraef
From: Albert G. <ag...@us...> - 2007-11-28 04:25:42
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv22196 Modified Files: calclib.q qcalc.q Log Message: added label GUI element Index: qcalc.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/qcalc.q,v retrieving revision 1.190 retrieving revision 1.191 diff -C2 -d -r1.190 -r1.191 *** qcalc.q 26 Nov 2007 14:35:45 -0000 1.190 --- qcalc.q 28 Nov 2007 04:25:37 -0000 1.191 *************** *** 684,688 **** // Use this for debugging if debug_invoke doesn't work (see below). // = printf "qt_invoke: %s %s %s\n" (str OBJ,str SLOT,str ARGS) || ! // fail if neq SLOT timer; // Blacklist #1: these are always inhibited in recursive mode if we are not in // local mode. --- 684,688 ---- // Use this for debugging if debug_invoke doesn't work (see below). // = printf "qt_invoke: %s %s %s\n" (str OBJ,str SLOT,str ARGS) || ! // fail if neq SLOT timer; // Blacklist #1: these are always inhibited in recursive mode if we are not in // local mode. *************** *** 1201,1206 **** = false otherwise; ! current_edited = real_index ! (qt TABLE "currEditRow" (),qt TABLE "currEditCol" ()) if qt TABLE "isEditing" (); current_cell = (current_row,current_col); --- 1201,1205 ---- = false otherwise; ! current_edited = (qt TABLE "currEditRow" (),qt TABLE "currEditCol" ()) if qt TABLE "isEditing" (); current_cell = (current_row,current_col); *************** *** 1224,1230 **** gui_clear (I,J) || clear_cell1 (I,J) || // make sure that edit mode is cleared, too ! if eq current_edited (I,J) then ! qt TABLE "setEditMode" (qt_val "QTable" "NotEditing",I,J) ! where X:QtObject = gui_elem (I,J); = clear_cell1 (I,J) otherwise; --- 1223,1230 ---- gui_clear (I,J) || clear_cell1 (I,J) || // make sure that edit mode is cleared, too ! if eq (real_index (I1,J1)) (I,J) then ! qt TABLE "setEditMode" (qt_val "QTable" "NotEditing",I1,J1) ! where X:QtObject = gui_elem (I,J), ! (I1,J1) = current_edited; = clear_cell1 (I,J) otherwise; *************** *** 1261,1265 **** = qt TABLE "setPixmap" (I,J,PM) if (I,J) = real_index (I,J); ! edit_cell (I,J) = get_table_item (I,J) || qt TABLE "editCell" (I,J); end_edit ACCEPT (I,J) --- 1261,1266 ---- = qt TABLE "setPixmap" (I,J,PM) if (I,J) = real_index (I,J); ! edit_cell (I,J) = get_table_item (I,J) || set_current_cell (I,J) || ! qt TABLE "editCell" (I,J); end_edit ACCEPT (I,J) *************** *** 1392,1399 **** check_editing = EDITED := true || ! recursive (end_edit true (I,J)) || finish_edit true (I,J) if not is_gui_elem (I,J) ! where (I,J) = current_edited; = finish_edit true (I,J) where (I,J,S) = get LAST_EDIT; --- 1393,1400 ---- check_editing = EDITED := true || ! recursive (end_edit true (I1,J1)) || finish_edit true (I,J) if not is_gui_elem (I,J) ! where (I1,J1) = current_edited, (I,J) = real_index (I1,J1); = finish_edit true (I,J) where (I,J,S) = get LAST_EDIT; *************** *** 1405,1409 **** clicked _ _ (I,J) = check_editing || fail ! if neq current_edited (real_index (I,J)); = updatemsg (I,J) if not qt TABLE "isEditing" (); --- 1406,1410 ---- clicked _ _ (I,J) = check_editing || fail ! if neq (real_index current_edited) (real_index (I,J)); = updatemsg (I,J) if not qt TABLE "isEditing" (); *************** *** 1419,1423 **** focus_widget (I,J) = qt X "setFocus" () ! if not is_nil X where X:QtObject = qt TABLE "cellWidget" (I,J) if not qt TABLE "isReadOnly" (); --- 1420,1425 ---- focus_widget (I,J) = qt X "setFocus" () ! if not is_nil X and then ! (qt X "focusPolicy" () <> qt_val "QWidget" "NoFocus") where X:QtObject = qt TABLE "cellWidget" (I,J) if not qt TABLE "isReadOnly" (); *************** *** 2768,2771 **** --- 2770,2785 ---- qt X "setPageStep" STEP || qt X "setValue" INIT; + label_gui (I,J) () S:String + = qt X "setBackgroundMode" (qt_val "Qt" "PaletteBase") || + qt TABLE "setCellWidget" (I,J,X) || IT + if not is_nil IT and then not is_nil X + where X:QtObject = qt_object "QLabel" (S,TABLE) + "MyLabel" (I,J) [] [] [], + IT:QtObject = make_table_item (I,J,X) + (qt_val "QTableItem" "Never"); + + label_gui (I,J) X:QtObject S:String + = qt X "setText" S; + /* Text<->value conversion routines for spinboxes. */ *************** *** 2804,2807 **** --- 2818,2824 ---- gui_get_slider,gui_getc_slider, gui_set_slider); + "MyLabel", (label_gui, + gui_get_label,gui_getc_label, + gui_set_label); "MyPushButton", (pushbutton_gui, gui_get_pushbutton,gui_getc_pushbutton, *************** *** 2861,2864 **** --- 2878,2884 ---- = qt X "value" (); + gui_get_label X + = qt X "text" (); + /* Get the value in string form. */ *************** *** 2893,2896 **** --- 2913,2919 ---- = str $ qt X "value" (); + gui_getc_label X + = qt X "text" (); + /* Set the value of a GUI element from a string. */ *************** *** 2954,2957 **** --- 2977,2984 ---- if checknum 'Y where 'Y = valq S; + gui_set_label X S + = qt X "setText" Y + if checkstr 'Y where 'Y = valq S; + // Convert a spinbox value; use the special value text and the text->value // converter if available. *************** *** 3681,3684 **** --- 3708,3717 ---- IT:QtObject = make_gui slider_gui (I1,J1) (MIN,MAX,STEP,INIT,VERT); + = results_loop T0 (insert U ((I1,J1),IT)) [(I,J)|V] + where [(K1,S1)] = regex "" + "^\\+\\+\\+ Label: (\\([0-9]+,[0-9]+\\)) (.*)$" S + (reg 1,reg 2), + (I1,J1) = val K1, S1:String = val S1, + IT:QtObject = make_gui label_gui (I1,J1) S1; // anything else just gets passed to the digest function, and we try again = local (digest S) || results_loop T0 U [(I,J)|V]; Index: calclib.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/calclib.q,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** calclib.q 23 Nov 2007 21:11:27 -0000 1.43 --- calclib.q 28 Nov 2007 04:25:36 -0000 1.44 *************** *** 39,49 **** public matrix KEY Xs, rowvect KEY Xs, colvect KEY Xs; ! /* Definition of GUI elements in table cells. Currently supported are ! checkboxes, comboboxes (both non-editable and editable), spinboxes, ! horizontal and vertical sliders, push buttons and toggle buttons. You can ! find examples for all of these in the guiexamples.qcalc spreadsheet ! included in the QCalc distribution. */ ! public checkbox ARGS, combobox ARGS, comboedit ARGS, spinbox ARGS, hslider ARGS, vslider ARGS, pushbutton ARGS, togglebutton ARGS; --- 39,49 ---- public matrix KEY Xs, rowvect KEY Xs, colvect KEY Xs; ! /* Definition of GUI elements in table cells. Currently supported are (rich) ! text labels, checkboxes, comboboxes (both non-editable and editable), ! spinboxes, horizontal and vertical sliders, push buttons and toggle ! buttons. You can find examples for all of these in the guiexamples.qcalc ! spreadsheet included in the QCalc distribution. */ ! public label ARGS, checkbox ARGS, combobox ARGS, comboedit ARGS, spinbox ARGS, hslider ARGS, vslider ARGS, pushbutton ARGS, togglebutton ARGS; *************** *** 174,177 **** --- 174,181 ---- /* Basic GUI elements. */ + label S:String = printf "\f+++ Label: %s %s\n" (str (I,J),str S) || + flush || yyset (I,J) S || S + where (I,J) = get YYKEY; + checkbox S:String = checkbox (S,false); |