2 * wavepanel.c, part of the gwave waveform viewer tool
4 * Functions in this file handle wave panels.
6 * Copyright (C) 1998, 1999, 2000 Stephen G. Tell.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public
19 * License along with this program; if not, write to the Free
20 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
35 #include <guile-gnome-gobject/gobject.h>
38 #include <scwm_guile.h>
42 #include <measurebtn.h>
44 #include <GtkTable_indel.h>
46 #define WAVEPANEL_MIN_WIDTH 300
47 #define WAVEPANEL_MIN_HEIGHT 20
48 #define WAVEPANEL_MAX_REQHEIGHT 600
50 XSCM_HOOK(new_wavepanel_hook
,"new-wavepanel-hook", 1, (SCM wp
),
51 "This hook is invoked with one WavePanel argument, WP, when the"
52 "WavePanel is first created and added to the waveform window."
53 "The main purpose of this hook is to allow creation of "
54 "popup menus and other event bindings for the wavepanel.");
56 SCM wavepanel_mouse_binding
[N_MOUSE_BUTTONS
];
58 void wavepanel_lmtable_size_handler(GtkWidget
*w
,
59 GtkRequisition
*req
, gpointer d
);
61 /* generate VisibleWave button label string,
62 * for both initial setup and updating.
65 vw_get_label_string(char *buf
, int buflen
, VisibleWave
*vw
)
71 g_assert(gdf
!= NULL
);
73 if(wv_is_multisweep(vw
->var
)) {
74 l
= buflen
- strlen(gdf
->ftag
) - 10;
76 snprintf(buf
, buflen
, "%s: %.*s @ %.10s=%g",
79 vw
->var
->wtable
->name
, vw
->var
->wtable
->swval
);
81 l
= buflen
- strlen(gdf
->ftag
) - 10;
83 snprintf(buf
, buflen
, "%s: %.*s", gdf
->ftag
, n
, vw
->varname
);
88 * vw_wp_create_button -- create button, label, and measurement
89 * widgets for a new VisibleWave just added to a WavePanel
92 vw_wp_create_button(VisibleWave
*vw
, WavePanel
*wp
)
97 vw_get_label_string(lbuf
, 64, vw
);
98 vw
->label
= gtk_label_new(lbuf
);
99 vw
->button
= gtk_toggle_button_new();
100 gtk_container_add(GTK_CONTAINER(vw
->button
), vw
->label
);
102 /* create new row #1 of the label/measurement table,
103 and add this stuff there. row 0 reserved for Y-axis label. */
105 gtk_table_insert_row(wp
->lmtable
, newrow
);
107 gtk_table_attach(GTK_TABLE(wp
->lmtable
), vw
->button
,
108 0, 1, newrow
, newrow
+1,
113 sprintf(lbuf
, "wavecolor%d", vw
->colorn
);
114 gtk_widget_set_name(vw
->label
, lbuf
);
115 gtk_widget_show(vw
->label
);
116 gtk_widget_set_name(vw
->button
, "wavebutton");
117 gtk_widget_show(vw
->button
);
119 /* create measurement buttons */
120 vw
->mbtn
[0] = measure_button_new(vw
->var
, MBF_VARC0
);
121 vw
->mbtn
[1] = measure_button_new(vw
->var
, MBF_VARC1
);
123 gtk_widget_set_usize(vw
->mbtn
[0]->button
, 60, -1);
124 gtk_widget_set_usize(vw
->mbtn
[1]->button
, 60, -1);
126 gtk_table_attach(GTK_TABLE(wp
->lmtable
), vw
->mbtn
[0]->button
,
127 1, 2, newrow
, newrow
+1,
132 gtk_table_attach(GTK_TABLE(wp
->lmtable
), vw
->mbtn
[1]->button
,
133 2, 3, newrow
, newrow
+1,
138 mbtn_update(vw
->mbtn
[0], NULL
);
139 mbtn_update(vw
->mbtn
[1], NULL
);
143 draw_wavepanel_labels(WavePanel
*wp
)
146 gtk_label_set(GTK_LABEL(wp
->lab_min
), val2txt(wp
->start_yval
,0));
149 gtk_label_set(GTK_LABEL(wp
->lab_max
), val2txt(wp
->end_yval
,0));
153 /* Allocate a new WavePanel and do basic setup */
158 wp
= g_new0(WavePanel
, 1);
161 SGT_NEWCELL_SMOB(wp
->smob
, WavePanel
, wp
);
162 scm_gc_protect_object(wp
->smob
);
163 wp
->outstanding_smob
= 1;
164 call1_hooks(new_wavepanel_hook
, wp
->smob
);
170 * Construct label/measurement area on the left side of a WavePanel.
171 * This area consist of a table containing 3 columns.
173 * The top row (row 0) has a single hbox spanning 3 colums.
174 * It may be invisible, and conatains the LogY indicator and maximum Y value
176 * The bottom row (row N-1) has a single hbox spanning 3 columns,
177 * with the minimum Y value label.
178 * rows 1 through N-2 contain three columns, for the label and up to two
182 void setup_wavepanel_lmtable(WavePanel
*wp
, int showlabels
)
186 GtkWidget
*scrolled_window
;
188 // outer label/measurement vbox, will have 3 entries
189 wp
->lmvbox
= gtk_vbox_new(FALSE
, 0);
190 gtk_widget_show(wp
->lmvbox
);
192 // hbox with logY and maxY labels
193 wp
->lab_max_hbox
= gtk_hbox_new(FALSE
, 0);
194 gtk_box_pack_start(GTK_BOX(wp
->lmvbox
), wp
->lab_max_hbox
,
197 strcpy(lbuf
, val2txt(wp
->end_yval
, 0));
198 wp
->lab_max
= gtk_label_new(lbuf
);
199 gtk_box_pack_end(GTK_BOX(wp
->lab_max_hbox
), wp
->lab_max
,
201 gtk_widget_show(wp
->lab_max
);
203 wp
->lab_logscale
= gtk_label_new("LogY");
204 gtk_box_pack_start(GTK_BOX(wp
->lab_max_hbox
), wp
->lab_logscale
,
208 // table for buttons and masurements. row 0 is space-filling dummy.
210 vbox
= gtk_vbox_new(FALSE
, 0);
211 gtk_widget_show(vbox
);
213 wp
->lmtable
= gtk_table_new(1, 3, FALSE
);
214 gtk_widget_set_usize(wp
->lmtable
, 190, -1);
215 gtk_widget_show(wp
->lmtable
);
217 gtk_table_attach(GTK_TABLE(wp
->lmtable
), vbox
,
223 // wrap scrolled window with vertical scrollbar around table
224 scrolled_window
= gtk_scrolled_window_new (NULL
, NULL
);
225 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (scrolled_window
),
228 gtk_scrolled_window_set_placement(GTK_SCROLLED_WINDOW (scrolled_window
),
229 GTK_CORNER_TOP_RIGHT
);
230 GTK_WIDGET_UNSET_FLAGS (GTK_SCROLLED_WINDOW (scrolled_window
)->vscrollbar
, GTK_CAN_FOCUS
);
231 gtk_widget_show (scrolled_window
);
233 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled_window
),
235 gtk_container_set_focus_vadjustment(
236 GTK_CONTAINER (wp
->lmtable
),
237 gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(scrolled_window
)));
240 gtk_box_pack_start(GTK_BOX(wp
->lmvbox
), scrolled_window
,
244 // last item in the outer vbox: hbox for minY label
245 strcpy(lbuf
, val2txt(wp
->start_yval
, 0));
246 wp
->lab_min
= gtk_label_new(lbuf
);
247 gtk_widget_show(wp
->lab_min
);
248 wp
->lab_min_hbox
= gtk_hbox_new(FALSE
, 0);
249 gtk_box_pack_end(GTK_BOX(wp
->lab_min_hbox
), wp
->lab_min
,
251 gtk_box_pack_end(GTK_BOX(wp
->lmvbox
), wp
->lab_min_hbox
,
255 gtk_widget_show(wp
->lab_min_hbox
);
256 gtk_widget_show(wp
->lab_max_hbox
);
259 // take action when the label/measure table wants to change size
260 gtk_signal_connect(GTK_OBJECT(wp
->lmtable
), "size-request",
261 GTK_SIGNAL_FUNC(wavepanel_lmtable_size_handler
), (gpointer
)wp
);
265 * Set up widgets for a newly-created WavePanel -
266 * construct label and drawing areas
268 void setup_wave_panel(WavePanel
*wp
, int minheight
, int showlabels
)
271 fprintf(stderr
, "setup_wave_panel minheight%d showlabels=%d\n",
272 minheight
, showlabels
);
274 wp
->start_xval
= wtable
->start_xval
;
275 wp
->end_xval
= wtable
->end_xval
;
277 setup_wavepanel_lmtable(wp
, showlabels
);
279 /* drawing area for waveform */
280 wp
->drawing
= gtk_drawing_area_new();
282 GTK_OBJECT(wp
->drawing
), "expose_event",
283 (GtkSignalFunc
)expose_handler
, (gpointer
)wp
);
285 GTK_OBJECT(wp
->drawing
), "button_press_event",
286 (GtkSignalFunc
)button_press_handler
, (gpointer
)wp
);
288 GTK_OBJECT(wp
->drawing
), "button_release_event",
289 (GtkSignalFunc
)button_release_handler
, (gpointer
)wp
);
291 GTK_OBJECT(wp
->drawing
), "motion_notify_event",
292 (GtkSignalFunc
)motion_handler
, (gpointer
)wp
);
294 if(minheight
< WAVEPANEL_MIN_HEIGHT
)
295 wp
->req_height
= WAVEPANEL_MIN_HEIGHT
;
296 else if(minheight
> WAVEPANEL_MAX_REQHEIGHT
)
297 wp
->req_height
= WAVEPANEL_MAX_REQHEIGHT
;
299 wp
->req_height
= minheight
;
301 gtk_drawing_area_size(GTK_DRAWING_AREA(wp
->drawing
),
302 wp
->width
? wp
->width
: WAVEPANEL_MIN_WIDTH
,
304 gtk_widget_show(wp
->drawing
);
306 dnd_setup_target(wp
->drawing
, (gpointer
)wp
);
308 gtk_widget_set_events(wp
->drawing
,
309 GDK_EXPOSURE_MASK
|GDK_BUTTON_RELEASE_MASK
|
310 GDK_BUTTON_PRESS_MASK
|
311 GDK_BUTTON1_MOTION_MASK
|GDK_BUTTON2_MOTION_MASK
);
315 * Delete a wavepanel structure and all data structures referenced from it.
317 void destroy_wave_panel(WavePanel
*wp
)
321 while((vw
= g_list_nth_data(wp
->vwlist
, 0)) != NULL
) {
322 remove_wave_from_panel(wp
, vw
);
324 gtk_widget_destroy(wp
->lmvbox
);
325 gtk_widget_destroy(wp
->drawing
);
326 gdk_pixmap_unref(wp
->pixmap
);
328 scm_gc_unprotect_object(wp
->smob
);
329 if(wp
->outstanding_smob
== 0)
334 * Gtk+ signal handler called a panel's lmtable changes size.
335 * If there isn't room to show the whole width, force it larger, but
336 * don't let it get too big.
337 * Seems to restore the behavior from before the ScrolledWindow was added,
338 * when the label/button area always fit.
341 wavepanel_lmtable_size_handler(GtkWidget
*w
,
342 GtkRequisition
*req
, gpointer d
)
344 WavePanel
*wp
= (WavePanel
*)d
;
346 /* printf("wavepanel_lmtable_size_handler: reqw=%d alloc=%d\n",
347 req->width, wp->lmtable->allocation.width); */
350 && wp
->lmtable
->allocation
.width
> 100
351 && req
->width
> wp
->lmtable
->allocation
.width
) {
352 gtk_widget_set_usize(wp
->lmtable
,
353 (req
->width
> 350 ? 350 : req
->width
), -1);
359 SCM_DEFINE(wavepanel_selected_p
, "wavepanel-selected?", 1, 0, 0,
361 "Return true if the WAVEPANEL is selected")
362 #define FUNC_NAME s_wavepanel_selected_p
365 VALIDATE_ARG_WavePanel_COPY(1,wavepanel
,wp
);
373 SCM_DEFINE(set_wavepanel_selected_x
, "set-wavepanel-selected!", 2, 0, 0,
374 (SCM wavepanel
, SCM tf
),
375 "Set the selected state of WAVEPANEL to TF, either true or false")
376 #define FUNC_NAME s_set_wavepanel_selected_x
380 VALIDATE_ARG_WavePanel_COPY(1,wavepanel
,wp
);
381 VALIDATE_ARG_BOOL_COPY(2, tf
, itf
);
383 if(wp
->selected
!= itf
) {
385 draw_wavepanel(wp
->drawing
, NULL
, wp
);
387 return SCM_UNSPECIFIED
;
391 SCM_DEFINE(wavepanel_y_zoom_x
, "wavepanel-y-zoom!", 3, 0, 0,
392 (SCM wavepanel
, SCM miny
, SCM maxy
),
393 "zoom/rescale WAVEPANEL so that the y axis displays from MINY to MAXY")
394 #define FUNC_NAME s_wavepanel_y_zoom_x
398 VALIDATE_ARG_WavePanel_COPY(1,wavepanel
,wp
);
399 if(miny
== SCM_BOOL_F
) {
401 wp
->start_yval
= wp
->min_yval
;
402 wp
->end_yval
= wp
->max_yval
;
404 VALIDATE_ARG_DBL_COPY(1, miny
, dmin
);
405 VALIDATE_ARG_DBL_COPY(2, maxy
, dmax
);
408 wp
->start_yval
= dmin
;
411 wp
->start_yval
= dmax
;
415 draw_wavepanel(wp
->drawing
, NULL
, wp
);
416 draw_wavepanel_labels(wp
);
417 return SCM_UNSPECIFIED
;
421 SCM_DEFINE(wavepanel_y_manual_p
, "wavepanel-y-manual?", 1, 0, 0,
423 "If WAVEPANEL's y extents have been zoomed manually, return #t."
424 "Otherwise, return #f to indicate automatic y-zoom to show the minimum"
425 "and maximum values of all dependent variables")
426 #define FUNC_NAME s_wavepanel_y_manual_p
429 VALIDATE_ARG_WavePanel_COPY(1,wavepanel
,wp
);
439 SCM_DEFINE(set_wavepanel_ylabels_visible_x
, "set-wavepanel-ylabels-visible!", 2, 0, 0,
440 (SCM wavepanel
, SCM show
),
441 "If SHOW is #t, make the Y-axis labels on the left side of WAVEPANEL"
442 "visible. If show is #f, hide the labels. Hiding the labels allows"
443 "shrinking WAVEPANEL's height a little further. This is useful when you have"
444 "a lot of panels, for example with digital circuits.")
445 #define FUNC_NAME s_set_wavepanel_ylabels_visible_x
449 VALIDATE_ARG_WavePanel_COPY(1,wavepanel
,wp
);
450 VALIDATE_ARG_BOOL_COPY(2, show
, ishow
);
453 gtk_widget_show(wp
->lab_min_hbox
);
454 gtk_widget_show(wp
->lab_max_hbox
);
456 gtk_widget_hide(wp
->lab_min_hbox
);
457 gtk_widget_hide(wp
->lab_max_hbox
);
459 return SCM_UNSPECIFIED
;
463 SCM_DEFINE(set_wavepanel_ylogscale_x
, "set-wavepanel-ylogscale!", 2, 0, 0,
464 (SCM wavepanel
, SCM logscale
),
465 "If LOGSCALE is #t, The Y-axis of WAVEPANEL is set to have"
466 "Logarithmic scaling. Otherwise, scaling is linear.")
467 #define FUNC_NAME s_set_wavepanel_ylogscale_x
471 VALIDATE_ARG_WavePanel_COPY(1,wavepanel
,wp
);
472 VALIDATE_ARG_BOOL_COPY(2, logscale
, logy
);
474 if(wp
->logy
!= logy
) {
477 gtk_widget_show(wp
->lab_logscale
);
479 gtk_widget_hide(wp
->lab_logscale
);
480 draw_wavepanel(wp
->drawing
, NULL
, wp
);
482 return SCM_UNSPECIFIED
;
486 SCM_DEFINE(wavepanel_ylogscale_p
, "wavepanel-ylogscale?", 1, 0, 0,
488 "If WAVEPANEL is set to Logarithmic scaling, return #t.")
489 #define FUNC_NAME s_wavepanel_ylogscale_p
492 VALIDATE_ARG_WavePanel_COPY(1,wavepanel
,wp
);
502 SCM
/* Helper for wavepanel_visiblewaves */
503 wavepanel_to_scm(void *vwp
)
505 WavePanel
*wp
= (WavePanel
*)vwp
;
509 SCM_DEFINE(wavepanel_visiblewaves
, "wavepanel-visiblewaves", 1, 0, 0,
511 "Return a list of the VisibleWaves contained in WAVEPANEL.")
512 #define FUNC_NAME s_wavepanel_visiblewaves
516 VALIDATE_ARG_WavePanel_COPY(1,wavepanel
,wp
);
518 return glist2scm(wp
->vwlist
, wavepanel_to_scm
);
524 * this binding stuff is really quite a hack; we should build a common
525 * mechanism for mouse and keyboard bindings, together with modifiers.
526 * But the scheme interface here isn't too far from what that would implement,
527 * and this simple thing lets us get the rest of the old menus into guile.
529 SCM_DEFINE(wavepanel_bind_mouse
, "wavepanel-bind-mouse", 2, 0, 0,
530 (SCM button
, SCM proc
),
531 "binds a mouse BUTTON to the procedure PROC in all wavepanels. "
532 "PROC is called with 1 argument, the wavepanel that the mouse was in.")
533 #define FUNC_NAME s_wavepanel_bind_mouse
536 VALIDATE_ARG_INT_RANGE_COPY(1, button
, 1, N_MOUSE_BUTTONS
-1, bnum
);
537 VALIDATE_ARG_PROC(2, proc
);
539 /* TODO: find right way to initialize and test to remove old binding.
540 if(SCM_NFALSEP(scm_procedure_p(wavepanel_mouse_binding[bnum])) {
541 scm_unprotect_object(wavepanel_mouse_binding[bnum]);
544 if (!UNSET_SCM(proc
)) {
545 scm_gc_protect_object(proc
);
546 wavepanel_mouse_binding
[bnum
] = proc
;
549 return SCM_UNSPECIFIED
;
553 SCM_DEFINE(wavepanel_x2val
, "wavepanel-x2val", 2, 0, 0,
554 (SCM wavepanel
, SCM xpixel
),
555 "Given an XPIXEL coordinate in WAVEPANEL, "
556 "return the value of the independent variable at that position"
558 #define FUNC_NAME s_wavepanel_x2val
563 VALIDATE_ARG_WavePanel_COPY_USE_NULL(1,wavepanel
,wp
);
564 VALIDATE_ARG_INT_COPY(2,xpixel
,x
);
565 val
= x2val(wp
, x
, wtable
->logx
);
566 return scm_make_real(val
);
570 SCM_DEFINE(wavepanel_y2val
, "wavepanel-y2val", 2, 0, 0,
571 (SCM wavepanel
, SCM ypixel
),
572 "Given a YPIXEL screen-space coordinate in WAVEPANEL, "
573 "return the value that the dependent variable would have"
575 #define FUNC_NAME s_wavepanel_y2val
580 VALIDATE_ARG_WavePanel_COPY_USE_NULL(1,wavepanel
,wp
);
581 VALIDATE_ARG_INT_COPY(2,ypixel
,y
);
583 return scm_make_real(val
);
587 SCM_DEFINE(wavepanel_disp_rect
, "wavepanel-disp-rect", 1, 0, 0,
589 "Return a list containing coordinates of the space "
590 "currently displayed by the current zoom setting of WAVEPANEL. "
591 "The list contains four elements, startX, startY, endX, endY")
592 #define FUNC_NAME s_wavepanel_disp_rect
595 SCM answer
= SCM_EOL
;
596 VALIDATE_ARG_WavePanel_COPY_USE_NULL(1,wavepanel
,wp
);
597 answer
= scm_cons( scm_make_real(wp
->end_yval
), answer
);
598 answer
= scm_cons( scm_make_real(wp
->end_xval
), answer
);
599 answer
= scm_cons( scm_make_real(wp
->start_yval
), answer
);
600 answer
= scm_cons( scm_make_real(wp
->start_xval
), answer
);
605 SCM_DEFINE(wavepanel_max_rect
, "wavepanel-max-rect", 1, 0, 0,
607 "Return a list containing coordinates of the bounding box of all waveforms"
608 "displayed in WAVEPANEL."
609 "The list contains four elements, minX, minY, maxX, maxY")
610 #define FUNC_NAME s_wavepanel_max_rect
613 SCM answer
= SCM_EOL
;
614 VALIDATE_ARG_WavePanel_COPY_USE_NULL(1,wavepanel
,wp
);
615 answer
= scm_cons( scm_make_real(wp
->max_yval
), answer
);
616 answer
= scm_cons( scm_make_real(wp
->max_xval
), answer
);
617 answer
= scm_cons( scm_make_real(wp
->min_yval
), answer
);
618 answer
= scm_cons( scm_make_real(wp
->min_xval
), answer
);
623 SCM_DEFINE(set_wavepanel_minheight_x
, "set-wavepanel-minheight!", 2, 0, 0,
624 (SCM wavepanel
, SCM height
),
625 "Set the minimum height of WAVEPANEL to HEIGHT pixels. Adding multiple"
626 "VisibleWaves to the wavepanel can cause the actual height to increase"
627 "beyond this minimum, but it will never be smaller.")
628 #define FUNC_NAME s_set_wavepanel_minheight_x
632 VALIDATE_ARG_WavePanel_COPY(1,wavepanel
,wp
);
633 VALIDATE_ARG_INT_RANGE_COPY(2,height
,WAVEPANEL_MIN_HEIGHT
,WAVEPANEL_MAX_REQHEIGHT
,min_height
);
634 wp
->req_height
= min_height
;
635 gtk_drawing_area_size(GTK_DRAWING_AREA(wp
->drawing
),
636 wp
->width
? wp
->width
: WAVEPANEL_MIN_WIDTH
,
639 return SCM_UNSPECIFIED
;
644 SCM_DEFINE(wavepanel_debug_x
, "wavepanel-debug!", 1, 0, 0,
646 "Causes debug info about WAVEPANEL to be printed to stdout")
647 #define FUNC_NAME s_wavepanel_debug_x
650 VALIDATE_ARG_WavePanel_COPY(1,wavepanel
,wp
);
652 printf("wavepanel lmtable req=%d,%d alloc=%d,%d\n",
653 wp
->lmtable
->requisition
.width
,
654 wp
->lmtable
->requisition
.height
,
655 wp
->lmtable
->allocation
.width
,
656 wp
->lmtable
->allocation
.height
);
657 printf(" vbox req=%d,%d alloc=%d,%d\n",
658 wp
->lmvbox
->requisition
.width
,
659 wp
->lmvbox
->requisition
.height
,
660 wp
->lmvbox
->allocation
.width
,
661 wp
->lmvbox
->allocation
.height
);
663 return SCM_UNSPECIFIED
;
668 SCM_DEFINE(VisibleWave_selected_p
, "VisibleWave-selected?", 1, 0, 0,
670 "Returns true if VISIBLEWAVE has been selected by having its buttons pressed.")
671 #define FUNC_NAME s_wavepanel_visiblewaves
675 VALIDATE_ARG_VisibleWave_COPY(1, visiblewave
, vw
);
676 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(vw
->button
)))
686 /*****************************************************************************
687 * Standard stuff for the WavePanel SMOB */
690 free_WavePanel(SCM obj
)
692 WavePanel
*wp
= WavePanel(obj
);
693 wp
->outstanding_smob
= 0;
695 if(wp
->valid
== 0) { /* if C has already invalidated, free it up */
697 fprintf(stderr
, "free WavePanel 0x%x in gc\n", wp
);
699 return sizeof(WavePanel
);
706 mark_WavePanel(SCM obj
)
712 print_WavePanel(SCM obj
, SCM port
, scm_print_state
*ARG_IGNORE(pstate
))
714 WavePanel
*wp
= WavePanel(obj
);
715 scm_puts("#<WavePanel ", port
);
716 scm_force_output(port
);
717 scm_uintprint((long)wp
, 16, port
);
718 scm_force_output(port
);
720 scm_puts("invalid", port
);
722 scm_force_output(port
);
726 SCM_DEFINE(WavePanel_p
, "WavePanel?", 1, 0, 0,
728 "Returns #t if OBJ is a gwave data file object, otherwise #f.")
729 #define FUNC_NAME s_WavePanel_p
731 return SCM_BOOL_FromBool(WavePanel_P(obj
));
735 /*****************************************************************************
736 * Standard stuff for the VisibleWave SMOB */
739 free_VisibleWave(SCM obj
)
741 VisibleWave
*wp
= VisibleWave(obj
);
742 wp
->outstanding_smob
= 0;
744 if(wp
->valid
== 0) { /* if C has already invalidated, free it up */
746 fprintf(stderr
, "free VisibleWave 0x%x in gc\n", wp
);
748 return sizeof(VisibleWave
);
755 mark_VisibleWave(SCM obj
)
761 print_VisibleWave(SCM obj
, SCM port
, scm_print_state
*ARG_IGNORE(pstate
))
763 VisibleWave
*wp
= VisibleWave(obj
);
764 scm_puts("#<VisibleWave ", port
);
765 scm_intprint((long)wp
, 16, port
);
766 if(!VisibleWave(obj
)->valid
)
767 scm_puts("invalid", port
);
772 SCM_DEFINE(VisibleWave_p
, "VisibleWave?", 1, 0, 0,
774 "Returns #t if OBJ is a gwave data file object, otherwise #f.")
775 #define FUNC_NAME s_VisibleWave_p
777 return SCM_BOOL_FromBool(VisibleWave_P(obj
));
781 /***********************************************************************
782 * guile initialization
785 MAKE_SMOBFUNS(WavePanel
);
786 MAKE_SMOBFUNS(VisibleWave
);
788 void init_wavepanel()
790 REGISTER_SCWMSMOBFUNS(WavePanel
);
791 REGISTER_SCWMSMOBFUNS(VisibleWave
);
793 #ifndef SCM_MAGIC_SNARF_INITS
794 #include "wavepanel.x"