Originally committed to SVN as r795.

This commit is contained in:
Rodrigo Braz Monteiro 2007-01-15 05:38:32 +00:00
parent b4d1384c6d
commit e5ad6e4b60
6 changed files with 45 additions and 6 deletions

View file

@ -135,6 +135,14 @@ bool AegisubApp::OnInit() {
} }
////////
// Exit
int AegisubApp::OnExit() {
Options.Clear();
return wxApp::OnExit();
}
#ifndef _DEBUG #ifndef _DEBUG
/////////////////////// ///////////////////////
// Unhandled exception // Unhandled exception

View file

@ -75,6 +75,7 @@ public:
void AssociateType(wxString type); void AssociateType(wxString type);
bool OnInit(); bool OnInit();
int OnExit();
int OnRun(); int OnRun();
#ifdef __WXMAC__ #ifdef __WXMAC__

View file

@ -59,7 +59,15 @@ OptionsManager::OptionsManager() {
////////////// //////////////
// Destructor // Destructor
OptionsManager::~OptionsManager() { OptionsManager::~OptionsManager() {
Clear();
}
/////////
// Clear
void OptionsManager::Clear() {
opt.clear(); opt.clear();
optType.clear();
} }

View file

@ -73,6 +73,7 @@ public:
OptionsManager(); OptionsManager();
~OptionsManager(); ~OptionsManager();
void Clear();
void SetFile(wxString file); void SetFile(wxString file);
void Save(); void Save();
void Load(); void Load();

View file

@ -203,7 +203,7 @@ wxString TextFileReader::ReadLineFromFile() {
// Read ASCII/UTF-8 line from file // Read ASCII/UTF-8 line from file
else { else {
#ifdef WIN32 #ifdef WIN32
char *buffer = new char[512]; char buffer[512];
while (1) { while (1) {
buffer[511] = '\1'; buffer[511] = '\1';
if (fgets(buffer, 512, file)) { if (fgets(buffer, 512, file)) {

View file

@ -988,16 +988,23 @@ void VideoDisplayVisual::OnMouseEvent (wxMouseEvent &event) {
// Rotate Z // Rotate Z
else if (hold == 2) { else if (hold == 2) {
// Find screen angle // Find angle
float screenAngle = atan2(double(lineOrgY-y*sh/h),double(x*sw/w-lineOrgX)) * 180.0 / 3.1415926535897932; float screenAngle = atan2(double(lineOrgY-y*sh/h),double(x*sw/w-lineOrgX)) * 180.0 / 3.1415926535897932;
curAngle = screenAngle - startAngle + origAngle;
while (curAngle < 0.0f) curAngle += 360.0f;
while (curAngle >= 360.0f) curAngle -= 360.0f;
// Snap
if (event.ShiftDown()) {
curAngle = (float)((int)((curAngle+15.0f)/30.0f))*30.0f;
if (curAngle == 360.0f) curAngle = 0.0f;
}
// Update // Update
curAngle = screenAngle - startAngle + origAngle;
while (curAngle < 0.0) curAngle += 360.0;
while (curAngle >= 360.0) curAngle -= 360.0;
if (realTime) { if (realTime) {
AssLimitToVisibleFilter::SetFrame(frame_n); AssLimitToVisibleFilter::SetFrame(frame_n);
grid->editBox->SetOverride(_T("\\frz"),PrettyFloat(wxString::Format(_T("(%0.3f)"),curAngle)),0); wxString param = PrettyFloat(wxString::Format(_T("(%0.3f)"),curAngle));
grid->editBox->SetOverride(_T("\\frz"),param,0);
grid->editBox->CommitText(true); grid->editBox->CommitText(true);
grid->CommitChanges(false,true); grid->CommitChanges(false,true);
} }
@ -1017,6 +1024,14 @@ void VideoDisplayVisual::OnMouseEvent (wxMouseEvent &event) {
while (curAngle2 < 0.0) curAngle2 += 360.0; while (curAngle2 < 0.0) curAngle2 += 360.0;
while (curAngle2 >= 360.0) curAngle2 -= 360.0; while (curAngle2 >= 360.0) curAngle2 -= 360.0;
// Oh Snap
if (event.ShiftDown()) {
curAngle = (float)((int)((curAngle+15.0f)/30.0f))*30.0f;
curAngle2 = (float)((int)((curAngle2+15.0f)/30.0f))*30.0f;
if (curAngle == 360.0f) curAngle = 0.0f;
if (curAngle2 == 360.0f) curAngle = 0.0f;
}
// Update // Update
if (realTime) { if (realTime) {
AssLimitToVisibleFilter::SetFrame(frame_n); AssLimitToVisibleFilter::SetFrame(frame_n);
@ -1035,6 +1050,12 @@ void VideoDisplayVisual::OnMouseEvent (wxMouseEvent &event) {
if (curScaleX < 0.0f) curScaleX = 0.0f; if (curScaleX < 0.0f) curScaleX = 0.0f;
if (curScaleY < 0.0f) curScaleY = 0.0f; if (curScaleY < 0.0f) curScaleY = 0.0f;
// Snap
if (event.ShiftDown()) {
curScaleX = (float)((int)((curScaleX+12.5f)/25.0f))*25.0f;
curScaleY = (float)((int)((curScaleY+12.5f)/25.0f))*25.0f;
}
// Update // Update
if (realTime) { if (realTime) {
AssLimitToVisibleFilter::SetFrame(frame_n); AssLimitToVisibleFilter::SetFrame(frame_n);