Selectable thread priority for Auto4/Lua

Originally committed to SVN as r754.
This commit is contained in:
Niels Martin Hansen 2007-01-10 02:51:11 +00:00
parent c0b3721a7f
commit 34e0ef4145
3 changed files with 15 additions and 2 deletions

View file

@ -39,6 +39,7 @@
#include "ass_file.h"
#include "ass_override.h"
#include "text_file_reader.h"
#include "options.h"
#include "../lua51/src/lualib.h"
#include "../lua51/src/lauxlib.h"
#include <wx/msgdlg.h>
@ -413,7 +414,13 @@ namespace Automation4 {
, nargs(_nargs)
, nresults(_nresults)
{
int prio = Options.AsInt(_T("Automation Thread Priority"));
if (prio == 0) prio = 50; // normal
else if (prio == 1) prio = 30; // below normal
else if (prio == 2) prio = 10; // lowest
else prio = 50; // fallback normal
Create();
SetPriority(prio);
Run();
}

View file

@ -554,11 +554,16 @@ DialogOptions::DialogOptions(wxWindow *parent)
Bind(control,_T("Automation Autoload Path"));
autoSizer2->Add(control,1,wxEXPAND);
autoSizer2->Add(new wxStaticText(autoPage,-1,_("Trace level: ")),0,wxALIGN_CENTER_VERTICAL | wxRIGHT,10);
wxString choices[6] = { _("0: Fatal"), _("1: Error"), _("2: Warning"), _("3: Hint"), _("4: Debug"), _("5: Trace") };
control = new wxComboBox(autoPage,-1,_T(""),wxDefaultPosition,wxDefaultSize,6,choices,wxCB_READONLY | wxCB_DROPDOWN);
wxString trace_choices[6] = { _("0: Fatal"), _("1: Error"), _("2: Warning"), _("3: Hint"), _("4: Debug"), _("5: Trace") };
control = new wxComboBox(autoPage,-1,_T(""),wxDefaultPosition,wxDefaultSize,6,trace_choices,wxCB_READONLY | wxCB_DROPDOWN);
Bind(control,_T("Automation Trace Level"));
autoSizer2->Add(control,1,wxEXPAND);
autoSizer2->AddGrowableCol(1,1);
autoSizer2->Add(new wxStaticText(autoPage,-1,_("Thread priority: ")),0,wxALIGN_CENTER_VERTICAL | wxRIGHT,10);
wxString prio_choices[3] = { _("Normal"), _("Below Normal (recommended)"), _("Lowest") };
control = new wxComboBox(autoPage,-1,_T(""),wxDefaultPosition,wxDefaultSize,3,prio_choices,wxCB_READONLY|wxCB_DROPDOWN);
Bind(control, _T("Automation Thread Priority"));
autoSizer2->Add(control, 1, wxEXPAND);
// Sizers
autoSizer1->Add(autoSizer2,1,wxEXPAND | wxALL,5);

View file

@ -167,6 +167,7 @@ void OptionsManager::LoadDefaults() {
SetText(_T("Automation Include Path"), AegisubApp::folderName + _T("automation/include/"));
SetText(_T("Automation Autoload Path"), AegisubApp::folderName + _T("automation/autoload/"));
SetInt(_T("Automation Trace Level"), 3);
SetInt(_T("Automation Thread Priority"), 1); // "below normal"
// Generate colors
wxColour tempCol = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);