Esempio n. 1
0
UIMainDialog* CreateMainWindow()
{
	short supply_value;
	short margin_value;
	UIMainDialog* main_window
		= (UIMainDialog*)CreateDialog(sizeof(UIMainDialog), NULL);

#ifdef	USE_LIB_GLADE
	UI_DIALOG(main_window)->window = LookupWidget(NULL, "ui_window");
#else
	UI_DIALOG(main_window)->window = create_ui_window();
#endif

	// Get initial paper size.
	main_window->init_paper_size = GetCurrentnValue(CNCL_PAPERSIZE);

	// Initialize auto color adjustment.
	main_window->color_auto = TRUE;

	// Initialize printing type, etc.
	main_window->printing_type = g_printing_type_value[0];
	main_window->scaling = 100;
	main_window->centering = LOCATION_UPPERLEFT;
	main_window->ext_border = GetDefaultExtBorder(g_model_id);
	main_window->stapleside = STAPLESIDE_LONG;
	main_window->copies = 1;

	// Save current supply & margin value .
	supply_value = GetCurrentnValue(CNCL_MEDIASUPPLY);
	margin_value = GetCurrentnValue(CNCL_MARGINTYPE);

	// Store ASF supply value.
	UpdateMenuLink(CNCL_MEDIASUPPLY, CND_SUPPLY_ASF);

	// Save list.
	g_paper_size_list = GetComboList(CNCL_PAPERSIZE);

	// Store ASF supply value.
	UpdateMenuLink(CNCL_MARGINTYPE, CND_MARGIN_MINUS);

	// Save list.
	g_paper_size_margin_list = GetComboList(CNCL_PAPERSIZE);

	// Store current supply value.
	UpdateMenuLink(CNCL_MARGINTYPE, margin_value);
	UpdateMenuLink(CNCL_MEDIASUPPLY, supply_value);

	// Save current paper size value.
	g_paper_size_value = GetCurrentnValue(CNCL_PAPERSIZE);

	// Save current duplex printing
	g_duplex_value = GetCurrentnValue(CNCL_DUPLEX_PRINTING);

	return main_window;
}
Esempio n. 2
0
static short SetGammaCombo(UIColorDialog* dialog, short gamma)
{
	dialog->gamma_list = GetComboList(CNCL_INPUT_GAMMA);

	if( dialog->gamma_list )
	{
		gchar* name;

		if( gamma != GetCurrentnValue(CNCL_INPUT_GAMMA) )
			UpdateMenuLink(CNCL_INPUT_GAMMA, gamma);

		name = ValueToName(CNCL_INPUT_GAMMA, gamma);

		SetGListToCombo(UI_DIALOG(dialog)->window,
			"color_dialog_gamma_combo", dialog->gamma_list, name);
	}
	else
	{
		SetTextArrayToCombo(UI_DIALOG(dialog)->window,
			"color_dialog_gamma_combo", gamma_key, gamma_value, gamma);
	}

	return gamma;
}
Esempio n. 3
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);
		}
	}

}