2006-01-16 22:02:54 +01:00
|
|
|
// Copyright (c) 2005, Rodrigo Braz Monteiro, Niels Martin Hansen
|
|
|
|
// 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.
|
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// Aegisub Project http://www.aegisub.org/
|
|
|
|
|
|
|
|
/// @file frame_main.cpp
|
|
|
|
/// @brief Main window creation and control management
|
|
|
|
/// @ingroup main_ui
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-07-15 06:05:49 +02:00
|
|
|
#include "frame_main.h"
|
|
|
|
|
2011-01-16 08:16:00 +01:00
|
|
|
#include "include/aegisub/context.h"
|
2011-01-05 19:40:37 +01:00
|
|
|
#include "include/aegisub/menu.h"
|
|
|
|
#include "include/aegisub/toolbar.h"
|
|
|
|
#include "include/aegisub/hotkey.h"
|
2009-09-10 15:06:40 +02:00
|
|
|
|
|
|
|
#include "ass_file.h"
|
2014-05-22 01:23:28 +02:00
|
|
|
#include "async_video_provider.h"
|
2010-12-08 04:36:10 +01:00
|
|
|
#include "audio_controller.h"
|
2009-09-10 15:06:40 +02:00
|
|
|
#include "audio_box.h"
|
2013-06-19 04:28:11 +02:00
|
|
|
#include "base_grid.h"
|
2010-05-21 03:13:36 +02:00
|
|
|
#include "compat.h"
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
#include "command/command.h"
|
2012-03-09 01:23:41 +01:00
|
|
|
#include "dialog_detached_video.h"
|
|
|
|
#include "dialog_manager.h"
|
2009-07-24 02:08:25 +02:00
|
|
|
#include "libresrc/libresrc.h"
|
2009-09-10 15:06:40 +02:00
|
|
|
#include "main.h"
|
2013-01-07 02:50:09 +01:00
|
|
|
#include "options.h"
|
2014-05-22 01:23:28 +02:00
|
|
|
#include "project.h"
|
2013-01-26 02:57:46 +01:00
|
|
|
#include "subs_controller.h"
|
2009-09-10 15:06:40 +02:00
|
|
|
#include "subs_edit_box.h"
|
|
|
|
#include "utils.h"
|
|
|
|
#include "version.h"
|
|
|
|
#include "video_box.h"
|
2014-05-22 01:23:28 +02:00
|
|
|
#include "video_controller.h"
|
2009-09-10 15:06:40 +02:00
|
|
|
#include "video_display.h"
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2014-06-27 02:18:27 +02:00
|
|
|
#include <libaegisub/dispatch.h>
|
2014-03-25 01:15:14 +01:00
|
|
|
#include <libaegisub/log.h>
|
2014-04-23 22:53:24 +02:00
|
|
|
#include <libaegisub/make_unique.h>
|
2013-01-04 16:01:50 +01:00
|
|
|
|
|
|
|
#include <wx/dnd.h>
|
|
|
|
#include <wx/msgdlg.h>
|
2014-05-23 00:40:16 +02:00
|
|
|
#include <wx/sizer.h>
|
2013-01-04 16:01:50 +01:00
|
|
|
#include <wx/statline.h>
|
|
|
|
#include <wx/sysopt.h>
|
|
|
|
|
2011-07-15 06:05:49 +02:00
|
|
|
enum {
|
2014-03-25 01:15:14 +01:00
|
|
|
ID_APP_TIMER_STATUSCLEAR = 12002
|
2011-07-15 06:05:49 +02:00
|
|
|
};
|
2009-06-12 18:59:53 +02:00
|
|
|
|
|
|
|
#ifdef WITH_STARTUPLOG
|
2011-07-15 06:05:49 +02:00
|
|
|
#define StartupLog(a) MessageBox(0, a, "Aegisub startup log", 0)
|
2009-06-12 18:59:53 +02:00
|
|
|
#else
|
2011-12-22 22:30:40 +01:00
|
|
|
#define StartupLog(a) LOG_I("frame_main/init") << a
|
2009-06-12 18:59:53 +02:00
|
|
|
#endif
|
|
|
|
|
2011-11-30 00:18:24 +01:00
|
|
|
/// Handle files drag and dropped onto Aegisub
|
2014-03-13 02:39:07 +01:00
|
|
|
class AegisubFileDropTarget final : public wxFileDropTarget {
|
2014-05-22 01:23:28 +02:00
|
|
|
agi::Context *context;
|
2011-11-30 00:18:24 +01:00
|
|
|
public:
|
2014-05-22 01:23:28 +02:00
|
|
|
AegisubFileDropTarget(agi::Context *context) : context(context) { }
|
|
|
|
bool OnDropFiles(wxCoord, wxCoord, wxArrayString const& filenames) override {
|
|
|
|
std::vector<agi::fs::path> files;
|
|
|
|
for (wxString const& fn : filenames)
|
|
|
|
files.push_back(from_wx(fn));
|
2014-06-27 02:18:27 +02:00
|
|
|
agi::dispatch::Main().Async([=] { context->project->LoadList(files); });
|
2012-08-04 18:31:44 +02:00
|
|
|
return true;
|
2011-11-30 00:18:24 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-02-05 16:52:24 +01:00
|
|
|
FrameMain::FrameMain()
|
|
|
|
: wxFrame(nullptr, -1, "", wxDefaultPosition, wxSize(920,700), wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN)
|
2014-04-23 22:53:24 +02:00
|
|
|
, context(agi::make_unique<agi::Context>())
|
2006-01-16 22:02:54 +01:00
|
|
|
{
|
2011-01-16 08:16:54 +01:00
|
|
|
StartupLog("Entering FrameMain constructor");
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
|
2007-04-03 06:34:56 +02:00
|
|
|
#ifdef __WXGTK__
|
2011-11-25 20:27:19 +01:00
|
|
|
// XXX HACK XXX
|
|
|
|
// We need to set LC_ALL to "" here for input methods to work reliably.
|
|
|
|
setlocale(LC_ALL, "");
|
|
|
|
|
|
|
|
// However LC_NUMERIC must be "C", otherwise some parsing fails.
|
2007-04-03 06:34:56 +02:00
|
|
|
setlocale(LC_NUMERIC, "C");
|
|
|
|
#endif
|
|
|
|
|
2011-01-16 08:16:54 +01:00
|
|
|
StartupLog("Initializing context controls");
|
2013-01-26 02:57:46 +01:00
|
|
|
context->ass->AddCommitListener(&FrameMain::UpdateTitle, this);
|
|
|
|
context->subsController->AddFileOpenListener(&FrameMain::OnSubtitlesOpen, this);
|
|
|
|
context->subsController->AddFileSaveListener(&FrameMain::UpdateTitle, this);
|
2014-05-22 01:23:28 +02:00
|
|
|
context->project->AddAudioProviderListener(&FrameMain::OnAudioOpen, this);
|
|
|
|
context->project->AddVideoProviderListener(&FrameMain::OnVideoOpen, this);
|
2011-01-16 08:16:54 +01:00
|
|
|
|
|
|
|
StartupLog("Initializing context frames");
|
|
|
|
context->parent = this;
|
2014-03-25 17:51:38 +01:00
|
|
|
context->frame = this;
|
2011-01-16 08:16:54 +01:00
|
|
|
|
|
|
|
StartupLog("Apply saved Maximized state");
|
2010-05-21 03:13:36 +02:00
|
|
|
if (OPT_GET("App/Maximized")->GetBool()) Maximize(true);
|
2011-01-16 08:16:54 +01:00
|
|
|
|
|
|
|
StartupLog("Initialize toolbar");
|
2014-05-22 01:23:28 +02:00
|
|
|
wxSystemOptions::SetOption("msw.remap", 0);
|
|
|
|
OPT_SUB("App/Show Toolbar", &FrameMain::EnableToolBar, this);
|
|
|
|
EnableToolBar(*OPT_GET("App/Show Toolbar"));
|
2011-01-16 08:16:54 +01:00
|
|
|
|
|
|
|
StartupLog("Initialize menu bar");
|
2011-08-27 08:29:36 +02:00
|
|
|
menu::GetMenuBar("main", this, context.get());
|
2012-03-25 06:05:06 +02:00
|
|
|
|
2011-01-16 08:16:54 +01:00
|
|
|
StartupLog("Create status bar");
|
2006-12-28 23:31:33 +01:00
|
|
|
CreateStatusBar(2);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-01-16 08:16:54 +01:00
|
|
|
StartupLog("Set icon");
|
2010-12-11 17:47:03 +01:00
|
|
|
#ifdef _WIN32
|
2009-07-25 22:32:58 +02:00
|
|
|
SetIcon(wxICON(wxicon));
|
|
|
|
#else
|
2009-07-25 22:07:07 +02:00
|
|
|
wxIcon icon;
|
2011-01-11 18:00:11 +01:00
|
|
|
icon.CopyFromBitmap(GETIMAGE(wxicon));
|
2009-07-25 22:07:07 +02:00
|
|
|
SetIcon(icon);
|
2009-07-25 22:32:58 +02:00
|
|
|
#endif
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-01-16 08:16:54 +01:00
|
|
|
StartupLog("Create views and inner main window controls");
|
2006-01-16 22:02:54 +01:00
|
|
|
InitContents();
|
2014-04-17 17:50:08 +02:00
|
|
|
OPT_SUB("Video/Detached/Enabled", &FrameMain::OnVideoDetach, this);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-01-16 08:16:54 +01:00
|
|
|
StartupLog("Set up drag/drop target");
|
2014-05-22 01:23:28 +02:00
|
|
|
SetDropTarget(new AegisubFileDropTarget(context.get()));
|
2006-12-26 04:32:48 +01:00
|
|
|
|
2011-01-16 08:16:54 +01:00
|
|
|
StartupLog("Load default file");
|
2014-06-02 19:04:25 +02:00
|
|
|
context->project->CloseSubtitles();
|
2011-01-16 08:16:54 +01:00
|
|
|
|
2011-09-30 22:43:04 +02:00
|
|
|
StartupLog("Display main window");
|
2012-05-26 22:16:08 +02:00
|
|
|
AddFullScreenButton(this);
|
2011-09-30 22:43:04 +02:00
|
|
|
Show();
|
|
|
|
SetDisplayMode(1, 1);
|
2007-01-07 23:54:04 +01:00
|
|
|
|
2011-01-16 08:16:54 +01:00
|
|
|
StartupLog("Leaving FrameMain constructor");
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
2012-05-15 15:39:24 +02:00
|
|
|
FrameMain::~FrameMain () {
|
2013-11-21 18:13:36 +01:00
|
|
|
wxGetApp().frame = nullptr;
|
2012-05-16 16:23:16 +02:00
|
|
|
|
2014-05-22 01:23:28 +02:00
|
|
|
context->project->CloseAudio();
|
|
|
|
context->project->CloseVideo();
|
2011-07-30 01:16:46 +02:00
|
|
|
|
2014-03-25 01:15:14 +01:00
|
|
|
DestroyChildren();
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
2012-01-23 00:44:24 +01:00
|
|
|
void FrameMain::EnableToolBar(agi::OptionValue const& opt) {
|
|
|
|
if (opt.GetBool()) {
|
|
|
|
if (!GetToolBar()) {
|
|
|
|
toolbar::AttachToolbar(this, "main", context.get(), "Default");
|
|
|
|
GetToolBar()->Realize();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (wxToolBar *old_tb = GetToolBar()) {
|
2013-11-21 18:13:36 +01:00
|
|
|
SetToolBar(nullptr);
|
2012-01-23 00:44:24 +01:00
|
|
|
delete old_tb;
|
|
|
|
Layout();
|
|
|
|
}
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void FrameMain::InitContents() {
|
2011-01-16 08:16:54 +01:00
|
|
|
StartupLog("Create background panel");
|
2014-05-22 01:23:28 +02:00
|
|
|
auto Panel = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxCLIP_CHILDREN);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-01-16 08:16:54 +01:00
|
|
|
StartupLog("Create subtitles grid");
|
2014-03-25 01:15:14 +01:00
|
|
|
context->subsGrid = new BaseGrid(Panel, context.get());
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-11-04 06:11:24 +01:00
|
|
|
StartupLog("Create video box");
|
2011-11-12 02:23:18 +01:00
|
|
|
videoBox = new VideoBox(Panel, false, context.get());
|
2011-11-04 06:11:24 +01:00
|
|
|
|
2011-01-16 08:16:54 +01:00
|
|
|
StartupLog("Create audio box");
|
2011-09-29 07:33:04 +02:00
|
|
|
context->audioBox = audioBox = new AudioBox(Panel, context.get());
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-01-16 08:16:54 +01:00
|
|
|
StartupLog("Create subtitle editing box");
|
2013-11-21 18:13:36 +01:00
|
|
|
auto EditBox = new SubsEditBox(Panel, context.get());
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-01-16 08:16:54 +01:00
|
|
|
StartupLog("Arrange main sizers");
|
2010-12-08 04:36:10 +01:00
|
|
|
ToolsSizer = new wxBoxSizer(wxVERTICAL);
|
2011-09-29 07:33:04 +02:00
|
|
|
ToolsSizer->Add(audioBox, 0, wxEXPAND);
|
2010-12-08 04:36:10 +01:00
|
|
|
ToolsSizer->Add(EditBox, 1, wxEXPAND);
|
|
|
|
TopSizer = new wxBoxSizer(wxHORIZONTAL);
|
2011-09-30 22:42:55 +02:00
|
|
|
TopSizer->Add(videoBox, 0, wxEXPAND, 0);
|
2010-12-08 04:36:10 +01:00
|
|
|
TopSizer->Add(ToolsSizer, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
|
|
|
|
MainSizer = new wxBoxSizer(wxVERTICAL);
|
2007-07-07 05:21:52 +02:00
|
|
|
MainSizer->Add(new wxStaticLine(Panel),0,wxEXPAND | wxALL,0);
|
2006-01-16 22:02:54 +01:00
|
|
|
MainSizer->Add(TopSizer,0,wxEXPAND | wxALL,0);
|
2014-03-25 01:15:14 +01:00
|
|
|
MainSizer->Add(context->subsGrid,1,wxEXPAND | wxALL,0);
|
2006-01-16 22:02:54 +01:00
|
|
|
Panel->SetSizer(MainSizer);
|
|
|
|
|
2011-01-16 08:16:54 +01:00
|
|
|
StartupLog("Perform layout");
|
2006-01-16 22:02:54 +01:00
|
|
|
Layout();
|
2011-01-16 08:16:54 +01:00
|
|
|
StartupLog("Leaving InitContents");
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
2009-10-12 00:10:08 +02:00
|
|
|
void FrameMain::SetDisplayMode(int video, int audio) {
|
|
|
|
if (!IsShownOnScreen()) return;
|
|
|
|
|
|
|
|
bool sv = false, sa = false;
|
|
|
|
|
|
|
|
if (video == -1) sv = showVideo;
|
2014-05-22 01:23:28 +02:00
|
|
|
else if (video) sv = context->project->VideoProvider() && !context->dialog->Get<DialogDetachedVideo>();
|
2009-10-12 00:10:08 +02:00
|
|
|
|
|
|
|
if (audio == -1) sa = showAudio;
|
2014-05-22 01:23:28 +02:00
|
|
|
else if (audio) sa = !!context->project->AudioProvider();
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2007-01-23 05:42:08 +01:00
|
|
|
// See if anything changed
|
2009-10-12 00:10:08 +02:00
|
|
|
if (sv == showVideo && sa == showAudio) return;
|
|
|
|
|
|
|
|
showVideo = sv;
|
|
|
|
showAudio = sa;
|
2007-01-23 05:42:08 +01:00
|
|
|
|
2010-06-29 00:15:40 +02:00
|
|
|
bool didFreeze = !IsFrozen();
|
|
|
|
if (didFreeze) Freeze();
|
|
|
|
|
2011-01-16 08:16:54 +01:00
|
|
|
context->videoController->Stop();
|
2007-04-13 03:46:50 +02:00
|
|
|
|
2010-12-08 04:36:10 +01:00
|
|
|
TopSizer->Show(videoBox, showVideo, true);
|
2011-09-29 07:33:04 +02:00
|
|
|
ToolsSizer->Show(audioBox, showAudio, true);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2006-07-11 03:58:53 +02:00
|
|
|
MainSizer->CalcMin();
|
|
|
|
MainSizer->RecalcSizes();
|
2006-01-16 22:02:54 +01:00
|
|
|
MainSizer->Layout();
|
2006-05-05 20:52:09 +02:00
|
|
|
Layout();
|
2010-06-29 00:15:40 +02:00
|
|
|
|
|
|
|
if (didFreeze) Thaw();
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void FrameMain::UpdateTitle() {
|
2011-01-16 08:16:33 +01:00
|
|
|
wxString newTitle;
|
2013-01-26 02:57:46 +01:00
|
|
|
if (context->subsController->IsModified()) newTitle << "* ";
|
|
|
|
newTitle << context->subsController->Filename().filename().wstring();
|
2011-01-16 08:16:33 +01:00
|
|
|
|
|
|
|
#ifndef __WXMAC__
|
|
|
|
newTitle << " - Aegisub " << GetAegisubLongVersionString();
|
2007-09-22 05:49:18 +02:00
|
|
|
#endif
|
2009-08-01 04:00:30 +02:00
|
|
|
|
2010-12-08 04:36:10 +01:00
|
|
|
#if defined(__WXMAC__) && !defined(__LP64__)
|
2007-09-22 05:07:16 +02:00
|
|
|
// On Mac, set the mark in the close button
|
2013-01-26 02:57:46 +01:00
|
|
|
OSXSetModified(context->subsController->IsModified());
|
2007-09-22 05:07:16 +02:00
|
|
|
#endif
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-01-16 08:16:33 +01:00
|
|
|
if (GetTitle() != newTitle) SetTitle(newTitle);
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
2014-05-22 01:23:28 +02:00
|
|
|
void FrameMain::OnVideoOpen(AsyncVideoProvider *provider) {
|
|
|
|
if (!provider) {
|
2011-01-16 08:16:27 +01:00
|
|
|
SetDisplayMode(0, -1);
|
|
|
|
return;
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
2011-01-16 08:16:27 +01:00
|
|
|
Freeze();
|
2014-05-22 01:23:28 +02:00
|
|
|
int vidx = provider->GetWidth(), vidy = provider->GetHeight();
|
2011-01-16 08:16:27 +01:00
|
|
|
|
|
|
|
// Set zoom level based on video resolution and window size
|
2011-11-12 02:23:29 +01:00
|
|
|
double zoom = context->videoDisplay->GetZoom();
|
2011-01-16 08:16:27 +01:00
|
|
|
wxSize windowSize = GetSize();
|
|
|
|
if (vidx*3*zoom > windowSize.GetX()*4 || vidy*4*zoom > windowSize.GetY()*6)
|
2011-11-12 02:23:29 +01:00
|
|
|
context->videoDisplay->SetZoom(zoom * .25);
|
2011-01-16 08:16:27 +01:00
|
|
|
else if (vidx*3*zoom > windowSize.GetX()*2 || vidy*4*zoom > windowSize.GetY()*3)
|
2011-11-12 02:23:29 +01:00
|
|
|
context->videoDisplay->SetZoom(zoom * .5);
|
2011-01-16 08:16:27 +01:00
|
|
|
|
2009-10-12 00:10:08 +02:00
|
|
|
SetDisplayMode(1,-1);
|
2008-01-12 04:09:48 +01:00
|
|
|
|
2012-03-09 01:23:41 +01:00
|
|
|
if (OPT_GET("Video/Detached/Enabled")->GetBool() && !context->dialog->Get<DialogDetachedVideo>())
|
2011-07-30 01:16:36 +02:00
|
|
|
cmd::call("video/detach", context.get());
|
2008-01-12 04:09:48 +01:00
|
|
|
Thaw();
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
2011-07-30 01:16:36 +02:00
|
|
|
void FrameMain::OnVideoDetach(agi::OptionValue const& opt) {
|
|
|
|
if (opt.GetBool())
|
|
|
|
SetDisplayMode(0, -1);
|
2014-05-22 01:23:28 +02:00
|
|
|
else if (context->project->VideoProvider())
|
2011-07-30 01:16:36 +02:00
|
|
|
SetDisplayMode(1, -1);
|
2008-01-12 04:09:48 +01:00
|
|
|
}
|
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
void FrameMain::StatusTimeout(wxString text,int ms) {
|
|
|
|
SetStatusText(text,1);
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
StatusClear.SetOwner(this, ID_APP_TIMER_STATUSCLEAR);
|
2006-01-16 22:02:54 +01:00
|
|
|
StatusClear.Start(ms,true);
|
|
|
|
}
|
|
|
|
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
BEGIN_EVENT_TABLE(FrameMain, wxFrame)
|
|
|
|
EVT_TIMER(ID_APP_TIMER_STATUSCLEAR, FrameMain::OnStatusClear)
|
|
|
|
EVT_CLOSE(FrameMain::OnCloseWindow)
|
2012-04-27 21:07:49 +02:00
|
|
|
EVT_CHAR_HOOK(FrameMain::OnKeyDown)
|
2011-10-25 21:40:57 +02:00
|
|
|
EVT_MOUSEWHEEL(FrameMain::OnMouseWheel)
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
2013-01-26 02:57:46 +01:00
|
|
|
void FrameMain::OnCloseWindow(wxCloseEvent &event) {
|
2013-10-17 00:40:17 +02:00
|
|
|
wxEventBlocker blocker(this, wxEVT_CLOSE_WINDOW);
|
|
|
|
|
2011-01-16 08:16:54 +01:00
|
|
|
context->videoController->Stop();
|
|
|
|
context->audioController->Stop();
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
|
|
|
|
// Ask user if he wants to save first
|
2013-01-26 02:57:46 +01:00
|
|
|
if (context->subsController->TryToClose(event.CanVeto()) == wxCANCEL) {
|
2012-03-12 00:04:49 +01:00
|
|
|
event.Veto();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-03-25 22:49:26 +01:00
|
|
|
context->dialog.reset();
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
|
|
|
|
// Store maximization state
|
|
|
|
OPT_SET("App/Maximized")->SetBool(IsMaximized());
|
|
|
|
|
2012-03-12 00:04:49 +01:00
|
|
|
Destroy();
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void FrameMain::OnStatusClear(wxTimerEvent &) {
|
2011-07-15 06:05:49 +02:00
|
|
|
SetStatusText("",1);
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
}
|
|
|
|
|
2014-07-09 16:22:49 +02:00
|
|
|
void FrameMain::OnAudioOpen(agi::AudioProvider *provider) {
|
2014-05-22 01:23:28 +02:00
|
|
|
if (provider)
|
|
|
|
SetDisplayMode(-1, 1);
|
|
|
|
else
|
|
|
|
SetDisplayMode(-1, 0);
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
}
|
|
|
|
|
2011-01-16 08:16:33 +01:00
|
|
|
void FrameMain::OnSubtitlesOpen() {
|
|
|
|
UpdateTitle();
|
2012-03-27 06:23:45 +02:00
|
|
|
SetDisplayMode(1, 1);
|
2011-01-16 08:16:33 +01:00
|
|
|
}
|
|
|
|
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
void FrameMain::OnKeyDown(wxKeyEvent &event) {
|
2012-03-13 00:34:34 +01:00
|
|
|
hotkey::check("Main Frame", context.get(), event);
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
}
|
2011-10-25 21:40:57 +02:00
|
|
|
|
|
|
|
void FrameMain::OnMouseWheel(wxMouseEvent &evt) {
|
|
|
|
ForwardMouseWheelEvent(this, evt);
|
|
|
|
}
|