-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathluamanager.cpp
62 lines (50 loc) · 1.61 KB
/
luamanager.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/////////////////////////////////////////////////////////////////////////////////
// Author: Steven Lamerton
// Copyright: Copyright (C) 2009 - 2010 Steven Lamerton
// License: GNU GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
/////////////////////////////////////////////////////////////////////////////////
#include <wx/gauge.h>
#include <wx/button.h>
#include <wx/bmpbuttn.h>
#include <wx/listctrl.h>
#include "toucan.h"
#include "luathread.h"
#include "luamanager.h"
#include "basicfunctions.h"
#include "forms/frmmain.h"
#include "forms/frmprogress.h"
#ifdef __WXMSW__
#include <windows.h>
#include <wx/msw/winundef.h>
#endif
LuaManager::LuaManager(){
m_Window = NULL;
}
void LuaManager::Run(const wxString &line, const bool showprogress){
wxGetApp().SetAbort(false);
//If we are in gui mode then reset as new runs should prompt again
//otherwise do not clear as the password is set from the commandline
if(wxGetApp().IsGui()){
//We initially set the password to blank
wxGetApp().m_Password = "";
}
if(line == wxEmptyString)
return;
LuaThread *thread = new LuaThread(line);
thread->Create();
thread->Run();
if(wxGetApp().IsGui()){
m_Window = new frmProgress(wxGetApp().MainWindow, wxID_ANY, _("Progress"));
#if defined(__WXMSW__) && !defined(__MINGW32__)
m_Window->SetTaskbar(wxGetApp().MainWindow->m_Taskbar);
#endif
if(!showprogress){
m_Window->m_Gauge->Show(false);
m_Window->SetSize(m_Window->GetSize() + wxSize(1, 1));
}
m_Window->ShowModal();
}
}
frmProgress* LuaManager::GetProgressWindow(){
return m_Window;
}