static BOOL CALLBACK DialogProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam) 
{ 
    BOOL fError; 
 
    switch(message) 
    { 
		case WM_INITDIALOG:
			SET_CHECK(OUT_Lossless_Check, g_lossless);

			SendMessage(GET_ITEM(OUT_Quality_Slider),(UINT)TBM_SETRANGEMIN, (WPARAM)(BOOL)FALSE, (LPARAM)1);
			SendMessage(GET_ITEM(OUT_Quality_Slider),(UINT)TBM_SETRANGEMAX, (WPARAM)(BOOL)FALSE, (LPARAM)100);
			SendMessage(GET_ITEM(OUT_Quality_Slider),(UINT)TBM_SETPOS, (WPARAM)(BOOL)TRUE, (LPARAM)g_quality);

			ADD_MENU_ITEM(OUT_BitDepth_Menu, 0, "Auto", DIALOG_BITDEPTH_AUTO, (g_bit_depth == DIALOG_BITDEPTH_AUTO));
			ADD_MENU_ITEM(OUT_BitDepth_Menu, 1, "8-bit", DIALOG_BITDEPTH_8, (g_bit_depth == DIALOG_BITDEPTH_8));
			ADD_MENU_ITEM(OUT_BitDepth_Menu, 2, "16-bit", DIALOG_BITDEPTH_16, (g_bit_depth == DIALOG_BITDEPTH_16));
			ADD_MENU_ITEM(OUT_BitDepth_Menu, 3, "16-bit float", DIALOG_BITDEPTH_16_FLOAT, (g_bit_depth == DIALOG_BITDEPTH_16_FLOAT));
			ADD_MENU_ITEM(OUT_BitDepth_Menu, 4, "32-bit float", DIALOG_BITDEPTH_32_FLOAT, (g_bit_depth == DIALOG_BITDEPTH_32_FLOAT));

			ADD_MENU_ITEM(OUT_Codec_Menu, 0, "Auto", DIALOG_CODEC_AUTO, (g_codec == DIALOG_CODEC_AUTO));
			ADD_MENU_ITEM(OUT_Codec_Menu, 1, "Dirac", DIALOG_CODEC_DIRAC, (g_codec == DIALOG_CODEC_DIRAC));
			ADD_MENU_ITEM(OUT_Codec_Menu, 2, "OpenEXR", DIALOG_CODEC_OPENEXR, (g_codec == DIALOG_CODEC_OPENEXR));
			ADD_MENU_ITEM(OUT_Codec_Menu, 3, "PNG", DIALOG_CODEC_PNG, (g_codec == DIALOG_CODEC_PNG));
			ADD_MENU_ITEM(OUT_Codec_Menu, 4, "Uncompressed", DIALOG_CODEC_UNCOMPRESSED, (g_codec == DIALOG_CODEC_UNCOMPRESSED));

			TrackSlider(hwndDlg);
			TrackLossless(hwndDlg);

			return TRUE;
 
		case WM_NOTIFY:
			switch(LOWORD(wParam))
			{
				case OUT_Quality_Slider:
					TrackSlider(hwndDlg);
				return TRUE;
			}
		return FALSE;

        case WM_COMMAND: 
			g_item_clicked = LOWORD(wParam);

            switch(g_item_clicked)
            { 
                case OUT_OK: 
				case OUT_Cancel:  // do the same thing, but g_item_clicked will be different
					g_lossless = GET_CHECK(OUT_Lossless_Check);
					g_quality = SendMessage(GET_ITEM(OUT_Quality_Slider), TBM_GETPOS, (WPARAM)0, (LPARAM)0 );
					g_bit_depth = (DialogBitDepth)GET_MENU_VALUE(OUT_BitDepth_Menu);
					g_codec = (DialogCodec)GET_MENU_VALUE(OUT_Codec_Menu);

					EndDialog(hwndDlg, 0);
					return TRUE;

				case OUT_Lossless_Check:
					TrackLossless(hwndDlg);
					return TRUE;
            } 
    } 
    return FALSE; 
} 
Пример #2
0
static BOOL CALLBACK DialogProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam) 
{ 
    BOOL fError; 
 
    switch(message) 
    { 
		case WM_INITDIALOG:
			SET_CHECK(OUT_Lossless_Radio, g_lossless);
			SET_CHECK(OUT_Lossy_Radio, !g_lossless);

			SendMessage(GET_ITEM(OUT_Quality_Slider),(UINT)TBM_SETRANGEMIN, (WPARAM)(BOOL)FALSE, (LPARAM)0);
			SendMessage(GET_ITEM(OUT_Quality_Slider),(UINT)TBM_SETRANGEMAX, (WPARAM)(BOOL)FALSE, (LPARAM)100);
			SendMessage(GET_ITEM(OUT_Quality_Slider),(UINT)TBM_SETPOS, (WPARAM)(BOOL)TRUE, (LPARAM)g_quality);

			if(!g_have_transparency)
			{
				ENABLE_ITEM(OUT_Alpha_Radio_Transparency, FALSE);

				if(g_alpha == DIALOG_ALPHA_TRANSPARENCY)
				{
					g_alpha = (g_alpha_name != NULL ? DIALOG_ALPHA_CHANNEL : DIALOG_ALPHA_NONE);
				}
			}

			if(g_alpha_name == NULL)
			{
				ENABLE_ITEM(OUT_Alpha_Radio_Channel, FALSE);

				if(g_alpha == DIALOG_ALPHA_CHANNEL)
				{
					g_alpha = (g_have_transparency ? DIALOG_ALPHA_TRANSPARENCY : DIALOG_ALPHA_NONE);
				}
			}
			else
			{
				SetDlgItemText(hwndDlg, OUT_Alpha_Radio_Channel, g_alpha_name);
			}

			SET_CHECK( (g_alpha == DIALOG_ALPHA_NONE ? OUT_Alpha_Radio_None :
						g_alpha == DIALOG_ALPHA_TRANSPARENCY ? OUT_Alpha_Radio_Transparency :
						g_alpha == DIALOG_ALPHA_CHANNEL ? OUT_Alpha_Radio_Channel :
						OUT_Alpha_Radio_None), TRUE);

			SET_CHECK(OUT_Alpha_Cleanup_Check, g_alpha_cleanup);
			SET_CHECK(OUT_Lossy_Alpha_Check, g_lossy_alpha);
			SET_CHECK(OUT_Save_Metadata_Check, g_save_metadata);

			TrackLossless(hwndDlg);
			TrackSlider(hwndDlg);
			TrackAlpha(hwndDlg);

			return TRUE;
 
		case WM_NOTIFY:
			switch(LOWORD(wParam))
			{
				case OUT_Quality_Slider:
					TrackSlider(hwndDlg);
				return TRUE;
			}
		return FALSE;

        case WM_COMMAND: 
			g_item_clicked = LOWORD(wParam);

            switch(g_item_clicked)
            { 
                case OUT_OK: 
				case OUT_Cancel:  // do the same thing, but g_item_clicked will be different
					g_lossless = GET_CHECK(OUT_Lossless_Radio);
					g_quality = SendMessage(GET_ITEM(OUT_Quality_Slider), TBM_GETPOS, (WPARAM)0, (LPARAM)0 );

					g_alpha =	GET_CHECK(OUT_Alpha_Radio_None) ? DIALOG_ALPHA_NONE :
								GET_CHECK(OUT_Alpha_Radio_Transparency) ? DIALOG_ALPHA_TRANSPARENCY :
								GET_CHECK(OUT_Alpha_Radio_Channel) ? DIALOG_ALPHA_CHANNEL :
								DIALOG_ALPHA_TRANSPARENCY;

					g_alpha_cleanup = GET_CHECK(OUT_Alpha_Cleanup_Check);
					g_lossy_alpha = GET_CHECK(OUT_Lossy_Alpha_Check);
					g_save_metadata = GET_CHECK(OUT_Save_Metadata_Check);

					EndDialog(hwndDlg, 0);
					return TRUE;


				case OUT_Lossless_Radio:
				case OUT_Lossy_Radio:
					TrackLossless(hwndDlg);
					return TRUE;

				case OUT_Alpha_Radio_None:
				case OUT_Alpha_Radio_Transparency:
				case OUT_Alpha_Radio_Channel:
					TrackAlpha(hwndDlg);

				case OUT_Quality_Field:
					TrackField(hwndDlg);
					return TRUE;
            } 
    } 
    return FALSE; 
}