v0.84 patchlevel 2 dial and xyoverlay problems

Dimitris Pantzartzis (panas@rain.org)
Mon, 23 Dec 1996 14:03:34 -0800 (PST)

To subscribers of the xforms list from Dimitris Pantzartzis <panas@rain.org> :

Running v0.84 patchlevel 2 on Linux ELF,

1. I cannot run fdesign:
fdesign: can't resolve symbol 'snprintf'
Is this an xforms problem or a lib setup problem on my system? Any
suggestions how to fix this?

2. the dial object now turns CW. Is there a way to have the dial object
behave as in 0.81 (CCW) with some routine call? I am trying to have
a dial turning from 9 oclock to 3 oclock CCW (bottom hemisphere of the
circle) and after trying various combinations I awasn't able to reproduce
the 0.81 behavior.

3. There is a problem with xyplot overlays. The plot overlay is not redrawn
after resetting the x/y bounds of the xyplot. I am including a test program
that shows the problem. Compiling this code under 0.81 "does the right
thing".

4. Setting the x/ybounds to 0.0 doesn't make the xyplot end at the
last x data point but rather at multiples of tic label boundaries. This is
probably "a preference choice" but leaves always a blank space at the end
of the plot depending on the tic scaling/position. (see also
the test program).

Thanks,

Dimitris (panas@rain.org)

#include <forms.h>
#include <stdlib.h>

#ifndef FD_form_h_
#define FD_form_h_
/* Header file generated with fdesign. */

/**** Callback routines ****/

extern void call_exit(FL_OBJECT *, long);
extern void call_auto(FL_OBJECT *, long);

/**** Forms and Objects ****/

typedef struct {
FL_FORM *form;
FL_OBJECT *exit;
FL_OBJECT *plot;
FL_OBJECT *scale;
void *vdata;
long ldata;
} FD_form;

extern FD_form *create_form_form(void);

#endif /* FD_form_h_ */

FD_form *fd_form;

void call_exit(FL_OBJECT * ob, long data)
{
exit(0);
}

/* Form definition file generated with fdesign. */

FD_form *create_form_form(void)
{
FL_OBJECT *obj;
FD_form *fdui = (FD_form *) fl_calloc(1, sizeof(*fdui));
int old_bw = fl_get_border_width();

fl_set_border_width(1);
fdui->form = fl_bgn_form(FL_NO_BOX, 570, 270);
obj = fl_add_box(FL_UP_BOX, 0, 0, 570, 270, "");
fdui->exit = obj = fl_add_button(FL_NORMAL_BUTTON, 250, 230, 80, 20, "Quit");
fl_set_object_callback(obj, call_exit, 0);
fdui->plot = obj = fl_add_xyplot(FL_NORMAL_XYPLOT, 0, 0, 570, 210, "");
fl_set_object_boxtype(obj, FL_UP_BOX);
fdui->scale = obj = fl_add_dial(FL_LINE_DIAL, 400, 220, 50, 40, "");
fl_set_object_boxtype(obj, FL_DOWN_BOX);
fl_set_object_callback(obj, call_auto, 0);
fl_end_form();
fl_set_border_width(old_bw);

return fdui;
}
/*---------------------------------------*/
#define NPTS 256
void call_auto(FL_OBJECT * ob, long data)
{
int i;
static int nclick = -60;
float xx[NPTS], yy[NPTS], xmin, xmax;
float xxx[2], yyy[2];

for (i = 0; i < NPTS; i++) {
xx[i] = i;
yy[i] = nclick + i;
}
xxx[0] = xx[0];
yyy[0] = yy[0]+NPTS/2;
xxx[1] = xx[NPTS-1];
yyy[1] = yy[0]+NPTS/2;
fl_freeze_form(fd_form->form);
fl_set_xyplot_xtics(fd_form->plot, 3, 2);
fl_set_xyplot_ytics(fd_form->plot, 3, 2);
fl_set_xyplot_data(fd_form->plot, xx, yy, NPTS, "Title", "xaxis", "yaxis");
fl_add_xyplot_overlay(fd_form->plot, 1, xxx, yyy, 2, FL_BLUE);
fl_set_xyplot_overlay_type(fd_form->plot, 1, FL_NORMAL_XYPLOT);
fl_set_xyplot_ybounds(fd_form->plot, 0, 0);
fl_set_xyplot_xbounds(fd_form->plot, 10, NPTS/2);
fl_unfreeze_form(fd_form->form);
nclick++;
}

int main(int argc, char *argv[])
{
fl_initialize(&argc, argv, 0, 0, 0);
fd_form = create_form_form();

fl_set_dial_return(fd_form->scale, True);

fl_set_object_dblbuffer(fd_form->plot,1);

fl_show_form(fd_form->form, FL_PLACE_CENTERFREE, FL_FULLBORDER, "form");
fl_do_forms();
return 0;
}