/// Static helper function to create a dialog window for validation /// settings. /// /// @param pluginEditor audio plug-in editor /// /// @param audioProcessor audio processor /// /// @return created dialog window /// DialogWindow *WindowValidationContent::createDialogWindow( AudioProcessorEditor *pluginEditor, KmeterAudioProcessor *audioProcessor) { // prepare dialog window DialogWindow::LaunchOptions windowValidationLauncher; // create content component WindowValidationContent *contentComponent = new WindowValidationContent(audioProcessor); // initialise dialog window settings windowValidationLauncher.dialogTitle = String("Validation"); windowValidationLauncher.dialogBackgroundColour = Colours::white; windowValidationLauncher.content.setOwned(contentComponent); windowValidationLauncher.componentToCentreAround = pluginEditor; windowValidationLauncher.escapeKeyTriggersCloseButton = true; windowValidationLauncher.useNativeTitleBar = false; windowValidationLauncher.resizable = false; windowValidationLauncher.useBottomRightCornerResizer = false; // launch dialog window DialogWindow *windowValidation = windowValidationLauncher.launchAsync(); windowValidation->setAlwaysOnTop(true); return windowValidation; }
void DialogWindowBase::execSyncV( FieldContainer &oFrom, ConstFieldMaskArg whichField, AspectOffsetStore &oOffsets, ConstFieldMaskArg syncMode, const UInt32 uiSyncInfo) { DialogWindow *pThis = static_cast<DialogWindow *>(this); pThis->execSync(static_cast<DialogWindow *>(&oFrom), whichField, oOffsets, syncMode, uiSyncInfo); }
void DialogWindowBase::onCreate(const DialogWindow *source) { Inherited::onCreate(source); if(source != NULL) { DialogWindow *pThis = static_cast<DialogWindow *>(this); pThis->setErrorIcon(source->getErrorIcon()); pThis->setQuestionIcon(source->getQuestionIcon()); pThis->setDefaultIcon(source->getDefaultIcon()); } }
void LastFmAuthPopup::buttonClicked (Button* buttonThatWasClicked) { if (buttonThatWasClicked == &authorise) { URL userAuth ("http://www.last.fm/api/auth/?api_key="+apiKey+"&token="+apiToken); userAuth.launchInDefaultBrowser(); start.setEnabled(true); } else if (buttonThatWasClicked == &start) { DialogWindow* dw = findParentComponentOfClass<DialogWindow>(); if (dw != nullptr) dw->exitModalState (1); } }
void GUI::menuCB(Fl_Widget* w, void*) { Fl_Menu_* mw = (Fl_Menu_*)w; const Fl_Menu_Item* m = mw->mvalue(); if (!m) printf("no MenuItem\n"); else { GUI* gui = GUI::getInstance(); if (strcmp(m->label(),menuItems[1].text)==0) { gui->updateMap();// } else if (strcmp(m->label(),menuItems[2].text)==0) { gui->setLevel(1); } else if (strcmp(m->label(),menuItems[3].text)==0) { gui->setLevel(2); } else if (strcmp(m->label(),menuItems[4].text)==0) { gui->setLevel(3); } else if (strcmp(m->label(),menuItems[5].text)==0) { DialogWindow* dialog = DialogWindow::getInstance(); Fl_Group::current(dialog); dialog->show(); dialog->set_visible(); dialog->active(); } else if (strcmp(m->label(),menuItems[6].text)==0) { //给出信息对话框 gui->RankingsDialog(); } else if (strcmp(m->label(),menuItems[7].text)==0) {//发送退出信息给主窗体 Fl::handle_(FL_CLOSE,gui->m_pWindow.get()); } printf("%s\n", m->label()); } }
void timerCallback() { repaint(); if (fontsToScan.size() == 0) { getAppSettings().monospacedFontNames = fontsFound; DialogWindow* w = findParentComponentOfClass<DialogWindow>(); if (w != nullptr) w->setContentOwned (new EditorPanel(), false); } else { if (isMonospacedTypeface (fontsToScan[0])) fontsFound.add (fontsToScan[0]); fontsToScan.remove (0); } }
void ApplicationSettingsComponent::buttonClicked (Button* buttonThatWasClicked) { //[UserbuttonClicked_Pre] //[/UserbuttonClicked_Pre] if (buttonThatWasClicked == connectButton) { //[UserButtonCode_connectButton] -- add your button handler code here.. ApplicationConfiguration::getBlipClient()->disconnect(); String port = serialPortComboBox->getText(); String speed = serialSpeedComboBox->getText(); ApplicationConfiguration::getBlipClient()->setPort(port); ApplicationConfiguration::getBlipClient()->setSpeed(speed.getIntValue()); ApplicationConfiguration::getBlipClient()->connect(); std::cout << "connected: " << ApplicationConfiguration::getBlipClient()->isConnected() << std::endl; //[/UserButtonCode_connectButton] } else if (buttonThatWasClicked == okButton) { //[UserButtonCode_okButton] -- add your button handler code here.. saveSettingsToFile(); setVisible(false); DialogWindow* dw = findParentComponentOfClass((DialogWindow*)nullptr); if(dw != nullptr) dw->exitModalState(1); //[/UserButtonCode_okButton] } else if (buttonThatWasClicked == cancelButton) { //[UserButtonCode_cancelButton] -- add your button handler code here.. setVisible(false); DialogWindow* dw = findParentComponentOfClass((DialogWindow*)nullptr); if(dw != nullptr) dw->exitModalState(0); //[/UserButtonCode_cancelButton] } //[UserbuttonClicked_Post] //[/UserbuttonClicked_Post] }
INT CALLBACK ShareDialog::dialogProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) { switch ( msg ) { case WM_COMMAND: { switch ( wParam ) { case IDCANCEL: { EndDialog(hWnd,0); } break; case IDOK: { std::string name = WinUtil::WindowUtil::getWindowText(GetDlgItem(m_setupPage.getHwnd(),IDC_EDIT_VIRTUALNAME)); std::string path = WinUtil::WindowUtil::getWindowText(GetDlgItem(m_setupPage.getHwnd(),IDC_EDIT_PATH)); std::string oldPath = m_pShare->getPath(); if ( name.empty() ) { MessageBox(hWnd,WinUtil::ResourceUtil::loadString(IDS_INVALIDVIRTUALNAME).c_str(),APP_NAME,MB_ICONEXCLAMATION); break; } if ( path.empty() ) { MessageBox(hWnd,WinUtil::ResourceUtil::loadString(IDS_INVALIDPATH).c_str(),APP_NAME,MB_ICONEXCLAMATION); break; } // make sure a share with this name doesn't already exist if ( !boost::iequals(m_pShare->getName(),name) && ShareManager::getInstance()->findShareByName(name,NULL) ) { MessageBox(hWnd,WinUtil::ResourceUtil::loadString(IDS_SHAREEXISTS).c_str(),APP_NAME,MB_ICONEXCLAMATION); break; } m_setupPage.savePage(m_pShare); m_permissionsPage.savePage(m_pShare); // check if path was changed if ( !m_pShare->getGuid().empty() && m_pShare->getPath()!=oldPath ) { if ( MessageBox(this->getHwnd(),"Share path has been changed. Do you want to re-index this share?", TEXT(APP_NAME),MB_ICONQUESTION | MB_YESNO)==IDYES ) { Indexer::getInstance()->queue(IndexerJob(m_pShare->getDbId(),false)); } } // check if no permissions was set if ( m_pShare->getPermissions().empty() ) { if ( MessageBox(this->getHwnd(),"Should all authenticated users be able to access this share?", TEXT(APP_NAME),MB_ICONQUESTION | MB_YESNO)==IDYES ) { // add permission for everyone m_pShare->addPermission(Permission("","","",true)); } } EndDialog(hWnd,1); } break; } } break; case WM_NOTIFY: { LPNMHDR pNmhdr = (LPNMHDR)lParam; if ( pNmhdr->hwndFrom==m_hTreeView && pNmhdr->code==TVN_SELCHANGING ) { HTREEITEM selectedItem = TreeView_GetSelection(m_hTreeView); DialogWindow *pSelectedDialog = (DialogWindow*)WinUtil::TreeViewUtil::getItemParam(m_hTreeView,selectedItem); if ( pSelectedDialog!=NULL ) { ShowWindow(pSelectedDialog->getHwnd(),SW_HIDE); } } else if ( pNmhdr->hwndFrom==m_hTreeView && pNmhdr->code==TVN_SELCHANGED ) { HTREEITEM selectedItem = TreeView_GetSelection(m_hTreeView); DialogWindow *pSelectedDialog = (DialogWindow*)WinUtil::TreeViewUtil::getItemParam(m_hTreeView,selectedItem); if ( pSelectedDialog!=NULL ) { ShowWindow(pSelectedDialog->getHwnd(),SW_SHOW); } } } break; } return 0; }
INT CALLBACK GroupDialog::dialogProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) { switch ( msg ) { case WM_COMMAND: { switch ( wParam ) { case IDCANCEL: { EndDialog(hWnd,0); } break; case IDOK: { std::string name = WinUtil::WindowUtil::getWindowText(GetDlgItem(m_setupPage.getHwnd(),IDC_EDIT_NAME)); if ( name.empty() ) { MessageBox(hWnd,WinUtil::ResourceUtil::loadString(IDS_INVALIDGROUPNAME).c_str(),APP_NAME,MB_ICONEXCLAMATION); break; } // make sure a group with this name doesn't already exist if ( !boost::iequals(m_pGroup->getName(),name) && UserManager::getInstance()->findGroupByName(name,NULL) ) { MessageBox(hWnd,WinUtil::ResourceUtil::loadString(IDS_GROUPEXISTS).c_str(),APP_NAME,MB_ICONEXCLAMATION); break; } m_setupPage.savePage(m_pGroup); m_generalPage.savePage(m_pGroup); EndDialog(hWnd,1); } break; } } break; case WM_NOTIFY: { LPNMHDR pNmhdr = (LPNMHDR)lParam; if ( pNmhdr->hwndFrom==m_hTreeView && pNmhdr->code==TVN_SELCHANGING ) { HTREEITEM selectedItem = TreeView_GetSelection(m_hTreeView); DialogWindow *pSelectedDialog = (DialogWindow*)WinUtil::TreeViewUtil::getItemParam(m_hTreeView,selectedItem); if ( pSelectedDialog!=NULL ) { ShowWindow(pSelectedDialog->getHwnd(),SW_HIDE); } } else if ( pNmhdr->hwndFrom==m_hTreeView && pNmhdr->code==TVN_SELCHANGED ) { HTREEITEM selectedItem = TreeView_GetSelection(m_hTreeView); DialogWindow *pSelectedDialog = (DialogWindow*)WinUtil::TreeViewUtil::getItemParam(m_hTreeView,selectedItem); if ( pSelectedDialog!=NULL ) { ShowWindow(pSelectedDialog->getHwnd(),SW_SHOW); } } } break; } return 0; }
/// Called when a button is clicked. The "Cancel" and file selection /// buttons are already handled here. Override this method to handle /// other buttons. /// /// @param button clicked button /// void WindowValidationContent::buttonClicked( Button *button) { // user wants to validate the meters if (button == &buttonValidation_) { // file name has not been set if (!validationFile_.existsAsFile()) { DBG("[K-Meter] file name for validation not set."); // prevent closing of parent dialog window return; } // get selected audio channel (internal value) and update // parameter float selectedChannelInternal = sliderSelectChannel_.getFloat(); audioProcessor->setParameter( KmeterPluginParameters::selValidationSelectedChannel, selectedChannelInternal); // get selected audio channel (real value; channel numbers // start at 0; -1 designates all channels) int selectedChannel = static_cast<int>( sliderSelectChannel_.getValue()); // get selected output format and update parameter bool reportCSV = buttonDumpCSV_.getToggleState(); audioProcessor->setParameter( KmeterPluginParameters::selValidationCSVFormat, reportCSV ? 1.0f : 0.0f); // get average level log setting and update parameter bool logAverageLevel = buttonDumpAverageLevel_.getToggleState(); audioProcessor->setParameter( KmeterPluginParameters::selValidationAverageMeterLevel, logAverageLevel ? 1.0f : 0.0f); // get peak level log setting and update parameter bool logPeakLevel = buttonDumpPeakLevel_.getToggleState(); audioProcessor->setParameter( KmeterPluginParameters::selValidationPeakMeterLevel, logPeakLevel ? 1.0f : 0.0f); // get maximum peak level log setting and update parameter bool logMaximumPeakLevel = buttonDumpMaximumPeakLevel_.getToggleState(); audioProcessor->setParameter( KmeterPluginParameters::selValidationMaximumPeakLevel, logMaximumPeakLevel ? 1.0f : 0.0f); // get true peak level log setting and update parameter bool logTruePeakLevel = buttonDumpTruePeakLevel_.getToggleState(); audioProcessor->setParameter( KmeterPluginParameters::selValidationTruePeakMeterLevel, logTruePeakLevel ? 1.0f : 0.0f); // get maximum true peak level log setting and update parameter bool logMaximumTruePeakLevel = buttonDumpMaximumTruePeakLevel_.getToggleState(); audioProcessor->setParameter( KmeterPluginParameters::selValidationMaximumTruePeakLevel, logMaximumTruePeakLevel ? 1.0f : 0.0f); // get stereo meter log setting and update parameter bool logStereoMeter = buttonDumpStereoMeter_.getToggleState(); audioProcessor->setParameter( KmeterPluginParameters::selValidationStereoMeterValue, logStereoMeter ? 1.0f : 0.0f); // get phase correlation log setting and update parameter bool logPhaseCorrelation = buttonDumpPhaseCorrelation_.getToggleState(); audioProcessor->setParameter( KmeterPluginParameters::selValidationPhaseCorrelation, logPhaseCorrelation ? 1.0f : 0.0f); // validation file has already been initialised audioProcessor->startValidation( validationFile_, selectedChannel, reportCSV, logAverageLevel, logPeakLevel, logMaximumPeakLevel, logTruePeakLevel, logMaximumTruePeakLevel, logStereoMeter, logPhaseCorrelation); // get parent dialog window DialogWindow *dialogWindow = findParentComponentOfClass<DialogWindow>(); if (dialogWindow != nullptr) { // close dialog window (exit value 1) dialogWindow->exitModalState(1); } } // otherwise, use handling of super class else { frut::widgets::WindowValidationContent::buttonClicked(button); } }