Пример #1
0
void UpdateDrawingArea(GtkWidget* window, const gchar* name)
{

	GtkWidget* area;
	gint area_w, area_h;
	GdkRectangle area_rect;

	if( (area = LookupWidget(window, name)) != NULL )
	{
		if( area->window != NULL )
		{
			gdk_window_get_size(area->window, &area_w, &area_h);
			area_rect.x = 0;
			area_rect.y = 0;
			area_rect.width = area_w;
			area_rect.height = area_h;
			gtk_widget_draw(area, &area_rect);
		}
	}
}
Пример #2
0
void ShowUserSizeDialog(UIUserSizeDialog* dialog)
{
	GtkWidget* button;

	button = LookupWidget(UI_DIALOG(dialog)->window,
				user_size_scale_button_name[dialog->scale]);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);

	dialog->min_mm_w = Long2Double(g_bj_paper_size.nMinCustomWidth);
	dialog->max_mm_w = Long2Double(g_bj_paper_size.nMaxCustomWidth);
	dialog->min_mm_h = Long2Double(g_bj_paper_size.nMinCustomLength);
	dialog->max_mm_h = Long2Double(g_bj_paper_size.nMaxCustomLength);
	dialog->min_in_w = MakeInchScale(dialog->min_mm_w / 25.4);
	dialog->max_in_w = MakeInchScale(dialog->max_mm_w / 25.4);
	dialog->min_in_h = MakeInchScale(dialog->min_mm_h / 25.4);
	dialog->max_in_h = MakeInchScale(dialog->max_mm_h / 25.4);

	UpdateUserSizeWidgets(dialog, TRUE);
	ShowDialog((UIDialog*)dialog, "user_size_ok_button");
}
Пример #3
0
int GetTextArrayValueFromCombo(GtkWidget* window, gchar *combo_name,
		const gchar* key_array[], const short value_array[])
{
	GtkWidget* combo = LookupWidget(window, combo_name);

	/* Ver.2.80 */
	gchar *current = NULL;
	current = (gchar*)gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo));

	int i;

	for( i = 0 ; key_array[i] != NULL ; i++ )
	{
		if( !strcmp(current, LookupText(g_keytext_list, key_array[i])) )
		{
			return value_array[i];
		}
	}
	return 0;
}
Пример #4
0
/* OK button */
void
on_setconfig_type003_button1_clicked   (GtkButton       *button,
                                        gpointer         user_data)
{
	LPSETCONFIGCOMPTYPE003WORK lpWk = (LPSETCONFIGCOMPTYPE003WORK)gLPSetConfigWork;
	GtkWidget	*combo;
  	char		*type;
	int index_num = lpWk->lpInkCartridgeMsgInfo->index_num;
	int currentIndex;

	combo = LookupWidget(GTK_WIDGET(button), "setconfig_type003_combobox1");
	type = (char*)gtk_combo_box_get_active_text( GTK_COMBO_BOX(combo) );	/* Ver.2.80 */

	currentIndex = KeyToIndex(lpWk->lpInkCartridgeMsgInfo->type, index_num, type );

	gtk_widget_destroy(gtk_widget_get_toplevel(GTK_WIDGET(button)));

	/* update database */
	UpdateMenuLink(CNCL_INKCARTRIDGESETTINGS, lpWk->lpInkCartridgeMsgInfo->nValue[currentIndex]);
	lpWk->status = US_OK;
}
Пример #5
0
static void
update_by_media_size_entry()
{
	GtkWidget* window = UI_DIALOG(g_main_window)->window;
	GtkWidget* entry = LookupWidget(window, "media_size_entry");
	short value = NameToValue(CNCL_PAPERSIZE, 
						(char*)gtk_entry_get_text(GTK_ENTRY(entry)));

	UpdateMenuLink(CNCL_PAPERSIZE, value);

	if( CND_SIZE_USER == GetCurrentnValue(CNCL_PAPERSIZE) )
	{
		set_user_paper_size();
	}

	UpdateWidgets(window,  "media_size_combo");
#ifdef	GUI_WITH_PIXMAPS
	UpdateDrawingArea(window, "basic_draw_area");
#endif
	g_media_size_entry_changed = FALSE;
}
Пример #6
0
void
on_color_dialog_default_button_clicked (GtkButton       *button,
                                        gpointer         user_data)
{
	UIColorDialog* dialog = g_color_dialog;
	short print_bw = IsGrayPrint(g_main_window);

	// Set cyan scale adjustment value.
	gtk_adjustment_set_value(dialog->cyan_adjust,
						(gfloat)CYAN_BALANCE_INIT);

	// Set magenta scale adjustment value.
	gtk_adjustment_set_value(dialog->magenta_adjust,
						(gfloat)MAGENTA_BALANCE_INIT);

	// Set yellow scale adjustment value.
	gtk_adjustment_set_value(dialog->yellow_adjust,
						(float)YELLOW_BALANCE_INIT);

	// Set black scale adjustment value.
	gtk_adjustment_set_value(dialog->black_adjust,
						(float)BLACK_BALANCE_INIT);

	// Set density scale adjustment value.
	gtk_adjustment_set_value(dialog->density_adjust,
						(float)DENSITY_BALANCE_INIT);

	// Vivid button.
	gtk_toggle_button_set_active(
		GTK_TOGGLE_BUTTON(LookupWidget(UI_DIALOG(dialog)->window,
			"color_dialog_vivid_button")), VIVID_INIT);

	// Color correct combo.
	SetColorCorrectCombo(dialog, COLOR_CORRECT_INIT);
	SensitiveColorCorrectCombo(dialog, !(VIVID_INIT | print_bw));

	// Gamma correct combo.
	SetGammaCombo(dialog, GetDefaultGamma(dialog));
}
Пример #7
0
/* Scale */
static void C_DLG_ScaleValueChanged( GtkRange   *range , short id )
{
	/* Ver.2.80 : Get the value from GtkRange (directly) */
	GtkWidget* window = UI_DIALOG(g_color_dialog2)->window;
	GtkSpinButton   *spinbutton = GTK_SPIN_BUTTON(LookupWidget( window, spin_scale_table[id].spin_name ) );

	
	if( DisableSignal() )	/* Ver.2.90: Prevent the endless loop between "scale" and "spinbutton" */
	{
		gtk_spin_button_set_value( spinbutton , (gdouble)gtk_range_get_value( range ) );

		/* Prevent from showing "-0" */
		if( CofirmSpinValue( spinbutton ) )
		{
#ifdef _PRINTUI_DEBUG_
			fprintf(stderr,"change -0 to 0 (C_DLG_ScaleValueChanged)\n" );
#endif
		}

	}
	EnableSignal();
}
Пример #8
0
void HideColorDialog(UIColorDialog* dialog, gboolean apply)
{
	if( apply )
	{
		dialog->cyan_balance    = (int)dialog->cyan_adjust->value; 
		dialog->magenta_balance = (int)dialog->magenta_adjust->value; 
		dialog->yellow_balance  = (int)dialog->yellow_adjust->value; 
		dialog->black_balance   = (int)dialog->black_adjust->value; 
		dialog->density_balance = (int)dialog->density_adjust->value; 

		dialog->vivid
			= GTK_TOGGLE_BUTTON(LookupWidget(UI_DIALOG(dialog)->window,
					"color_dialog_vivid_button"))->active;

		dialog->color_correct = GetColorCorrectCombo(dialog);

		if( dialog->gamma_list == NULL )
		{
			dialog->gamma
				 = GetTextArrayValueFromCombo(UI_DIALOG(dialog)->window,
					 "color_dialog_gamma_combo", gamma_key, gamma_value);
		}
		else
		{
			dialog->gamma = GetCurrentnValue(CNCL_INPUT_GAMMA);
		}
	}
	else
	{
		if( dialog->gamma_list )
		{
			// Recover parameters.
			UpdateMenuLink(CNCL_INPUT_GAMMA, dialog->gamma);
		}
	}

	HideDialog((UIDialog*)dialog);
}
Пример #9
0
/* Spin BUtton */
static void C_DLG_SpinValueChanged( GtkSpinButton   *spinbutton , short id )
{
	short	spin_value;
	GtkWidget* window = GetTopWidget(GTK_WIDGET(spinbutton));


	if( DisableSignal() )
	{
		spin_value = spinbutton->adjustment->value;
	
		/* Prevent from showing "-0" */
		if( CofirmSpinValue( spinbutton ) )
		{
#ifdef _PRINTUI_DEBUG_
			fprintf(stderr,"change -0 to 0 (C_DLG_SpinValueChanged)\n" );
#endif
		}

		/* Update sacle value */
		gtk_range_set_value( GTK_RANGE(LookupWidget(window, spin_scale_table[id].scale_name )) , (gdouble)spin_value );
	}
	EnableSignal();
}
Пример #10
0
void
on_setconfig_type003_dialog_combo_changed
                                        (GtkComboBox     *combobox,
                                        gpointer         user_data)
{
	LPSETCONFIGCOMPTYPE003WORK lpWk = (LPSETCONFIGCOMPTYPE003WORK)gLPSetConfigWork;
	GtkWidget*	label;
	char*		type;
	gchar* 		msg;
	int index_num = lpWk->lpInkCartridgeMsgInfo->index_num;
	int currentIndex;

	if( DisableSignal() )
	{
		type = (char*)gtk_combo_box_get_active_text( combobox );
	
		currentIndex = KeyToIndex(lpWk->lpInkCartridgeMsgInfo->type, index_num, type );
	
		msg = LookupText(g_keytext_list, lpWk->lpInkCartridgeMsgInfo->info[currentIndex]);
		label = LookupWidget(GTK_WIDGET(combobox), "setconfig_type003_label3");
		gtk_label_set_text(GTK_LABEL(label), msg);
	}
	EnableSignal();
}
Пример #11
0
UIQualityDialog* CreateQualityDialog(UIDialog* parent)
{
	GtkWidget* window;
	UIQualityDialog* dialog
		 = (UIQualityDialog*)CreateDialog(sizeof(UIQualityDialog), parent);

#ifdef	USE_LIB_GLADE
	UI_DIALOG(dialog)->window = window = LookupWidget(NULL, "quality_dialog");
#else
	UI_DIALOG(dialog)->window = window = create_quality_dialog();
#endif

	dialog->print_quality = GetCurrentnValue(CNCL_PRINTQUALITY);
	dialog->bin_method = GetCurrentnValue(CNCL_DITHER_PAT);

	SetCallbackTableFunc(CNCL_MEDIATYPE, (void*)SetQualityCustomValue, dialog);


	gtk_widget_realize(window);

	UpdateQualityDialogWidgets(window, NULL);

	return dialog;
}
Пример #12
0
gboolean CheckMediaSizeCombination(LPBJFLTDEVICE bjdev, gboolean* change_item)
{
	MediaSizeTable* table = GetMediaSizeTable(bjdev->bjfltModelID);
	char* media = ValueToKey(CNCL_MEDIATYPE, bjdev->bjfltMediaType);
	char* size = ValueToKey(CNCL_PAPERSIZE, bjdev->bjfltPaperSize);
	int change;
	gboolean exec_print;
	int result = TRUE;
	gchar* applied = NULL;
	gchar* applied_title = NULL;
	GtkWidget *window = UI_DIALOG(g_main_window)->window;

	*change_item = FALSE;

	if( table == NULL )
		return TRUE;


	while( table->base != NULL )
	{
		if( !strcmp(media, table->base) )
		{
			// Get available media size.
			applied = GetAvailableSize(table->applied);

			if( SearchWord(size, applied) == NULL )
			{
				applied_title = GetAvailableSize(table->applied_title);
				change = UI_MEDIASIZE_CHANGE_SIZE;
				break;
			}
		}
		else if( !strcmp(size, table->base) )
		{
			// Get available media type.
			applied = GetAvailableMedia(table->applied);

			if( SearchWord(media, applied) == NULL )
			{
				applied_title = GetAvailableMedia(table->applied_title);
				change = UI_MEDIASIZE_CHANGE_MEDIA;
				break;
			}
		}
		table++;
	}


	if( table->base )
	{
		UIMediaSizeDialog* dialog = NULL;
		int (*show_dialog)(UIMediaSizeDialog*, gchar*) = NULL;

		switch( table->type )
		{
			case UI_MEDIASIZE_ILLEGAL:
				if( 1 >= CountWords(applied) )
				{
					dialog = g_mediasize_illegal_dialog;
					show_dialog = ShowMediaSizeIllegalDialog;
				}
				else
				{
					dialog = g_mediasize_illegal_select_dialog;
					show_dialog = ShowMediaSizeIllegalSelectDialog;
				}
				break;

			case UI_MEDIASIZE_RECOMMEND:
				dialog = g_mediasize_recommend_dialog;
				show_dialog = ShowMediaSizeRecommendDialog;
				break;
		}

		// Show the dialog when the number of applied item is more than 1.
		if( dialog && strlen(applied) > 0 )
		{
			dialog->media = media;
			dialog->size = size;
			dialog->table = (void*)table;
			dialog->change = change;

			// Show dialog.
			exec_print = show_dialog(dialog, applied_title);

			if( dialog->apply )
			{
				GtkWidget*	analyzer_combo = NULL;
				char 		*change_to_value_str = NULL;
				short		change_to_id;

				if( dialog->item_count > 1 )		/* multiple items -> get value id of chenge item */
				{
					/* Ver.3.20 */
					if( table->type == UI_MEDIASIZE_RECOMMEND )			/* recommend */
						analyzer_combo = LookupWidget(UI_DIALOG(dialog)->window,  "mediasize_recommend_combo");
					else												/* illegal   */
						analyzer_combo = LookupWidget(UI_DIALOG(dialog)->window,  "mediasize_illegal_combo");

					change_to_value_str = (char*)gtk_combo_box_get_active_text(GTK_COMBO_BOX(analyzer_combo));
					
					if( dialog->change == UI_MEDIASIZE_CHANGE_SIZE )	/* change size */
						change_to_id = NameToValue( CNCL_PAPERSIZE , change_to_value_str );
					else												/* change media */
						change_to_id = NameToValue( CNCL_MEDIATYPE , change_to_value_str );
					
					dialog->current_change_to_id = change_to_id;
					
					if(change_to_value_str){
						free(change_to_value_str);
						change_to_value_str = NULL;
					}
				}

				if( dialog->change == UI_MEDIASIZE_CHANGE_SIZE )
				{
					UpdateMenuLink(CNCL_PAPERSIZE, dialog->current_change_to_id);
					DisableSignal();
					UpdateWidgets(window, NULL);
					EnableSignal();
				}
				else
				{
					// Save current supply value.
					short supply_value = GetCurrentnValue(CNCL_MEDIASUPPLY);

					// Change the media type.
					UpdateMenuLink(CNCL_MEDIATYPE, dialog->current_change_to_id);
					DisableSignal();
					UpdateWidgets(window, NULL);
					EnableSignal();

					if( supply_value != GetCurrentnValue(CNCL_MEDIASUPPLY) )
					{
						// If no supply value for the current media type,
						// Some alert should be shown.

						// Only restore the saved supply value in this version.
						//UpdateMenuLink(CNCL_MEDIASUPPLY, supply_value);
					}
				}

				*change_item = TRUE;
			}
			result = exec_print;
		}
	}

	if( applied )
		g_free(applied);

	if( applied_title )
		g_free(applied_title);	/* Ver.3.00 */

	return result;
}
Пример #13
0
void UpdateUserSizeWidgets(UIUserSizeDialog* dialog, gboolean init_flag)
{
	GtkSpinButton* width_spin
		= (GtkSpinButton*)LookupWidget(
			UI_DIALOG(dialog)->window, "user_size_width_spin");
	GtkSpinButton* height_spin
	 	= (GtkSpinButton*)LookupWidget(
			UI_DIALOG(dialog)->window, "user_size_height_spin");

	GtkAdjustment* adjust_w = width_spin->adjustment;
	GtkAdjustment* adjust_h = height_spin->adjustment;

	double min_w, max_w;
	double min_h, max_h;
	double new_w, new_h;
	GtkWidget* label;
	gchar scale_label[64];
	gchar* scale_string;
	gchar width_min_string[12];
	gchar width_max_string[12];
	gchar height_min_string[12];
	gchar height_max_string[12];
	/* Ver.3.00 */
	double min_w_adjust, max_w_adjust;
	double min_h_adjust, max_h_adjust;
	gchar width_min_string_adjust[12];
	gchar width_max_string_adjust[12];
	gchar height_min_string_adjust[12];
	gchar height_max_string_adjust[12];

	// The scale of dialog->width and dialog->height is "mm", 
	// so old_scale must be 0 when showing this dialog.
	int old_scale = (init_flag)? 0 : dialog->old_scale;
	int new_scale
		= GetActiveButtonIndex(
			UI_DIALOG(dialog)->window, user_size_scale_button_name, 0);

	if( init_flag )
	{
		adjust_w->value = dialog->width;
		adjust_h->value = dialog->height;
	}

	if( new_scale )
	{	// inch
		width_spin->climb_rate = height_spin->climb_rate = 0.01;
		width_spin->digits = height_spin->digits = 2;

		if( new_scale != old_scale )
		{	//  mm -> inch
			new_w = Milli2Inch(dialog->min_mm_w, dialog->max_mm_w,
					dialog->min_in_w, dialog->max_in_w, adjust_w->value);
			new_h = Milli2Inch(dialog->min_mm_h, dialog->max_mm_h,
					dialog->min_in_h, dialog->max_in_h, adjust_h->value);
		}
		else
		{
			new_w = adjust_w->value;
			new_h = adjust_h->value;
		}
		min_w = dialog->min_in_w;
		max_w = dialog->max_in_w;
		min_h = dialog->min_in_h;
		max_h = dialog->max_in_h;
	}
	else
	{	// mm
		width_spin->climb_rate = height_spin->climb_rate = 0.1;
		width_spin->digits = height_spin->digits = 1;

		if( new_scale != old_scale )
		{	//  inch -> mm
			new_w = Inch2Milli(dialog->min_in_w, dialog->max_in_w,
					dialog->min_mm_w, dialog->max_mm_w, adjust_w->value);
			new_h = Inch2Milli(dialog->min_in_h, dialog->max_in_h,
					dialog->min_mm_h, dialog->max_mm_h, adjust_h->value);
		}
		else
		{
			new_w = adjust_w->value;
			new_h = adjust_h->value;
		}
		min_w = dialog->min_mm_w;
		max_w = dialog->max_mm_w;
		min_h = dialog->min_mm_h;
		max_h = dialog->max_mm_h;
	}

	// Set adjustment fields.
	adjust_w->step_increment = width_spin->climb_rate;
	adjust_h->step_increment = height_spin->climb_rate;
	adjust_w->page_increment = width_spin->climb_rate * 10;
	adjust_h->page_increment = height_spin->climb_rate * 10;

#if 0
	adjust_w->lower = min_w;
	adjust_w->upper = max_w;
	adjust_h->lower = min_h;
	adjust_h->upper = max_h;
#endif

	/* Ver.3.00 */
	if( new_scale )	//inch
	{
		snprintf( width_min_string_adjust, 12, "%6.0f", (float)min_w * (float)100 );
		snprintf( width_max_string_adjust, 12, "%6.0f", (float)max_w * (float)100 );
		snprintf( height_min_string_adjust, 12,  "%6.0f", (float)min_h * (float)100 );
		snprintf( height_max_string_adjust, 12,  "%6.0f", (float)max_h * (float)100 );

		min_w_adjust = (double)atoi( width_min_string_adjust ) / (double)100;
		max_w_adjust = (double)atoi( width_max_string_adjust ) / (double)100;
		min_h_adjust = (double)atoi( height_min_string_adjust ) / (double)100;
		max_h_adjust = (double)atoi( height_max_string_adjust ) / (double)100;

	}
	else		//mm
	{
		snprintf( width_min_string_adjust, 12, "%6.0f", (float)min_w * (float)10 );
		snprintf( width_max_string_adjust, 12, "%6.0f", (float)max_w * (float)10 );
		snprintf( height_min_string_adjust,12,  "%6.0f", (float)min_h * (float)10 );
		snprintf( height_max_string_adjust, 12, "%6.0f", (float)max_h * (float)10 );
	
		min_w_adjust = (double)atoi( width_min_string_adjust ) / (double)10;
		max_w_adjust = (double)atoi( width_max_string_adjust ) / (double)10;
		min_h_adjust = (double)atoi( height_min_string_adjust ) / (double)10;
		max_h_adjust = (double)atoi( height_max_string_adjust ) / (double)10;
	}

	adjust_w->lower = min_w_adjust;
	adjust_w->upper = max_w_adjust;
	adjust_h->lower = min_h_adjust;
	adjust_h->upper = max_h_adjust;


#ifdef _PRINTUI_DEBUG_
	fprintf(stderr,"adjust_w->lower = %f\n",adjust_w->lower);
	fprintf(stderr,"min_w = %f\n",min_w);
	fprintf(stderr,"adjust_w->upper = %f\n",adjust_w->upper);
	fprintf(stderr,"max_w = %f\n",max_w);
	fprintf(stderr,"adjust_h->lower = %f\n",adjust_h->lower);
	fprintf(stderr,"min_h = %f\n",min_h);
	fprintf(stderr,"adjust_h->upper = %f\n",adjust_h->upper);
	fprintf(stderr,"max_h = %f\n",max_h);
#endif

	gtk_spin_button_set_value(width_spin, new_w);
	gtk_spin_button_set_value(height_spin, new_h);


	/* Ver.2.80 */
	snprintf( width_min_string, 12, user_size_range_format[new_scale], (float)min_w );
	snprintf( width_max_string, 12, user_size_range_format[new_scale], (float)max_w );
	snprintf( height_min_string, 12, user_size_range_format[new_scale], (float)min_h );
	snprintf( height_max_string, 12, user_size_range_format[new_scale], (float)max_h );

	scale_string = LookupText(g_keytext_list, user_size_scale_format_res[new_scale]);

	// Width scale label.
	label = LookupWidget(UI_DIALOG(dialog)->window, "user_size_width_label");
	snprintf(scale_label, sizeof(scale_label), scale_string, width_min_string, width_max_string );/*Ver.2.90(s)*/
	gtk_label_set_text(GTK_LABEL(label), scale_label);

	// Height scale label.
	label = LookupWidget(UI_DIALOG(dialog)->window, "user_size_height_label");
	snprintf(scale_label,sizeof(scale_label), scale_string, height_min_string, height_max_string );/*Ver.2.90(s)*/
	gtk_label_set_text(GTK_LABEL(label), scale_label);


	dialog->old_scale = new_scale;
}
Пример #14
0
/*--------------------------------------*/
void
on_color_dialog_default_button_clicked2 (GtkButton       *button,
                                        gpointer         user_data)
{
	UIColorDialog2* dialog = g_color_dialog2;
	short print_bw = IsGrayPrint(g_main_window);

	/* Ver.2.80 */
	GtkWidget* window = UI_DIALOG(dialog)->window;

	/* Ver.2.80 */
	DisableSignal();

	/* Ver.2.80 */
	gtk_range_set_value( GTK_RANGE(LookupWidget(window, "color_dialog_cyan_scale2")) , (gdouble)CYAN_BALANCE_INIT );
	gtk_range_set_value( GTK_RANGE(LookupWidget(window, "color_dialog_magenta_scale2")) , (gdouble)MAGENTA_BALANCE_INIT );
	gtk_range_set_value( GTK_RANGE(LookupWidget(window, "color_dialog_yellow_scale2")) , (gdouble)YELLOW_BALANCE_INIT );
	gtk_range_set_value( GTK_RANGE(LookupWidget(window, "color_dialog_contrast_scale2")) , (gdouble)CONTRAST_BALANCE_INIT );
	gtk_range_set_value( GTK_RANGE(LookupWidget(window, "color_dialog_density_scale2")) , (gdouble)DENSITY_BALANCE_INIT );

	/* Ver.2.90 */
	gtk_spin_button_set_value( GTK_SPIN_BUTTON(LookupWidget(window, "c_dlg_c_value_spin2")) , (gdouble)CYAN_BALANCE_INIT );
	gtk_spin_button_set_value( GTK_SPIN_BUTTON(LookupWidget(window, "c_dlg_m_value_spin2")) , (gdouble)MAGENTA_BALANCE_INIT );
	gtk_spin_button_set_value( GTK_SPIN_BUTTON(LookupWidget(window, "c_dlg_y_value_spin2")) , (gdouble)YELLOW_BALANCE_INIT );
	gtk_spin_button_set_value( GTK_SPIN_BUTTON(LookupWidget(window, "c_dlg_density_value_spin2")) , (gdouble)CONTRAST_BALANCE_INIT );
	gtk_spin_button_set_value( GTK_SPIN_BUTTON(LookupWidget(window, "c_dlg_contrast_value_spin2")) , (gdouble)DENSITY_BALANCE_INIT );

	/* Ver.3.40 */
	gtk_range_set_value( GTK_RANGE(LookupWidget(window, "color_dialog_tone_scale2")) , (gdouble)TONE_BALANCE_INIT );
	gtk_spin_button_set_value( GTK_SPIN_BUTTON(LookupWidget(window, "c_dlg_tone_value_spin2")) , (gdouble)TONE_BALANCE_INIT );

	// Vivid button.
	gtk_toggle_button_set_active(
		GTK_TOGGLE_BUTTON(LookupWidget(UI_DIALOG(dialog)->window,
			"color_dialog_vivid_button2")), VIVID_INIT);

	// Color correct combo.
	SetColorCorrectCombo2(dialog, GetDefaultnValue(CNCL_INTENT));
	SensitiveColorCorrectCombo(dialog, !(VIVID_INIT | print_bw));

	// Gamma correct combo.
	SetGammaCombo(dialog, GetDefaultnValue(CNCL_INPUT_GAMMA));

	/* Ver.2.80 */
	EnableSignal();
}
Пример #15
0
void UpdateUserSizeWidgets(UIUserSizeDialog* dialog, gboolean init_flag)
{
	GtkSpinButton* width_spin
		= (GtkSpinButton*)LookupWidget(
			UI_DIALOG(dialog)->window, "user_size_width_spin");
	GtkSpinButton* height_spin
	 	= (GtkSpinButton*)LookupWidget(
			UI_DIALOG(dialog)->window, "user_size_height_spin");

	GtkAdjustment* adjust_w = width_spin->adjustment;
	GtkAdjustment* adjust_h = height_spin->adjustment;

	double min_w, max_w;
	double min_h, max_h;
	double new_w, new_h;
	GtkWidget* label;
	gchar scale_label[64];

	// The scale of dialog->width and dialog->height is "mm", 
	// so old_scale must be 0 when showing this dialog.
	int old_scale = (init_flag)? 0 : dialog->old_scale;
	int new_scale
		= GetActiveButtonIndex(
			UI_DIALOG(dialog)->window, user_size_scale_button_name, 0);

	if( init_flag )
	{
		adjust_w->value = dialog->width;
		adjust_h->value = dialog->height;
	}

	if( new_scale )
	{	// inch
		width_spin->climb_rate = height_spin->climb_rate = 0.01;
		width_spin->digits = height_spin->digits = 2;

		if( new_scale != old_scale )
		{	//  mm -> inch
			new_w = Milli2Inch(dialog->min_mm_w, dialog->max_mm_w,
					dialog->min_in_w, dialog->max_in_w, adjust_w->value);
			new_h = Milli2Inch(dialog->min_mm_h, dialog->max_mm_h,
					dialog->min_in_h, dialog->max_in_h, adjust_h->value);
		}
		else
		{
			new_w = adjust_w->value;
			new_h = adjust_h->value;
		}
		min_w = dialog->min_in_w;
		max_w = dialog->max_in_w;
		min_h = dialog->min_in_h;
		max_h = dialog->max_in_h;
	}
	else
	{	// mm
		width_spin->climb_rate = height_spin->climb_rate = 0.1;
		width_spin->digits = height_spin->digits = 1;

		if( new_scale != old_scale )
		{	//  inch -> mm
			new_w = Inch2Milli(dialog->min_in_w, dialog->max_in_w,
					dialog->min_mm_w, dialog->max_mm_w, adjust_w->value);
			new_h = Inch2Milli(dialog->min_in_h, dialog->max_in_h,
					dialog->min_mm_h, dialog->max_mm_h, adjust_h->value);
		}
		else
		{
			new_w = adjust_w->value;
			new_h = adjust_h->value;
		}
		min_w = dialog->min_mm_w;
		max_w = dialog->max_mm_w;
		min_h = dialog->min_mm_h;
		max_h = dialog->max_mm_h;
	}

	// Set adjustment fields.
	adjust_w->step_increment = width_spin->climb_rate;
	adjust_h->step_increment = height_spin->climb_rate;
	adjust_w->page_increment = width_spin->climb_rate * 10;
	adjust_h->page_increment = height_spin->climb_rate * 10;
	adjust_w->lower = min_w;
	adjust_w->upper = max_w;
	adjust_h->lower = min_h;
	adjust_h->upper = max_h;

	gtk_spin_button_set_value(width_spin, new_w);
	gtk_spin_button_set_value(height_spin, new_h);

	// Width scale label.
	label = LookupWidget(UI_DIALOG(dialog)->window, "user_size_width_label");
	sprintf(scale_label, user_size_scale_format[new_scale],
		user_size_scale_label[new_scale], (float)min_w, (float)max_w);
	gtk_label_set_text(GTK_LABEL(label), scale_label);

	// Height scale label.
	label = LookupWidget(UI_DIALOG(dialog)->window, "user_size_height_label");
	sprintf(scale_label, user_size_scale_format[new_scale],
		user_size_scale_label[new_scale], (float)min_h, (float)max_h);
	gtk_label_set_text(GTK_LABEL(label), scale_label);

	dialog->old_scale = new_scale;
}
Пример #16
0
/* ver.3.20:Use combo (item list) */
int ShowMediaSizeIllegalSelectDialog(UIMediaSizeDialog* dialog, gchar* applied)
{
	GtkWidget* current_label;
	GtkWidget* message_label;
	char *data;
	short change_id;
	char* change_msg;
	int i;
	gchar* alert_msg2_1;
	gchar* alert_msg2_2;
	gchar* message;
	gchar* tmp_message;
	gint message_len, tmp_message_len;

	if( dialog->change == UI_MEDIASIZE_CHANGE_SIZE ){
		/* show  media -> size */
		/* show media */
		current_label = LookupWidget(UI_DIALOG(dialog)->window, "mediasize_illegal_select_label001");
		gtk_label_set_text( GTK_LABEL(current_label), LookupText(g_keytext_list, "LUM_IDD_PAG_MAIN_IDC_STT_MEDIATYPE") );

		current_label = LookupWidget(UI_DIALOG(dialog)->window, "mediasize_illegal_select_label002");
		data = ValueToName(CNCL_MEDIATYPE, KeyToValue(CNCL_MEDIATYPE, dialog->media));
		gtk_label_set_text( GTK_LABEL(current_label), data );

		/* show size */
		current_label = LookupWidget(UI_DIALOG(dialog)->window, "mediasize_illegal_select_label003");
		gtk_label_set_text( GTK_LABEL(current_label), LookupText(g_keytext_list, "LUM_IDD_PAG_PAGESET_XP_IDC_STT_PAGESIZE") );

		current_label = LookupWidget(UI_DIALOG(dialog)->window, "mediasize_illegal_select_label004");
		data = ValueToName(CNCL_PAPERSIZE, KeyToValue(CNCL_PAPERSIZE, dialog->size));
		gtk_label_set_text( GTK_LABEL(current_label), data );
	}
	else {
		/* show  size -> media */
		/* show size */
		current_label = LookupWidget(UI_DIALOG(dialog)->window, "mediasize_illegal_select_label001");
		gtk_label_set_text( GTK_LABEL(current_label), LookupText(g_keytext_list, "LUM_IDD_PAG_PAGESET_XP_IDC_STT_PAGESIZE") );

		current_label = LookupWidget(UI_DIALOG(dialog)->window, "mediasize_illegal_select_label002");
		data = ValueToName(CNCL_PAPERSIZE, KeyToValue(CNCL_PAPERSIZE, dialog->size));
		gtk_label_set_text( GTK_LABEL(current_label), data );

		/* show media */
		current_label = LookupWidget(UI_DIALOG(dialog)->window, "mediasize_illegal_select_label003");
		gtk_label_set_text( GTK_LABEL(current_label), LookupText(g_keytext_list, "LUM_IDD_PAG_MAIN_IDC_STT_MEDIATYPE") );

		current_label = LookupWidget(UI_DIALOG(dialog)->window, "mediasize_illegal_select_label004");
		data = ValueToName(CNCL_MEDIATYPE, KeyToValue(CNCL_MEDIATYPE, dialog->media));
		gtk_label_set_text( GTK_LABEL(current_label), data );
	}
	dialog->item_count = CountWords(applied);

	message_label = LookupWidget(UI_DIALOG(dialog)->window,
									"mediasize_illegal_select_message_label");
	if( dialog->change == UI_MEDIASIZE_CHANGE_SIZE )
	{
		change_id = CNCL_PAPERSIZE;
		change_msg = LookupText(g_keytext_list, "mediasize_change_size");
	}
	else
	{
		change_id = CNCL_MEDIATYPE;
		change_msg = LookupText(g_keytext_list, "mediasize_change_media");
	}

	// In case of changing more than 1 recommended items.
	alert_msg2_1
		= LookupText(g_keytext_list, "mediasize_illegal_select_message2_1");
	alert_msg2_2
		= LookupText(g_keytext_list, "mediasize_illegal_select_message2_2");
	message_len = strlen(change_msg) + strlen(alert_msg2_1) + strlen(alert_msg2_2) + 2;	/* Ver.2.80 "2":\n+\0 */
	message = (gchar*)g_malloc( message_len );
	tmp_message_len = strlen(change_msg) + strlen(alert_msg2_1) + 1;	/* Ver.2.80 "1":\0 */
	tmp_message = (gchar*)g_malloc( tmp_message_len );

	snprintf(tmp_message, tmp_message_len, alert_msg2_1, change_msg ); /* Ver.3.60 */
	snprintf(message, message_len, "%s\n%s", tmp_message, alert_msg2_2);
	gtk_label_set_text(GTK_LABEL(message_label), message);

	g_free(tmp_message);
	g_free(message);

	{
		gchar* words = applied;
		gchar* word = (gchar*)g_malloc(strlen(words));
		gchar* next;
		gchar* change_to;
		int len;

		/* Ver.3.20: make combo */
		GtkWidget* combo = LookupWidget(UI_DIALOG(dialog)->window, "mediasize_illegal_combo" );
	
		/* Remove all items in current list */
		if(gtk_combo_box_get_active_text( GTK_COMBO_BOX( combo )) ){
			while( 1 ){
				gtk_combo_box_set_active( GTK_COMBO_BOX( combo ), 0 );
				if( ! gtk_combo_box_get_active_text( GTK_COMBO_BOX( combo )) ) break;
				gtk_combo_box_remove_text( GTK_COMBO_BOX( combo ), 0 );
			}
		}
		/* Add available list (not disable items from UIDB ) */
		for( i = 0 ; i < dialog->item_count ; i++ )
		{
			next = GetWord(words, &len);
			strncpy(word, words, len);
			word[len] = '\0';
			change_to = LookupText(g_keytext_list, word);
			
			if( change_to != NULL )
			{
				if( *change_to != '\0' ){
					/* append one item */
					gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), change_to );
				}
			}
			
			if( i == 0) dialog->current_change_to_id = KeyToValue(change_id, word);		/* default current...set top item */
			
			words = next;
			
		}
		/* Set active item to top */
		gtk_combo_box_set_active( GTK_COMBO_BOX( combo ), 0 );
		gtk_widget_show( combo );

		g_free(word);
	}

	gtk_window_set_title(
		GTK_WINDOW(UI_DIALOG(dialog)->window), g_window_title);	
	gtk_window_set_position(
		GTK_WINDOW(UI_DIALOG(dialog)->window), GTK_WIN_POS_CENTER);	

	ShowDialog((UIDialog*)dialog, "mediasize_illegal_select_apply_button");
	return dialog->exec;
}
Пример #17
0
UIColorDialog* CreateColorDialog(UIDialog* parent)
{
	GtkWidget* window;
	GtkAdjustment* adjust;
	// Create dialog.
	UIColorDialog* dialog
		 = (UIColorDialog*)CreateDialog(sizeof(UIColorDialog), parent);

	// Create dialog window.
#ifdef	USE_LIB_GLADE
	UI_DIALOG(dialog)->window = window = LookupWidget(NULL, "color_dialog");
#else
	UI_DIALOG(dialog)->window = window = create_color_dialog();
#endif

	// Cyan scale adjustment.
	adjust = gtk_range_get_adjustment(
		GTK_RANGE(LookupWidget(window, "color_dialog_cyan_scale")));
	gtk_signal_connect(GTK_OBJECT(adjust), "value_changed",
		GTK_SIGNAL_FUNC(on_color_dialog_cyan_adjust_value_changed), window);
	dialog->cyan_balance = CYAN_BALANCE_INIT;
	dialog->cyan_adjust = adjust;

	// Magenta scale adjustment.
	adjust = gtk_range_get_adjustment(
		GTK_RANGE(LookupWidget(window, "color_dialog_magenta_scale")));
	gtk_signal_connect(GTK_OBJECT(adjust), "value_changed",
		GTK_SIGNAL_FUNC(on_color_dialog_magenta_adjust_value_changed), window);
	dialog->magenta_balance = MAGENTA_BALANCE_INIT;
	dialog->magenta_adjust = adjust;

	// Yellow scale adjustment.
	adjust = gtk_range_get_adjustment(
		GTK_RANGE(LookupWidget(window, "color_dialog_yellow_scale")));
	gtk_signal_connect(GTK_OBJECT(adjust), "value_changed",
		GTK_SIGNAL_FUNC(on_color_dialog_yellow_adjust_value_changed), window);
	dialog->yellow_balance = YELLOW_BALANCE_INIT;
	dialog->yellow_adjust = adjust;

	// Black scale adjustment.
	adjust = gtk_range_get_adjustment(
			GTK_RANGE(LookupWidget(window, "color_dialog_black_scale")));
	gtk_signal_connect(GTK_OBJECT(adjust), "value_changed",
		GTK_SIGNAL_FUNC(on_color_dialog_black_adjust_value_changed), window);
	dialog->black_balance = BLACK_BALANCE_INIT;
	dialog->black_adjust = adjust;

	// Density scale adjustment.
	adjust = gtk_range_get_adjustment(
			GTK_RANGE(LookupWidget(window, "color_dialog_density_scale")));
	gtk_signal_connect(GTK_OBJECT(adjust), "value_changed",
		GTK_SIGNAL_FUNC(on_color_dialog_density_adjust_value_changed), window);
	dialog->density_balance = DENSITY_BALANCE_INIT;
	dialog->density_adjust = adjust;

	// Color correct combo.
	dialog->color_correct = SetColorCorrectCombo(dialog, COLOR_CORRECT_INIT);

	// Gamma combo.
	dialog->default_gamma =
	dialog->gamma = SetGammaCombo(dialog, GetDefaultGamma(dialog));

	dialog->vivid = FALSE;

	// Show vivid button if supported.
	if( IsAvailableVivid() )
	{
		gtk_widget_show(LookupWidget(window, "color_dialog_vivid_button"));
	}
	return dialog;
}
Пример #18
0
void UpdateQualityDialogWidgets(GtkWidget* window, gchar* except_name)
{
	// Print quality 1-5 button.
	int quality;

	for( quality = 0 ; print_quality_button_name[quality] != NULL ; quality++ )
	{
		GtkWidget* button
			 = LookupWidget(window, print_quality_button_name[quality]);
		short flag
			 = GetAllFlags(CNCL_PRINTQUALITY,
				 print_quality_button_value[quality]);

		if( flag & DISABLE_FLAG )
			gtk_widget_set_sensitive(button, FALSE);
		else
			gtk_widget_set_sensitive(button, TRUE);

		if( flag & CURRENT_FLAG )
		{
			gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
		}
	}

	{
		short quality_value = GetCurrentnValue(CNCL_PRINTQUALITY);
		GtkWidget* button;
		short value[3];
		int i;

		for( i = 0 ; i < 3 ; i++ )
		{
			button = LookupWidget(UI_DIALOG(g_main_window)->window,
								g_quality_button_name[i]);
			value[i] = GetCurrentnValue(g_mess_map[i]);

			if( value[i] == quality_value )
			{
				gtk_label_set_text(
					GTK_LABEL(LookupWidget(window, "quality_level_name_label")),
						GTK_LABEL(GTK_BIN(button)->child)->label);
				break;
			}
		}
		if( i == 3 )
		{
				gtk_label_set_text(
					GTK_LABEL(LookupWidget(window, "quality_level_name_label")),"");
		}

		{	/* Ver.2.70: Write 5position value always */
			int index
			 	= GetActiveButtonIndex( window, print_quality_button_name, 0);
			char message[16];

			sprintf(message, "%d", 5 - index);
			gtk_label_set_text(
				GTK_LABEL(
					LookupWidget(window, "quality_level_num_label")), message);
		}
	}

	// Halftoning button and label.
	{
		int bin_method;
		for( bin_method = 0
			; bin_method_button_name[bin_method] != NULL ; bin_method++ )
		{
			GtkWidget* button
				 = LookupWidget(window, bin_method_button_name[bin_method]);
			gboolean sensitive;
			gboolean toggle;

			if( bin_method_button_value[bin_method] == CND_UIBIN_PATTERN )
			{
				short flag0 = 0;
				short flag1 = -1;
				int i;

				for( i = 0 ; bin_method_pattern_value[i] != -1 ; i++ )
				{
					short flag = GetAllFlags(CNCL_DITHER_PAT,
								 bin_method_pattern_value[i]);
					if( flag != -1 )
					{
						flag1 &= flag;
						flag0 |= flag;
					}
				}

				sensitive = (flag1 & DISABLE_FLAG)? FALSE :TRUE;
				toggle    = (flag0 & CURRENT_FLAG)? TRUE : FALSE;
			}
			else
			{
				short flag = GetAllFlags(CNCL_DITHER_PAT, CND_UIBIN_ED);

				sensitive = (flag & DISABLE_FLAG)? FALSE : TRUE;
				toggle    = (flag & CURRENT_FLAG)? TRUE : FALSE;
			}

			gtk_widget_set_sensitive(button, sensitive);
			gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), toggle);
		}
	}
}
Пример #19
0
void UpdateWidgets(GtkWidget* window, gchar* except_name)
{
	char *current_comb_supply = NULL;
	char *current_comb_supply_local = NULL;
	short	len = 0;
	short	current_comb_supply_id = 0;
	
#ifdef _PRINTUI_DEBUG_
	fprintf(stderr,"\n### UpdateWidgets :except_name = %s ###\n",except_name);
#endif

	/* Ver.2.70: for "Front for Plain" */
	if( except_name!=NULL ){

		/* Store "media_supply_entry" setting(UI strings) */
		/* Ver.2.80 */
		GtkWidget* combo = LookupWidget(window,  "media_supply_combo");
		current_comb_supply = (char*)gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo));

		len = strlen(current_comb_supply) + 1;
		current_comb_supply_local = malloc( len );
		memset(current_comb_supply_local,0x00, len );
		strncpy( current_comb_supply_local , current_comb_supply , len );
		current_comb_supply_local[len-1] = '\0';
#ifdef _PRINTUI_DEBUG_
		fprintf(stderr,"current_comb_supply_local = %s\n",current_comb_supply_local);
#endif
	}
	
	// Print bw button
	if( !SameName(except_name, "print_bw_button") )
	{
		gboolean sensitive = TRUE;

		switch( GetCurrentnValue(CNCL_GRAYSCALE) )
		{
		case CND_BJGRAYSCALE_OFF:
			break;
		case CND_BJGRAYSCALE_ON:
			break;
		case CND_BJGRAYSCALE_GRAY:
			sensitive = FALSE;
			break;
		default:
			break;
		}

		gtk_widget_set_sensitive( LookupWidget(window, "print_bw_button1"), sensitive);
		gtk_widget_set_sensitive( LookupWidget(window, "print_bw_button2"), sensitive);
	}

	// Media type combo
	if( !SameName(except_name, "media_type_combo") )
	{
#ifdef _PRINTUI_DEBUG_
		fprintf(stderr,"UpdateWidgets:media_type_combo\n");
#endif
		SetItemsToComboBox(window, "media_type_combo", CNCL_MEDIATYPE, GetCurrentnValue(CNCL_MEDIATYPE));/* Ver.2.80 */
	}

	// Media supply combo
	if( !SameName(except_name, "media_supply_combo") )
	{
		GList* glist = GetComboList(CNCL_MEDIASUPPLY);

		/* iP3300,MP510:Add "Front for Plain" (This value is always available) */
		{
			char *str;
		
			//GetAllFlags:If CND_SUPPLY_CASSETTE_04 exist --> str > 0
			if( GetAllFlags( CNCL_MEDIASUPPLY , CND_SUPPLY_CASSETTE_04 ) >= 0 ){
				str = ValueToName( CNCL_MEDIASUPPLY , CND_SUPPLY_FRONT_FOR_PLAIN );
				glist = g_list_append(glist, str);
			}
		}
		
		/* Ver.2.70: for "Front for Plain" */
		if( except_name!=NULL ){
			/* UI setting at the top of this function is not disable on CNCLDB --> use it (to UI) */
			/* UI setting at the top of this function is disable on CNCLDB     --> use current value of CNCLDB (to UI) */
			current_comb_supply_id = NameToValue( CNCL_MEDIASUPPLY , current_comb_supply_local );

			/* Replace "CND_SUPPLY_FRONT_FOR_PLAIN" with "CND_SUPPLY_ASF" before check */
			if( current_comb_supply_id == CND_SUPPLY_FRONT_FOR_PLAIN ) current_comb_supply_id = CND_SUPPLY_ASF;
		
			if( IsAvailableValue( CNCL_MEDIASUPPLY , current_comb_supply_id ) ){ /* UI setting is not disable on CNCLDB */
				SetGListToComboBox(window, "media_supply_combo",glist, current_comb_supply_local , CNCL_MEDIASUPPLY );/* Ver.2.80 */

			}else{ 																 /* UI setting is disable on CNCLDB */
#ifdef _PRINTUI_DEBUG_
				fprintf(stderr," IsAvailableValue(%s,ID=%d): not Available!!\n",current_comb_supply_local,current_comb_supply_id);
#endif
				SetGListToComboBox(window, "media_supply_combo",glist, GetCurrentString(CNCL_MEDIASUPPLY) , CNCL_MEDIASUPPLY );/* Ver.2.80 */
			}
		}
		else{	//NULL --> Select "CNCLDB current value" on UI
			SetGListToComboBox(window, "media_supply_combo",glist, GetCurrentString(CNCL_MEDIASUPPLY) , CNCL_MEDIASUPPLY);/* Ver.2.80 */
		}
	}


	// Cartridge type combo
	if( !SameName(except_name, "cartridge_type_combo") )
	{
#ifdef _PRINTUI_DEBUG_
		fprintf(stderr,"UpdateWidgets:cartridge_type_combo\n");
#endif
		SetItemsToComboBox(window, "cartridge_type_combo", CNCL_CARTRIDGE, GetCurrentnValue(CNCL_CARTRIDGE));/* Ver.2.80 */
	}


	// Quality radio button
	{
		gboolean custom_active = GTK_TOGGLE_BUTTON( LookupWidget(window, "quality_custom_button"))->active;
		GtkWidget* custom_button  = LookupWidget(window, "quality_dialog_button");
		short quality = GetCurrentnValue(CNCL_PRINTQUALITY);
		GtkWidget* button;
		short value[3];
		int i;

		for( i = 0 ; i < 3 ; i++ )
		{
			button = LookupWidget(window, g_quality_button_name[i]);
			value[i] = GetCurrentnValue(g_mess_map[i]);

			if( !custom_active && value[i] == quality )
			{	// activate button
				gtk_widget_set_sensitive(custom_button, FALSE);
				gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
			}

			if( value[i] != CND_QUALITY_ABSOLUTE_NA )
				gtk_widget_set_sensitive(button, TRUE);
			else
				gtk_widget_set_sensitive(button, FALSE);
		}

		if( custom_active ){	// activate custom button
			gtk_widget_set_sensitive(custom_button, TRUE);
		}
	}

	// Color auto radio button
	{
		GtkWidget* button = LookupWidget(window, "color_auto_button");
		gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(button), g_main_window->color_auto );
		
	}

	// Color adjust radio button
	{
		GtkWidget* button = LookupWidget(window, "color_dialog_button");

		if( GTK_TOGGLE_BUTTON( LookupWidget(window, "color_manual_button"))->active )
			gtk_widget_set_sensitive(button, TRUE);
		else
			gtk_widget_set_sensitive(button, FALSE);
	}

	// Guide(Thickness etc...)
	{
		GtkWidget* label = LookupWidget(window, "thick_msg_label");
		char* position_msg = GetCurrentString(CNCL_MESS_THICK);

		gtk_label_set_text(GTK_LABEL(label), (gchar*)position_msg);
	}

#ifdef _PRINTUI_DEBUG_
	fprintf(stderr,"UpdateWidgets:8\n");
#endif
	// Paper gap combo
	if( !SameName(except_name, "paper_gap_combo") )
	{
#ifdef _PRINTUI_DEBUG_
		fprintf(stderr,"UpdateWidgets:paper_gap_combo\n");
#endif
		SetItemsToComboBox(window, "paper_gap_combo", CNCL_PAPERGAP_COMMAND, GetCurrentnValue(CNCL_PAPERGAP_COMMAND));/* Ver.2.80 */
	}

	/////////////////////////////////////////////////////////////////


	// Media size combo
	if( !SameName(except_name, "media_size_combo") )
	{
		//Ver.3.00
		SetItemsToComboBox(window, "media_size_combo", CNCL_PAPERSIZE, GetCurrentnValue(CNCL_PAPERSIZE));
	}

	// Printing type combo
	if( !SameName(except_name, "printing_type_combo") )
	{
		SetTextArrayToComboBox(window, "printing_type_combo",
			(const gchar**)g_printing_type_name,
			(const short*)g_printing_type_value, g_main_window->printing_type);
	}

	// Printing scaling hbox.
	{
		GtkWidget* hbox = LookupWidget(window, "scaling_hbox");

		if( g_main_window->printing_type == PRINTING_TYPE_SCALE )
			gtk_widget_show(hbox);
		else
			gtk_widget_hide(hbox);
	}

	// Printing scaling spin.
	if( !SameName(except_name, "printing_scaling_button") )
	{
		GtkSpinButton* scaling_spin = (GtkSpinButton*)LookupWidget(window, "printing_scaling_spin");
		gtk_adjustment_set_value(scaling_spin->adjustment, (gfloat)g_main_window->scaling);
	}

	// Centering button.
	if( !SameName(except_name, "centering_button") )
	{
		gboolean active
			= (g_main_window->centering == LOCATION_CENTER)? TRUE : FALSE;
		gtk_toggle_button_set_active(
			GTK_TOGGLE_BUTTON(LookupWidget(UI_DIALOG(g_main_window)->window,
				"centering_button")), active);
	}

	if( IsAvailableBorderless() )
	{
		short margin_type = GetCurrentnValue(CNCL_MARGINTYPE);
		gboolean active = (margin_type == CND_MARGIN_MINUS)? TRUE : FALSE;

		// Borderless hbox.
		GtkWidget* hbox = LookupWidget(window, "borderless_hbox");
//		gtk_widget_set_sensitive(hbox, active);
		if( active == TRUE )
			gtk_widget_show(hbox);
		else
			gtk_widget_hide(hbox);

		// Borderless button.
		if( !SameName(except_name, "borderless_button") )
		{
			GtkWidget* button = LookupWidget(window, "borderless_button");
			gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), active);
		}

		// Border ext button.
		if( !SameName(except_name, "border_ext_button") )
		{
			gtk_toggle_button_set_active(
				GTK_TOGGLE_BUTTON(LookupWidget(UI_DIALOG(g_main_window)->window,
				g_border_ext_button_name[g_main_window->ext_border])), TRUE);
		}
	}

	if( IsAvailableDuplex() )
	{
		GtkWidget* duplex_vbox;
		GtkWidget* duplex_hbox;
		gboolean active;

		// Duplex vbox.
		duplex_vbox = LookupWidget(window, "duplex_vbox");
		gtk_widget_set_sensitive(duplex_vbox, IsAvailableValue(CNCL_DUPLEX_PRINTING, CND_DUPLEX_AUTO));

		// Duplex hbox.
		active = (CND_DUPLEX_AUTO == GetCurrentnValue(CNCL_DUPLEX_PRINTING))? TRUE : FALSE;	/* Ver.2.70 */
		duplex_hbox = LookupWidget(window, "duplex_hbox");
		gtk_widget_set_sensitive(duplex_hbox, active);

		// Auto Duplex button.
		if( !SameName(except_name, "auto_duplex_button") )
		{
		//	GtkWidget* button = LookupWidget(window, "auto_duplex_button");	// not in use...
		}

		// Stapleside
		if( !SameName(except_name, "stapleside_button") )
		{
			gtk_toggle_button_set_active(
				GTK_TOGGLE_BUTTON(LookupWidget(UI_DIALOG(g_main_window)->window,
				g_staple_button_name[g_main_window->stapleside])), TRUE);
		}
	}

	// Copies spin.
	if( !SameName(except_name, "copies_spin") )
	{
		GtkSpinButton* copies_spin = (GtkSpinButton*)LookupWidget(window, "copies_spin");
		gtk_adjustment_set_value(copies_spin->adjustment, (gfloat)g_main_window->copies);
	}
	

	if(current_comb_supply_local){
		free(current_comb_supply_local);
		current_comb_supply_local = NULL;
	}
	
	// Ver.2.90:Custom Paper Size dialog button
	{
		GtkWidget* hbox_user = LookupWidget(window, "hbox_user");
//		GtkWidget* space_user = LookupWidget(window, "usersize_space_label");	//Ver.3.10テスト中

		if( CND_SIZE_USER == GetCurrentnValue(CNCL_PAPERSIZE)  )
		{
			gtk_widget_show(hbox_user);
//			gtk_widget_show(space_user);
		}else
		{
			gtk_widget_hide(hbox_user);
//			gtk_widget_hide(space_user);
		}
	}


	/* Ver.3.00: Show supply position */
	{
		GtkWidget* supply_mes_label2 = LookupWidget(window, "supply_label2");
		short	media,size;
		
		media = GetCurrentnValue(CNCL_MEDIATYPE);
		size = GetCurrentnValue(CNCL_PAPERSIZE);

		if( GetCurrentnValue(CNCL_MEDIASUPPLY) == CND_SUPPLY_AUTO_SELECT )
		{
			if( ( media==CND_MEDIA_PLAIN ) && ( size==CND_SIZE_A4 || size==CND_SIZE_A5 || size==CND_SIZE_B5 || size==CND_SIZE_LETTER ) ){
				gtk_widget_hide(supply_mes_label2);
			}
			else{
				gtk_label_set_text(GTK_LABEL(supply_mes_label2), (gchar*)ValueToName( CNCL_MEDIASUPPLY , CND_SUPPLY_ASF ));
				gtk_widget_show(supply_mes_label2);
			}
		}
		else{
			gtk_widget_hide(supply_mes_label2);
		}
	}

}
Пример #20
0
int UpdateMenuLink(short id, short value)
{
	int ret;
	short media_type;
	short gray_scale;
	short margin_type;
	short paper_size;
	short print_quality;
	short media_supply;
	short dither_pat;
	short ui_duplex_toggled = CND_DUPLEX_OFF;/* Default */	/* Ver.2.70 */
	GtkWidget* window = NULL;	/* Ver.2.70 */
	short select_paper_size;		// paper size combo selected paper size
	short changed_paper_size;		// CNCL_GetMenulink(1st) selected paper size
	/* Ver.2.70 */
	short margin_old;
	short margin_new;

#ifdef _PRINTUI_DEBUG_
	fprintf(stderr,"\n+++ UpdateMenuLink id=%d,value=%d +++\n",id,value);
#endif

	select_paper_size = GetCurrentnValue(CNCL_PAPERSIZE);

	/*Ver.2.70: Replace "CND_SUPPLY_FRONT_FOR_PLAIN" with "CND_SUPPLY_ASF" before MenuLink */
	if( id == CNCL_MEDIASUPPLY &&  value == CND_SUPPLY_FRONT_FOR_PLAIN ) value = CND_SUPPLY_ASF;
	

	/* Ver.2.70: Store toggle status of "Duplex Printing" */
	if(g_main_window){
		window = UI_DIALOG(g_main_window)->window;
		ui_duplex_toggled = GTK_TOGGLE_BUTTON( LookupWidget(window, "auto_duplex_button"))->active;
	}

	/* Ver.2.70: Store current setting of "CNCL_MARGINTYPE"(CNCLDB) */
	margin_old = GetCurrentnValue(CNCL_MARGINTYPE);

	if( GetCallbackTableNum() )
		SetCallbackTableOldValue();
	
	/* Save all low level values. */
	SaveIDValue(id, CNCL_MEDIATYPE, &media_type);
	SaveIDValue(id, CNCL_GRAYSCALE, &gray_scale);
	SaveIDValue(id, CNCL_MARGINTYPE, &margin_type);

	if( id != CNCL_CARTRIDGE && id != CNCL_MEDIATYPE )
		SaveIDValue(id, CNCL_PRINTQUALITY, &print_quality);

	SaveIDValue(id, CNCL_MEDIASUPPLY, &media_supply);
	SaveIDValue(id, CNCL_PAPERSIZE, &paper_size);
	SaveIDValue(id, CNCL_DITHER_PAT, &dither_pat);
	/* Ver.2.70: CNCL_DUPLEX_PRINTING... Use toggle status of "Dupelx Printing" (instead of CNCLDB value) */


	/* SetTemporaryFlag , CNCL_GetMenulink */
	SetTemporaryFlag(id, value, 1);
	ret = CNCL_GetMenulink(&g_uidb.nominfo, (void*)g_bjlibdir, g_uidb.lpdbTop, g_uidb.dbsize);

	/* Restore all low level values. */
	RestoreIDValue(id, CNCL_MEDIATYPE, media_type);
	RestoreIDValue(id, CNCL_GRAYSCALE, gray_scale);
	RestoreIDValue(id, CNCL_MARGINTYPE, margin_type);

	if( id != CNCL_CARTRIDGE && id != CNCL_MEDIATYPE )
		RestoreIDValue(id, CNCL_PRINTQUALITY, print_quality);

	RestoreIDValue(id, CNCL_MEDIASUPPLY, media_supply);
	RestoreIDValue(id, CNCL_PAPERSIZE, paper_size);
	RestoreIDValue(id, CNCL_DITHER_PAT, dither_pat);
	RestoreIDValue(id, CNCL_DUPLEX_PRINTING, ui_duplex_toggled);	/* Ver.2.70:use UI toggle status (instead of CNCLDB value) */

	/* If PaperSize is changed to "A4" and unit is "inch" , PaperSize should be changed to "Letter" */
	if( g_unit_inch == TRUE && id != CNCL_PAPERSIZE )
	{
		changed_paper_size = GetCurrentnValue(CNCL_PAPERSIZE);

		if( (changed_paper_size == CND_SIZE_A4) && (select_paper_size != changed_paper_size) )
		{
			/* Save all low level values. */
			SaveIDValue(CNCL_PAPERSIZE, CNCL_MEDIATYPE, &media_type);
			SaveIDValue(CNCL_PAPERSIZE, CNCL_GRAYSCALE, &gray_scale);
			SaveIDValue(CNCL_PAPERSIZE, CNCL_MARGINTYPE, &margin_type);
			SaveIDValue(CNCL_PAPERSIZE, CNCL_PRINTQUALITY, &print_quality);
			SaveIDValue(CNCL_PAPERSIZE, CNCL_MEDIASUPPLY, &media_supply);
			SaveIDValue(CNCL_PAPERSIZE, CNCL_DITHER_PAT, &dither_pat);

			/* SetTemporaryFlag , CNCL_GetMenulink */
			SetTemporaryFlag(CNCL_PAPERSIZE, CND_SIZE_LETTER, 1);
			ret = CNCL_GetMenulink(&g_uidb.nominfo, (void*)g_bjlibdir, g_uidb.lpdbTop, g_uidb.dbsize);

			/* Restore all low level values. */
			RestoreIDValue(CNCL_PAPERSIZE, CNCL_MEDIATYPE, media_type);
			RestoreIDValue(CNCL_PAPERSIZE, CNCL_GRAYSCALE, gray_scale);
			RestoreIDValue(CNCL_PAPERSIZE, CNCL_MARGINTYPE, margin_type);
			RestoreIDValue(CNCL_PAPERSIZE, CNCL_PRINTQUALITY, print_quality);
			RestoreIDValue(CNCL_PAPERSIZE, CNCL_MEDIASUPPLY, media_supply);
			RestoreIDValue(CNCL_PAPERSIZE, CNCL_DITHER_PAT, dither_pat);
			RestoreIDValue(CNCL_PAPERSIZE, CNCL_DUPLEX_PRINTING, ui_duplex_toggled);	/* Ver.2.70:use UI toggle status (instead of CNCLDB value) */
		}
	}

	/* Ver.2.70: If "CNCL_MARGINTYPE" is changed , update g_quality_dialog(quality&ht) with CNCLDB value */
	margin_new = GetCurrentnValue(CNCL_MARGINTYPE);
	if( margin_old != margin_new ){
#ifdef _PRINTUI_DEBUG_
		fprintf(stderr,"UpdateMenuLink:margin changed!! old=%d new=%d\n",margin_old,margin_new);
#endif
		if(g_quality_dialog) SetQualityCustomValue(g_quality_dialog);
	}
	
	if( GetCallbackTableNum() )
		CompCallbackTableValue();

	return ret;
}
Пример #21
0
/*--------------------------------------*/
void ShowColorDialog2(UIColorDialog2* dialog)
{
	/* Ver.2.80 */
	DisableSignal();

	GtkWidget* window = UI_DIALOG(dialog)->window;

	gtk_range_set_value( GTK_RANGE(LookupWidget(window, "color_dialog_cyan_scale2")) , (gdouble)dialog->cyan_balance );
	gtk_range_set_value( GTK_RANGE(LookupWidget(window, "color_dialog_magenta_scale2")) , (gdouble)dialog->magenta_balance );
	gtk_range_set_value( GTK_RANGE(LookupWidget(window, "color_dialog_yellow_scale2")) , (gdouble)dialog->yellow_balance );
	gtk_range_set_value( GTK_RANGE(LookupWidget(window, "color_dialog_density_scale2")) ,(gdouble)dialog->density_balance );
	gtk_range_set_value( GTK_RANGE(LookupWidget(window, "color_dialog_contrast_scale2")) , (gdouble)dialog->contrast_balance );
	gtk_range_set_value( GTK_RANGE(LookupWidget(window, "color_dialog_tone_scale2")) , (gdouble)dialog->tone_balance ); /* Ver.3.40 */

	/* Ver.2.90 */
	gtk_spin_button_set_value( GTK_SPIN_BUTTON(LookupWidget(window, "c_dlg_c_value_spin2")) , (gdouble)dialog->cyan_balance );
	gtk_spin_button_set_value( GTK_SPIN_BUTTON(LookupWidget(window, "c_dlg_m_value_spin2")) , (gdouble)dialog->magenta_balance );
	gtk_spin_button_set_value( GTK_SPIN_BUTTON(LookupWidget(window, "c_dlg_y_value_spin2")) , (gdouble)dialog->yellow_balance );
	gtk_spin_button_set_value( GTK_SPIN_BUTTON(LookupWidget(window, "c_dlg_density_value_spin2")) , (gdouble)dialog->density_balance );
	gtk_spin_button_set_value( GTK_SPIN_BUTTON(LookupWidget(window, "c_dlg_contrast_value_spin2")) , (gdouble)dialog->contrast_balance );
	gtk_spin_button_set_value( GTK_SPIN_BUTTON(LookupWidget(window, "c_dlg_tone_value_spin2")) , (gdouble)dialog->tone_balance ); /* Ver.3.40 */

	// Vivid button.
	gtk_toggle_button_set_active(
		GTK_TOGGLE_BUTTON(LookupWidget(UI_DIALOG(dialog)->window,
		"color_dialog_vivid_button2")), dialog->vivid);

	// Gamma combo.
	dialog->gamma = SetGammaCombo(dialog, dialog->gamma);

	// Color correct combo.
	dialog->color_correct = SetColorCorrectCombo2(dialog, dialog->color_correct);
	SensitiveColorCorrectCombo(dialog, !dialog->vivid);

	{
		short print_bw = IsGrayPrint(g_main_window);
		int i;

		for( i = 0 ; bw_sensitive_name[i] != NULL ; i++ )
		{
			gboolean sensitive;

			if( !strcmp(bw_sensitive_name[i], "color_dialog_correct_combo2") )
				sensitive = !(print_bw | dialog->vivid);
			else
				sensitive = !print_bw;

			gtk_widget_set_sensitive(
				LookupWidget(UI_DIALOG(dialog)->window,
				 			bw_sensitive_name[i]), sensitive);
		}
	}

	/* If more than one intent exist , show "color_dialog_intent_table". */
	{
		/* Ver.3.10 */
		GtkWidget* label_tmp = LookupWidget(UI_DIALOG(dialog)->window, "color_dialog_correct_label2");
		GtkWidget* combo_tmp = LookupWidget(UI_DIALOG(dialog)->window, "color_dialog_correct_combo2");

		/* Ver.280 */
		if( dialog->intent_num > 1 ){
			gtk_widget_show(label_tmp);
			gtk_widget_show(combo_tmp);
		}

#if 0
		GtkWidget* table = LookupWidget(UI_DIALOG(dialog)->window, "color_dialog_intent_table");

		/* Ver.280 */
		if( dialog->intent_num > 1 ) gtk_widget_show(table);
#endif
	}

	/* Ver.3.40 */
	if ( IsAvailableBlackAdjustment() ){
		gboolean sensitive;
		int i;

		/* Confirm black adjustment media */
		if ( IsAvailableBlackAdjustmentMode() ){
			sensitive = TRUE;
		}
		else {
			sensitive = FALSE;
		}
		
		for ( i=0; bw_sensitive_name_black_adjustment[i] != NULL; i++ ){
			gtk_widget_set_sensitive( LookupWidget(UI_DIALOG(dialog)->window, 
				bw_sensitive_name_black_adjustment[i]), sensitive  );
		}
	}

	/* Ver.2.80 */
	EnableSignal();

	ShowDialog((UIDialog*)dialog, "color_dialog_ok_button2"); 
}