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
|
|
|
// Copyright (c) 2010, Amar Takhar
|
|
|
|
// 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/
|
|
|
|
|
|
|
|
/// @file recent.cpp
|
|
|
|
/// @brief recent/ commands, rebuild MRU-based lists.
|
|
|
|
/// @ingroup command
|
|
|
|
///
|
|
|
|
|
2011-01-05 19:40:37 +01:00
|
|
|
#include "../config.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.h"
|
|
|
|
|
2011-01-16 08:15:46 +01:00
|
|
|
#include "../audio_controller.h"
|
2011-01-05 19:40:37 +01:00
|
|
|
#include "../compat.h"
|
2013-01-07 02:50:09 +01:00
|
|
|
#include "../include/aegisub/context.h"
|
|
|
|
#include "../main.h"
|
|
|
|
#include "../options.h"
|
2013-01-26 02:57:46 +01:00
|
|
|
#include "../subs_controller.h"
|
2011-01-05 19:40:37 +01:00
|
|
|
#include "../video_context.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
|
|
|
|
2013-01-04 16:01:50 +01:00
|
|
|
#include <wx/event.h>
|
|
|
|
#include <wx/msgdlg.h>
|
|
|
|
|
2011-07-15 06:05:01 +02:00
|
|
|
namespace {
|
|
|
|
using cmd::Command;
|
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
|
|
|
/// @defgroup cmd-recent MRU (Most Recently Used) commands.
|
|
|
|
/// @{
|
|
|
|
|
2012-02-07 02:22:32 +01:00
|
|
|
COMMAND_GROUP(recent_audio, "recent/audio", _("Recent"), _("Recent"), _("Open recent audio"));
|
|
|
|
COMMAND_GROUP(recent_keyframes, "recent/keyframe", _("Recent"), _("Recent"), _("Open recent keyframes"));
|
|
|
|
COMMAND_GROUP(recent_subtitle, "recent/subtitle", _("Recent"), _("Recent"), _("Open recent subtitles"));
|
|
|
|
COMMAND_GROUP(recent_timecodes, "recent/timecodes", _("Recent"), _("Recent"), _("Open recent timecodes"));
|
|
|
|
COMMAND_GROUP(recent_video, "recent/video", _("Recent"), _("Recent"), _("Open recent video"));
|
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:15:46 +01:00
|
|
|
struct recent_audio_entry : public Command {
|
|
|
|
CMD_NAME("recent/audio/")
|
|
|
|
STR_MENU("Recent")
|
|
|
|
STR_DISP("Recent")
|
2012-02-01 19:47:26 +01:00
|
|
|
STR_HELP("Open recent audio")
|
2011-01-16 08:15:46 +01:00
|
|
|
|
|
|
|
void operator()(agi::Context *c, int id) {
|
2011-10-29 06:31:05 +02:00
|
|
|
try {
|
2013-01-04 16:01:50 +01:00
|
|
|
c->audioController->OpenAudio(config::mru->GetEntry("Audio", id));
|
2011-10-29 06:31:05 +02:00
|
|
|
}
|
|
|
|
catch (agi::UserCancelException const&) { }
|
|
|
|
catch (agi::Exception const& e) {
|
2012-12-23 00:18:38 +01:00
|
|
|
wxMessageBox(to_wx(e.GetChainedMessage()), "Error loading file", wxOK | wxICON_ERROR | wxCENTER, c->parent);
|
2011-10-29 06:31:05 +02:00
|
|
|
}
|
2011-01-16 08:15:46 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2011-08-27 08:29:36 +02:00
|
|
|
struct recent_keyframes_entry : public Command {
|
|
|
|
CMD_NAME("recent/keyframes/")
|
2011-01-16 08:15:46 +01:00
|
|
|
STR_MENU("Recent")
|
|
|
|
STR_DISP("Recent")
|
2012-02-01 19:47:26 +01:00
|
|
|
STR_HELP("Open recent keyframes")
|
2011-01-16 08:15:46 +01:00
|
|
|
|
|
|
|
void operator()(agi::Context *c, int id) {
|
2013-01-04 16:01:50 +01:00
|
|
|
c->videoController->LoadKeyframes(config::mru->GetEntry("Keyframes", id));
|
2011-01-16 08:15:46 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct recent_subtitle_entry : public Command {
|
|
|
|
CMD_NAME("recent/subtitle/")
|
|
|
|
STR_MENU("Recent")
|
|
|
|
STR_DISP("Recent")
|
2012-02-01 19:47:26 +01:00
|
|
|
STR_HELP("Open recent subtitles")
|
2011-01-16 08:15:46 +01:00
|
|
|
|
|
|
|
void operator()(agi::Context *c, int id) {
|
2013-01-26 02:57:46 +01:00
|
|
|
c->subsController->Load(config::mru->GetEntry("Subtitle", id));
|
2011-01-16 08:15:46 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2011-08-27 08:29:36 +02:00
|
|
|
struct recent_timecodes_entry : public Command {
|
|
|
|
CMD_NAME("recent/timecodes/")
|
2011-01-16 08:15:46 +01:00
|
|
|
STR_MENU("Recent")
|
|
|
|
STR_DISP("Recent")
|
2012-02-01 19:47:26 +01:00
|
|
|
STR_HELP("Open recent timecodes")
|
2011-01-16 08:15:46 +01:00
|
|
|
|
|
|
|
void operator()(agi::Context *c, int id) {
|
2013-01-04 16:01:50 +01:00
|
|
|
c->videoController->LoadTimecodes(config::mru->GetEntry("Timecodes", id));
|
2011-01-16 08:15:46 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct recent_video_entry : public Command {
|
|
|
|
CMD_NAME("recent/video/")
|
|
|
|
STR_MENU("Recent")
|
|
|
|
STR_DISP("Recent")
|
2012-02-01 19:47:26 +01:00
|
|
|
STR_HELP("Open recent videos")
|
2011-01-16 08:15:46 +01:00
|
|
|
|
|
|
|
void operator()(agi::Context *c, int id) {
|
2013-01-04 16:01:50 +01:00
|
|
|
c->videoController->SetVideo(config::mru->GetEntry("Video", id));
|
2011-01-16 08:15:46 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/// @class mru_wrapper
|
2012-03-25 06:05:06 +02:00
|
|
|
/// @brief Wrapper class for mru commands to
|
2011-01-16 08:15:46 +01:00
|
|
|
template<class T>
|
|
|
|
class mru_wrapper : public T {
|
|
|
|
int id;
|
|
|
|
std::string full_name;
|
|
|
|
public:
|
2011-10-24 22:17:57 +02:00
|
|
|
const char *name() const { return full_name.c_str(); }
|
2011-01-16 08:15:46 +01:00
|
|
|
void operator()(agi::Context *c) {
|
|
|
|
T::operator()(c, id);
|
|
|
|
}
|
2013-01-04 16:01:50 +01:00
|
|
|
mru_wrapper(int id) : id(id) , full_name(T::name() + std::to_string(id)) { }
|
2011-01-16 08:15:46 +01:00
|
|
|
};
|
2011-07-15 06:05:01 +02: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
|
|
|
/// @}
|
|
|
|
|
2011-07-15 06:05:01 +02:00
|
|
|
namespace cmd {
|
|
|
|
void init_recent() {
|
|
|
|
reg(new recent_audio);
|
2011-08-27 08:29:36 +02:00
|
|
|
reg(new recent_keyframes);
|
2011-07-15 06:05:01 +02:00
|
|
|
reg(new recent_subtitle);
|
2011-08-27 08:29:36 +02:00
|
|
|
reg(new recent_timecodes);
|
2011-07-15 06:05:01 +02:00
|
|
|
reg(new recent_video);
|
|
|
|
|
|
|
|
/// @todo 16 is an implementation detail that maybe needs to be exposed
|
|
|
|
for (int i = 0; i < 16; ++i) {
|
|
|
|
reg(new mru_wrapper<recent_audio_entry>(i));
|
2011-08-27 08:29:36 +02:00
|
|
|
reg(new mru_wrapper<recent_keyframes_entry>(i));
|
2011-07-15 06:05:01 +02:00
|
|
|
reg(new mru_wrapper<recent_subtitle_entry>(i));
|
2011-08-27 08:29:36 +02:00
|
|
|
reg(new mru_wrapper<recent_timecodes_entry>(i));
|
2011-07-15 06:05:01 +02:00
|
|
|
reg(new mru_wrapper<recent_video_entry>(i));
|
|
|
|
}
|
2011-01-16 08:15:46 +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
|
|
|
}
|