diff options
author | Aaron Plattner <aplattner@nvidia.com> | 2012-09-07 19:23:34 -0700 |
---|---|---|
committer | Aaron Plattner <aplattner@nvidia.com> | 2012-09-07 19:23:34 -0700 |
commit | 85ab38c897e266d1e9805e4d276916dceb0ad801 (patch) | |
tree | 159ad31e7f098bac0292474713ad861b4531903c /src | |
parent | cc58d9323aa331f16121c2e157611189cee92293 (diff) |
Add missing color correction page sources
src/gtk+-2.x/ctkcolorcorrectionpage.c and .h were missed in commit
cc58d9323aa331f16121c2e157611189cee92293.
Diffstat (limited to 'src')
-rw-r--r-- | src/gtk+-2.x/ctkcolorcorrectionpage.c | 130 | ||||
-rw-r--r-- | src/gtk+-2.x/ctkcolorcorrectionpage.h | 88 |
2 files changed, 218 insertions, 0 deletions
diff --git a/src/gtk+-2.x/ctkcolorcorrectionpage.c b/src/gtk+-2.x/ctkcolorcorrectionpage.c new file mode 100644 index 0000000..3b15260 --- /dev/null +++ b/src/gtk+-2.x/ctkcolorcorrectionpage.c @@ -0,0 +1,130 @@ +/* + * nvidia-settings: A tool for configuring the NVIDIA X driver on Unix + * and Linux systems. + * + * Copyright (C) 2012 NVIDIA Corporation. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * 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, see <http://www.gnu.org/licenses>. + */ + +#include <gtk/gtk.h> + +#include "NvCtrlAttributes.h" + +#include "ctkbanner.h" + +#include "ctkcolorcorrectionpage.h" +#include "ctkcolorcorrection.h" + +#include "ctkconfig.h" +#include "ctkhelp.h" + +#include <string.h> +#include <stdlib.h> + + +GType ctk_color_correction_page_get_type( + void +) +{ + static GType ctk_color_correction_page_type = 0; + + if (!ctk_color_correction_page_type) { + static const GTypeInfo ctk_color_correction_page_info = { + sizeof (CtkColorCorrectionPageClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + NULL, /* class_init */ + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (CtkColorCorrectionPage), + 0, /* n_preallocs */ + NULL, /* instance_init */ + NULL /* value_table */ + }; + + ctk_color_correction_page_type = + g_type_register_static(GTK_TYPE_VBOX, "CtkColorCorrectionPage", + &ctk_color_correction_page_info, 0); + } + + return ctk_color_correction_page_type; +} + + +GtkWidget* ctk_color_correction_page_new(NvCtrlAttributeHandle *handle, + CtkConfig *ctk_config, + ParsedAttribute *p, + CtkEvent *ctk_event) +{ + CtkColorCorrectionPage *ctk_color_correction_page; + ReturnStatus ret; + GObject *object; + GtkWidget *banner; + GtkWidget *ctk_color_correction; + gint val; + + /* check if the VidMode extension is present */ + + ret = NvCtrlGetAttribute(handle, NV_CTRL_ATTR_EXT_VM_PRESENT, &val); + if ((ret != NvCtrlSuccess) || (val == FALSE)) { + return NULL; + } + + /* check if the noScanout mode enabled */ + + ret = NvCtrlGetAttribute(handle, NV_CTRL_NO_SCANOUT, &val); + if ((ret == NvCtrlSuccess) && (val == NV_CTRL_NO_SCANOUT_ENABLED)) { + return NULL; + } + + /* allocate the color correction widget */ + + ctk_color_correction = + ctk_color_correction_new(handle, ctk_config, p, ctk_event); + + if (ctk_color_correction == NULL) { + return NULL; + } + + /* create the new page */ + + object = g_object_new(CTK_TYPE_COLOR_CORRECTION_PAGE, NULL); + + ctk_color_correction_page = CTK_COLOR_CORRECTION_PAGE(object); + + gtk_box_set_spacing(GTK_BOX(ctk_color_correction_page), 10); + + /* + * pack the banner at the top of the page, followed by the color + * correction widget + */ + + banner = ctk_banner_image_new(BANNER_ARTWORK_COLOR); + gtk_box_pack_start(GTK_BOX(ctk_color_correction_page), + banner, FALSE, FALSE, 0); + + gtk_box_pack_start(GTK_BOX(ctk_color_correction_page), + ctk_color_correction, TRUE, TRUE, 0); + + gtk_widget_show_all(GTK_WIDGET(object)); + + return GTK_WIDGET(object); +} + + +GtkTextBuffer *ctk_color_correction_page_create_help(GtkTextTagTable *table, + const gchar *title) +{ + return ctk_color_correction_create_help(table, title, FALSE /* randr */); +} diff --git a/src/gtk+-2.x/ctkcolorcorrectionpage.h b/src/gtk+-2.x/ctkcolorcorrectionpage.h new file mode 100644 index 0000000..5512985 --- /dev/null +++ b/src/gtk+-2.x/ctkcolorcorrectionpage.h @@ -0,0 +1,88 @@ +/* + * nvidia-settings: A tool for configuring the NVIDIA X driver on Unix + * and Linux systems. + * + * Copyright (C) 2012 NVIDIA Corporation. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * 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, see <http://www.gnu.org/licenses>. + */ + +#ifndef __CTK_COLOR_CORRECTION_PAGE_H__ +#define __CTK_COLOR_CORRECTION_PAGE_H__ + +#include "parse.h" +#include "ctkevent.h" +#include "ctkconfig.h" + +G_BEGIN_DECLS + +#define CTK_TYPE_COLOR_CORRECTION_PAGE (ctk_color_correction_page_get_type()) + +#define CTK_COLOR_CORRECTION_PAGE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), CTK_TYPE_COLOR_CORRECTION_PAGE, \ + CtkColorCorrectionPage)) + +#define CTK_COLOR_CORRECTION_PAGE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), CTK_TYPE_COLOR_CORRECTION_PAGE, \ + CtkColorCorrectionPageClass)) + +#define CTK_IS_COLOR_CORRECTION_PAGE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), CTK_TYPE_COLOR_CORRECTION_PAGE)) + +#define CTK_IS_COLOR_CORRECTION_PAGE_CLASS(class) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), CTK_TYPE_COLOR_CORRECTION_PAGE)) + +#define CTK_COLOR_CORRECTION_PAGE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), CTK_TYPE_COLOR_CORRECTION_PAGE, \ + CtkColorCorrectionPageClass)) + + +typedef struct _CtkColorCorrectionPage CtkColorCorrectionPage; +typedef struct _CtkColorCorrectionPageClass CtkColorCorrectionPageClass; + +struct _CtkColorCorrectionPage +{ + GtkVBox parent; + NvCtrlAttributeHandle *handle; + CtkConfig *ctk_config; + GtkWidget *option_menu; + GtkObject *brightness_adjustment; + GtkObject *contrast_adjustment; + GtkObject *gamma_adjustment; + GtkWidget *confirm_button; + GtkWidget *confirm_label; + gint confirm_countdown; + guint confirm_timer; + gfloat cur_slider_val[3][4]; // as [attribute][channel] + gfloat prev_slider_val[3][4]; // as [attribute][channel] + guint enabled_display_devices; +}; + +struct _CtkColorCorrectionPageClass +{ + GtkVBoxClass parent_class; + + void (*changed) (CtkColorCorrectionPage *); +}; + +GType ctk_color_correction_page_get_type (void) G_GNUC_CONST; +GtkWidget* ctk_color_correction_page_new (NvCtrlAttributeHandle *, + CtkConfig *, ParsedAttribute *, + CtkEvent *); +GtkTextBuffer *ctk_color_correction_page_create_help(GtkTextTagTable *, + const gchar *title); + +G_END_DECLS + +#endif /* __CTK_COLOR_CORRECTION_PAGE_H__ */ + |