/*****************************************************************************/

/*
 *      adjustborderCB.c -- REALmagic calibration application 
 *
 *      Copyright (C) 2000 Sigma Designs
 *                    written by Nicolas Vignal <nicolas_vignal@sdesigns.com>
 *                    modified by Emmanuel Michon <emmanuel_michon@sdesigns.com>
 *
 *      This program is free software; you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 2 of the License, or
 *      (at your option) any later version.
 *
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *
 *      You should have received a copy of the GNU General Public License
 *      along with this program; if not, write to the Free Software
 *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include "define.h"

#include "adjustborderCB.h"

// sorry BOOL and BYTE conflict with FMP       
Bool XF86VidModeGetViewPort(
           Display *display,
           int screen,
           int *x_return,
           int *y_return);

/* callback when the window move */
void WindowMove( GtkWidget *widget, gpointer   data )
{
	DWORD FMPreturn;
	gint x,y,xof,yof;
	GtkWidget *window;

	window=gtk_widget_get_toplevel(widget);
	gdk_window_get_position(window->window , &x ,&y);
	
	// ugly patch for gtk bug? 
	// first call here has bogus 0,22 coordinates
	if (x==0) return;
	
	G_MESSAGE("Event move window,       new position : %d,%d",x,y);

	// [hack] How can we get the real layout of the window?
	// Grabbed with xv it appears the purple area is 
	// at 20x29 (remove the window bar), real size 377x267.
#define PURPLE_ORG_X 20
#define PURPLE_ORG_Y 29
#define PURPLE_WIDTH 377
#define PURPLE_HEIGHT 267

	// view port correction xof,yof
 	if (!XF86VidModeGetViewPort(dpy,scr,&xof,&yof)) exit(1);

	FMPreturn=FMPSetDestination ((DWORD)(x-xof+PURPLE_ORG_X),
				     (DWORD)(y-yof+PURPLE_ORG_Y),
				     (DWORD)PURPLE_WIDTH,
				     (DWORD)PURPLE_HEIGHT);
}

void BA_Ok_clicked( GtkWidget *widget, gpointer   data ){
	DWORD FMPreturn;
	DWORD xresolution;
	DWORD yresolution;
	DWORD depth;
	DWORD freq;
	
    GtkWidget *window;
	window=gtk_widget_get_toplevel(widget);
  gtk_widget_destroy(window);

	G_MESSAGE("Ok clicked");

  	
	getres(&xresolution,&yresolution,&depth,&freq);
	FMPreturn=SaveParamForThisResolution(xresolution,yresolution,depth,freq);

	G_MESSAGE("Save parameters: %ld",FMPreturn);	
	
  // Set mode to none
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_SET,FMP_ANALOG_OVERLAY_ATTRIBUTE_MODE,0,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
	G_MESSAGE("set mode to none return: %ld",FMPreturn);	

		// switch output to VGA
	FMPreturn = FMPSet (FMPI_VIDEOOUT, FMPV_VIDEOOUT_VGA);
	G_MESSAGE("Switch to output VGA return: %ld",FMPreturn);
}



void BA_Cancel_clicked( GtkWidget *widget, gpointer   data ){
	DWORD FMPreturn;
	DWORD xresolution;
	DWORD yresolution;
	DWORD depth;
	DWORD freq;
		
	GtkWidget *window;
	window=gtk_widget_get_toplevel(widget);
  gtk_widget_destroy(window);

  // load old values
 	getres(&xresolution,&yresolution,&depth,&freq);
	FMPreturn=LoadParamForThisResolution(xresolution,yresolution,depth,freq);

	
	// Set mode to none
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_SET,FMP_ANALOG_OVERLAY_ATTRIBUTE_MODE,0,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
	G_MESSAGE("set mode to none return: %ld",FMPreturn);	
}



void BA_Default_clicked( GtkWidget *widget, gpointer   data ){
	DWORD FMPreturn;
	
	G_MESSAGE("Default clicked");
		
	// set stability to 0
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_SET,FMP_ANALOG_OVERLAY_ATTRIBUTE_JITTERADJUSTMENT,0,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
	G_MESSAGE("set stability to 0 return: %ld",FMPreturn);	

	// set vgacorrection to 1000
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_SET,FMP_ANALOG_OVERLAY_ATTRIBUTE_VGACORRECTION,1000,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
	G_MESSAGE("set vga correction to 1000 return: %ld",FMPreturn);	
	
	// set YOFFSET to 0
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_SET,FMP_ANALOG_OVERLAY_ATTRIBUTE_YOFFSET,0,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
	G_MESSAGE("set YOFFSET to 0 return: %ld",FMPreturn);	
		
	// set XOFFSET to 0
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_SET,FMP_ANALOG_OVERLAY_ATTRIBUTE_XOFFSET,0,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
	G_MESSAGE("set XOFFSET to 0 return: %ld",FMPreturn);	
}



void BA_left_pressed( GtkWidget *widget, gpointer   data){
	DWORD FMPreturn;
	GdkModifierType mask;

	G_MESSAGE("left pressed");
// get the current XOFFSET
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_GET,FMP_ANALOG_OVERLAY_ATTRIBUTE_XOFFSET,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
	G_MESSAGE("current XOFFSET return: %ld",FMPreturn);	

// set the current XOFFSET -1
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_SET,FMP_ANALOG_OVERLAY_ATTRIBUTE_XOFFSET,FMPreturn-1,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);

#ifdef DEBUG
	G_MESSAGE("set new current XOFFSET return: %ld",FMPreturn);	
// get the new XOFFSET
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_GET,FMP_ANALOG_OVERLAY_ATTRIBUTE_XOFFSET,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
	G_MESSAGE("new XOFFSET return: %ld",FMPreturn);	
#endif

	
	gdk_window_get_pointer (widget->window, NULL, NULL, &mask);

	while (mask & GDK_BUTTON1_MASK){
		gdk_window_get_pointer (widget->window, NULL, NULL, &mask);

	G_MESSAGE("left still press");
	
    gtk_main_iteration_do (FALSE);
		usleep(50000);

// get the current XOFFSET
		FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_GET,FMP_ANALOG_OVERLAY_ATTRIBUTE_XOFFSET,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
	G_MESSAGE("current XOFFSET return: %ld",FMPreturn);	

// set the current XOFFSET -1
		FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_SET,FMP_ANALOG_OVERLAY_ATTRIBUTE_XOFFSET,FMPreturn-1,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
#ifdef DEBUG
	G_MESSAGE("set new current XOFFSET return: %ld",FMPreturn);	
// get the new XOFFSET
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_GET,FMP_ANALOG_OVERLAY_ATTRIBUTE_XOFFSET,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
	G_MESSAGE("new XOFFSET return: %ld",FMPreturn);	
#endif

	}

}



void BA_right_pressed( GtkWidget *widget, gpointer   data ){
	DWORD FMPreturn;
	GdkModifierType mask;

	G_MESSAGE("right pressed");

// get the current XOFFSET
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_GET,FMP_ANALOG_OVERLAY_ATTRIBUTE_XOFFSET,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
	G_MESSAGE("current XOFFSET return: %ld",FMPreturn);	

// set the current XOFFSET +1
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_SET,FMP_ANALOG_OVERLAY_ATTRIBUTE_XOFFSET,FMPreturn+1,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
#ifdef DEBUG
	G_MESSAGE("set new current XOFFSET return: %ld",FMPreturn);	
// get the new XOFFSET
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_GET,FMP_ANALOG_OVERLAY_ATTRIBUTE_XOFFSET,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
	G_MESSAGE("new XOFFSET return: %ld",FMPreturn);	
#endif

	gdk_window_get_pointer (widget->window, NULL, NULL, &mask);

	while (mask & GDK_BUTTON1_MASK){
	gdk_window_get_pointer (widget->window, NULL, NULL, &mask);

	G_MESSAGE("right still press");

	
	gtk_main_iteration_do (FALSE);

	usleep(50000);
	
// get the current XOFFSET
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_GET,FMP_ANALOG_OVERLAY_ATTRIBUTE_XOFFSET,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
	G_MESSAGE("current XOFFSET return: %ld",FMPreturn);	

// set the current XOFFSET +1
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_SET,FMP_ANALOG_OVERLAY_ATTRIBUTE_XOFFSET,FMPreturn+1,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
#ifdef DEBUG
	G_MESSAGE("set new current XOFFSET return: %ld",FMPreturn);	
// get the new XOFFSET
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_GET,FMP_ANALOG_OVERLAY_ATTRIBUTE_XOFFSET,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
	G_MESSAGE("new XOFFSET return: %ld",FMPreturn);	
#endif
	}

}



void BA_wideup_pressed( GtkWidget *widget, gpointer   data ){

DWORD FMPreturn;
GdkModifierType mask;

	G_MESSAGE("wideup pressed");

// get the current YOFFSET
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_GET,FMP_ANALOG_OVERLAY_ATTRIBUTE_VGACORRECTION,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
	G_MESSAGE("current VGACORRECTION return: %ld",FMPreturn);	

// set the VGACORRECTION -1
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_SET,FMP_ANALOG_OVERLAY_ATTRIBUTE_VGACORRECTION,FMPreturn-1,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
#ifdef DEBUG
	G_MESSAGE("set new current VGACORRECTION return: %ld",FMPreturn);	
// get the new VGACORRECTION
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_GET,FMP_ANALOG_OVERLAY_ATTRIBUTE_VGACORRECTION,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
	G_MESSAGE("new VGACORRECTION return: %ld",FMPreturn);	
#endif
	
	gdk_window_get_pointer (widget->window, NULL, NULL, &mask);

	while (mask & GDK_BUTTON1_MASK){
	gdk_window_get_pointer (widget->window, NULL, NULL, &mask);

	G_MESSAGE("wideup still press");
	
  gtk_main_iteration_do (FALSE);

	usleep(50000);
	
// get the current VGACORRECTION
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_GET,FMP_ANALOG_OVERLAY_ATTRIBUTE_VGACORRECTION,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
	G_MESSAGE("current VGACORRECTION return: %ld",FMPreturn);	

// set the current VGACORRECTION -1
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_SET,FMP_ANALOG_OVERLAY_ATTRIBUTE_VGACORRECTION,FMPreturn-1,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
#ifdef DEBUG
	G_MESSAGE("set new current VGACORRECTION return: %ld",FMPreturn);	
// get the new VGACORRECTION
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_GET,FMP_ANALOG_OVERLAY_ATTRIBUTE_VGACORRECTION,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
	G_MESSAGE("new VGACORRECTION return: %ld",FMPreturn);	
#endif
	}
}



void BA_down_pressed( GtkWidget *widget, gpointer   data ){
	DWORD FMPreturn;
	GdkModifierType mask;

	G_MESSAGE("down pressed");

// get the current YOFFSET
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_GET,FMP_ANALOG_OVERLAY_ATTRIBUTE_YOFFSET,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
	G_MESSAGE("current YOFFSET return: %ld",FMPreturn);	

// set the current YOFFSET +1
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_SET,FMP_ANALOG_OVERLAY_ATTRIBUTE_YOFFSET,FMPreturn+1,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
#ifdef DEBUG
	G_MESSAGE("set new current YOFFSET return: %ld",FMPreturn);	
// get the new YOFFSET
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_GET,FMP_ANALOG_OVERLAY_ATTRIBUTE_YOFFSET,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
	G_MESSAGE("new YOFFSET return: %ld",FMPreturn);	
#endif

	gdk_window_get_pointer (widget->window, NULL, NULL, &mask);
	
	while (mask & GDK_BUTTON1_MASK){
	gdk_window_get_pointer (widget->window, NULL, NULL, &mask);

	G_MESSAGE("down still press");

  gtk_main_iteration_do (FALSE);
		
	usleep(50000);

// get the current YOFFSET
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_GET,FMP_ANALOG_OVERLAY_ATTRIBUTE_YOFFSET,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
	G_MESSAGE("current YOFFSET return: %ld",FMPreturn);	

// set the current YOFFSET +1
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_SET,FMP_ANALOG_OVERLAY_ATTRIBUTE_YOFFSET,FMPreturn+1,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
#ifdef DEBUG
	G_MESSAGE("set new current YOFFSET return: %ld",FMPreturn);	
// get the new YOFFSET
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_GET,FMP_ANALOG_OVERLAY_ATTRIBUTE_YOFFSET,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
	G_MESSAGE("new YOFFSET return: %ld",FMPreturn);	
#endif

	}

}



void BA_up_pressed( GtkWidget *widget, gpointer   data ){

DWORD FMPreturn;
GdkModifierType mask;

	G_MESSAGE("up pressed");

// get the current YOFFSET
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_GET,FMP_ANALOG_OVERLAY_ATTRIBUTE_YOFFSET,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
	G_MESSAGE("current YOFFSET return: %ld",FMPreturn);	

// set theYOFFSET -1
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_SET,FMP_ANALOG_OVERLAY_ATTRIBUTE_YOFFSET,FMPreturn-1,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
#ifdef DEBUG
	G_MESSAGE("set new current YOFFSET return: %ld",FMPreturn);	
// get the new YOFFSET
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_GET,FMP_ANALOG_OVERLAY_ATTRIBUTE_YOFFSET,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
	G_MESSAGE("new YOFFSET return: %ld",FMPreturn);	
#endif
	
	gdk_window_get_pointer (widget->window, NULL, NULL, &mask);

	while (mask & GDK_BUTTON1_MASK){
	gdk_window_get_pointer (widget->window, NULL, NULL, &mask);

	G_MESSAGE("up still press");

  gtk_main_iteration_do (FALSE);

	usleep(50000);
	
// get the current YOFFSET
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_GET,FMP_ANALOG_OVERLAY_ATTRIBUTE_YOFFSET,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
	G_MESSAGE("current YOFFSET return: %ld",FMPreturn);	

// set the current YOFFSET -1
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_SET,FMP_ANALOG_OVERLAY_ATTRIBUTE_YOFFSET,FMPreturn-1,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
#ifdef DEBUG
	G_MESSAGE("set new current YOFFSET return: %ld",FMPreturn);	
// get the new YOFFSET
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_GET,FMP_ANALOG_OVERLAY_ATTRIBUTE_YOFFSET,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
	G_MESSAGE("new YOFFSET return: %ld",FMPreturn);	
#endif
	}
}


void BA_widedown_pressed( GtkWidget *widget, gpointer   data ){

DWORD FMPreturn;
GdkModifierType mask;

	G_MESSAGE("widedown pressed");

// get the current YOFFSET
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_GET,FMP_ANALOG_OVERLAY_ATTRIBUTE_VGACORRECTION,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
	G_MESSAGE("current VGACORRECTION return: %ld",FMPreturn);	

// set the VGACORRECTION -1
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_SET,FMP_ANALOG_OVERLAY_ATTRIBUTE_VGACORRECTION,FMPreturn+1,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
#ifdef DEBUG
	G_MESSAGE("set new current VGACORRECTION return: %ld",FMPreturn);	
// get the new VGACORRECTION
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_GET,FMP_ANALOG_OVERLAY_ATTRIBUTE_VGACORRECTION,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
	G_MESSAGE("new VGACORRECTION return: %ld",FMPreturn);	
#endif
	
	gdk_window_get_pointer (widget->window, NULL, NULL, &mask);

	while (mask & GDK_BUTTON1_MASK){
	gdk_window_get_pointer (widget->window, NULL, NULL, &mask);

	G_MESSAGE("widedown still press");
	
  gtk_main_iteration_do (FALSE);
	
	usleep(50000);
	
// get the current VGACORRECTION
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_GET,FMP_ANALOG_OVERLAY_ATTRIBUTE_VGACORRECTION,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
	G_MESSAGE("current VGACORRECTION return: %ld",FMPreturn);	

// set the current VGACORRECTION -1
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_SET,FMP_ANALOG_OVERLAY_ATTRIBUTE_VGACORRECTION,FMPreturn+1,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
#ifdef DEBUG
	G_MESSAGE("set new current VGACORRECTION return: %ld",FMPreturn);	
// get the new VGACORRECTION
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_GET,FMP_ANALOG_OVERLAY_ATTRIBUTE_VGACORRECTION,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
	G_MESSAGE("new VGACORRECTION return: %ld",FMPreturn);	
#endif
	}
}



void BA_Stability_changed( GtkWidget *widget, gpointer   data )
{
	DWORD FMPreturn;
	int value=0;
	
	value=gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON(widget));
	
#ifdef DEBUG
	G_MESSAGE("widget stability return %d", value);
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_GET,FMP_ANALOG_OVERLAY_ATTRIBUTE_JITTERADJUSTMENT,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
	G_MESSAGE("Stability return: %ld",FMPreturn);	
#endif

// set a new stability value
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_SET,FMP_ANALOG_OVERLAY_ATTRIBUTE_JITTERADJUSTMENT,value,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
#ifdef DEBUG
	G_MESSAGE("set new stability value return: %ld",FMPreturn);	
// get the new stability
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_GET,FMP_ANALOG_OVERLAY_ATTRIBUTE_JITTERADJUSTMENT,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
	G_MESSAGE("Stability return: %ld",FMPreturn);	
#endif
}


void BA_init_stability   ( GtkWidget *widget )
{
	DWORD FMPreturn;
	
	FMPreturn=FMPAnalogOverlay(FMP_ANALOG_OVERLAY_GET,FMP_ANALOG_OVERLAY_ATTRIBUTE_JITTERADJUSTMENT,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG,UNUSED_ARG);
	G_MESSAGE("Stability return: %ld",FMPreturn);	

	gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget),FMPreturn);
}
