ChartObject WebFAQ - Q11
:
static void Unzoom();
/**
** Other Global Variables
**/
Widget edit;
Object chart;
Object *list;
/**
** Translations
**/
static char zoom_translations[] =
"None <Btn1Down> TraverseCurrent() InitAreaSelection(callback) \n\
Ctrl <Btn1Down> Unzoom() ";
XtTranslations zoom_translations_parsed;
static void
Unzoom(Widget widget, XEvent *event, String *params, int *num_params)
{
Object chart, plot;
int count;
register int i;
if (list) XtFree((char *)list);
/*
* Retrieve object list to find ID of chart
*/
list = XintEditObjectGetList(edit, &count);
for (i=0; i<count; i++)
if (XintIsChart(list[i])) break;
if (i > count) return;
plot = XintChartGetComponent(list[i], XintCHART_COMPONENT_PLOT);
/*
* Return if it is a 3D plot
*/
if (XintIsPlot3D(plot)) return;
XtVaSetValues((Widget) plot, XmNxLimits, NULL, XmNyLimits, NULL, NULL);
}
static XtActionsRec app_actions[] = {
{"Unzoom", (XtActionProc) Unzoom}
};
/***
*** ZoomCallback
***/
static void ZoomCallback(widget, data, cb)
Widget widget;
XtPointer data;
XintEditObjectAreaSelectionCallbackStruct *cb;
{
if (chart == NULL) return;
XintChartZoom(chart, cb->x, cb->y, cb->width, cb->height);
}
main(argc, argv)
int argc;
char *argv[];
{
:
:
XtAppAddActions(app_context, app_actions, XtNumber(app_actions));
/*
* Parse translations
*/
zoom_translations_parsed = XtParseTranslationTable(zoom_translations);
:
:
XtOverrideTranslations(edit, zoom_translations_parsed);
/*
* Register callback that is called after user has selected a rectangle
* when zoom is on
*/
XtAddCallback(edit, XmNareaSelectionCallback,
(XtCallbackProc) ZoomCallback, NULL);
:
:
Click here for the Image
Back to ChartObject FAQ
© INT 1996.