Win32 - TASEdit - more cleanup and commenting about what needs to be done.

This commit is contained in:
adelikat 2010-05-25 18:04:33 +00:00
parent 042feb025f
commit 50928c86fa
3 changed files with 57 additions and 56 deletions

View File

@ -14,7 +14,7 @@
#include "keyboard.h"
#include "joystick.h"
#include "help.h"
#include "main.h" //So we can use the GetRomName() function!
#include "main.h" //For the GetRomName() function
using namespace std;
@ -39,7 +39,7 @@ static TSelectionFrames selectionFrames;
//add a new fceud_ function?? blehhh maybe
extern EMOVIEMODE movieMode;
TASEDIT_PROJECT project; //Create an instance of the project
TASEDIT_PROJECT project;
static void GetDispInfo(NMLVDISPINFO* nmlvDispInfo)
{
@ -411,7 +411,7 @@ static void DeleteFrames()
if(frames == currMovieData.records.size())
{
MessageBox(hwndTasEdit,"Please don't delete all of the frames in the movie. This violates an internal invariant we need to keep.","Error deleting",0);
return;
return; ///adelikat: why not just add an empty frame in the event of deleting all frames?
}
//this is going to be _really_ slow.
@ -820,22 +820,25 @@ static void NewProject()
if (!CheckSaveChanges())
return;
//TODO: Reinitialise project
//TODO: close current project instance, create a new one with a non-parameterized constructor
}
//Opens a new Project file
static void OpenProject()
{
//determine if current project changed
//if so, ask to save changes
//close current project
//open dialog for new project file
//TODO
//determine if current project changed
//if so, ask to save changes
//close current project
const char TPfilter[]="TASEdit Project (*.tas)\0*.tas\0\0"; //Filetype filter
//If OPENFILENAME dialog successful, open up a completely new project instance and scrap the old one
//Run the project Load() function to pull all info from the .tas file into this new project instance
OPENFILENAME ofn; //New instance of OPENFILENAME
memset(&ofn,0,sizeof(ofn)); //Set aside some memory
ofn.lStructSize=sizeof(ofn); //Various parameters
const char TPfilter[]="TASEdit Project (*.tas)\0*.tas\0\0";
OPENFILENAME ofn;
memset(&ofn,0,sizeof(ofn));
ofn.lStructSize=sizeof(ofn);
ofn.hInstance=fceu_hInstance;
ofn.lpstrTitle="Open TASEdit Project...";
ofn.lpstrFilter=TPfilter;
@ -843,10 +846,10 @@ static void OpenProject()
char nameo[2048]; //File name
strcpy(nameo, GetRomName()); //For now, just use ROM name
ofn.lpstrFile=nameo; //More parameters
ofn.lpstrFile=nameo;
ofn.nMaxFile=256;
ofn.Flags=OFN_EXPLORER|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_FILEMUSTEXIST;
string initdir = FCEU_GetPath(FCEUMKF_MOVIE); //Initial directory
string initdir = FCEU_GetPath(FCEUMKF_MOVIE);
ofn.lpstrInitialDir=initdir.c_str();
if(GetOpenFileName(&ofn)){ //If it is a valid filename
@ -880,12 +883,11 @@ static void SaveProjectAs()
//Save project as new user selected filename
//flag project as not changed
//Creation of a save window
const char TPfilter[]="TASEdit Project (*.tas)\0*.tas\0All Files (*.*)\0*.*\0\0"; //Filetype filter
OPENFILENAME ofn; //New instance of OPENFILENAME
memset(&ofn,0,sizeof(ofn)); //Set aside some memory
ofn.lStructSize=sizeof(ofn); //Various parameters
OPENFILENAME ofn;
memset(&ofn,0,sizeof(ofn));
ofn.lStructSize=sizeof(ofn);
ofn.hInstance=fceu_hInstance;
ofn.lpstrTitle="Save TASEdit Project As...";
ofn.lpstrFilter=TPfilter;
@ -926,17 +928,21 @@ static void SaveProject()
//Save work, flag project as not changed
if (!project.SaveProject())
SaveProjectAs();
}
//Takes a selected .fm2 file and adds it to the Project inputlog
static void Import()
{
//Pull the fm2 header, comments, subtitle information out and put it into the project info
//Pull the input out and add it to the main branch input log file
}
//Takes current inputlog and saves it as a .fm2 file
static void Export()
{
//TODO: redesign this
//Dump project header info into file, then comments & subtitles, then input log
//This will require special prunctions, ::DumpHeader ::DumpComments etc
const char filter[]="FCEUX Movie File (*.fm2)\0*.fm2\0All Files (*.*)\0*.*\0\0";
char fname[2048] = {0};
OPENFILENAME ofn;
@ -1074,7 +1080,6 @@ BOOL CALLBACK WndprocTasEdit(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
case ACCEL_CTRL_O:
case ID_FILE_OPENPROJECT:
//Replay_LoadMovie(true); //TODO: change function name to LoadProject(true)?
OpenProject();
break;

View File

@ -1,18 +1,8 @@
//Implementation file of TASEdit Project file object
//Written by Chris220
//Contains all the TASEDit project and all files/settings associated with it
//Also contains all methods for manipulating the project files/settings, and saving them to disk
/*
//Private members
//The TASEdit Project's name
std::string projectName;
//The FM2's file name
std::string fm2FileName;
//The TASEdit Project's filename (For saving purposes)
std::string projectFile;
*/
#include <string>
#include <iostream>
@ -21,6 +11,11 @@
#include "taseditproj.h"
#include "movie.h"
TASEDIT_PROJECT::TASEDIT_PROJECT() //Non parameterized constructor, loads project with default values
{
}
void TASEDIT_PROJECT::init() //TODO: rip this out! This should be the class constructor instead
{
projectName="";

View File

@ -47,6 +47,7 @@ struct TASEHeader
class TASEDIT_PROJECT
{
public:
TASEDIT_PROJECT();
void init();
std::string GetProjectName();