Ejemplo n.º 1
0
void InstConsoleWindow::OnImgurClicked(wxCommandEvent& event)
{
	// Find the newest screenshot.
	wxDir screnshotDir(m_inst->GetScreenshotsDir().GetFullPath());
	if (!screnshotDir.IsOpened())
	{
		wxLogError(_("Failed to open screenshot folder."));
		return;
	}

	wxDateTime newestModTime(1, wxDateTime::Jan, 0); // Set this to 'zero'
	wxString newestFile;
	wxString currentFile;
	if (screnshotDir.GetFirst(&currentFile, "*.png"))
	{
		do
		{
			wxFileName cFileName(screnshotDir.GetName(), currentFile);
			wxDateTime currentModTime = cFileName.GetModificationTime();

			if (currentModTime > newestModTime)
			{
				newestModTime = currentModTime;
				newestFile = Path::Combine(screnshotDir.GetName(), currentFile);
			}
		} while (screnshotDir.GetNext(&currentFile));
	}

	if (newestFile == wxEmptyString || !wxFileExists(newestFile))
	{
		wxMessageBox(_("No screenshots found. You must press F2 in-game to take a screenshot first."),
			_("No screenshots to upload"), wxOK | wxCENTER, this);
		return;
	}


	ImgurTask* task = new ImgurTask(newestFile);
	TaskProgressDialog tDlg(this);

	if (tDlg.ShowModal(task))
	{
		wxTextEntryDialog urlDialog(this, _("Your screenshot has been"
			" sent to the URL shown below."), _("Success"), task->GetImageURL(),
			wxOK | wxCENTER);
		urlDialog.ShowModal();
	}
	else
	{
		wxMessageBox(wxString::Format(_("Failed to upload the image.\n%s"),
			task->GetErrorMsg().c_str()), _("Error"), wxOK | wxCENTER, this);
	}
}
void CPrintFooterDataDlg::OnFooterRevnoBtn() 
{
    CChangeCaptionDlg tDlg(this);
    tDlg.m_strCaption = m_strRevNoCap;
    if(tDlg.DoModal() == IDOK)
    {
        m_strRevNoCap = tDlg.m_strCaption;
    }

    CWnd* pWnd = GetDlgItem(IDC_FOOTER_REVNO_BTN);
    if(pWnd)
    {
        pWnd->SetWindowText(m_strRevNoCap);
    }
}
void CPrintFooterDataDlg::OnFooterChdescrBtn() 
{
    CChangeCaptionDlg tDlg(this);
    tDlg.m_strCaption = m_strChangeDescCap;
    if(tDlg.DoModal() == IDOK)
    {
        m_strChangeDescCap = tDlg.m_strCaption;
    }

    CWnd* pWnd = GetDlgItem(IDC_FOOTER_CHDESCR_BTN);
    if(pWnd)
    {
        pWnd->SetWindowText(m_strChangeDescCap);
    }
}
Ejemplo n.º 4
0
void CColorBar::OnChangeback()
{
    // TODO: Add your control notification handler code here
    CColorDialog    tDlg(m_BackColor);

    if ( tDlg.DoModal() != IDOK ) {
        return;
    }

    // m_ColorChanged = 1;

    m_BackColor = tDlg.GetColor();

    RedrawWindow();

}
/**
 * ShowProjectWizardDialog
 *
 */
HRESULT CAAddOnObject::ShowProjectWizardDialog(CBaseProjectData* pProjectData)
{
    HRESULT hr;

    CProjectWizardDialog        tDlg(pProjectData);

    if (tDlg.DoModal () != ID_WIZFINISH)
    {
        return (S_FALSE);
    }

    hr = pProjectData->CreateProjectFiles ();
    if (FAILED (hr))
    {
        delete pProjectData;
    }
    return (hr);
}
Ejemplo n.º 6
0
void CPhyloGenDialog::OnPhyloimport()
{
	// TODO: Add your control notification handler code here
	static char Filter[] = "Tree Files (*.ph)|*.ph|All Files (*.*)|*.*||";


	CFileDialog tDlg( TRUE, NULL, NULL, 
		OFN_HIDEREADONLY, 
		Filter, NULL
	);

	if ( tDlg.DoModal() != IDOK ) {
		return;
	}

	GetParseFile ( tDlg.GetPathName() );

	UpdateData(FALSE);

}
Ejemplo n.º 7
0
void CPhyloGenDialog::OnPhyloexport()
{
	// TODO: Add your control notification handler code here
	static char Filter[] = "Phylogen Files (*.ph|*.ph|All Files (*.*)|*.*||";

	CFileDialog tDlg( FALSE, NULL, NULL, 
		OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, 
		Filter, NULL
	);
	
	if ( tDlg.DoModal() != IDOK ) {
		return;
	}
	
	// Start, Open the file
	// CFile
TRY {

	CStdioFile wFile ( tDlg.GetPathName(), CFile::modeWrite | CFile::typeText | CFile::modeCreate );

	wFile.WriteString( m_ParseString );
	
	wFile.Close();
} 
CATCH (CFileException, e ) {
    if( e->m_cause == CFileException::fileNotFound )
		AfxMessageBox( "File Not Found Error" );
	else
		AfxMessageBox( "File Error" );

	return;
}
AND_CATCH (CMemoryException, e ) {
	AfxMessageBox( "Memory Exception" );
	return;
}
Ejemplo n.º 8
0
void CExportDlg::OnExport() 
{
	// TODO: Add your control notification handler code here

	int Selected = 0;
	int *SelArray = NULL;

	UpdateData();

	if ( m_SelAllSeq ) {

		int SelCount = m_listSequence.GetSelCount();
		
		if ( SelCount == 0 || SelCount == LB_ERR ) return;
				   
		CGSFiller *pGSFiller = pDoc->pGSFiller;
		// Put the data rows on the list

		if ( pGSFiller == NULL ) return;

		SelArray = new int[SelCount];
		
		m_listSequence.GetSelItems( SelCount, SelArray );

		POSITION tPos = pGSFiller->SegDataList.GetHeadPosition();
		while (tPos != NULL ) {

			CGeneSegment *tCGSeg = (CGeneSegment *)pGSFiller->SegDataList.GetNext(tPos);
			tCGSeg->SetExportFlag(0);

		}

		for ( int i=SelCount-1; i >=0; --i ) {

			int SeqSel = SelArray[i];
			
			CGSFiller *pGSFiller = pDoc->pGSFiller;
			// Put the data rows on the list

			POSITION tPos = pGSFiller->SegDataList.FindIndex (SeqSel + 2);

			CGeneSegment *tCGSeg = (CGeneSegment *)pGSFiller->SegDataList.GetAt (tPos);

			tCGSeg->SetExportFlag(1);

		}

		Selected = TRUE;
	}
	
	CString PathName;
	//	static char Filter[] = 
//		"Phylip (*.phy)|*.phy|Clustal (*.aln)|*.aln|PIR (*.pir)|*.pir|Fasta (Pearson)(*.aa)|*.aa||";

    if ( m_Device == 0 ) {
		CString possName = pDoc->GetTitle().SpanExcluding(".");
		CFileDialog tDlg( FALSE, NULL, possName, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, NULL, NULL );
		
		if ( tDlg.DoModal() != IDOK ) {
			return;
		}
		PathName = tDlg.GetPathName();

		if ( m_ExportType == 0  ) {
			if ( tDlg.GetFileExt() == "" ) PathName += ".aa";
		} else if ( m_ExportType == 1  ) {
			if ( tDlg.GetFileExt() == "" ) PathName += ".aln";
		} else if ( m_ExportType == 2  ) {
			if ( tDlg.GetFileExt() == "" ) PathName += ".phy";
		} else if ( m_ExportType == 3  ) {
			if ( tDlg.GetFileExt() == "" ) PathName += ".pir";
		} else if ( m_ExportType == 4  ) {
			if ( tDlg.GetFileExt() == "" ) PathName += ".txt";
		} else if ( m_ExportType == 5  ) {
			if ( tDlg.GetFileExt() == "" ) PathName += ".txt";
		}

	} else {

		GetTempFileName(PathName);
	}
	
	
	BeginWaitCursor();
	                                     
	// OPENFILENAME
	
	if ( m_ExportType == 0  ) {
		pDoc->WriteFastaFile ( PathName, Selected );
	} else if ( m_ExportType == 1  ) {
		pDoc->WriteALNFile ( PathName, Selected );
	} else if ( m_ExportType == 2  ) {
		pDoc->WritePhylipFile ( PathName, Selected );
	} else if ( m_ExportType == 3  ) {
		pDoc->WritePIRFile ( PathName, Selected );
	} else if ( m_ExportType == 4  ) {
		pDoc->WriteTextFile ( PathName, Selected );
	} else if ( m_ExportType == 5  ) {
		pDoc->WriteTNoGapFile ( PathName, Selected );
	} else if ( m_ExportType == 6  ) {
		pDoc->WriteFasNTFile ( PathName, Selected );
	}
	
    if ( m_Device != 0 ) {
		if ( !OpenClipboard() ) {
			AfxMessageBox("Cannot Open Clipboard", MB_OK | MB_ICONEXCLAMATION);
			return;
		}
		
		
		if ( !EmptyClipboard() ) {
			AfxMessageBox("Cannot Empty Clipboard", MB_OK | MB_ICONEXCLAMATION);
			return;
		}


		HANDLE hText;

		DWORD dwCount = 0;
		char *pText;
		

TRY {

		CFile oFile( (const char *)PathName, CFile::modeRead | CFile::typeBinary );
		dwCount = oFile.GetLength();


		hText = GlobalAlloc( GMEM_FLAG, dwCount + 1 );
		if ( hText == NULL ) {
			pDoc->EndWaitCursor(); // Let em know
			AfxMessageBox("GlobalAlloc Fails");
			return;
		}
		
		pText = (char *)GlobalLock ( hText );
		if ( pText == NULL ) {
			pDoc->EndWaitCursor(); // Let em know
			AfxMessageBox("GlobalLock Fails");
			GlobalFree(hText);
			return;
		}
		

		oFile.Read( pText, dwCount );

		GlobalUnlock( hText );

		oFile.Close();
		
		CFile::Remove((const char *)PathName);

		if ( SetClipboardData ( CF_TEXT, hText ) == NULL ) {
			AfxMessageBox( "SetClipboardData Fails" );
		}
		
		if ( !CloseClipboard() ) {
			AfxMessageBox( "CloseClipboard Failed", MB_OK | MB_ICONEXCLAMATION );
		}

} 
CATCH (CFileException, e ) {
	if( e->m_cause == CFileException::fileNotFound )
		AfxMessageBox( "File Not Found Error" );
	else
		AfxMessageBox( "File Error" );

	GlobalUnlock( hText );
	return;
}
END_CATCH

	}
	EndWaitCursor(); // Let em know

	if ( m_SelAllSeq ) {
		m_listSequence.SelItemRange(FALSE, 0, m_listSequence.GetCount()-1 );

		if ( SelArray != NULL ) delete SelArray;
	}

    m_listSequence.Invalidate();
	
	return;
	
}
/**
 * OnPouProtection
 *
 */
HRESULT CAAddOnObject::OnPouProtection(CATargetData* pTargetData, 
									   const CString& crstrFileName, 
									   const CString& crstrIdPath, 
									   ICEProjInfo* pICEProjInfo, 
									   const CString& crstrAddInfo)
{
    HRESULT hr = S_OK;
    ASSERT(pICEProjInfo);

    // first load file
    CComBSTR    sProjectPath;
    hr = pICEProjInfo->getProjectPath(&sProjectPath);
    if (hr != S_OK)
    {
        CString strMessage;
        strMessage.LoadString(IDS_INTERNAL_ERROR);
        strMessage += _T(": OnPouProtection1");
        ::AfxMessageBox(strMessage, MB_OK|MB_ICONERROR);
        return hr;
    }

    // open 4gh file
    CGHFile     tGHFile;
    CString     strGHFileName;

    strGHFileName.Format("%s\\Project.4gh", (CString)sProjectPath);

    tGHFile.SetFileName(strGHFileName);

    if(!tGHFile.Read())
    {
        ::AfxMessageBox(IDS_4GHFILE_READ_ERR);
        return E_FAIL;
    }

    // password dialog
    CString strGHPassword = tGHFile.GetPassword();
    CEnterPasswordDlg   tEnterPWDlg(strGHPassword);
    if(tEnterPWDlg.DoModal() != IDOK)
    {
        tGHFile.SetPassword(tEnterPWDlg.m_strPassword);
        if(tEnterPWDlg.m_bPasswdChanged)
        {
            tGHFile.Write();
        }
        return E_FAIL;
    }

    tGHFile.SetPassword(tEnterPWDlg.m_strPassword);
    if(tEnterPWDlg.m_bPasswdChanged)
    {
        tGHFile.Write();
    }

    // check project guid
    CComBSTR    sSection(_T("ATTRIBUTES"));
    CComBSTR    sKey(_T("GUID"));
    CComBSTR    sValue;
    pICEProjInfo->CPGetValueForKeyFromSection(sSection, sKey, &sValue);

    CString     strProjectGuid(sValue);
    // remove ""
    strProjectGuid = strProjectGuid.Mid(1);
    strProjectGuid = strProjectGuid.Left(strProjectGuid.GetLength()-1);

    if(strProjectGuid.Compare(tGHFile.GetProjectGuid()) != 0)
    {
        ::AfxMessageBox(IDS_4GHFILE_PROJCONFILCT);
        return E_FAIL;
    }

    // user is authorized to get pou protection dialog
    CPouProtectionDlg   tDlg(&tGHFile, pICEProjInfo);
    if(tDlg.DoModal() != IDOK)
    {
        return S_FALSE;
    }

    return hr;
}
Ejemplo n.º 10
0
void InstConsoleWindow::OnGenReportClicked(wxCommandEvent& event)
{
	wxString crashReportString = GetCrashReport();

	const int id_pastebin = 1;
	const int id_file = 2;
	const int id_clipboard = 3;

	AdvancedMsgDialog::ButtonDefList btns;
	btns.push_back(AdvancedMsgDialog::ButtonDef(_("Send to Pastebin"), id_pastebin));
	btns.push_back(AdvancedMsgDialog::ButtonDef(_("Save to File"), id_file));
	btns.push_back(AdvancedMsgDialog::ButtonDef(_("Copy to Clipboard"), id_clipboard));
	btns.push_back(AdvancedMsgDialog::ButtonDef(_("&Cancel"), wxID_CANCEL));

	AdvancedMsgDialog msgDlg(this, _("A crash report has been generated. "
		"What would you like to do with it?"), btns, _("Crash Report"));


	crashReportIsOpen = true;
	msgDlg.CenterOnParent();
	int response = msgDlg.ShowModal();
	if (response == id_pastebin) // Pastebin
	{
		PastebinTask *task = new PastebinTask(crashReportString);
		TaskProgressDialog tDlg(this);
		if (tDlg.ShowModal(task))
		{
			wxTextEntryDialog urlDialog(this, _("Your error report has been"
				" sent to the URL listed below."), _("Success"), task->GetPasteURL(),
				wxOK | wxCENTER);
			urlDialog.ShowModal();
		}
		else
		{
			wxMessageBox(_("Failed to send the crash report to pastebin. "
				"Please check your internet connection."), _("Error"));
		}
		delete task;
	}
	else if (response == id_file) // Save to file
	{
		wxFileDialog saveReportDlg(this, _("Save Crash Report"), wxGetCwd(), 
			wxDateTime::Now().Format("MultiMC_Report_%m-%d-%Y_%H-%M-%S.txt"), 
			"*.txt", wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
		if (saveReportDlg.ShowModal() != wxID_CANCEL)
		{
			wxFFileOutputStream outStream(saveReportDlg.GetFilename());
			wxStringInputStream inStream(crashReportString);
			outStream.Write(inStream);
		}
	}
	else if (response == id_clipboard)
	{
		if (wxTheClipboard->Open())
		{
			wxTheClipboard->SetData(new wxTextDataObject(crashReportString));
			wxTheClipboard->Close();
		}
	}
	crashReportIsOpen = false;
}