From: Curt M. <we...@us...> - 2004-04-21 23:03:43
|
Update of /cvsroot/xastir/xastir/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4240 Modified Files: main.c Log Message: Working version of the new Center & Zoom mouse menu function. Index: main.c =================================================================== RCS file: /cvsroot/xastir/xastir/src/main.c,v retrieving revision 1.450 retrieving revision 1.451 diff -C2 -d -r1.450 -r1.451 *** main.c 21 Apr 2004 21:59:44 -0000 1.450 --- main.c 21 Apr 2004 23:01:16 -0000 1.451 *************** *** 10499,10519 **** void Center_Zoom_do_it( /*@unused@*/ Widget widget, XtPointer clientData, /*@unused@*/ XtPointer callData) { ! // Widget shell = (Widget) clientData; ! /* ! // This stuff is from the Pan_ctr function above ! Dimension width, height; ! if(display_up) { ! XtVaGetValues(da,XmNwidth, &width,XmNheight, &height,0); ! new_mid_x = mid_x_long_offset - ((width *scale_x)/2) + (menu_x*scale_x); ! new_mid_y = mid_y_lat_offset - ((height*scale_y)/2) + (menu_y*scale_y); ! new_scale_y = scale_y; // keep size ! display_zoom_image(1); // check range and do display, recenter ! } ! */ } --- 10499,10528 ---- + static Widget center_zoom_latitude, + center_zoom_longitude, + center_zoom_zoom_level; + + + + + void Center_Zoom_do_it( /*@unused@*/ Widget widget, XtPointer clientData, /*@unused@*/ XtPointer callData) { ! unsigned long x, y; ! f_center_latitude = atof( XmTextFieldGetString(center_zoom_latitude) ); ! f_center_longitude = atof( XmTextFieldGetString(center_zoom_longitude) ); ! //Convert to Xastir coordinate system for lat/long ! convert_to_xastir_coordinates(&x, ! &y, ! f_center_longitude, ! f_center_latitude); + scale_y = atoi( XmTextFieldGetString(center_zoom_zoom_level) ); + new_mid_x = x; + new_mid_y = y; + new_scale_y = scale_y; + display_zoom_image(1); } *************** *** 10524,10535 **** // Function to bring up a dialog. User can then select the center // and zoom for the display directly. void Center_Zoom( /*@unused@*/ Widget w, /*@unused@*/ XtPointer clientData, /*@unused@*/ XtPointer calldata) { static Widget pane,form, button_ok, button_cancel, ! lat_label, latitude, ! lon_label, longitude, ! zoom_label, zoom_level; // Arg al[20]; /* Arg List */ // unsigned int ac = 0; /* Arg Count */ Atom delw; if(!center_zoom_dialog) { --- 10533,10548 ---- // Function to bring up a dialog. User can then select the center // and zoom for the display directly. + // + // Later it would be nice to have a "Calc" button so that the user + // could input lat/long in any of the supported formats. Right now + // it is DD.DDDD format only. + // void Center_Zoom( /*@unused@*/ Widget w, /*@unused@*/ XtPointer clientData, /*@unused@*/ XtPointer calldata) { static Widget pane,form, button_ok, button_cancel, ! lat_label, lon_label, zoom_label; // Arg al[20]; /* Arg List */ // unsigned int ac = 0; /* Arg Count */ Atom delw; + char temp[50]; if(!center_zoom_dialog) { *************** *** 10575,10579 **** NULL); ! latitude = XtVaCreateManagedWidget("Center_Zoom latitude", xmTextFieldWidgetClass, form, --- 10588,10592 ---- NULL); ! center_zoom_latitude = XtVaCreateManagedWidget("Center_Zoom latitude", xmTextFieldWidgetClass, form, *************** *** 10610,10614 **** NULL); ! longitude = XtVaCreateManagedWidget("Center_Zoom longitude", xmTextFieldWidgetClass, form, --- 10623,10627 ---- NULL); ! center_zoom_longitude = XtVaCreateManagedWidget("Center_Zoom longitude", xmTextFieldWidgetClass, form, *************** *** 10646,10650 **** NULL); ! zoom_level = XtVaCreateManagedWidget("Center_Zoom zoom_level", xmTextFieldWidgetClass, form, --- 10659,10663 ---- NULL); ! center_zoom_zoom_level = XtVaCreateManagedWidget("Center_Zoom zoom_level", xmTextFieldWidgetClass, form, *************** *** 10707,10710 **** --- 10720,10745 ---- XmAddWMProtocolCallback(center_zoom_dialog, delw, Center_Zoom_destroy_shell, (XtPointer)center_zoom_dialog); + + // Snag the current lat/long/center values, convert them to + // displayable values, and fill in the fields. + xastir_snprintf(temp, + sizeof(temp), + "%f", + f_center_latitude); + XmTextFieldSetString(center_zoom_latitude, temp); + + xastir_snprintf(temp, + sizeof(temp), + "%f", + f_center_longitude); + XmTextFieldSetString(center_zoom_longitude, temp); + + xastir_snprintf(temp, + sizeof(temp), + "%ld", + scale_y); + XmTextFieldSetString(center_zoom_zoom_level, temp); + + XtManageChild(form); XtManageChild(pane); |