LRESULT CFoldView::DoneFolding(WPARAM wParam, LPARAM lParam) { CDialog* finished; //CMainFrame* frame = (CMainFrame*) Parent; if (m_save) delete foldobject.savefile; if (!subfold) { //offer to display the predicted structures if this is not subfolding finished = new CDialog(IDD_FINISHED,this); if(finished->DoModal()==IDOK) ((CRNAstructureApp*) GetFoldDocument()->pMainFrame)->Draw(m_ctname.GetBuffer(10)); delete finished; } progress->SendMessage (WM_CLOSE); GetFoldDocument()->Frame->SendMessage(WM_CLOSE); return 0; }
void CUITestDialog::OnBnClickedButtonHtmlDialogTest() { // TODO: 在此添加控件通知处理程序代码 // CWindowFactory::Instance()->ShowWindow( WndWebpage, this->GetWindowId() ); CDialog *pDlg = CWindowFactory::Instance()->NewDlg( WndWebpage ); pDlg->DoModal(); }
void CUITestDialog::OnBnClickedButtonControlTest() { // TODO: 在此添加控件通知处理程序代码 // CControlTestDialog dlg; // dlg.DoModal(); CDialog *pDlg = CWindowFactory::Instance()->NewDlg( WndUnittestCtrl ); pDlg->DoModal(); }
void CUITestDialog::OnBnClickedButtonLoginDialogTest() { // TODO: 在此添加控件通知处理程序代码 // CWindowFactory::Instance()->ShowWindow( WndLogin, this->GetWindowId() ); // return ; CDialog *pDlg = CWindowFactory::Instance()->NewDlg( WndLogin ); pDlg->DoModal(); }
void CUITestDialog::OnBnClickedButtonPlayerDlgNoPtz() { // TODO: 在此添加控件通知处理程序代码 // CPlayerDialog dlg; CMCUSession::Instance()->CurVideoSession()->PtzControl( FALSE ); // dlg.DoModal(); // CWindowFactory::Instance()->ShowWindow( WndPlayer, this->GetWindowId() ); CDialog *pDlg = CWindowFactory::Instance()->NewDlg( WndPlayer ); pDlg->DoModal(); }
void CUITestDialog::OnBnClickedButtonPlayerDlgTest() { // TODO: 在此添加控件通知处理程序代码 // CPlayerDialog dlg; CMCUSession::Instance()->CurVideoSession()->PtzControl( TRUE ); // dlg.DoModal(); // CWindowFactory::Instance()->ShowWindow( WndPlayer, WndUnittestUI ); CDialog *pDlg = CWindowFactory::Instance()->NewDlg( WndPlayer ); pDlg->DoModal(); }
//This function is called by the backend thread LRESULT CMEADialog::DoneFolding(WPARAM wParam, LPARAM lParam) { CDialog* finished; //offer to display the predicted structures if this is not subfolding finished = new CDialog(IDD_FINISHED,this); if(finished->DoModal()==IDOK) ((CRNAstructureApp*) GetFoldDocument()->pMainFrame)->Draw(m_CT.GetBuffer(10)); delete finished; progress->SendMessage (WM_CLOSE); GetFoldDocument()->Frame->SendMessage(WM_CLOSE); return 0; }
LRESULT CBiFoldView::DoneFolding(WPARAM wParam, LPARAM lParam) { CDialog* finished; finished = new CDialog(IDD_FINISHED,this); if(finished->DoModal()==IDOK) ((CRNAstructureApp*) GetBiFoldDocument()->pMainFrame)->Draw(m_ctname.GetBuffer(10)); delete finished; progress->SendMessage (WM_CLOSE); GetBiFoldDocument()->Frame->SendMessage(WM_CLOSE); return 0; }
LRESULT CCPApplet::OnRun(CWnd* pParentWnd) { LRESULT lResult = 1; CWnd * pWnd; InitCommonControls(); pWnd = (CWnd*) m_uiClass->CreateObject(); if ( pWnd ) { lResult = ERROR_SUCCESS; if ( pWnd->IsKindOf( RUNTIME_CLASS( CPropertySheet ) ) ) { CPropertySheet * pSheet = (CPropertySheet*) pWnd; pSheet->Construct(m_name, pParentWnd, m_pageNumber); pSheet->DoModal(); } else { check( pWnd->IsKindOf( RUNTIME_CLASS( CDialog ) ) ); CDialog * pDialog = (CDialog*) pWnd; pDialog->DoModal(); } delete pWnd; } return lResult; }
void CGenPropertyPage::OnAddItem(CDialog & dlg) { // load dialog with default values InitDialog (&dlg); // display dialog, exit if cancelled if (dlg.DoModal () != IDOK) return; // create the object's lookup name (label converted to lower case, or generated) CObject * pItem; CString strObjectName; strObjectName = GetObjectName (&dlg); if (strObjectName.IsEmpty ()) strObjectName.Format ("*%s%s", // e.g. *trigger100 (LPCTSTR) m_strObjectType, (LPCTSTR) App.GetUniqueString ()); else strObjectName.MakeLower(); // if already there (presumably not possible with un-named objects), // then abort the add if (m_ObjectMap->Lookup (strObjectName, pItem)) { CString strMsg; strMsg = TFormat ("The %s named \"%s\" is already in the %s list", (LPCTSTR) m_strObjectType, (LPCTSTR) GetObjectName (&dlg), (LPCTSTR) m_strObjectType); ::UMessageBox (strMsg); return; } // add new object to map m_ObjectMap->SetAt (strObjectName, pItem = MakeNewObject ()); // unload from dialog into object's properties UnloadDialog (&dlg, pItem); // They can no longer cancel the property sheet, the document has changed CancelToClose (); if (!CheckIfTemporary (pItem)) m_doc->SetModifiedFlag (TRUE); // create a CString for lookup purposes CString * pstrObjectName = new CString (strObjectName); // add this item to the list view add_item (pItem, pstrObjectName, 0, TRUE); SetInternalName (pItem, strObjectName); // set name so we can delete one-shot items // resort the list t_gen_sort_param sort_param (m_ObjectMap, m_last_col, m_reverse, m_CompareObjects); m_ctlList->SortItems (CompareFunc, (LPARAM) &sort_param); // redraw the list if (GetFilterFlag ()) LoadList (); // full reload because it may have changed filter requirements // get dispatch id from the script and put it into the item if (m_doc->m_ScriptEngine) { CString strMessage; SetDispatchID (pItem, m_doc->GetProcedureDispid (GetScriptName (pItem), m_strObjectType, GetLabel (pItem), strMessage)); if (!strMessage.IsEmpty ()) ::UMessageBox (strMessage, MB_ICONINFORMATION); } } // end of CGenPropertyPage::OnAddItem
void CGenPropertyPage::OnChangeItem(CDialog & dlg) { CString strMsg; // iterate through list in case we implement multiple selection one day for (int nItem = -1; (nItem = m_ctlList->GetNextItem(nItem, LVNI_SELECTED)) != -1;) { // get the lower-case name of this item's object CString * pstrObjectName = (CString *) m_ctlList->GetItemData (nItem); ASSERT (pstrObjectName != NULL); CObject * pItem; // check object is still there (it might have gone while we looked at the list box) if (!m_ObjectMap->Lookup (*pstrObjectName, pItem)) { m_ctlList->DeleteItem (nItem); // it's gone, so delete it from the list view m_ctlList->RedrawItems (0, m_ctlList->GetItemCount () - 1); // redraw the list // in the case of one-shot timers, unnamed items might be removed from the list if (pstrObjectName->Left (1) == "*") strMsg = TFormat ("The %s you selected is no longer in the %s list", (LPCTSTR) m_strObjectType, (LPCTSTR) m_strObjectType); else strMsg = TFormat ("The %s named \"%s\" is no longer in the %s list", (LPCTSTR) m_strObjectType, (LPCTSTR) *pstrObjectName, (LPCTSTR) m_strObjectType); ::UMessageBox (strMsg); delete pstrObjectName; // and get rid of its name string continue; } ASSERT_VALID (pItem); ASSERT( pItem->IsKindOf( RUNTIME_CLASS( CObject ) ) ); // load dialog with values from the found item LoadDialog (&dlg, pItem); // put up the dialog, give up if they cancel if (dlg.DoModal () != IDOK) continue; // lookup this object, to make sure it still exists if (!m_ObjectMap->Lookup (*pstrObjectName, pItem)) { m_ctlList->DeleteItem (nItem); // it's gone, so delete it from the list view m_ctlList->RedrawItems (0, m_ctlList->GetItemCount () - 1); // redraw the list // in the case of one-shot timers, unnamed items might be removed from the list if (pstrObjectName->Left (1) == "*") strMsg = TFormat ("The %s you selected is no longer in the %s list", (LPCTSTR) m_strObjectType, (LPCTSTR) m_strObjectType); else strMsg = TFormat ("The %s named \"%s\" is no longer in the %s list", (LPCTSTR) m_strObjectType, (LPCTSTR) *pstrObjectName, (LPCTSTR) m_strObjectType); delete pstrObjectName; // and get rid of its name string ::UMessageBox (strMsg); continue; } ASSERT_VALID (pItem); ASSERT( pItem->IsKindOf( RUNTIME_CLASS( CObject ) ) ); if (CheckIfIncluded (pItem)) { strMsg = TFormat ("The %s named \"%s\" has been included from an include file. You cannot modify it here.", (LPCTSTR) m_strObjectType, (LPCTSTR) *pstrObjectName); ::UMessageBox (strMsg); return; // can't modify included items } // check object still has the same modification number // (it might have been modified while we looked at the list box) if (GetModificationNumber (pItem) != m_nUpdateNumber) { strMsg = TFormat ("The %s named \"%s\" has already been modified by a script subroutine", (LPCTSTR) m_strObjectType, (LPCTSTR) *pstrObjectName); ::UMessageBox (strMsg); continue; } // check for name change CString strObjectName = GetObjectName (&dlg); if (strObjectName.IsEmpty ()) strObjectName.Format ("*%s%s", (LPCTSTR) m_strObjectType, (LPCTSTR) App.GetUniqueString ()); else strObjectName.MakeLower (); if (strObjectName != *pstrObjectName) // has name changed? { // here if label has changed CObject * new_pItem; if (m_ObjectMap->Lookup (strObjectName, new_pItem)) { strMsg = TFormat ("The %s named \"%s\" already exists in the %s list", (LPCTSTR) m_strObjectType, (LPCTSTR) strObjectName, (LPCTSTR) m_strObjectType); ::UMessageBox (strMsg); continue; } // remove old entry and re-add under new name m_ObjectMap->RemoveKey (*pstrObjectName); // remove old entry m_ObjectMap->SetAt (strObjectName, pItem); // insert under new name // delete old name in the list delete pstrObjectName; // create a new CString for lookup purposes pstrObjectName = new CString (strObjectName); // record item's new name as the list object data m_ctlList->SetItemData(nItem, (DWORD) pstrObjectName); } // end of label changing // see if the user changed anything, anyway if (CheckIfChanged (&dlg, pItem)) { // unload from dialog into object's properties UnloadDialog (&dlg, pItem); // They can no longer cancel the property sheet, the document has changed CancelToClose (); if (!CheckIfTemporary (pItem)) m_doc->SetModifiedFlag (TRUE); // re-setup list with amended details int nNewItem = add_item (pItem, pstrObjectName, nItem, FALSE); m_ctlList->RedrawItems (nNewItem, nNewItem); } // end of item changing // Get dispatch id from the script and put it into the item. // We do this even if nothing has changed, so that we can force re-evaluation // of the dispatch ID, by just getting the item and pressing OK. if (m_doc->m_ScriptEngine) { CString strMessage; SetDispatchID (pItem, m_doc->GetProcedureDispid (GetScriptName (pItem), m_strObjectType, GetLabel (pItem), strMessage)); if (!strMessage.IsEmpty ()) ::UMessageBox (strMessage, MB_ICONINFORMATION); } } // end of dealing with each selected item // redraw the list if (GetFilterFlag ()) LoadList (); // full reload because it may have changed filter requirements // resort the list t_gen_sort_param sort_param (m_ObjectMap, m_last_col, m_reverse, m_CompareObjects); m_ctlList->SortItems (CompareFunc, (LPARAM) &sort_param); } // end of CGenPropertyPage::OnChangeItem
void CUITestDialog::OnBnClickedButtonConfigDialogTest() { // CWindowFactory::Instance()->ShowWindow( WndConfig, this->GetWindowId() ); CDialog *pDlg = CWindowFactory::Instance()->NewDlg( WndConfig ); pDlg->DoModal(); }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { Waifu2x::init_liblary(__argc, __argv); // 管理者権限で起動してもファイルのドロップを受け付けるようにする ChangeWindowMessageFilter(WM_DROPFILES, MSGFLT_ADD); ChangeWindowMessageFilter(WM_COPYDATA, MSGFLT_ADD); ChangeWindowMessageFilter(0x0049, MSGFLT_ADD); // Caffeのエラーでないログを保存しないようにする google::SetLogDestination(google::INFO, ""); google::SetLogDestination(google::WARNING, ""); // Caffeのエラーログを「error_log_〜」に出力 google::SetLogDestination(google::ERROR, "error_log_"); google::SetLogDestination(google::FATAL, "error_log_"); // CDialogクラスでダイアログを作成する CDialog cDialog; CDialog cDialog2; // IDC_EDITのサブクラス CControl cControlInput(IDC_EDIT_INPUT); CControl cControlOutput(IDC_EDIT_OUTPUT); CControl cControlScaleRatio(IDC_EDIT_SCALE_RATIO); CControl cControlScaleWidth(IDC_EDIT_SCALE_WIDTH); CControl cControlScaleHeight(IDC_EDIT_SCALE_HEIGHT); CControl cControlScaleWidthHeight(IDC_EDIT_SCALE_WIDTH_HEIGHT); // 登録する関数がまとめられたクラス // グローバル関数を使えばクラスにまとめる必要はないがこの方法が役立つこともあるはず DialogEvent cDialogEvent; // クラスの関数を登録する場合 // IDC_EDITにWM_DROPFILESが送られてきたときに実行する関数の登録 cControlInput.SetEventCallBack(SetClassCustomFunc(DialogEvent::DropInput, &cDialogEvent), NULL, WM_DROPFILES); cControlOutput.SetEventCallBack(SetClassCustomFunc(DialogEvent::DropOutput, &cDialogEvent), NULL, WM_DROPFILES); cControlScaleRatio.SetEventCallBack(SetClassCustomFunc(DialogEvent::TextInput, &cDialogEvent), NULL, WM_CHAR); cControlScaleWidth.SetEventCallBack(SetClassCustomFunc(DialogEvent::TextInput, &cDialogEvent), NULL, WM_CHAR); cControlScaleHeight.SetEventCallBack(SetClassCustomFunc(DialogEvent::TextInput, &cDialogEvent), NULL, WM_CHAR); cControlScaleWidthHeight.SetEventCallBack(SetClassCustomFunc(DialogEvent::TextInput, &cDialogEvent), NULL, WM_CHAR); // コントロールのサブクラスを登録 cDialog.AddControl(&cControlInput); cDialog.AddControl(&cControlOutput); cDialog.AddControl(&cControlScaleRatio); cDialog.AddControl(&cControlScaleWidth); cDialog.AddControl(&cControlScaleHeight); cDialog.AddControl(&cControlScaleWidthHeight); // 各コントロールのイベントで実行する関数の登録 cDialog.SetCommandCallBack(SetClassFunc(DialogEvent::Exec, &cDialogEvent), NULL, IDC_BUTTON_EXEC); cDialog.SetCommandCallBack(SetClassFunc(DialogEvent::Cancel, &cDialogEvent), NULL, IDC_BUTTON_CANCEL); cDialog.SetCommandCallBack(SetClassFunc(DialogEvent::InputRef, &cDialogEvent), NULL, IDC_BUTTON_INPUT_REF); cDialog.SetCommandCallBack(SetClassFunc(DialogEvent::OutputRef, &cDialogEvent), NULL, IDC_BUTTON_OUTPUT_REF); cDialog.SetCommandCallBack(SetClassFunc(DialogEvent::ClearOutputDir, &cDialogEvent), NULL, IDC_BUTTON_CLEAR_OUTPUT_DIR); cDialog.SetCommandCallBack(SetClassFunc(DialogEvent::AppSetting, &cDialogEvent), NULL, IDC_BUTTON_APP_SETTING); cDialog.SetCommandCallBack(SetClassFunc(DialogEvent::OnModeChange, &cDialogEvent), NULL, IDC_RADIO_MODE_NOISE); cDialog.SetCommandCallBack(SetClassFunc(DialogEvent::OnModeChange, &cDialogEvent), NULL, IDC_RADIO_MODE_SCALE); cDialog.SetCommandCallBack(SetClassFunc(DialogEvent::OnModeChange, &cDialogEvent), NULL, IDC_RADIO_MODE_NOISE_SCALE); cDialog.SetCommandCallBack(SetClassFunc(DialogEvent::OnModeChange, &cDialogEvent), NULL, IDC_RADIO_AUTO_SCALE); cDialog.SetCommandCallBack(SetClassFunc(DialogEvent::OnModeChange, &cDialogEvent), NULL, IDC_RADIO_SCALE_WIDTH_HEIGHT); cDialog.SetCommandCallBack(SetClassFunc(DialogEvent::UpdateAddString, &cDialogEvent), NULL, IDC_RADIONOISE_LEVEL0); cDialog.SetCommandCallBack(SetClassFunc(DialogEvent::UpdateAddString, &cDialogEvent), NULL, IDC_RADIONOISE_LEVEL1); cDialog.SetCommandCallBack(SetClassFunc(DialogEvent::UpdateAddString, &cDialogEvent), NULL, IDC_RADIONOISE_LEVEL2); cDialog.SetCommandCallBack(SetClassFunc(DialogEvent::UpdateAddString, &cDialogEvent), NULL, IDC_RADIONOISE_LEVEL3); cDialog.SetCommandCallBack(SetClassFunc(DialogEvent::UpdateAddString, &cDialogEvent), NULL, IDC_CHECK_TTA); cDialog.SetCommandCallBack(SetClassFunc(DialogEvent::UpdateAddString, &cDialogEvent), NULL, IDC_COMBO_OUTPUT_DEPTH); cDialog.SetCommandCallBack(SetClassFunc(DialogEvent::ScaleRadio, &cDialogEvent), NULL, IDC_RADIO_SCALE_RATIO); cDialog.SetCommandCallBack(SetClassFunc(DialogEvent::ScaleRadio, &cDialogEvent), NULL, IDC_RADIO_SCALE_WIDTH); cDialog.SetCommandCallBack(SetClassFunc(DialogEvent::ScaleRadio, &cDialogEvent), NULL, IDC_RADIO_SCALE_HEIGHT); cDialog.SetCommandCallBack(SetClassFunc(DialogEvent::CheckCUDNN, &cDialogEvent), NULL, IDC_BUTTON_CHECK_CUDNN); cDialog.SetCommandCallBack(SetClassFunc(DialogEvent::LangChange, &cDialogEvent), NULL, IDC_COMBO_LANG); cDialog.SetCommandCallBack(SetClassFunc(DialogEvent::OutExtChange, &cDialogEvent), NULL, IDC_COMBO_OUT_EXT); cDialog.SetCommandCallBack(SetClassFunc(DialogEvent::OnModelChange, &cDialogEvent), NULL, IDC_COMBO_MODEL); // ダイアログのイベントで実行する関数の登録 cDialog.SetEventCallBack(SetClassFunc(DialogEvent::Create, &cDialogEvent), NULL, WM_INITDIALOG); cDialog.SetEventCallBack(SetClassFunc(DialogEvent::OnDialogEnd, &cDialogEvent), NULL, WM_CLOSE); cDialog.SetEventCallBack(SetClassFunc(DialogEvent::OnFaildCreateDir, &cDialogEvent), NULL, WM_FAILD_CREATE_DIR); cDialog.SetEventCallBack(SetClassFunc(DialogEvent::OnWaifu2xError, &cDialogEvent), NULL, WM_ON_WAIFU2X_ERROR); cDialog.SetEventCallBack(SetClassFunc(DialogEvent::OnWaifu2xNoOverwrite, &cDialogEvent), NULL, WM_ON_WAIFU2X_NO_OVERWRITE); cDialog.SetEventCallBack(SetClassFunc(DialogEvent::WaitThreadExit, &cDialogEvent), NULL, WM_END_THREAD); cDialog.SetEventCallBack(SetClassFunc(DialogEvent::Timer, &cDialogEvent), NULL, WM_TIMER); // ダイアログを表示 cDialog.DoModal(hInstance, IDD_DIALOG); Waifu2x::quit_liblary(); return 0; }
void CEntitiesDialog::OnDblclkPropertieslist() { // Double-click on the item...Edit it. mCurrentKey = m_PropertiesList.GetCurSel (); if (mCurrentKey != LB_ERR) { CEntity *Ent = &((*mEntityArray)[mCurrentEntity]); CString EntityTypeName = Ent->GetClassname (); CString KeyName; CString TheValue; m_PropertiesList.GetText (mCurrentKey, KeyName); Ent->GetKeyValue (KeyName, TheValue); TopType eType; if (EntityTable_GetEntityPropertyType (Level_GetEntityDefs (pDoc->pLevel), EntityTypeName, KeyName, &eType)) { CDialog *pEditDialog = NULL; // Create the dialog that's appropriate for this type.... switch (eType) { case T_INT : pEditDialog = new CIntKeyEditDlg (this, KeyName, &TheValue); break; case T_FLOAT : pEditDialog = new CFloatKeyEditDlg (this, KeyName, &TheValue); break; case T_COLOR : pEditDialog = new CColorKeyEditDlg (this, KeyName, &TheValue); break; case T_POINT : pEditDialog = new CPointKeyEditDlg (this, KeyName, &TheValue); break; case T_STRING : pEditDialog = new CKeyEditDlg (this, KeyName, &TheValue); break; case T_MODEL : pEditDialog = new CModelKeyEditDlg (this, Level_GetModelInfo (pDoc->pLevel)->Models, KeyName, &TheValue); break; case T_STRUCT : pEditDialog = new CStructKeyEditDlg (this, *Ent, KeyName, mEntityArray, &TheValue, Level_GetEntityDefs (pDoc->pLevel)); break; case T_BOOLEAN : pEditDialog = new CBoolKeyEditDlg (this, KeyName, &TheValue); break; case T_PTR : default : // bad or unknown type assert (0); break; } if (pEditDialog != NULL) { int ModalResult = pEditDialog->DoModal (); delete pEditDialog; if (ModalResult == IDOK) { if (MultiEntityFlag) { // multiple entities--change this property on all of them int i; for (i = 0; i < mEntityArray->GetSize (); ++i) { CEntity *pEnt; pEnt = &(*mEntityArray)[i]; if (pEnt->IsSelected ()) { pEnt->SetKeyValue (KeyName, TheValue); } } } else { // update Ent->SetKeyValue (KeyName, TheValue); } FillInKeyValuePairs(mCurrentKey); } } } } }