Athenasub is operational again, although it now has memory leaks due to cyclical references.
Originally committed to SVN as r2365.
This commit is contained in:
parent
743527eeb8
commit
5b8ce78d40
7 changed files with 47 additions and 26 deletions
|
@ -20,7 +20,7 @@
|
|||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
|
@ -42,8 +42,8 @@
|
|||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/MP"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="include/aegilib"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
||||
AdditionalIncludeDirectories="include/athenasub;src"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;ATHENA_EXPORTS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
|
@ -67,11 +67,15 @@
|
|||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="../bin/aegilib_d.dll"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
|
@ -81,6 +85,9 @@
|
|||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
|
|
|
@ -48,4 +48,8 @@ namespace Athenasub {
|
|||
return LibAthenaSub(CreateLib(hostName));
|
||||
//return LibAthenaSub(CreateLibAthenasub(hostName));
|
||||
}
|
||||
|
||||
inline LibAthenaSub Create(const char* hostName) {
|
||||
return LibAthenaSub(CreateLibAthenasub(hostName));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ namespace Athenasub {
|
|||
friend class IAction;
|
||||
|
||||
protected:
|
||||
virtual void ProcessActionList(ActionList actionList,int type=0) = 0;
|
||||
virtual void ProcessActionList(CActionList &actionList,int type=0) = 0;
|
||||
|
||||
virtual String GetUndoMessage(const String owner=L"") const = 0;
|
||||
virtual String GetRedoMessage(const String owner=L"") const = 0;
|
||||
|
@ -255,12 +255,12 @@ namespace Athenasub {
|
|||
virtual Entry Clone() const = 0;
|
||||
|
||||
/*
|
||||
static PlainTextPtr GetAsPlain(EntryPtr ptr);
|
||||
static DialoguePtr GetAsDialogue(EntryPtr ptr);
|
||||
static DialogueConstPtr GetAsDialogue(EntryConstPtr ptr);
|
||||
static StylePtr GetAsStyle(EntryPtr ptr);
|
||||
static AttachmentPtr GetAsFile(EntryPtr ptr);
|
||||
static RawEntryPtr GetAsRaw(EntryPtr ptr);
|
||||
static PlainText GetAsPlain(Entry ptr);
|
||||
static Dialogue GetAsDialogue(Entry ptr);
|
||||
static DialogueConst GetAsDialogue(EntryConst ptr);
|
||||
static Style GetAsStyle(Entry ptr);
|
||||
static Attachment GetAsFile(Entry ptr);
|
||||
static RawEntry GetAsRaw(Entry ptr);
|
||||
*/
|
||||
};
|
||||
|
||||
|
@ -273,7 +273,6 @@ namespace Athenasub {
|
|||
|
||||
// Type
|
||||
SectionEntryType GetType() const { return SECTION_ENTRY_DIALOGUE; }
|
||||
Dialogue GetAsDialogue() { return Dialogue(this); }
|
||||
|
||||
// Capabilities
|
||||
virtual bool HasText() const { return false; }
|
||||
|
@ -319,7 +318,6 @@ namespace Athenasub {
|
|||
|
||||
// Type
|
||||
SectionEntryType GetType() const { return SECTION_ENTRY_STYLE; }
|
||||
Style GetAsStyle() { return Style(this); }
|
||||
|
||||
// Read accessors
|
||||
virtual String GetName() const = 0;
|
||||
|
|
|
@ -96,7 +96,7 @@ void CActionList::Start(const String name)
|
|||
void CActionList::Finish()
|
||||
{
|
||||
if (valid) {
|
||||
model->ProcessActionList(ActionList(this));
|
||||
model->ProcessActionList(*this);
|
||||
actions.clear();
|
||||
valid = false;
|
||||
}
|
||||
|
|
|
@ -60,10 +60,11 @@ void CModel::DispatchNotifications(Notification notification) const
|
|||
|
||||
////////////////////////////
|
||||
// Processes an action list
|
||||
void CModel::ProcessActionList(ActionList _actionList,int type)
|
||||
void CModel::ProcessActionList(CActionList &_actionList,int type)
|
||||
{
|
||||
// Copy the list
|
||||
shared_ptr<CActionList> actions = shared_ptr<CActionList>(new CActionList(*static_pointer_cast<CActionList>(_actionList)));
|
||||
//shared_ptr<CActionList> actions = shared_ptr<CActionList>(new CActionList(*static_pointer_cast<CActionList>(_actionList)));
|
||||
shared_ptr<CActionList> actions = shared_ptr<CActionList>(new CActionList(_actionList));
|
||||
|
||||
// Setup undo
|
||||
shared_ptr<CActionList> undo = shared_ptr<CActionList>(new CActionList(actions->model,actions->actionName,actions->owner,actions->undoAble));
|
||||
|
@ -224,7 +225,8 @@ void CModel::ActivateStack(ActionStack stack,bool isUndo,const String &owner)
|
|||
(void) owner;
|
||||
|
||||
// Process list
|
||||
ProcessActionList(stack.back(),isUndo?1:2);
|
||||
//ProcessActionList(stack.back(),isUndo?1:2);
|
||||
ProcessActionList(*static_pointer_cast<CActionList>(stack.back()),isUndo?1:2);
|
||||
|
||||
// Pop original
|
||||
stack.pop_back();
|
||||
|
|
|
@ -62,7 +62,7 @@ namespace Athenasub {
|
|||
bool readOnly;
|
||||
Format format;
|
||||
|
||||
void ProcessActionList(ActionList actionList,int type=0);
|
||||
void ProcessActionList(CActionList &actionList,int type=0);
|
||||
|
||||
String GetUndoMessage(const String owner=L"") const;
|
||||
String GetRedoMessage(const String owner=L"") const;
|
||||
|
|
|
@ -50,15 +50,23 @@ int main()
|
|||
|
||||
try {
|
||||
// Set up the lib
|
||||
cout << "Loading library... ";
|
||||
HMODULE module = LoadLibrary(_T("athenasub.dll"));
|
||||
if (!module) {
|
||||
cout << "Failed to load library, aborting.\n";
|
||||
system("pause");
|
||||
return 1;
|
||||
if (false) {
|
||||
cout << "Loading library... ";
|
||||
#ifdef WXDEBUG
|
||||
HMODULE module = LoadLibrary(_T("athenasub_d.dll"));
|
||||
#else
|
||||
HMODULE module = LoadLibrary(_T("athenasub.dll"));
|
||||
#endif
|
||||
if (!module) {
|
||||
cout << "Failed to load library, aborting.\n";
|
||||
system("pause");
|
||||
return 1;
|
||||
}
|
||||
cout << "Done.\nCreating library...";
|
||||
}
|
||||
cout << "Done.\nCreating library...";
|
||||
LibAthenaSub lib = Athenasub::Create(module,"Aegilib test program");
|
||||
|
||||
//LibAthenaSub lib = Athenasub::Create(module,"Aegilib test program");
|
||||
LibAthenaSub lib = Athenasub::Create("Aegilib test program");
|
||||
cout << "Done.\n";
|
||||
|
||||
// Subtitles model
|
||||
|
@ -133,6 +141,8 @@ int main()
|
|||
control->SaveFile(L"subs_out2.ass",L"UTF-8");
|
||||
control->Undo();
|
||||
control->SaveFile(L"subs_out3.ass",L"UTF-8");
|
||||
|
||||
system("pause");
|
||||
}
|
||||
|
||||
catch (std::exception &e) {
|
||||
|
|
Loading…
Reference in a new issue