forked from mia/Aegisub
Hide the StatusTimeout awfulness in a util function
This commit is contained in:
parent
a9467836f9
commit
09aa873ed7
6 changed files with 18 additions and 13 deletions
|
@ -46,6 +46,7 @@
|
|||
#include "../include/aegisub/context.h"
|
||||
#include "../main.h"
|
||||
#include "../options.h"
|
||||
#include "../utils.h"
|
||||
#include "../video_context.h"
|
||||
|
||||
namespace {
|
||||
|
@ -62,7 +63,7 @@ struct reload_all : public Command {
|
|||
void operator()(agi::Context *c) {
|
||||
wxGetApp().global_scripts->Reload();
|
||||
c->local_scripts->Reload();
|
||||
wxGetApp().frame->StatusTimeout(_("Reloaded all Automation scripts"));
|
||||
StatusTimeout(_("Reloaded all Automation scripts"));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -74,7 +75,7 @@ struct reload_autoload : public Command {
|
|||
|
||||
void operator()(agi::Context *c) {
|
||||
wxGetApp().global_scripts->Reload();
|
||||
wxGetApp().frame->StatusTimeout(_("Reloaded autoload Automation scripts"));
|
||||
StatusTimeout(_("Reloaded autoload Automation scripts"));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -42,9 +42,7 @@
|
|||
#include "../ass_file.h"
|
||||
#include "../audio_controller.h"
|
||||
#include "../audio_timing.h"
|
||||
#include "../frame_main.h"
|
||||
#include "../include/aegisub/context.h"
|
||||
#include "../main.h"
|
||||
#include "../options.h"
|
||||
#include "../selection_controller.h"
|
||||
#include "../utils.h"
|
||||
|
@ -288,7 +286,7 @@ struct grid_tag_cycle_hiding : public Command {
|
|||
if (tagMode == 0) message = _("ASS Override Tag mode set to show full tags.");
|
||||
if (tagMode == 1) message = _("ASS Override Tag mode set to simplify tags.");
|
||||
if (tagMode == 2) message = _("ASS Override Tag mode set to hide tags.");
|
||||
wxGetApp().frame->StatusTimeout(message,10000);
|
||||
StatusTimeout(message,10000);
|
||||
|
||||
// Set option
|
||||
OPT_SET("Subtitle/Grid/Hide Overrides")->SetInt(tagMode);
|
||||
|
|
|
@ -26,14 +26,13 @@
|
|||
#include "ass_dialogue.h"
|
||||
#include "ass_file.h"
|
||||
#include "compat.h"
|
||||
#include "frame_main.h"
|
||||
#include "help_button.h"
|
||||
#include "include/aegisub/context.h"
|
||||
#include "libresrc/libresrc.h"
|
||||
#include "main.h"
|
||||
#include "options.h"
|
||||
#include "search_replace_engine.h"
|
||||
#include "selection_controller.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include <libaegisub/of_type_adaptor.h>
|
||||
|
||||
|
@ -232,7 +231,7 @@ void DialogSelection::Process(wxCommandEvent&) {
|
|||
if (count == 0)
|
||||
wxMessageBox(message, _("Selection"), wxOK | wxCENTER, this);
|
||||
else
|
||||
wxGetApp().frame->StatusTimeout(message);
|
||||
StatusTimeout(message);
|
||||
|
||||
if (new_sel.size() && !new_sel.count(con->selectionController->GetActiveLine()))
|
||||
con->selectionController->SetActiveLine(*new_sel.begin());
|
||||
|
|
|
@ -23,12 +23,11 @@
|
|||
#include "ass_style.h"
|
||||
#include "compat.h"
|
||||
#include "command/command.h"
|
||||
#include "frame_main.h"
|
||||
#include "include/aegisub/context.h"
|
||||
#include "main.h"
|
||||
#include "options.h"
|
||||
#include "subtitle_format.h"
|
||||
#include "text_file_reader.h"
|
||||
#include "utils.h"
|
||||
#include "video_context.h"
|
||||
|
||||
#include <libaegisub/fs.h>
|
||||
|
@ -71,13 +70,13 @@ SubsController::SubsController(agi::Context *context)
|
|||
try {
|
||||
auto fn = AutoSave();
|
||||
if (!fn.empty())
|
||||
wxTheApp->frame->StatusTimeout(wxString::Format(_("File backup saved as \"%s\"."), fn.wstring()));
|
||||
StatusTimeout(wxString::Format(_("File backup saved as \"%s\"."), fn.wstring()));
|
||||
}
|
||||
catch (const agi::Exception& err) {
|
||||
wxTheApp->frame->StatusTimeout(to_wx("Exception when attempting to autosave file: " + err.GetMessage()));
|
||||
StatusTimeout(to_wx("Exception when attempting to autosave file: " + err.GetMessage()));
|
||||
}
|
||||
catch (...) {
|
||||
wxTheApp->frame->StatusTimeout("Unhandled exception when attempting to autosave file.");
|
||||
StatusTimeout("Unhandled exception when attempting to autosave file.");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -37,6 +37,8 @@
|
|||
#include "utils.h"
|
||||
|
||||
#include "compat.h"
|
||||
#include "frame_main.h"
|
||||
#include "main.h"
|
||||
#include "options.h"
|
||||
|
||||
#include <libaegisub/dispatch.h>
|
||||
|
@ -88,6 +90,10 @@ wxString PrettySize(int bytes) {
|
|||
return wxString::Format(fmt, size) + " " + suffix[i];
|
||||
}
|
||||
|
||||
void StatusTimeout(wxString const& msg, int ms) {
|
||||
wxGetApp().frame->StatusTimeout(msg, ms);
|
||||
}
|
||||
|
||||
int SmallestPowerOf2(int x) {
|
||||
x--;
|
||||
x |= (x >> 1);
|
||||
|
|
|
@ -54,6 +54,8 @@ wxString AegiFloatToString(double value);
|
|||
wxString AegiIntegerToString(int value);
|
||||
wxString PrettySize(int bytes);
|
||||
|
||||
void StatusTimeout(wxString const& msg, int ms = 10000);
|
||||
|
||||
/// @brief Get the smallest power of two that is greater or equal to x
|
||||
///
|
||||
/// Algorithm from http://bob.allegronetwork.com/prog/tricks.html
|
||||
|
|
Loading…
Reference in a new issue