Esempio n. 1
0
LOCAL void Convert_OnCommand(HWND hDlg, int id, HWND hControl, UINT codeNotify)
/************************************************************************/
{
BOOL Bool;

switch (id)
	{
	case IDC_MINITYPES:
// case IDC_MINI256:
// case IDC_MINI16:
// case IDC_MINI8:
// case IDC_MINICUSTOM:
	if ( !(id = HandleCombo( hDlg, id, codeNotify )) )
		break;
	Convert.MiniType = id;

	if (Convert.MiniType == IDC_MINI256)
		Convert.ConvertColors = 256;
	else
	if (Convert.MiniType == IDC_MINI16)
		Convert.ConvertColors = 16;
	else
	if (Convert.MiniType == IDC_MINI8)
		Convert.ConvertColors = 8;
	Convert_Enable(hDlg);
	break;

	case IDC_DITHERTYPES:
//	case IDC_DITHERPATTERN:
//	case IDC_DITHERSCATTERED:
//	case IDC_DITHERNONE:
	if ( !(id = HandleCombo( hDlg, id, codeNotify )) )
		break;
	if ( id == IDC_DITHERPATTERN )
		{
		Convert.fDither = YES;
		Convert.fScatter = NO;
		Convert.ConvertDitherType = DT_PATTERN;
		}
	else
	if ( id == IDC_DITHERSCATTERED )
		{
		Convert.fDither = NO;
		Convert.fScatter = YES;
		Convert.ConvertDitherType = DT_SCATTER;
		}
	else
		{
		Convert.fDither = NO;
		Convert.fScatter = NO;
		Convert.ConvertDitherType = DT_NONE;
		}
	break;

	case IDC_PALETTETYPES:
//	case IDC_PALETTEOPTIMIZED:
//	case IDC_PALETTESTANDARD:
//	case IDC_PALETTECUSTOM:
	if ( !(id = HandleCombo( hDlg, id, codeNotify )) )
		break;
	if (id == IDC_PALETTEOPTIMIZED)
		Convert.ConvertType = CT_OPTIMIZED;
	else
	if (id == IDC_PALETTESTANDARD)
		Convert.ConvertType = CT_STANDARD;
	else
		Convert.ConvertType = CT_CUSTOM;
	Convert.fOptimize = ( id == IDC_PALETTEOPTIMIZED );
	Convert_Enable(hDlg);
	break;

	case IDC_PALETTECOLORS:
	if ( GetFocus() != GetDlgItem( hDlg, id ) )
		break;
	if ( codeNotify != EN_CHANGE )
		break;
	Convert.ConvertColors = GetDlgItemSpin( hDlg, id, &Bool, NO );
	break;

	case IDC_EXTNAMES:
	GetExtName( hDlg, IDC_EXTNAMES, IDC_FILENAME,
		Convert.ConvertPalette, IDN_PALETTE, codeNotify );
	break;

	case IDC_EXTMANAGE:
	PopupMenu( hDlg, id, IDC_FILENAME );
	break;

	case IDC_ADDEXT:
	case IDC_DELETEEXT:
	case IDC_RENAMEEXT:
	ExtNameManager( hDlg, IDC_EXTNAMES, IDC_FILENAME, Convert.ConvertPalette,
		IDN_PALETTE, id, NO );
	break;

    case IDOK:
	// make sure we can open a colormap
	if (Convert.ConvertType == CT_CUSTOM)
		{
		FNAME szFileName;
		LPCOLORMAP lpColorMap;

		if ( !LookupExtFile( Convert.ConvertPalette, szFileName, IDN_PALETTE ) )
			break;
		if (!(lpColorMap = Palette_ReadColorMap(szFileName)))
			break;
		FrameDestroyColorMap(lpColorMap);
		}

	AstralDlgEnd( hDlg, TRUE );
	break;

    case IDCANCEL:
	AstralDlgEnd( hDlg, FALSE );
	break;

   default:
	break;
   }
}
Esempio n. 2
0
LOCAL void TextureFill_OnCommand(HWND hDlg, int id, HWND hControl, UINT codeNotify)
/************************************************************************/
{
int i;
BOOL Bool;
MERGE_MODE MergeMode;

switch (id)
	{
	case IDC_TEXTUREFILL:
	if ( !SaveToolPreferences( id ) )
		break;
	break;

	case IDC_TEXTUREFLIPX:
	Texture.fHorzFlip = !Texture.fHorzFlip;
	CheckDlgButton( hDlg, IDC_TEXTUREFLIPX, Texture.fHorzFlip);
	break;

	case IDC_TEXTUREFLIPY:
	Texture.fVertFlip = !Texture.fVertFlip;
	CheckDlgButton( hDlg, IDC_TEXTUREFLIPY, Texture.fVertFlip);
	break;

	case IDC_EXTNAMES:
	GetExtName( hDlg, IDC_EXTNAMES, IDC_FILENAME, Texture.TextureName,
		IDN_TEXTURE, codeNotify );
	break;

	case IDC_EXTMANAGE:
	PopupMenu( hDlg, id, IDC_FILENAME );
	break;

	case IDC_ADDEXT:
	case IDC_DELETEEXT:
	case IDC_RENAMEEXT:
	ExtNameManager( hDlg, IDC_EXTNAMES, IDC_FILENAME, Texture.TextureName,
		IDN_TEXTURE, id, NO );
	break;

	case IDC_MERGEMODE:
	if ((MergeMode = HandleMergeCombo( hDlg, id, FALSE, MM_NORMAL, codeNotify )) < 0)
		break;
	Texture.TextureMergeMode = MergeMode;
	SetCommonMergeMode(Texture.TextureMergeMode);
	break;

	case IDC_TRANSPARENT:
	if ( GetFocus() != GetDlgItem( hDlg, id ) )
		break;
	if ( codeNotify != EN_CHANGE )
		break;
	i = GetDlgItemSpin( hDlg, id, &Bool, NO );
	Texture.TextureOpacity = 255-TOGRAY(i);
	SetCommonOpacity(Texture.TextureOpacity);
	break;

   default:
	break;
   }
}