Fixed the default resolution for video display and resolution resampler when the script's field is blank.

Originally committed to SVN as r454.
This commit is contained in:
Rodrigo Braz Monteiro 2006-07-01 07:22:57 +00:00
parent 8f3fbdd781
commit ad91cb4460
5 changed files with 38 additions and 28 deletions

View File

@ -673,6 +673,33 @@ void AssFile::SetScriptInfo(const wxString _key,const wxString value) {
}
//////////////////
// Get resolution
void AssFile::GetResolution(int &sw,int &sh) {
// Height
wxString temp = GetScriptInfo(_T("PlayResY"));
if (temp.IsEmpty() || !temp.IsNumber()) {
sh = 288;
}
else {
long templ;
temp.ToLong(&templ);
sh = templ;
}
// Width
temp = GetScriptInfo(_T("PlayResX"));
if (temp.IsEmpty() || !temp.IsNumber()) {
sw = 384;
}
else {
long templ;
temp.ToLong(&templ);
sw = templ;
}
}
///////////////////////////////////
// Adds a comment to [Script Info]
void AssFile::AddComment(const wxString _comment) {

View File

@ -96,8 +96,9 @@ public:
void AddToRecent(wxString file); // Adds file name to list of recently opened files
bool CanSave(); // Return true if the file can be saved in its current format
int GetScriptInfoAsInt(const wxString key);
wxString GetScriptInfo(const wxString key); // Returns the value in a [Script Info] key.
void GetResolution(int &w,int &h); // Get resolution
int GetScriptInfoAsInt(const wxString key); // Returns the value in a [Script Info] key as int.
wxString GetScriptInfo(const wxString key); // Returns the value in a [Script Info] key as string.
void SetScriptInfo(const wxString key,const wxString value); // Sets the value of a [Script Info] key. Adds it if it doesn't exist.
void AddComment(const wxString comment); // Adds a ";" comment under [Script Info].
int AddLine(wxString data,wxString group,int lasttime,bool &IsSSA,wxString *outGroup=NULL);

View File

@ -92,6 +92,7 @@ Please visit http://aegisub.net to download latest version
- Added recent menu to Video Timecodes. (AMZ)
- Playing in video mode will now play the audio as well even if it hasn't been previously loaded into audio mode (experimental). (AMZ)
- Added hotkey to Audio's "play to end of file" (defaulting to "T"). (AMZ)
- Fixed the default resolution for video display and resolution resampler when the script's field is blank. (AMZ)
= 1.09 beta - 2006.01.16 ===========================

View File

@ -60,8 +60,10 @@ DialogResample::DialogResample(wxWindow *parent, SubtitlesGrid *_grid)
// Resolution line
wxSizer *ResBoxSizer = new wxStaticBoxSizer(wxVERTICAL,this,_("Resolution"));
wxSizer *ResSizer = new wxBoxSizer(wxHORIZONTAL);
ResXValue = subs->GetScriptInfo(_T("PlayResX"));
ResYValue = subs->GetScriptInfo(_T("PlayResY"));
int sw,sh;
subs->GetResolution(sw,sh);
ResXValue = wxString::Format(_T("%i"),sw);
ResYValue = wxString::Format(_T("%i"),sh);
ResX = new wxTextCtrl(this,-1,_T(""),wxDefaultPosition,wxSize(50,20),0,NumValidator(&ResXValue));
ResY = new wxTextCtrl(this,-1,_T(""),wxDefaultPosition,wxSize(50,20),0,NumValidator(&ResYValue));
wxStaticText *ResText = new wxStaticText(this,-1,_("x"));
@ -152,8 +154,8 @@ void DialogResample::ResampleTags (wxString name,int n,AssOverrideParameter *cur
void DialogResample::OnResample (wxCommandEvent &event) {
// Resolutions
AssFile *subs = AssFile::top;
long x1 = subs->GetScriptInfoAsInt(_T("PlayResX"));
long y1 = subs->GetScriptInfoAsInt(_T("PlayResY"));
int x1,y1;
subs->GetResolution(x1,y1);
long x2 = 0;
long y2 = 0;
ResX->GetValue().ToLong(&x2);

View File

@ -793,28 +793,7 @@ wxBitmap VideoDisplay::GetFrame(int n) {
////////////////////////////
// Get dimensions of script
void VideoDisplay::GetScriptSize(int &sw,int &sh) {
// Height
wxString temp = grid->ass->GetScriptInfo(_T("PlayResY"));
if (temp.IsEmpty() || !temp.IsNumber()) {
//sh = orig_h;
sh = 384;
}
else {
long templ;
temp.ToLong(&templ);
sh = templ;
}
// Width
temp = grid->ass->GetScriptInfo(_T("PlayResX"));
if (temp.IsEmpty() || !temp.IsNumber()) {
sw = 288;
}
else {
long templ;
temp.ToLong(&templ);
sw = templ;
}
grid->ass->GetResolution(sw,sh);
}