static void
update_by_cartridge_type_entry()
{
	GtkWidget* window = UI_DIALOG(g_main_window)->window;
	GtkWidget* entry = LookupWidget(window, "cartridge_type_entry");
	short new_cartridge_value = NameToValue(CNCL_CARTRIDGE, 
						(char*)gtk_entry_get_text(GTK_ENTRY(entry)));
	short media_type_value = GetCurrentnValue(CNCL_MEDIATYPE);

	if( !IsAvailableMedia(g_mediatype_dialog,
			media_type_value, new_cartridge_value) )
	{
		short new_media_type_value;

		if( (new_media_type_value = ShowMediaTypeDialog(g_mediatype_dialog,
			media_type_value, new_cartridge_value)) != -1 )
		{
			UpdateMenuLink(CNCL_MEDIATYPE, new_media_type_value);
			UpdateMenuLink(CNCL_CARTRIDGE, new_cartridge_value);

#ifdef NEED_TO_SAVE_GRAYSCALE
			if( GetCurrentnValue(CNCL_GRAYSCALE) != CND_BJGRAYSCALE_GRAY )
			{
				short gray_scale_value = IsGrayPrint(g_main_window)?
						CND_BJGRAYSCALE_ON : CND_BJGRAYSCALE_OFF;

				UpdateMenuLink(CNCL_GRAYSCALE, gray_scale_value);
			}
#endif
			UpdateWidgets(window, "cartridge_type_combo");
		}
		else
		{
			UpdateWidgets(window, NULL);
		}
	}
	else
	{
		UpdateMenuLink(CNCL_CARTRIDGE, new_cartridge_value);

#ifdef NEED_TO_SAVE_GRAYSCALE
		if( GetCurrentnValue(CNCL_GRAYSCALE) != CND_BJGRAYSCALE_GRAY )
		{
			short gray_scale_value = IsGrayPrint(g_main_window)?
				CND_BJGRAYSCALE_ON : CND_BJGRAYSCALE_OFF;

			UpdateMenuLink(CNCL_GRAYSCALE, gray_scale_value);
		}
#endif
		UpdateWidgets(window, "cartridge_type_combo");
	}

#ifdef	GUI_WITH_PIXMAPS
	UpdateDrawingArea(window, "basic_draw_area");
#endif
	g_cartridge_type_entry_changed = FALSE;
}
static void SetBJFltColorSystem(LPBJFLTCOLORSYSTEM bjcolor)
{

	if( g_main_window->color_auto )
		g_color_dialog = 
			ReCreateColorDialog(g_color_dialog, UI_DIALOG(g_main_window));

	if( IsGrayPrint(g_main_window) )
	{
		bjcolor->bjfltIntent = CND_INTENT_PHOTO;

		bjcolor->bjfltGamma = g_color_dialog->default_gamma;
		bjcolor->bjfltBalanceC = 0;
		bjcolor->bjfltBalanceM = 0;
		bjcolor->bjfltBalanceY = 0;
		bjcolor->bjfltBalanceK = 0;
		bjcolor->bjfltDensity  = g_color_dialog->density_balance;
	}
	else
	{
		if( g_color_dialog->vivid )
			bjcolor->bjfltIntent = CND_INTENT_VIVID;
		else
			bjcolor->bjfltIntent = g_color_dialog->color_correct;

		bjcolor->bjfltGamma = g_color_dialog->gamma;
		bjcolor->bjfltBalanceC = g_color_dialog->cyan_balance;
		bjcolor->bjfltBalanceM = g_color_dialog->magenta_balance;
		bjcolor->bjfltBalanceY = g_color_dialog->yellow_balance;
		bjcolor->bjfltBalanceK = g_color_dialog->black_balance;
		bjcolor->bjfltDensity  = g_color_dialog->density_balance;
	}
}
void
on_print_bw_button_clicked             (GtkButton       *button,
                                        gpointer         user_data)
{
	if( DisableSignal() )
	{
		GtkWidget* window = GetTopWidget(GTK_WIDGET(button));
		short value;

		if( IsGrayPrint(g_main_window) )
			value = CND_BJGRAYSCALE_ON;
		else
			value = CND_BJGRAYSCALE_OFF;

		UpdateMenuLink(CNCL_GRAYSCALE, value);

		UpdateWidgets(window, "print_bw_button");

#ifdef	GUI_WITH_PIXMAPS
		UpdateDrawingArea(window, "basic_draw_area");
		UpdateDrawingArea(window, "quality_draw_area");
#endif
	}
	EnableSignal();
}
Exemple #4
0
void ShowColorDialog(UIColorDialog* dialog)
{
	// Set cyan scale adjustment value.
	gtk_adjustment_set_value(dialog->cyan_adjust,
							(gfloat)dialog->cyan_balance);

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

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

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

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

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

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

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

	{
		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_combo") )
				sensitive = !(print_bw | dialog->vivid);
			else
				sensitive = !print_bw;

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

	ShowDialog((UIDialog*)dialog, "color_dialog_ok_button"); 
}
/*--------------------------------------*/
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();
}
void DrawQualityDrawingArea(GtkWidget* window, GtkWidget* area)
{
	GdkWindow* area_window = area->window;
	GdkGC* gc = gdk_gc_new(window->window);
	GdkPixmap* pixmap;
	GdkBitmap* mask;
	int quality;
	const gchar* button_name[] =
	{
		"quality_high_button",
		"quality_standard_button",
		"quality_draft_button",
		"quality_custom_button",
		NULL
	};
	const gchar* xpm_name[] = 
	{
		"quality_best.xpm",
		"quality_best_color.xpm",
		"quality_normal.xpm",
		"quality_normal_color.xpm",
		"quality_draft.xpm",
		"quality_draft_color.xpm",
		"quality_custom.xpm",
		"quality_custom_color.xpm"
	};

	quality = GetActiveButtonIndex(window, button_name, 0) << 1;

	if( !IsGrayPrint(g_main_window) )
		quality++;

	pixmap = LoadPixmap(window, &mask, xpm_name[quality]);
	DrawPixmap(area_window, gc,
			 QUALITY_PIXMAP_X, QUALITY_PIXMAP_Y, pixmap, mask);
	FreePixmap(pixmap, mask);

	gdk_gc_unref(gc);
}
Exemple #7
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));
}
void DrawPrinterDrawingArea(GtkWidget* window, GtkWidget* area)
{
	GdkWindow* area_window = area->window;
	GdkPixmap* pixmap;
	GdkBitmap* mask;
	gchar* xpm_name;
	gchar* key_str;
	gchar* message_str;
	GdkGC* gc = gdk_gc_new(window->window);

	// Background pattern.
	pixmap = LoadPixmap(window, NULL, "bg.xpm");
	DrawPixmap(area_window, gc, 0, 0, pixmap, NULL);
	FreePixmap(pixmap, NULL);

	// Printer body.
	pixmap = LoadPixmap(window, &mask, "printer.xpm");
	DrawPixmap(area_window, gc,
				 BODY_PIXMAP_X, BODY_PIXMAP_Y, pixmap, mask);
	FreePixmap(pixmap, mask);

	// Paper set and out.
	// Right guide(Paper set).
	{
		gchar* in_xpm_name;
		gchar* out_xpm_name;
		gchar* guide_xpm_name;
		short supply = GetCurrentnValue(CNCL_MEDIASUPPLY);
#ifdef	SUPPORT_BANNER
		short media = GetCurrentnValue(CNCL_MEDIATYPE);
#endif
		short size = GetCurrentnValue(CNCL_PAPERSIZE);

		if( supply == CND_SUPPLY_MANUAL )
			in_xpm_name = "in_m.xpm";
		else
			in_xpm_name = NULL;

#ifdef	SUPPORT_BANNER
		if( media == CND_MEDIA_BANNER )
			guide_xpm_name = "guide_a3.xpm";
		else
#endif
			guide_xpm_name = NULL;

		if( GetPaperWidth(size) > GetPaperHeight(size) )
		{
			if( in_xpm_name == NULL )
				in_xpm_name = "in_l.xpm";
			if( guide_xpm_name == NULL )
				guide_xpm_name = "guide_a2.xpm";
			out_xpm_name = "out_ph.xpm";
		}
		else
		{
			if( in_xpm_name == NULL )
				in_xpm_name = "in_p.xpm";
			if( guide_xpm_name == NULL )
				guide_xpm_name = "guide_a1.xpm";
			out_xpm_name = "out_pv.xpm";
		}

		pixmap = LoadPixmap(window, &mask, in_xpm_name);
		DrawPixmap(area_window, gc,
				 BODY_PIXMAP_X, BODY_PIXMAP_Y, pixmap, mask);
		FreePixmap(pixmap, mask);

		pixmap = LoadPixmap(window, &mask, out_xpm_name);
		DrawPixmap(area_window, gc,
				 BODY_PIXMAP_X, BODY_PIXMAP_Y, pixmap, mask);
		FreePixmap(pixmap, mask);

		pixmap = LoadPixmap(window, &mask, guide_xpm_name);
		DrawPixmap(area_window, gc,
				 R_GUIDE_PIXMAP_X, R_GUIDE_PIXMAP_Y, pixmap, mask);
		FreePixmap(pixmap, mask);
	}


	// Left guide(Thickness).
	{
		short thick = GetCurrentnValue(CNCL_MESS_THICK);

		switch( thick )
		{
		case CND_TMESSAGE_UPPER2:
			xpm_name = "guide_b1.xpm";
			break;
		default:
			xpm_name = "guide_b3.xpm";
			break;
		}

		pixmap = LoadPixmap(window, &mask, xpm_name);
		DrawPixmap(area_window, gc,
			 L_GUIDE_PIXMAP_X, L_GUIDE_PIXMAP_Y, pixmap, mask);
		FreePixmap(pixmap, mask);
	}

	// Media type message.
	message_str = GetCurrentString(CNCL_MEDIATYPE);

	DrawString(area_window, g_main_font, gc,
			 MEDIA_TEXT_X, MEDIA_TEXT_Y, message_str);

	{
		if( IsGrayPrint(g_main_window) )
		{
			xpm_name = "print_mono.xpm";
			key_str = "print_mono_message";
		}
		else
		{
			xpm_name = "print_color.xpm";
			key_str = "print_color_message";
		}

#ifndef	NO_PRINT_COLOR_ICON
		// Print color icon.
		pixmap = LoadPixmap(window, &mask, xpm_name);
		DrawPixmap(area_window, gc,
				 COLOR_PIXMAP_X, COLOR_PIXMAP_Y, pixmap, mask);
		FreePixmap(pixmap, mask);
#endif	
		// Color type message.
		message_str = LookupText(g_keytext_list, key_str);
		DrawString(area_window, g_main_font, gc,
				 COLOR_TEXT_X, COLOR_TEXT_Y, message_str);
	}

	gdk_gc_unref(gc);
}
/*--------------------------------------*/
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"); 
}