Remove #pragma once from context.h and fix resulting compilation errors

Originally committed to SVN as r5201.
This commit is contained in:
Thomas Goyne 2011-01-16 07:16:00 +00:00
parent 64ebce6c0f
commit 71937757a2
5 changed files with 22 additions and 23 deletions

View File

@ -25,10 +25,9 @@
#include <libaegisub/exception.h> #include <libaegisub/exception.h>
#include "../include/aegisub/context.h"
#include "icon.h" #include "icon.h"
namespace agi { struct Context; }
DEFINE_BASE_EXCEPTION_NOINNER(CommandError, agi::Exception) DEFINE_BASE_EXCEPTION_NOINNER(CommandError, agi::Exception)
DEFINE_SIMPLE_EXCEPTION_NOINNER(CommandIconNone, CommandError, "command/icon") DEFINE_SIMPLE_EXCEPTION_NOINNER(CommandIconNone, CommandError, "command/icon")

View File

@ -47,6 +47,7 @@
#include <libaegisub/log.h> #include <libaegisub/log.h>
#include "include/aegisub/context.h"
#include "include/aegisub/menu.h" #include "include/aegisub/menu.h"
#include "include/aegisub/toolbar.h" #include "include/aegisub/toolbar.h"
#include "include/aegisub/hotkey.h" #include "include/aegisub/hotkey.h"
@ -101,9 +102,10 @@ static void autosave_timer_changed(wxTimer *timer, const agi::OptionValue &opt);
FrameMain::FrameMain (wxArrayString args) FrameMain::FrameMain (wxArrayString args)
: wxFrame ((wxFrame*)NULL,-1,_T(""),wxDefaultPosition,wxSize(920,700),wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN) : wxFrame ((wxFrame*)NULL,-1,_T(""),wxDefaultPosition,wxSize(920,700),wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN)
, temp_context(new agi::Context)
{ {
StartupLog(_T("Entering FrameMain constructor")); StartupLog(_T("Entering FrameMain constructor"));
temp_context.parent = this; temp_context->parent = this;
// Bind all commands. // Bind all commands.
// XXX: This is a hack for now, it will need to be dealt with when other frames are involved. // XXX: This is a hack for now, it will need to be dealt with when other frames are involved.
@ -149,12 +151,12 @@ FrameMain::FrameMain (wxArrayString args)
#ifdef WITH_AUTOMATION #ifdef WITH_AUTOMATION
StartupLog(_T("Create local Automation script manager")); StartupLog(_T("Create local Automation script manager"));
local_scripts = new Automation4::ScriptManager(); local_scripts = new Automation4::ScriptManager();
temp_context.local_scripts = local_scripts; temp_context->local_scripts = local_scripts;
#endif #endif
// Contexts and controllers // Contexts and controllers
audioController = new AudioController; audioController = new AudioController;
temp_context.audioController = audioController; temp_context->audioController = audioController;
audioController->AddAudioOpenListener(&FrameMain::OnAudioOpen, this); audioController->AddAudioOpenListener(&FrameMain::OnAudioOpen, this);
audioController->AddAudioCloseListener(&FrameMain::OnAudioClose, this); audioController->AddAudioCloseListener(&FrameMain::OnAudioClose, this);
@ -185,7 +187,7 @@ FrameMain::FrameMain (wxArrayString args)
showAudio = true; showAudio = true;
detachedVideo = NULL; detachedVideo = NULL;
stylingAssistant = NULL; stylingAssistant = NULL;
temp_context.stylingAssistant = stylingAssistant; temp_context->stylingAssistant = stylingAssistant;
StartupLog(_T("Initialize inner main window controls")); StartupLog(_T("Initialize inner main window controls"));
InitContents(); InitContents();
@ -200,7 +202,7 @@ FrameMain::FrameMain (wxArrayString args)
PreviousFocus = NULL; // Artifact from old hotkey removal not sure what it does. PreviousFocus = NULL; // Artifact from old hotkey removal not sure what it does.
temp_context.PreviousFocus = PreviousFocus; // Artifact from old hotkey removal not sure what it does. temp_context->PreviousFocus = PreviousFocus; // Artifact from old hotkey removal not sure what it does.
// Set drop target // Set drop target
StartupLog(_T("Set up drag/drop target")); StartupLog(_T("Set up drag/drop target"));
@ -248,7 +250,7 @@ FrameMain::~FrameMain () {
void FrameMain::cmd_call(wxCommandEvent& event) { void FrameMain::cmd_call(wxCommandEvent& event) {
int id = event.GetId(); int id = event.GetId();
LOG_D("event/select") << "Id: " << id; LOG_D("event/select") << "Id: " << id;
cmd::call(&temp_context, id); cmd::call(temp_context.get(), id);
} }
@ -295,7 +297,7 @@ void FrameMain::InitMenu() {
/// @brief Initialize contents /// @brief Initialize contents
void FrameMain::InitContents() { void FrameMain::InitContents() {
AssFile::top = ass = new AssFile; AssFile::top = ass = new AssFile;
temp_context.ass = ass; temp_context->ass = ass;
ass->AddCommitListener(&FrameMain::OnSubtitlesFileChanged, this); ass->AddCommitListener(&FrameMain::OnSubtitlesFileChanged, this);
// Set a background panel // Set a background panel
@ -305,9 +307,9 @@ void FrameMain::InitContents() {
// Video area; // Video area;
StartupLog(_T("Create video box")); StartupLog(_T("Create video box"));
videoBox = new VideoBox(Panel, false, ZoomBox, ass); videoBox = new VideoBox(Panel, false, ZoomBox, ass);
temp_context.videoBox = videoBox; temp_context->videoBox = videoBox;
temp_context.videoContext = VideoContext::Get(); temp_context->videoContext = VideoContext::Get();
temp_context.videoContext->audio = audioController; temp_context->videoContext->audio = audioController;
wxBoxSizer *videoSizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer *videoSizer = new wxBoxSizer(wxVERTICAL);
videoSizer->Add(videoBox, 0, wxEXPAND); videoSizer->Add(videoBox, 0, wxEXPAND);
videoSizer->AddStretchSpacer(1); videoSizer->AddStretchSpacer(1);
@ -315,9 +317,9 @@ void FrameMain::InitContents() {
// Subtitles area // Subtitles area
StartupLog(_T("Create subtitles grid")); StartupLog(_T("Create subtitles grid"));
SubsGrid = new SubtitlesGrid(this,Panel,-1,ass,wxDefaultPosition,wxSize(600,100),wxWANTS_CHARS | wxSUNKEN_BORDER,_T("Subs grid")); SubsGrid = new SubtitlesGrid(this,Panel,-1,ass,wxDefaultPosition,wxSize(600,100),wxWANTS_CHARS | wxSUNKEN_BORDER,_T("Subs grid"));
temp_context.SubsGrid = SubsGrid; temp_context->SubsGrid = SubsGrid;
videoBox->videoSlider->grid = SubsGrid; videoBox->videoSlider->grid = SubsGrid;
temp_context.videoContext->grid = SubsGrid; temp_context->videoContext->grid = SubsGrid;
Search.grid = SubsGrid; Search.grid = SubsGrid;
// Tools area // Tools area
@ -329,7 +331,7 @@ void FrameMain::InitContents() {
// Audio area // Audio area
StartupLog(_T("Create audio box")); StartupLog(_T("Create audio box"));
audioBox = new AudioBox(audioSash, audioController, SubsGrid, ass); audioBox = new AudioBox(audioSash, audioController, SubsGrid, ass);
temp_context.audioBox = audioBox; temp_context->audioBox = audioBox;
audioBox->frameMain = this; audioBox->frameMain = this;
audioSashSizer->Add(audioBox, 1, wxEXPAND); audioSashSizer->Add(audioBox, 1, wxEXPAND);
audioSash->SetSizer(audioSashSizer); audioSash->SetSizer(audioSashSizer);
@ -339,7 +341,7 @@ void FrameMain::InitContents() {
// Editing area // Editing area
StartupLog(_T("Create subtitle editing box")); StartupLog(_T("Create subtitle editing box"));
EditBox = new SubsEditBox(Panel,SubsGrid); EditBox = new SubsEditBox(Panel,SubsGrid);
temp_context.EditBox = EditBox; temp_context->EditBox = EditBox;
// Set sizers/hints // Set sizers/hints
StartupLog(_T("Arrange main sizers")); StartupLog(_T("Arrange main sizers"));
@ -903,7 +905,7 @@ void FrameMain::DetachVideo(bool detach) {
if (detach) { if (detach) {
if (!detachedVideo) { if (!detachedVideo) {
detachedVideo = new DialogDetachedVideo(this, videoBox->videoDisplay->GetClientSize()); detachedVideo = new DialogDetachedVideo(this, videoBox->videoDisplay->GetClientSize());
temp_context.detachedVideo = detachedVideo; temp_context->detachedVideo = detachedVideo;
detachedVideo->Show(); detachedVideo->Show();
} }
} }

View File

@ -47,8 +47,7 @@
#include <wx/timer.h> #include <wx/timer.h>
#endif #endif
#include "include/aegisub/context.h" #include <libaegisub/scoped_ptr.h>
class AssFile; class AssFile;
class VideoDisplay; class VideoDisplay;
@ -64,6 +63,7 @@ class AegisubFileDropTarget;
class AudioController; class AudioController;
class AudioProvider; class AudioProvider;
namespace agi { struct Context; }
namespace Automation4 { class FeatureMacro; class ScriptManager; } namespace Automation4 { class FeatureMacro; class ScriptManager; }
@ -94,7 +94,7 @@ public:
void DetachVideo(bool detach=true); void DetachVideo(bool detach=true);
void LoadVFR(wxString filename); void LoadVFR(wxString filename);
agi::Context temp_context; agi::scoped_ptr<agi::Context> temp_context;
private: private:

View File

@ -72,7 +72,7 @@ void check(std::string context, int key_code, wchar_t key_char, int modifier) {
/// The bottom line should be removed after all the hotkey commands are fixed. /// The bottom line should be removed after all the hotkey commands are fixed.
/// This is to avoid pointless exceptions. /// This is to avoid pointless exceptions.
if (command.find("/") != std::string::npos) if (command.find("/") != std::string::npos)
(*cmd::get(command))(&wxGetApp().frame->temp_context); (*cmd::get(command))(wxGetApp().frame->temp_context.get());
} }
} }

View File

@ -1,5 +1,3 @@
#pragma once // sigh.
class wxWindow; class wxWindow;
class DialogStyling; class DialogStyling;
class AudioBox; class AudioBox;