GtkTextBuffer *ctk_display_device_create_help(GtkTextTagTable *table, CtkDisplayDevice *ctk_object) { GtkTextIter i; GtkTextBuffer *b; GtkTooltipsData *td; int j; b = gtk_text_buffer_new(table); gtk_text_buffer_get_iter_at_offset(b, &i, 0); ctk_help_title(b, &i, "%s Help", ctk_object->name); ctk_help_heading(b, &i, "Device Information"); ctk_help_para(b, &i, "%s", __info_help); for (j = 0; j < ARRAY_LEN(__info_entry_data); j++) { InfoEntryData *entryData = __info_entry_data+j; InfoEntry *entry = ctk_object->info_entries+j; if (entry->present) { ctk_help_term(b, &i, "%s", entryData->str); ctk_help_para(b, &i, "%s", *entryData->tooltip); } } add_acquire_edid_help(b, &i); add_color_controls_help (CTK_COLOR_CONTROLS(ctk_object->color_controls), b, &i); add_dithering_controls_help (CTK_DITHERING_CONTROLS(ctk_object->dithering_controls), b, &i); add_image_sliders_help (CTK_IMAGE_SLIDERS(ctk_object->image_sliders), b, &i); if (ctk_object->color_correction_available) { ctk_color_correction_tab_help(b, &i, "X Server Color Correction", TRUE); } td = gtk_tooltips_data_get(GTK_WIDGET(ctk_object->reset_button)); ctk_help_reset_hardware_defaults(b, &i, td->tip_text); ctk_help_finish(b); return b; } /* ctk_display_device_create_help() */
static void scale_value_received(GObject *object, CtrlEvent *event, gpointer user_data) { CtkImageSliders *ctk_image_sliders = CTK_IMAGE_SLIDERS(user_data); GtkAdjustment *adj; GtkWidget *scale; gint val; if (event->type != CTRL_EVENT_TYPE_INTEGER_ATTRIBUTE) { return; } switch (event->int_attr.attribute) { case NV_CTRL_DIGITAL_VIBRANCE: scale = ctk_image_sliders->digital_vibrance; break; case NV_CTRL_IMAGE_SHARPENING: scale = ctk_image_sliders->image_sharpening; break; default: return; } if (event->int_attr.is_availability_changed) { setup_scale(ctk_image_sliders, event->int_attr.attribute, scale); } adj = CTK_SCALE(scale)->gtk_adjustment; val = gtk_adjustment_get_value(GTK_ADJUSTMENT(adj)); if (val != event->int_attr.value) { val = event->int_attr.value; g_signal_handlers_block_by_func(adj, scale_value_changed, ctk_image_sliders); gtk_adjustment_set_value(GTK_ADJUSTMENT(adj), val); post_scale_value_changed(GTK_ADJUSTMENT(adj), ctk_image_sliders, val); g_signal_handlers_unblock_by_func(adj, scale_value_changed, ctk_image_sliders); } } /* scale_value_received() */
static void scale_value_changed(GtkAdjustment *adjustment, gpointer user_data) { CtkImageSliders *ctk_image_sliders = CTK_IMAGE_SLIDERS(user_data); CtrlTarget *ctrl_target = ctk_image_sliders->ctrl_target; gint value; gint attribute; value = (gint) gtk_adjustment_get_value(adjustment); user_data = g_object_get_data(G_OBJECT(adjustment), "attribute"); attribute = GPOINTER_TO_INT(user_data); NvCtrlSetAttribute(ctrl_target, attribute, (int) value); post_scale_value_changed(adjustment, ctk_image_sliders, value); } /* scale_value_changed() */
static void reset_button_clicked(GtkButton *button, gpointer user_data) { CtkDisplayDevice *ctk_object = CTK_DISPLAY_DEVICE(user_data); /* Disable the reset button here and allow the controls below to (re)enable * it if need be,. */ gtk_widget_set_sensitive(ctk_object->reset_button, FALSE); ctk_color_controls_reset(CTK_COLOR_CONTROLS(ctk_object->color_controls)); ctk_dithering_controls_reset (CTK_DITHERING_CONTROLS(ctk_object->dithering_controls)); ctk_image_sliders_reset(CTK_IMAGE_SLIDERS(ctk_object->image_sliders)); ctk_config_statusbar_message(ctk_object->ctk_config, "Reset hardware defaults for %s.", ctk_object->name); } /* reset_button_clicked() */
GtkWidget* ctk_image_sliders_new(NvCtrlAttributeHandle *handle, CtkConfig *ctk_config, CtkEvent *ctk_event, GtkWidget *reset_button, char *name) { CtkImageSliders *ctk_image_sliders; GObject *object; GtkWidget *frame; GtkWidget *vbox; ReturnStatus status; gint val; /* * now that we know that we will have atleast one attribute, * create the object */ object = g_object_new(CTK_TYPE_IMAGE_SLIDERS, NULL); if (!object) return NULL; ctk_image_sliders = CTK_IMAGE_SLIDERS(object); ctk_image_sliders->handle = handle; ctk_image_sliders->ctk_config = ctk_config; ctk_image_sliders->ctk_event = ctk_event; ctk_image_sliders->reset_button = reset_button; ctk_image_sliders->name = name; /* create the frame and vbox */ frame = gtk_frame_new(NULL); vbox = gtk_vbox_new(FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox), FRAME_PADDING); gtk_container_add(GTK_CONTAINER(frame), vbox); gtk_box_pack_start(GTK_BOX(object), frame, FALSE, FALSE, 0); ctk_image_sliders->frame = frame; /* Digital Vibrance */ ctk_image_sliders->digital_vibrance = add_scale(ctk_config, NV_CTRL_DIGITAL_VIBRANCE, "Digital Vibrance", __digital_vibrance_help, G_TYPE_INT, 0, /* default value */ ctk_image_sliders); g_signal_connect(G_OBJECT(ctk_event), CTK_EVENT_NAME(NV_CTRL_DIGITAL_VIBRANCE), G_CALLBACK(scale_value_received), (gpointer) ctk_image_sliders); gtk_box_pack_start(GTK_BOX(vbox), ctk_image_sliders->digital_vibrance, TRUE, TRUE, 0); /* Image Sharpening */ status = NvCtrlGetAttribute(ctk_image_sliders->handle, NV_CTRL_IMAGE_SHARPENING_DEFAULT, &val); if (status != NvCtrlSuccess) { val = 0; } ctk_image_sliders->image_sharpening = add_scale(ctk_config, NV_CTRL_IMAGE_SHARPENING, "Image Sharpening", __image_sharpening_help, G_TYPE_INT, val, ctk_image_sliders); g_signal_connect(G_OBJECT(ctk_event), CTK_EVENT_NAME(NV_CTRL_IMAGE_SHARPENING), G_CALLBACK(scale_value_received), (gpointer) ctk_image_sliders); gtk_box_pack_start(GTK_BOX(vbox), ctk_image_sliders->image_sharpening, TRUE, TRUE, 0); gtk_widget_show_all(GTK_WIDGET(object)); /* update the GUI */ ctk_image_sliders_setup(ctk_image_sliders); return GTK_WIDGET(object); } /* ctk_image_sliders_new() */
GtkTextBuffer *ctk_display_device_dfp_create_help(GtkTextTagTable *table, CtkDisplayDeviceDfp *ctk_display_device_dfp) { GtkTextIter i; GtkTextBuffer *b; b = gtk_text_buffer_new(table); gtk_text_buffer_get_iter_at_offset(b, &i, 0); ctk_help_title(b, &i, "%s Help", ctk_display_device_dfp->name); ctk_help_heading(b, &i, "Flat Panel Information"); ctk_help_para(b, &i, __info_help); ctk_help_term(b, &i, "Chip Location"); ctk_help_para(b, &i, "Report whether the flat panel is driven by " "the on-chip controller (internal), or a " "separate controller chip elsewhere on the " "graphics board (external)."); ctk_help_term(b, &i, "Link"); ctk_help_para(b, &i, "Report whether the specified display device " "is driven by a single link or dual link DVI " "connection."); ctk_help_term(b, &i, "Signal"); ctk_help_para(b, &i, "Report whether the flat panel is driven by " "an LVDS, TMDS, or DisplayPort signal."); ctk_help_term(b, &i, "Native Resolution"); ctk_help_para(b, &i, __native_res_help); ctk_help_term(b, &i, "Best Fit Resolution"); ctk_help_para(b, &i, __best_fit_res_help); ctk_help_term(b, &i, "Frontend Resolution"); ctk_help_para(b, &i, __frontend_res_help); ctk_help_term(b, &i, "Backend Resolution"); ctk_help_para(b, &i, __backend_res_help); ctk_help_term(b, &i, "Refresh Rate"); ctk_help_para(b, &i, __refresh_rate_help); ctk_help_heading(b, &i, "Flat Panel Scaling"); ctk_help_para(b, &i, __scaling_help); ctk_help_term(b, &i, "Force Full GPU Scaling"); ctk_help_para(b, &i, __force_gpu_scaling_help); ctk_help_term(b, &i, "Scaling"); ctk_help_para(b, &i, "Reports whether the GPU and/or DFP are actively " "scaling the current resolution."); ctk_help_term(b, &i, "Stretched"); ctk_help_para(b, &i, "The image will be expanded to fit the entire " "flat panel."); ctk_help_term(b, &i, "Centered"); ctk_help_para(b, &i, "The image will only occupy the number of pixels " "needed and be centered on the flat panel. Setting this " "will disable image sharpening for the display device."); ctk_help_term(b, &i, "Aspect Ratio Scaled"); ctk_help_para(b, &i, "The image will be scaled (retaining the original " "aspect ratio) to expand and fit as much of the entire " "flat panel as possible."); if (ctk_display_device_dfp->color_controls) { add_color_controls_help (CTK_COLOR_CONTROLS(ctk_display_device_dfp->color_controls), b, &i); } if (ctk_display_device_dfp->dithering_controls) { add_dithering_controls_help (CTK_DITHERING_CONTROLS(ctk_display_device_dfp->dithering_controls), b, &i); } add_image_sliders_help (CTK_IMAGE_SLIDERS(ctk_display_device_dfp->image_sliders), b, &i); if (ctk_display_device_dfp->edid) { add_acquire_edid_help(b, &i); } ctk_help_reset_hardware_defaults(b, &i, ctk_display_device_dfp->name); ctk_help_finish(b); return b; } /* ctk_display_device_dfp_create_help() */