static void on_scale_value_changed_simple (GtkRange *range, gpointer data) { double fGammaPercent = gtk_range_get_value (GTK_RANGE (range)); double fGamma = _percent_to_gamma (fGammaPercent); myData.Xgamma.red = fGamma; myData.Xgamma.blue = fGamma; myData.Xgamma.green = fGamma; xgamma_set_gamma (&myData.Xgamma); }
static void _xgamma_apply_value_simple (int iClickedButton, GtkWidget *pWidget, gpointer data, CairoDialog *pDialog) { if (iClickedButton == 0 || iClickedButton == -1) // ok button or Enter. { cd_message ("%s (ok)", __func__); } else { cd_message ("%s (cancel)", __func__); myData.Xgamma = myData.XoldGamma; xgamma_set_gamma (&myData.Xgamma); } }
static void on_scale_value_changed (GtkRange *range, gpointer data) { int iChannelNumber = GPOINTER_TO_INT (data); cd_message ("%s (%d, %.2f)", __func__, iChannelNumber, gtk_range_get_value (GTK_RANGE (range))); switch (iChannelNumber) { case 0 : { double fOldGamma = (myData.Xgamma.red + myData.Xgamma.blue + myData.Xgamma.green) / 3; double fNewGamma = gtk_range_get_value (GTK_RANGE (range)); double fDeltaGamma = fNewGamma - fOldGamma; myData.Xgamma.red += fDeltaGamma; myData.Xgamma.red = MAX (GAMMA_MIN, MIN (GAMMA_MAX, myData.Xgamma.red)); myData.Xgamma.green += fDeltaGamma; myData.Xgamma.green = MAX (GAMMA_MIN, MIN (GAMMA_MAX, myData.Xgamma.green)); myData.Xgamma.blue += fDeltaGamma; myData.Xgamma.blue = MAX (GAMMA_MIN, MIN (GAMMA_MAX, myData.Xgamma.blue)); g_signal_handler_block (myData.pRedScale, myData.iRedScaleSignalID); g_signal_handler_block (myData.pGreenScale, myData.iGreenScaleSignalID); g_signal_handler_block (myData.pBlueScale, myData.iBlueScaleSignalID); gtk_range_set_value (GTK_RANGE (myData.pRedScale), myData.Xgamma.red); gtk_range_set_value (GTK_RANGE (myData.pGreenScale), myData.Xgamma.green); gtk_range_set_value (GTK_RANGE (myData.pBlueScale), myData.Xgamma.blue); g_signal_handler_unblock (myData.pRedScale, myData.iRedScaleSignalID); g_signal_handler_unblock (myData.pGreenScale, myData.iGreenScaleSignalID); g_signal_handler_unblock (myData.pBlueScale, myData.iBlueScaleSignalID); } break ; case 1 : myData.Xgamma.red = gtk_range_get_value (GTK_RANGE (range)); break ; case 2 : myData.Xgamma.blue = gtk_range_get_value (GTK_RANGE (range)); break ; case 3 : myData.Xgamma.green = gtk_range_get_value (GTK_RANGE (range)); break ; } xgamma_set_gamma (&myData.Xgamma); }
void xgamma_add_gamma (XF86VidModeGamma *pGamma, gint iNbSteps) { if (iNbSteps == 0) return; double fGamma = xgamma_get_gamma (pGamma); double fGammaPercent = _gamma_to_percent (fGamma); fGammaPercent += iNbSteps * myConfig.iScrollVariation; double fNewGamma = _percent_to_gamma (fGammaPercent); double f = fNewGamma / fGamma; myData.Xgamma.red *= f; myData.Xgamma.green *= f; myData.Xgamma.blue *= f; xgamma_set_gamma (&myData.Xgamma); }
static void _xgamma_apply_values (int iClickedButton, GtkWidget *pWidget, gpointer data, CairoDialog *pDialog) { if (iClickedButton == 0 || iClickedButton == -1) // ok button or Enter. { cd_message ("%s (ok)", __func__); } else { cd_message ("%s (cancel)", __func__); myData.Xgamma = myData.XoldGamma; xgamma_set_gamma (&myData.Xgamma); } gldi_dialog_hide (myData.pDialog); gldi_object_ref (GLDI_OBJECT(myData.pDialog)); // pour garder notre dialogue en vie. }
void xgamma_apply_values (int iClickedButton, GtkWidget *pWidget, gpointer data, CairoDialog *pDialog) { if (iClickedButton == 0) { cd_message ("%s (ok)", __func__); } else { cd_message ("%s (cancel)", __func__); myData.Xgamma = myData.XoldGamma; xgamma_set_gamma (&myData.Xgamma); } cairo_dock_hide_dialog (myData.pDialog); cairo_dock_dialog_reference (myData.pDialog); // pour garder notre dialogue en vie. }