static void PostScriptCB(Widget widget, int client_data, XtPointer call_data)
{
/* US Size */
double paper_width = 8.5;
double paper_height = 11.;
/* European Size */
/*
double paper_width = 21./2.54;
double paper_height = 29.7/2.54;
*/
int fudge = 6;
float tpi;
int st, et;
float grid_width, plot_width;
float w_dpi;
float ps_ratio;
int lm, rm, tm, bm, w, h;
XintPostscriptSetDefaults (300, paper_width, paper_height);
/*
* Get the current widget scale and range
*/
XtVaGetValues(segy_widget, XmNtracesPerInch, &tpi,
XmNprimaryKeyStart, &st, XmNprimaryKeyEnd, &et, NULL);
/*
* Calculate height of traces in inches
*/
grid_width = (et - st) / tpi;
grid_width *= 3.8;
/*
* Calculate width of plot, including margins in inches
*/
XintGetHardcopyGeometryInfo (segy_widget, &lm, &rm, &tm, &bm, &w, &h);
plot_width = grid_width * (float) w / (float) (w - rm - lm);
/*
* Calculate actual paper size in dpi (remove margins on paper)
* NOTE: PS printers don't seem to use the entire page size exactly,
* so we add a little FUDGE factor.
*/
w_dpi = (paper_width * 72) -2 * IntPOSTSCRIPT_MARGIN - fudge;
/*
* Calculate scaling factor
*/
ps_ratio = plot_width * 72. / w_dpi;
XintOutputPostscript(segy_widget, "test.ps", ps_ratio, XintCOLOR,
XintORIENTATION_PORTRAIT);
}
XintPickingRecordSetTrackerCallback (picking_record,
your new callback,
your data structure to be passed)
The arguments used internally by the default callback for tracker manipulation are:
XintSeismicWidget seismic_widget - the seismic widget id, XintPickingRecord *picking_record - callback data, XintPoint *point - the current picked point, float *time_pick_list - an array to store times of automatic picks, int number_of_picks - the total number of picks to calculatethe callback data used by the default callback for tracker manipulation is the picking record. Once you have built the time pick list it is used by the picking library.
For Snap, after the picking record has been created call:
XintPickingRecordSetSnapCallback (picking_record,
your new callback,
your data structure to be passed)
The arguments used internally by the default callback for snapping are:
XintSeismicWidget seismic_widget - the seismic widget id, XtPointer data - user data, XintPoint *point - current picked pointthe callback data used by the default callback for snapping is the picking record. Once you have a new time calculated update point->time.
If altering traces in the trace data array use XintSeismicUpdateTraces.
If changing the trace color array use XintSeismicUpdateTraceColor setting only the exact number of traces changed.
If changing trace status (killed, inverted, or normal) use XintSeismicSetTraceStatus.
If muting, use the function XintSeismicSetMute.
width = scale_x * width;
height = scale_y * height;
scroll_x = (float)call_data->user_x_start;
scroll_y = (float)call_data->user_y_start;
scroll_xpercent = 0.0;
scroll_ypercent = 0.0;
if (width <= 0) width = 1;
if (height <= 0) height = 1;
XtVaSetValues(plotXY, XmNwidth, width, XmNheight, height, NULL);
XintScrollScrollToPosition(scrolled_window, scroll_x, scroll_y,
scroll_xpercent, scroll_ypercent);
int *width, *height, *depth;
XintSeismicGetPixmapInfo(widget, pixmap, width, height, depth);
In your code you should have ...
int width, height, depth;
XintSeismicGetPixmapInfo(widget, pixmap, &width, &height, &depth);
Typically when INT function calls ask for pointers, the programmer must declare the variable to reserve memory for that variable and then pass the pointer of the variable to the function.
XmNprimaryKeyStart XmNprimaryKeyEnd XmNsecondaryKeyStart XmNsecondaryKeyEnd XmNstartingTime XmNendingTimeIn creating that duplicate seismic widget, we by default set the two resources XmNprimaryKeyName and XmNsecondaryKeyName to be the same as the original seismic widget. Once these two resources have been set to Shot and Trace (or whatever you chose) then we have to use these headers in our trace limiting.
As a work around have your application check the "boundaries" that are returned when the user does a zoom and then change the callback structure skey_start to be the beginning trace of a record and skey_end to be the ending trace of a record.
void build_displayx()
{
Widget second_shell;
Widget well;
Display *display = XtDisplay(top_level);
second_shell = XtAppCreateShell(NULL, "example shell",
applicationShellWidgetClass,
display, NULL, 0);
XtVaSetValues(second_shell,
XmNallowShellResize, True,
NULL);
/****** well is child of curve display *************/
well = XtVaCreateManagedWidget ("well_log",
xintWellLogWidgetClass,
second_shell,
XmNspacing, 0,
NULL);
/****** track is child of WellLog *******************/
track1 = XtVaCreateManagedWidget("track1", xintTrackWidgetClass,
well,
...
NULL);
...
XtRealizeWidget(second_shell);
}
typedef struct {
int reason;
XEvent *event;
int doit;
int index;
XintPolylinePoint old_value, new_value;
XintCoord shift_x, shift_y;
} XintPolylineVerifyCallbackStruct;
Convert the user_x and user_y values to pixels using XintHorizontalUserToPixel and XintVerticalUserToPixel.
Use XintEditObjectGetIntersectList with the pixel x and y and width of 0 and height of 0, so the list should only contain the Polyline, to check this, call the function XintIsPolyline to confirm.
width = scale_x * width;
height = scale_y * height;
scroll_x = (float)call_data->user_x_start;
scroll_y = (float)call_data->user_y_start;
scroll_xpercent = 0.0;
scroll_ypercent = 0.0;
if (width <= 0) width = 1;
if (height <= 0) height = 1;
XtVaSetValues(plotXY, XmNwidth, width, XmNheight, height, NULL);
XintScrollScrollToPosition(scrolled_window, scroll_x, scroll_y,
scroll_xpercent, scroll_ypercent);