⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 build_ranges.c

📁 Coriander is a GUI for controlling a Digital Camera (in the sense of the IIDC specs issued by the 1
💻 C
📖 第 1 页 / 共 2 页
字号:
/* * Copyright (C) 2000-2004 Damien Douxchamps  <ddouxchamps@users.sf.net> * * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */#include "coriander.h"#define RANGE_TABLE_WIDTH 5extern char* feature_menu_table_list[NUM_FEATURES];extern char* feature_menu_items_list[NUM_FEATURES];extern char* feature_name_list[NUM_FEATURES];extern char* feature_abs_label_list[NUM_FEATURES];voidBuildEmptyRange(int feature){  GtkWidget *table, *frame, *label1, *label2;  char *stemp;  stemp=(char*)malloc(STRING_SIZE*sizeof(char));  frame = gtk_frame_new (_(feature_name_list[feature-FEATURE_MIN]));  gtk_widget_ref (frame);  sprintf(stemp,"feature_%d_frame",feature);  gtk_object_set_data_full (GTK_OBJECT (main_window), stemp, frame,                            (GtkDestroyNotify) gtk_widget_unref);  gtk_widget_show (frame);  gtk_box_pack_start (GTK_BOX (lookup_widget(main_window,"vbox_features")), frame, FALSE, TRUE, 0);  gtk_container_set_border_width (GTK_CONTAINER (frame), 5);  gtk_widget_set_sensitive (frame, TRUE);  switch (feature) {  case FEATURE_TEMPERATURE:    table = gtk_table_new (3, RANGE_TABLE_WIDTH, FALSE);    gtk_table_set_homogeneous (GTK_TABLE(table),TRUE);    gtk_widget_ref (table);    sprintf(stemp,"feature_%d_table",feature);    gtk_object_set_data_full (GTK_OBJECT (main_window), stemp, table,			      (GtkDestroyNotify) gtk_widget_unref);    gtk_widget_show (table);    gtk_container_add (GTK_CONTAINER (frame), table);    label1 = gtk_label_new (_("Current:"));    gtk_widget_ref (label1);    gtk_object_set_data_full (GTK_OBJECT (main_window), "label_temp_scale_current", label1,			      (GtkDestroyNotify) gtk_widget_unref);    gtk_widget_show (label1);    gtk_table_attach (GTK_TABLE (table), label1, 0, 1, 1, 2,		      (GtkAttachOptions) (GTK_FILL),		      (GtkAttachOptions) (0), 0, 0);    gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_RIGHT);    gtk_misc_set_alignment (GTK_MISC (label1), 0, 0.5);    label2 = gtk_label_new (_("Target:"));    gtk_widget_ref (label2);    gtk_object_set_data_full (GTK_OBJECT (main_window), "label_temp_scale_target", label2,			      (GtkDestroyNotify) gtk_widget_unref);    gtk_widget_show (label2);    gtk_table_attach (GTK_TABLE (table), label2, 0, 1, 2, 3,		      (GtkAttachOptions) (GTK_FILL),		      (GtkAttachOptions) (0), 0, 0);    gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_RIGHT);    gtk_misc_set_alignment (GTK_MISC (label2), 0, 0.5);    break;  case FEATURE_WHITE_BALANCE:    table = gtk_table_new (3, RANGE_TABLE_WIDTH, FALSE);    gtk_table_set_homogeneous (GTK_TABLE(table),TRUE);    gtk_widget_ref (table);    sprintf(stemp,"feature_%d_table",feature);    gtk_object_set_data_full (GTK_OBJECT (main_window), stemp, table,			      (GtkDestroyNotify) gtk_widget_unref);    gtk_widget_show (table);    gtk_container_add (GTK_CONTAINER (frame), table);    label1 = gtk_label_new (_("Blue/U:"));    gtk_widget_ref (label1);    gtk_object_set_data_full (GTK_OBJECT (main_window), "label_wb_scale_bu", label1,			      (GtkDestroyNotify) gtk_widget_unref);    gtk_widget_show (label1);    gtk_table_attach (GTK_TABLE (table), label1, 0, 1, 1, 2,		      (GtkAttachOptions) (GTK_FILL),		      (GtkAttachOptions) (0), 0, 0);    gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_RIGHT);    gtk_misc_set_alignment (GTK_MISC (label1), 0, 0.5);    label2 = gtk_label_new (_("Red/V:"));    gtk_widget_ref (label2);    gtk_object_set_data_full (GTK_OBJECT (main_window), "label_wb_scale_rv", label2,			      (GtkDestroyNotify) gtk_widget_unref);    gtk_widget_show (label2);    gtk_table_attach (GTK_TABLE (table), label2, 0, 1, 2, 3,		      (GtkAttachOptions) (GTK_FILL),		      (GtkAttachOptions) (0), 0, 0);    gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_RIGHT);    gtk_misc_set_alignment (GTK_MISC (label2), 0, 0.5);    break;  case FEATURE_WHITE_SHADING:    fprintf(stderr,"Not implemented\n");    break;  default:    if (camera->feature_set.feature[feature-FEATURE_MIN].absolute_capable!=0) {      table = gtk_table_new (2, RANGE_TABLE_WIDTH, FALSE);    }    else {      table = gtk_table_new (1, RANGE_TABLE_WIDTH, FALSE);    }    gtk_table_set_homogeneous (GTK_TABLE(table),TRUE);    gtk_widget_ref (table);    sprintf(stemp,"feature_%d_table",feature);    gtk_object_set_data_full (GTK_OBJECT (main_window), stemp, table,			      (GtkDestroyNotify) gtk_widget_unref);    gtk_widget_show (table);    gtk_container_add (GTK_CONTAINER (frame), table);    break;  }  free(stemp);}void BuildRange(int feature){  GtkAdjustment *adjustment, *adjustment2;  GtkWidget* new_option_menu;  GtkWidget* new_menu;  GtkWidget* glade_menuitem;  GtkWidget* scale, *scale2;  GtkWidget* abs_entry;  GtkWidget* label;    char *stemp;  stemp=(char*)malloc(STRING_SIZE*sizeof(char));  BuildEmptyRange(feature);  // BUILD A NEW OPTION_MENU:  sprintf(stemp,"feature_%d_menu",feature);    new_option_menu = gtk_option_menu_new ();  gtk_widget_ref (new_option_menu);  gtk_object_set_data_full (GTK_OBJECT (main_window), stemp, new_option_menu,			    (GtkDestroyNotify) gtk_widget_unref);  gtk_widget_show (new_option_menu);  sprintf(stemp,"feature_%d_table",feature);  gtk_table_attach (GTK_TABLE (lookup_widget(main_window, stemp)),		    new_option_menu, 0, 1, 0, 1,                    (GtkAttachOptions) (GTK_FILL),                    (GtkAttachOptions) (0), 0, 0);  gtk_container_set_border_width (GTK_CONTAINER (new_option_menu), 1);    new_menu = gtk_menu_new ();  /*  fprintf(stderr,"feature %d: avail: %d, onoff: %d, man: %d, auto: %d, op: %d, min:%d, max:%d\n",feature-FEATURE_MIN,	  feature_set->feature[feature-FEATURE_MIN].available,	  feature_set->feature[feature-FEATURE_MIN].on_off_capable,	  feature_set->feature[feature-FEATURE_MIN].manual_capable,	  feature_set->feature[feature-FEATURE_MIN].auto_capable,	  feature_set->feature[feature-FEATURE_MIN].one_push,	  feature_set->feature[feature-FEATURE_MIN].min,	  feature_set->feature[feature-FEATURE_MIN].max);  */    // BUILD MENU ITEMS ====================================================================================  // 'off' menuitem optional addition:  if (camera->feature_set.feature[feature-FEATURE_MIN].on_off_capable>0) {    glade_menuitem = gtk_menu_item_new_with_label (_(feature_menu_items_list[RANGE_MENU_OFF]));    gtk_widget_show (glade_menuitem);    gtk_menu_append (GTK_MENU (new_menu), glade_menuitem);    gtk_signal_connect (GTK_OBJECT (glade_menuitem), "activate",			GTK_SIGNAL_FUNC (on_range_menu_activate),			(int*)(feature*1000+RANGE_MENU_OFF)); // i is an int passed in a pointer variable. This is 'normal'.  }  // 'man' menuitem optional addition:  if (camera->feature_set.feature[feature-FEATURE_MIN].manual_capable>0) {    glade_menuitem = gtk_menu_item_new_with_label (_(feature_menu_items_list[RANGE_MENU_MAN]));    gtk_widget_show (glade_menuitem);    gtk_menu_append (GTK_MENU (new_menu), glade_menuitem);    gtk_signal_connect (GTK_OBJECT (glade_menuitem), "activate",			GTK_SIGNAL_FUNC (on_range_menu_activate),			(int*)(feature*1000+RANGE_MENU_MAN));  }  // 'auto' menuitem optional addition:  if (camera->feature_set.feature[feature-FEATURE_MIN].auto_capable>0) {    glade_menuitem = gtk_menu_item_new_with_label (_(feature_menu_items_list[RANGE_MENU_AUTO]));    gtk_widget_show (glade_menuitem);    gtk_menu_append (GTK_MENU (new_menu), glade_menuitem);    gtk_signal_connect (GTK_OBJECT (glade_menuitem), "activate",			GTK_SIGNAL_FUNC (on_range_menu_activate),			(int*)(feature*1000+RANGE_MENU_AUTO));  }  // 'single' menuitem optional addition:  if (camera->feature_set.feature[feature-FEATURE_MIN].one_push>0) {    glade_menuitem = gtk_menu_item_new_with_label (_(feature_menu_items_list[RANGE_MENU_SINGLE]));    gtk_widget_show (glade_menuitem);    gtk_menu_append (GTK_MENU (new_menu), glade_menuitem);    gtk_signal_connect (GTK_OBJECT (glade_menuitem), "activate",			GTK_SIGNAL_FUNC (on_range_menu_activate),			(int*)(feature*1000+RANGE_MENU_SINGLE));  }  // 'absolute' menuitem optional addition:  if (camera->feature_set.feature[feature-FEATURE_MIN].absolute_capable>0) {    glade_menuitem = gtk_menu_item_new_with_label (_(feature_menu_items_list[RANGE_MENU_ABSOLUTE]));    gtk_widget_show (glade_menuitem);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -