char * sp_kde_get_write_filename (gchar *dir, gchar *filter, gchar *title) { QString fileName; QTimer timer; QObject::connect (&timer, SIGNAL (timeout ()), Bridge, SLOT (TimerHook ())); timer.changeInterval (1000 / SP_FOREIGN_FREQ); SPKDEModal = TRUE; fileName = KFileDialog::getSaveFileName (QString::fromLocal8Bit((const char *) dir), QString::fromLocal8Bit((const char *) filter), NULL, QString::fromUtf8((const char *) title)); SPKDEModal = FALSE; if (fileName.isEmpty()) return NULL; return g_strdup (fileName.local8Bit()); }
int CLoadBalanceBar::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMySizingControlBar::OnCreate(lpCreateStruct) == -1) return -1; CRuntimeClass *pFactory = RUNTIME_CLASS(CLoadBalanceView); m_View = DYNAMIC_DOWNCAST(CLoadBalanceView, pFactory->CreateObject()); DWORD dwStyle = AFX_WS_DEFAULT_VIEW; CRect r(0, 0, 0, 0); // arbitrary initial size if (!m_View->Create(NULL, NULL, dwStyle, r, this, IDC_LOAD_BALANCE_VIEW, NULL)) return -1; m_View->m_Parent = this; m_View->SetNotifyWnd(this); m_View->CreateCols(COLS, m_ColInfo, IDD_LOAD_BALANCE_ROW); m_View->SetAccel(NULL, theApp.GetMain()); m_Engine = &theApp.GetEngine(); PopulateView(); TimerHook(); return 0; }
bool CCrossDlg::FadeTo(const CPatch& Patch, LPCTSTR Name, double Secs, bool RandPhase) { if (!m_Frm->IsVeejay() && !SaveCheck()) return(FALSE); m_Play = FALSE; // halt fader first, without updating UI double Pos = GetPos(); bool Fwd = Pos <= .5; // set fade direction int Src = SEL_A + !Fwd; // index of source int Dst = SEL_A + Fwd; // index of destination if (Pos > 0 && Pos < 1) { // if fader is between A and B SetInfo(Src, GetInfo(SEL_MIX)); // copy mix to source SetName(Src, m_MixName); // set source name to mix m_Frm->OnNewParms(Src); // update parameters dialog } SetPos(!Fwd); // move fader to source SetInfo(Dst, Patch); // copy arg to destination SetName(Dst, Name); // set destination file name SetSeconds(Secs); if (Secs) Play(TRUE); // start fading to new patch else { Play(FALSE); SetPos(Fwd); // jump to new patch m_Frm->GetView()->FlushHistory(); // prevent glitch } if (RandPhase) { TimerHook(); // make mod freqs non-zero so randomize phase works for (int i = 0; i < ROWS; i++) { // if modulator is unused in source, but active in destination if (!m_Info[Src].m_Row[i].Freq && m_Info[Dst].m_Row[i].Freq) m_Frm->GetView()->SetPhase(i, double(rand()) / RAND_MAX); // randomize phase } } if (m_Frm->GetPatchMode() == CMainFrame::PM_FULL) m_Frm->SetPatch(Patch); // restore master and main settings m_Frm->OnNewParms(Dst); // update parameters dialog return(TRUE); }