|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "casmsubmitpage.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tfilepath.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tconvert.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tsystem.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "tw/mainshell.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tw/textfield.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tw/label.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tw/optionmenu.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tw/button.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tw/checkbox.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "filebrowserpopup.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "casmconfigpanel.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "casmfileinfo.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tfarmcontroller.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "application.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "util.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "tw/message.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//==============================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class CasmSubmitPage::Data
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
Data(CasmSubmitPage *cspage);
|
|
Toshihiro Shimizu |
890ddd |
~Data()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
delete m_casmTask;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void configureNotify(const TDimension &size);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void browseCasmFiles();
|
|
Toshihiro Shimizu |
890ddd |
void submit();
|
|
Toshihiro Shimizu |
890ddd |
void loadCasm(const TFilePath &fp);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
CasmSubmitPage *m_cspage;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TLabel *m_taskNameLabel;
|
|
Toshihiro Shimizu |
890ddd |
TTextField *m_taskNameTextField;
|
|
Toshihiro Shimizu |
890ddd |
TCheckBox *m_submitAsSuspended;
|
|
Toshihiro Shimizu |
890ddd |
TButton *m_submit;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TLabel *m_filepathLabel;
|
|
Toshihiro Shimizu |
890ddd |
TTextField *m_filepathTextField;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TButton *m_casmBrowseBtn;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
CasmConfigPanel *m_configPanel;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
CasmTask *m_casmTask;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
CasmSubmitPage::Data::Data(CasmSubmitPage *cspage)
|
|
Toshihiro Shimizu |
890ddd |
: m_cspage(cspage), m_casmTask(0)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_taskNameLabel = new TLabel(cspage);
|
|
Toshihiro Shimizu |
890ddd |
m_taskNameLabel->setText("Task Name:");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_submitAsSuspended = new TCheckBox(cspage, "Submit as Suspended");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_taskNameTextField = new TTextField(cspage);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_filepathLabel = new TLabel(cspage);
|
|
Toshihiro Shimizu |
890ddd |
m_filepathLabel->setText("File Path:");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_filepathTextField = new TTextField(cspage);
|
|
Toshihiro Shimizu |
890ddd |
m_casmBrowseBtn = new TButton(cspage);
|
|
Toshihiro Shimizu |
890ddd |
m_casmBrowseBtn->setTitle("...");
|
|
Toshihiro Shimizu |
890ddd |
tconnect(*m_casmBrowseBtn, this, &CasmSubmitPage::Data::browseCasmFiles);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_submit = new TButton(cspage);
|
|
Toshihiro Shimizu |
890ddd |
m_submit->setTitle("Submit");
|
|
Toshihiro Shimizu |
890ddd |
tconnect(*m_submit, this, &CasmSubmitPage::Data::submit);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_configPanel = new CasmConfigPanel(cspage);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void CasmSubmitPage::Data::configureNotify(const TDimension &size)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
int x0 = 20;
|
|
Toshihiro Shimizu |
890ddd |
int y = size.ly - 1 - 10;
|
|
Toshihiro Shimizu |
890ddd |
int x = x0;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_taskNameLabel->setGeometry(x, y - 15, x + 100, y);
|
|
Toshihiro Shimizu |
890ddd |
m_taskNameTextField->setGeometry(x + 104, y - 15, x + 250, y);
|
|
Toshihiro Shimizu |
890ddd |
x += 280;
|
|
Toshihiro Shimizu |
890ddd |
m_submitAsSuspended->setGeometry(x, y - 15, x + 120, y);
|
|
Toshihiro Shimizu |
890ddd |
x += 150;
|
|
Toshihiro Shimizu |
890ddd |
m_submit->setGeometry(x, y - 15, x + 80, y);
|
|
Toshihiro Shimizu |
890ddd |
x = x0;
|
|
Toshihiro Shimizu |
890ddd |
y -= 40;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_filepathLabel->setGeometry(x, y - 15, x + 100, y);
|
|
Toshihiro Shimizu |
890ddd |
m_filepathTextField->setGeometry(x + 104, y - 15, x + 650, y);
|
|
Toshihiro Shimizu |
890ddd |
m_casmBrowseBtn->setGeometry(x + 660, y - 15, x + 680, y);
|
|
Toshihiro Shimizu |
890ddd |
x = x0;
|
|
Toshihiro Shimizu |
890ddd |
y -= 40;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_configPanel->setGeometry(0, 0, size.lx - 1, y);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void CasmSubmitPage::Data::browseCasmFiles()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
static FileBrowserPopup *popup = 0;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (!popup) {
|
|
Toshihiro Shimizu |
890ddd |
vector<string> fileTypes;</string>
|
|
Toshihiro Shimizu |
890ddd |
fileTypes.push_back("casm");
|
|
Toshihiro Shimizu |
890ddd |
popup = new FileBrowserPopup(m_cspage, fileTypes);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
popup->setOkAction(
|
|
Toshihiro Shimizu |
890ddd |
new TFileBrowserPopupAction<casmsubmitpage::data>(this, &CasmSubmitPage::Data::loadCasm));</casmsubmitpage::data>
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (!popup)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFilePath fp = Application::instance()->getCurrentFolder();
|
|
Toshihiro Shimizu |
890ddd |
if (fp != TFilePath())
|
|
Toshihiro Shimizu |
890ddd |
popup->setCurrentDir(fp);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TDimension d = TMainshell::getMainshell()->getSize();
|
|
Toshihiro Shimizu |
890ddd |
#ifdef WIN32
|
|
Toshihiro Shimizu |
890ddd |
HDC hdc = GetDC(0);
|
|
Toshihiro Shimizu |
890ddd |
d.lx = GetDeviceCaps(hdc, HORZRES);
|
|
Toshihiro Shimizu |
890ddd |
d.ly = GetDeviceCaps(hdc, VERTRES);
|
|
Toshihiro Shimizu |
890ddd |
ReleaseDC(0, hdc);
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
d -= popup->getSize();
|
|
Toshihiro Shimizu |
890ddd |
//TDimension d = TMainshell::getMainshell()->getSize() - popup->getSize();
|
|
Toshihiro Shimizu |
890ddd |
popup->popup(TPoint(d.lx / 2, d.ly / 2));
|
|
Toshihiro Shimizu |
890ddd |
popup->setCaption("Load Casm");
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void CasmSubmitPage::Data::submit()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (m_filepathTextField->getText() == toWideString("")) {
|
|
Toshihiro Shimizu |
890ddd |
TMessage::error("You must load a file");
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
CasmTask *casm = m_configPanel->getTask();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFarmController *controller = Application::instance()->getController();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
string nativeCmdLine("runcasm ");
|
|
Toshihiro Shimizu |
890ddd |
nativeCmdLine += casm->m_casmFile;
|
|
Toshihiro Shimizu |
890ddd |
nativeCmdLine += " ";
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (casm->m_setupFile != "") {
|
|
Toshihiro Shimizu |
890ddd |
nativeCmdLine += "-setup ";
|
|
Toshihiro Shimizu |
890ddd |
nativeCmdLine += casm->m_setupFile;
|
|
Toshihiro Shimizu |
890ddd |
nativeCmdLine += " ";
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
nativeCmdLine += casm->getCommandLine();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
string casmName = TFilePath(casm->m_casmFile).getName();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int stepCount = casm->m_end - casm->m_start + 1;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFarmTaskGroup task(
|
|
Toshihiro Shimizu |
890ddd |
casmName, nativeCmdLine, TSystem::getUserName(),
|
|
Toshihiro Shimizu |
890ddd |
TSystem::getHostName(), stepCount);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int ra = casm->m_start;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
for (;;) {
|
|
Toshihiro Shimizu |
890ddd |
CasmTask subcasm(*casm);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
string cmdLine("runcasm ");
|
|
Toshihiro Shimizu |
890ddd |
int rb = tmin(ra + casm->m_taskChunksize - 1, casm->m_end);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
subcasm.m_start = ra;
|
|
Toshihiro Shimizu |
890ddd |
subcasm.m_end = rb;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
cmdLine += subcasm.m_casmFile;
|
|
Toshihiro Shimizu |
890ddd |
cmdLine += " ";
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (subcasm.m_setupFile != "") {
|
|
Toshihiro Shimizu |
890ddd |
cmdLine += "-setup ";
|
|
Toshihiro Shimizu |
890ddd |
cmdLine += subcasm.m_setupFile;
|
|
Toshihiro Shimizu |
890ddd |
cmdLine += " ";
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
cmdLine += subcasm.getCommandLine();
|
|
Toshihiro Shimizu |
890ddd |
cmdLine += " -nowait ";
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
try {
|
|
Toshihiro Shimizu |
890ddd |
string name = casmName + " " + toString(ra) + "-" + toString(rb);
|
|
Toshihiro Shimizu |
890ddd |
stepCount = rb - ra + 1;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
task.addTask(new TFarmTask(
|
|
Toshihiro Shimizu |
890ddd |
name, cmdLine, TSystem::getUserName(), TSystem::getHostName(), stepCount));
|
|
Toshihiro Shimizu |
890ddd |
} catch (TException &e) {
|
|
Toshihiro Shimizu |
890ddd |
TMessage::error(toString(e.getMessage()));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (rb == casm->m_end)
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
ra = rb + 1;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
try {
|
|
Toshihiro Shimizu |
890ddd |
controller->addTask(task, m_submitAsSuspended->isSelected());
|
|
Toshihiro Shimizu |
890ddd |
} catch (TException &e) {
|
|
Toshihiro Shimizu |
890ddd |
TMessage::error(toString(e.getMessage()));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifdef WIN32
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void DisplayStruct(LPNETRESOURCE lpnr)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
string info;
|
|
Toshihiro Shimizu |
890ddd |
if (lpnr->lpLocalName) {
|
|
Toshihiro Shimizu |
890ddd |
info += lpnr->lpLocalName;
|
|
Toshihiro Shimizu |
890ddd |
info += " = ";
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
info += lpnr->lpRemoteName;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
MessageBox(NULL, info.c_str(), "Connection info", 0);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
BOOL WINAPI EnumerateFunc(LPNETRESOURCE lpnr)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
DWORD dwResult, dwResultEnum;
|
|
Toshihiro Shimizu |
890ddd |
HANDLE hEnum;
|
|
Toshihiro Shimizu |
890ddd |
DWORD cbBuffer = 16384; // 16K is a good size
|
|
Toshihiro Shimizu |
890ddd |
DWORD cEntries = -1; // enumerate all possible entries
|
|
Toshihiro Shimizu |
890ddd |
LPNETRESOURCE lpnrLocal; // pointer to enumerated structures
|
|
Toshihiro Shimizu |
890ddd |
DWORD i;
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// Call the WNetOpenEnum function to begin the enumeration.
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
dwResult = WNetOpenEnum(RESOURCE_CONNECTED /*RESOURCE_GLOBALNET*/, // all network resources
|
|
Toshihiro Shimizu |
890ddd |
RESOURCETYPE_ANY, // all resources
|
|
Toshihiro Shimizu |
890ddd |
0, // enumerate all resources
|
|
Toshihiro Shimizu |
890ddd |
lpnr, // NULL first time the function is called
|
|
Toshihiro Shimizu |
890ddd |
&hEnum); // handle to the resource
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (dwResult != NO_ERROR) {
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// Process errors with an application-defined error handler.
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
//NetErrorHandler(hwnd, dwResult, (LPSTR)"WNetOpenEnum");
|
|
Toshihiro Shimizu |
890ddd |
return FALSE;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// Call the GlobalAlloc function to allocate resources.
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
lpnrLocal = (LPNETRESOURCE)GlobalAlloc(GPTR, cbBuffer);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
do {
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// Initialize the buffer.
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
ZeroMemory(lpnrLocal, cbBuffer);
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// Call the WNetEnumResource function to continue
|
|
Toshihiro Shimizu |
890ddd |
// the enumeration.
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
dwResultEnum = WNetEnumResource(hEnum, // resource handle
|
|
Toshihiro Shimizu |
890ddd |
&cEntries, // defined locally as -1
|
|
Toshihiro Shimizu |
890ddd |
lpnrLocal, // LPNETRESOURCE
|
|
Toshihiro Shimizu |
890ddd |
&cbBuffer); // buffer size
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// If the call succeeds, loop through the structures.
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
if (dwResultEnum == NO_ERROR) {
|
|
Toshihiro Shimizu |
890ddd |
for (i = 0; i < cEntries; i++) {
|
|
Toshihiro Shimizu |
890ddd |
// Call an application-defined function to
|
|
Toshihiro Shimizu |
890ddd |
// display the contents of the NETRESOURCE structures.
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
DisplayStruct(&lpnrLocal[i]);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// If the NETRESOURCE structure represents a container resource,
|
|
Toshihiro Shimizu |
890ddd |
// call the EnumerateFunc function recursively.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (RESOURCEUSAGE_CONTAINER == (lpnrLocal[i].dwUsage & RESOURCEUSAGE_CONTAINER))
|
|
Toshihiro Shimizu |
890ddd |
if (!EnumerateFunc(&lpnrLocal[i]))
|
|
Toshihiro Shimizu |
890ddd |
return FALSE;
|
|
Toshihiro Shimizu |
890ddd |
//TextOut(hdc, 10, 10, "EnumerateFunc returned FALSE.", 29);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
// Process errors.
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
else if (dwResultEnum != ERROR_NO_MORE_ITEMS) {
|
|
Toshihiro Shimizu |
890ddd |
//NetErrorHandler(hwnd, dwResultEnum, (LPSTR)"WNetEnumResource");
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// End do.
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
while (dwResultEnum != ERROR_NO_MORE_ITEMS);
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// Call the GlobalFree function to free the memory.
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
GlobalFree((HGLOBAL)lpnrLocal);
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// Call WNetCloseEnum to end the enumeration.
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
dwResult = WNetCloseEnum(hEnum);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (dwResult != NO_ERROR) {
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// Process errors.
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
//NetErrorHandler(hwnd, dwResult, (LPSTR)"WNetCloseEnum");
|
|
Toshihiro Shimizu |
890ddd |
return FALSE;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
return TRUE;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void CasmSubmitPage::Data::loadCasm(const TFilePath &fp)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (!TFileStatus(fp).doesExist()) {
|
|
Toshihiro Shimizu |
890ddd |
string msg = toString(fp.getWideString()) + "\n";
|
|
Toshihiro Shimizu |
890ddd |
msg += "File not found\n";
|
|
Toshihiro Shimizu |
890ddd |
msg += "Please verify that the path and file name are correct";
|
|
Toshihiro Shimizu |
890ddd |
m_filepathTextField->setText("");
|
|
Toshihiro Shimizu |
890ddd |
TMessage::error(msg);
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Application::instance()->setCurrentFolder(fp.getParentDir());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
string uncString = convertToUncString(fp);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_filepathTextField->setText(uncString);
|
|
Toshihiro Shimizu |
890ddd |
m_taskNameTextField->setText(TFilePath(uncString).getName());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifdef WIN32
|
|
Toshihiro Shimizu |
890ddd |
int x = uncString.find("\\", 2);
|
|
Toshihiro Shimizu |
890ddd |
while (x != string::npos) {
|
|
Toshihiro Shimizu |
890ddd |
uncString.replace(x, 1, "/", 0, 1);
|
|
Toshihiro Shimizu |
890ddd |
x = uncString.find("\\", x + 1);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFilePath uncFilePath = TFilePath(uncString);
|
|
Toshihiro Shimizu |
890ddd |
CasmFileInfo casmFileInfo(uncFilePath);
|
|
Toshihiro Shimizu |
890ddd |
int start, end;
|
|
Toshihiro Shimizu |
890ddd |
bool interlaced;
|
|
Toshihiro Shimizu |
890ddd |
casmFileInfo.getFrameRange(start, end, interlaced);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (m_casmTask)
|
|
Toshihiro Shimizu |
890ddd |
delete m_casmTask;
|
|
Toshihiro Shimizu |
890ddd |
m_casmTask = new CasmTask;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_casmTask->m_casmFile = uncString;
|
|
Toshihiro Shimizu |
890ddd |
m_casmTask->m_start = start;
|
|
Toshihiro Shimizu |
890ddd |
m_casmTask->m_end = end;
|
|
Toshihiro Shimizu |
890ddd |
m_casmTask->m_step = 1;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_configPanel->setTask(m_casmTask);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//==============================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
CasmSubmitPage::CasmSubmitPage(TWidget *parent)
|
|
Toshihiro Shimizu |
890ddd |
: TabPage(parent, "SubmitCasm")
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_data = new CasmSubmitPage::Data(this);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
CasmSubmitPage::~CasmSubmitPage()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void CasmSubmitPage::configureNotify(const TDimension &size)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_data->configureNotify(size);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void CasmSubmitPage::onActivate()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void CasmSubmitPage::onDeactivate()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|