Aegisub/aegisub/src/frame_main.h

209 lines
5.0 KiB
C
Raw Normal View History

2006-01-16 22:02:54 +01:00
// Copyright (c) 2005, Rodrigo Braz Monteiro
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of the Aegisub Group nor the names of its contributors
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// Aegisub Project http://www.aegisub.org/
2006-01-16 22:02:54 +01:00
//
// $Id$
/// @file frame_main.h
/// @see frame_main.cpp
/// @ingroup main_ui
///
2006-01-16 22:02:54 +01:00
#ifndef AGI_PRE
#include <vector>
#include <wx/combobox.h>
#include <wx/frame.h>
#include <wx/log.h>
#include <wx/menu.h>
#include <wx/panel.h>
#include <wx/sizer.h>
#include <wx/sashwin.h>
#include <wx/timer.h>
#endif
2006-01-16 22:02:54 +01:00
#include <libaegisub/scoped_ptr.h>
class AssFile;
2006-01-16 22:02:54 +01:00
class VideoDisplay;
class VideoSlider;
class VideoZoomSlider;
class SubtitlesGrid;
class SubsEditBox;
class AudioBox;
class VideoBox;
class DialogDetachedVideo;
class DialogStyling;
2006-01-16 22:02:54 +01:00
class AegisubFileDropTarget;
class AudioController;
class AudioProvider;
namespace agi { struct Context; }
namespace Automation4 { class FeatureMacro; class ScriptManager; }
2006-01-16 22:02:54 +01:00
enum SubMenuID {
ID_TOOLBAR_ZOOM_DROPDOWN = 11001,
ID_APP_TIMER_AUTOSAVE = 12001,
ID_APP_TIMER_STATUSCLEAR = 12002,
ID_MENU_AUTOMATION_MACRO = 13006,
ID_SASH_MAIN_AUDIO = 14001
};
/// DOCME
/// @class FrameMain
/// @brief DOCME
///
/// DOCME
class FrameMain: public wxFrame {
2006-01-16 22:02:54 +01:00
friend class AegisubFileDropTarget;
friend class AegisubApp;
friend class SubtitlesGrid;
2006-01-16 22:02:54 +01:00
public:
void StatusTimeout(wxString text,int ms=10000);
void SetDisplayMode(int showVid,int showAudio);
void LoadSubtitles(wxString filename,wxString charset="");
bool SaveSubtitles(bool saveas=false,bool withCharset=false);
void DetachVideo(bool detach=true);
void LoadVFR(wxString filename);
agi::scoped_ptr<agi::Context> context;
private:
void cmd_call(wxCommandEvent& event);
/// DOCME
/// DOCME
bool showVideo,showAudio;
/// DOCME
2006-01-16 22:02:54 +01:00
bool HasSelection;
/// DOCME
2006-01-16 22:02:54 +01:00
bool menuCreated;
/// DOCME
2006-01-16 22:02:54 +01:00
wxTimer AutoSave;
/// DOCME
2006-01-16 22:02:54 +01:00
wxTimer StatusClear;
/// DOCME
2006-01-16 22:02:54 +01:00
bool blockVideoLoad;
/// DOCME
2006-01-16 22:02:54 +01:00
wxPanel *Panel;
/// DOCME
2006-01-16 22:02:54 +01:00
wxToolBar *Toolbar;
/// DOCME
2006-01-16 22:02:54 +01:00
wxComboBox *ZoomBox;
/// DOCME
std::vector<Automation4::FeatureMacro*> activeMacroItems;
int AddMacroMenuItems(wxMenu *menu, const std::vector<Automation4::FeatureMacro*> &macros);
2006-01-16 22:02:54 +01:00
void InitToolbar();
void InitContents();
void DeInitContents();
2006-01-16 22:02:54 +01:00
void OnKeyDown(wxKeyEvent &event);
void OnGridEvent (wxCommandEvent &event);
void OnMenuOpen (wxMenuEvent &event);
2006-01-16 22:02:54 +01:00
void OnAudioBoxResize(wxSashEvent &event);
void OnAutoSave(wxTimerEvent &event);
void OnStatusClear(wxTimerEvent &event);
2006-01-16 22:02:54 +01:00
void OnCloseWindow (wxCloseEvent &event);
void OnAutomationMacro(wxCommandEvent &event);
2006-01-16 22:02:54 +01:00
int TryToCloseSubs(bool enableCancel=true);
void RebuildRecentList(const char *root_command, const char *mru_name);
void SynchronizeProject();
2006-01-16 22:02:54 +01:00
// AudioControllerAudioEventListener implementation
void OnAudioOpen(AudioProvider *provider);
void OnAudioClose();
void OnVideoOpen();
void OnSubtitlesCommit();
void OnSubtitlesOpen();
void OnSubtitlesSave();
2006-01-16 22:02:54 +01:00
public:
/// The subtitle editing area
SubtitlesGrid *SubsGrid;
/// The subtitle editing textbox
SubsEditBox *EditBox;
/// Sash for resizing the audio area
wxSashWindow *audioSash;
/// The audio area
AudioBox *audioBox;
/// The video area
VideoBox *videoBox;
/// Arranges things from top to bottom in the window
2006-01-16 22:02:54 +01:00
wxBoxSizer *MainSizer;
/// Arranges video box and tool box from left to right
2006-01-16 22:02:54 +01:00
wxBoxSizer *TopSizer;
/// Arranges audio and editing areas top to bottom
wxBoxSizer *ToolsSizer;
2006-01-16 22:02:54 +01:00
FrameMain (wxArrayString args);
~FrameMain ();
bool LoadList(wxArrayString list);
static void OpenHelp(wxString page=_T(""));
void UpdateTitle();
void InitMenu();
void UpdateToolbar();
2007-01-26 01:47:42 +01:00
void SetUndoRedoDesc();
bool HasASSDraw();
2006-01-16 22:02:54 +01:00
DECLARE_EVENT_TABLE()
2006-01-16 22:02:54 +01:00
};