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