liutanyu / mcl

Automatically exported from code.google.com/p/mcl
Other
0 stars 0 forks source link

Interface Toolkit: color editor: "The timer probaly won't work here" #35

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Using Interface Toolkit, make new dialog, add any dialog item (eg. static 
text), double click to edit this, click Frame to edit background color ...

... system hangs (with Listener notice: "The timer probaly won't work here").
Only crash boot possible (which is exasperating when an hour of detailed GUI 
editing is lost!).

Original issue reported on code.google.com by p2.edoc@gmail.com on 20 Jun 2010 at 8:44

GoogleCodeExporter commented 8 years ago
Suggest that in user-pick-color we bypass the timer

(defun user-pick-color (&key (color *black-color*) 
                             (prompt "Pick a color")
                             (position (default-pick-color-position)))
  "lets the user choose a color with the standard mac window"
  ;; timer usually works but not always when the pop-up-menu is clicked
  ;; doesn't work when mouse down
  (progn
    (with-cursor *arrow-cursor*
      (if *color-available*
        (with-port %temp-port%  ; << added this - serendipitous guess
          (setq *interrupt-level* 0)  ;; why does with port do without-interrupts??
          (with-rgb (rgb color)
            (with-pstrs ((pp prompt))
              (if (if t ; (osx-p)
                    (progn 
                      (if nil           ;*timer-interval* 
                        (progn
                          (warn "The timer probaly won't work here")
                          (with-timer (#_GetColor position pp rgb rgb)))
                        (#_GetColor position pp rgb rgb)))

                    (#_getcolor position pp rgb rgb))  ;; timer makes a mess on OS9
                (rgb-to-color rgb)
                (throw-cancel)))))
        (if (y-or-n-dialog prompt
                           :yes-text "Black"
                           :no-text "White")
          *black-color*
          *white-color*)))))

Original comment by p2.edoc@gmail.com on 22 Jun 2010 at 6:01