www.pudn.com > WMACompressor.zip > EditWmaWriter.h
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
// PURPOSE. IT CAN BE DISTRIBUTED FREE OF CHARGE AS LONG AS THIS HEADER
// REMAINS UNCHANGED.
//
// Email: yetiicb@hotmail.com
//
// Copyright (C) 2002-2004 Idael Cardoso.
//
#pragma once
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
#include "WmaWriterConfig.h"
using namespace Yeti::MMedia;
using namespace Yeti::MMedia::Wmf;
namespace WmaUserCtrls
{
#pragma warning( push )
#pragma warning( disable : 4803 )
///
/// Summary for EditWmaWriter
///
public __gc class EditWmaWriter : public System::Windows::Forms::UserControl, public IEditAudioWriterConfig
{
public:
EditWmaWriter(void)
{
InitializeComponent();
comboBoxProfiles->Items->AddRange(WmaWriterProfileManager::AudioSystemProfiles);
DoSetInitialValues();
}
protected:
void Dispose(Boolean disposing)
{
if (disposing && components)
{
components->Dispose();
}
__super::Dispose(disposing);
}
private: System::Windows::Forms::TabControl * tabControl1;
private: System::Windows::Forms::TabPage * tabPage1;
private: System::Windows::Forms::TabPage * tabPage2;
private: System::Windows::Forms::Label * label1;
private: System::Windows::Forms::ComboBox * comboBoxProfiles;
private: Yeti::MMedia::EditFormat * editFormat1;
private: System::Windows::Forms::Label * labelDescription;
protected:
EventHandler* m_ConfigChange;
public:
__property bool get_InFormatReadOnly()
{
return editFormat1->ReadOnly;
}
__property void set_InFormatReadOnly(bool value)
{
editFormat1->ReadOnly = value;
}
//IEditAudioWriterConfig
[Browsable(false)]
__property Yeti::MMedia::AudioWriterConfig* get_Config()
{
return new WmaWriterConfig(editFormat1->Format, static_cast(comboBoxProfiles->SelectedItem));
}
[Browsable(false)]
__property void set_Config(Yeti::MMedia::AudioWriterConfig* config)
{
WmaWriterProfile* profile;
editFormat1->Format = config->Format;
profile = dynamic_cast(config)->Profile;
int index = -1;
for (int i = 0; (index < 0) && (i < comboBoxProfiles->Items->Count); i ++)
{
if (profile->Id == static_cast(comboBoxProfiles->Items->Item[i])->Id)
{
index = i;
}
}
if ( index >= 0)
{
comboBoxProfiles->SelectedIndex = index;
}
else
{
throw new ArgumentException(S"The profile is not a System Profile", S"config");
}
}
//IConfigControl
void DoApply()
{
editFormat1->DoApply();
}
void DoSetInitialValues()
{
editFormat1->DoSetInitialValues();
comboBoxProfiles->SelectedIndex = 0;
labelDescription->Text = static_cast(comboBoxProfiles->SelectedItem)->Description;
}
[Browsable(false)]
__property Control* get_ConfigControl()
{
return this;
}
[Browsable(false)]
__property String* get_ControlName()
{
return S"WMA Writer Config";
}
__event EventHandler* ConfigChange;
private:
///
/// Required designer variable.
///
System::ComponentModel::Container* components;
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
void InitializeComponent(void)
{
this->tabControl1 = new System::Windows::Forms::TabControl();
this->tabPage1 = new System::Windows::Forms::TabPage();
this->editFormat1 = new Yeti::MMedia::EditFormat();
this->tabPage2 = new System::Windows::Forms::TabPage();
this->labelDescription = new System::Windows::Forms::Label();
this->comboBoxProfiles = new System::Windows::Forms::ComboBox();
this->label1 = new System::Windows::Forms::Label();
this->tabControl1->SuspendLayout();
this->tabPage1->SuspendLayout();
this->tabPage2->SuspendLayout();
this->SuspendLayout();
//
// tabControl1
//
this->tabControl1->Controls->Add(this->tabPage1);
this->tabControl1->Controls->Add(this->tabPage2);
this->tabControl1->Dock = System::Windows::Forms::DockStyle::Fill;
this->tabControl1->Location = System::Drawing::Point(0, 0);
this->tabControl1->Name = S"tabControl1";
this->tabControl1->SelectedIndex = 0;
this->tabControl1->Size = System::Drawing::Size(320, 184);
this->tabControl1->TabIndex = 0;
//
// tabPage1
//
this->tabPage1->Controls->Add(this->editFormat1);
this->tabPage1->Location = System::Drawing::Point(4, 22);
this->tabPage1->Name = S"tabPage1";
this->tabPage1->Size = System::Drawing::Size(312, 158);
this->tabPage1->TabIndex = 0;
this->tabPage1->Text = S"Input format";
//
// editFormat1
//
this->editFormat1->Dock = System::Windows::Forms::DockStyle::Fill;
this->editFormat1->Location = System::Drawing::Point(0, 0);
this->editFormat1->Name = S"editFormat1";
this->editFormat1->ReadOnly = false;
this->editFormat1->Size = System::Drawing::Size(312, 158);
this->editFormat1->TabIndex = 0;
this->editFormat1->ConfigChange += new System::EventHandler(this, editFormat1_ConfigChange);
//
// tabPage2
//
this->tabPage2->Controls->Add(this->labelDescription);
this->tabPage2->Controls->Add(this->comboBoxProfiles);
this->tabPage2->Controls->Add(this->label1);
this->tabPage2->Location = System::Drawing::Point(4, 22);
this->tabPage2->Name = S"tabPage2";
this->tabPage2->Size = System::Drawing::Size(312, 158);
this->tabPage2->TabIndex = 1;
this->tabPage2->Text = S"WMA Config";
//
// labelDescription
//
this->labelDescription->Location = System::Drawing::Point(8, 56);
this->labelDescription->Name = S"labelDescription";
this->labelDescription->Size = System::Drawing::Size(288, 80);
this->labelDescription->TabIndex = 2;
//
// comboBoxProfiles
//
this->comboBoxProfiles->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
this->comboBoxProfiles->Location = System::Drawing::Point(8, 24);
this->comboBoxProfiles->Name = S"comboBoxProfiles";
this->comboBoxProfiles->Size = System::Drawing::Size(296, 21);
this->comboBoxProfiles->TabIndex = 1;
this->comboBoxProfiles->SelectionChangeCommitted += new System::EventHandler(this, comboBoxProfiles_SelectionChangeCommitted);
//
// label1
//
this->label1->Location = System::Drawing::Point(8, 8);
this->label1->Name = S"label1";
this->label1->Size = System::Drawing::Size(176, 16);
this->label1->TabIndex = 0;
this->label1->Text = S"Windows Media Audio Profile:";
//
// EditWmaWriter
//
this->Controls->Add(this->tabControl1);
this->Name = S"EditWmaWriter";
this->Size = System::Drawing::Size(320, 184);
this->tabControl1->ResumeLayout(false);
this->tabPage1->ResumeLayout(false);
this->tabPage2->ResumeLayout(false);
this->ResumeLayout(false);
}
private:
System::Void editFormat1_ConfigChange(System::Object * sender, System::EventArgs * e)
{
raise_ConfigChange(this, e);
}
private:
System::Void comboBoxProfiles_SelectionChangeCommitted(System::Object * sender, System::EventArgs * e)
{
labelDescription->Text = static_cast(comboBoxProfiles->SelectedItem)->Description;
raise_ConfigChange(this, e);
}
};
#pragma warning( pop )
}