[cells-gtk-devel] cells-gtk & cl-2d

marsijanin at gmail.com marsijanin at gmail.com
Fri Oct 2 16:33:01 UTC 2009


Good ${current_time_of_day}

I'm trying to use cl-2d plotting library (http://github.com/tpapp/cl-2d)
with cl-cairo2 support in cells-gtk. First I tried to make an
cl-2d:frame from cells-gtk:cairo-context of cells-gtk:cairo-drawing-area:


CL-USER> (in-package :cgtk)
#<PACKAGE "CELLS-GTK">
CGTK> (defmodel test-app (gtk-app)
  ()
  (:default-initargs :title "Test"
    :position :center
    :width 800 :height 600
    :kids (c?
	    (the-kids
	     (mk-hbox 
	      :kids
	      (list 
	       (make-instance 'cairo-drawing-area :width 640 :height 480 :fm-parent *parent* :md-name :draw
			      :expand t :fill t)
	       (mk-button :label "test"
			  :on-clicked (callback (w e d)
					;; cl-cairo2::with-gtk-context dose not setup
					;; width, height & pixel-based-p properties of the context
					;; needed by cl-2d:as-frame
					(with-accessors ((widget-width width)
							 (widget-height height)
							 (context cairo-context)) (find-widget :draw)
					  (with-slots ((context-width cl-cairo2:width)
						       (context-height cl-cairo2:height)
						       (context-pixel-based-p cl-cairo2:pixel-based-p)) context 
					    (setf context-width widget-width  context-height widget-height
						  context-pixel-based-p t))
					  (print (cl-2d::vertical-interval (cl-2d:as-frame context))))))))))))
  
#<STANDARD-CLASS TEST-APP>
CGTK> (cells-gtk-init)

"----------UTILSRESET----------------------------------" 
#()
CGTK> (start-win 'test-app)

"----------UTILSRESET----------------------------------" 
0> registering handlers for #.(sb-sys:int-sap #x080d2898)
0> c-link> query link :draw cells-store2 nil
#<CL-2D:INTERVAL left=480  right=0> ;; <--- vertical-interval of the cl-2d:frame, created by calling cl-2d:frame
0> c-link> kick link :draw cells-store2 #<cells::c-link {ba79009}>
0> not-to-be cairo-drawing area erasing everything drawTEST-APP6

And then I tried to call cl-2d:plot-simple on with cl-2d:frame and
got strange error about unknown CAIRO_STATUS_T value:


CGTK> (defmodel test-app (gtk-app)
  ()
  (:default-initargs :title "Test"
    :position :center
    :width 800 :height 600
    :kids (c?
	    (the-kids
	     (mk-hbox 
	      :kids
	      (list 
	       (make-instance 'cairo-drawing-area :width 640 :height 480 :fm-parent *parent* :md-name :draw
			      :expand t :fill t)
	       (mk-button :label "test"
			  :on-clicked (callback (w e d)
					;; cl-cairo2::with-gtk-context dose not setup
					;; width, height & pixel-based-p properties of the context
					;; needed by cl-2d:as-frame
					(with-accessors ((widget-width width)
							 (widget-height height)
							 (context cairo-context)) (find-widget :draw)
					  (with-slots ((context-width cl-cairo2:width)
						       (context-height cl-cairo2:height)
						       (context-pixel-based-p cl-cairo2:pixel-based-p)) context 
					    (setf context-width widget-width  context-height widget-height
						  context-pixel-based-p t))
					  (cl-2d:plot-simple (cl-2d:as-frame context)
							     (cl-2d:make-interval  1 2)
							     (cl-2d:make-interval  3 4)
							     :x-title "x"
							     :y-title "y"))))))))))
  

STYLE-WARNING:
   redefining SHARED-INITIALIZE :AFTER (#<STANDARD-CLASS TEST-APP>
                                        #<BUILT-IN-CLASS T>) in DEFMETHOD
#<STANDARD-CLASS TEST-APP>
CGTK> (start-win 'test-app)
1> c-link> kick link :draw cells-store2 #<cells::c-link {d0a3801}>
0> registering handlers for #.(sb-sys:int-sap #x0810f8c0)
0> c-link> query link :draw cells-store2 #<cells::c-link {d0a3801}>
0> show error message
0> md-awaken :after
1> processing dlg
.2> running dialog
1> showed dialog -9 :no
1> destroying self (not-to-be)
0> >>>> ERROR REPORTING --> #<simple-error {bbfcc79}>

And here is debugger output:


-1208503376 is not defined as a value for enum type #<CFFI::FOREIGN-ENUM CL-CAIRO2::CAIRO_STATUS_T>.
   [Condition of type SIMPLE-ERROR]

Restarts:
 0: [TERMINATE-THREAD] Terminate this thread (#<THREAD "gtk-main-thread" RUNNING {B0D1409}>)

Backtrace:
  0: ((LAMBDA (CELLS-GTK::C2)) #<SIMPLE-ERROR {BBFCC79}>)
      Locals:
        CELLS-GTK::C2 = #<SIMPLE-ERROR {BBFCC79}>
  1: (CELLS-GTK::MAIN-LOOP)
      Locals:
        SB-KERNEL:*HANDLER-CLUSTERS* = :<NOT-AVAILABLE>
        SB-KERNEL:*RESTART-CLUSTERS* = :<NOT-AVAILABLE>
        #:COUNT[MAIN-LOOP]594 = :<NOT-AVAILABLE>
        #:G600 = (#<SIMPLE-ERROR {BBFCC79}>)
        #:NEXT[MAIN-LOOP]592 = :<NOT-AVAILABLE>
        #:START[MAIN-LOOP]593 = :<NOT-AVAILABLE>
  2: ((FLET CELLS-GTK::GTK-THREAD))
      Locals:
        CELLS-GTK::GTK-MAIN-THREAD = #<SB-THREAD:THREAD "gtk-main-thread" RUNNING {B0D1409}>
  3: ((LAMBDA ()))
      Locals:
        CELLS-GTK::GTK-MAIN-THREAD = #<SB-THREAD:THREAD "gtk-main-thread" RUNNING {B0D1409}>
        CELLS-GTK::SO = #<SWANK-BACKEND::SLIME-OUTPUT-STREAM {B71B6A9}>
  4: ((LAMBDA ()))
      [No Locals]
  5: ((FLET #:WITHOUT-INTERRUPTS-BODY-[BLOCK375]380))
      [No Locals]
  6: ((FLET SB-THREAD::WITH-MUTEX-THUNK))
      [No Locals]
      Catch-tags:
        SB-IMPL::%END-OF-THE-WORLD
        SB-INT:TOPLEVEL-CATCHER
  7: ((FLET #:WITHOUT-INTERRUPTS-BODY-[CALL-WITH-MUTEX]267))
      [No Locals]
  8: (SB-THREAD::CALL-WITH-MUTEX ..)
      Locals:
        SB-DEBUG::ARG-0 = #<CLOSURE (FLET SB-THREAD::WITH-MUTEX-THUNK) {AF142205}>
        SB-DEBUG::ARG-1 = #S(SB-THREAD:MUTEX ..)
        SB-DEBUG::ARG-2 = #<SB-THREAD:THREAD "gtk-main-thread" RUNNING {B0D1409}>
        SB-DEBUG::ARG-3 = T
  9: ((LAMBDA ()))
      [No Locals]
 10: ("foreign function: #x8063A3B")
 11: ("foreign function: #x80523BD")
 12: ("foreign function: #x805BC20")
 13: ("foreign function: #xB7FA965C")


Can anyone please help to solve this problem?

Best, Nikolay V. Razbegaev.




More information about the cells-gtk-devel mailing list