Exemple #1
0
void CMultiMix::Create()
{
	// initialize timer
	CAutoDlg::SetTimerPeriod(m_TimerPeriod);
	m_Timer = m_Frm->SetTimer(1, m_TimerPeriod, NULL);
	// create control bars and dock them in a row
	int	DockStyle = CBRS_ALIGN_TOP | CBRS_ALIGN_BOTTOM;	// horizontal only
	CControlBar	*LeftOf = m_Frm->GetToolBar();
	for (int i = 0; i < DLGBARS; i++) {
		m_DlgBar[i]->Create(m_Frm, m_DlgBarResID[i], 0, DockStyle, i, LeftOf);
		LeftOf = m_DlgBar[i];
	}
	// now hide docked bars in case frame can't restore dock state
	for (i = 0; i < DLGBARS; i++)
		m_Frm->ShowControlBar(m_DlgBar[i], FALSE, 0);
	// initialize dialog bar data
	m_MasterVolBar.SetWindowText(LDS(MASTER_VOLUME));
	m_MasterVolBar.SetBarCaption(LDS(MASTER));
	if (!GetAutoBar(MASTER_VOL_AUTO, m_MasterVolBar))
		m_MasterVolBar.SetVolume(1);	// default master volume
	if (!GetAutoBar(CROSSFADER_AUTO, m_CrossfaderBar))
		m_CrossfaderBar.SetPos(.5);		// default crossfader position
	m_CrossfaderBar.SetFaderType(CPersist::GetInt(REG_SETTINGS, CROSSFADER_TYPE, 0));
	// applying our tool tip state here is useless, because when we return, the
	// main frame restores the bar state, which magically enables tool tips for
	// all the bars; the main frame has to apply our tool tip state for us, but
	EnableToolTips(m_OptionsDlg.ShowToolTips());   // do it anyway just in case
}
void CMetaparmPropsDlg::InitCombos()
{
	m_PluginCombo.ResetContent();
	m_PlugIdx.RemoveAll();
	int	slots = theApp.GetEngine().GetSlotCount();
	for (int SlotIdx = 0; SlotIdx < slots; SlotIdx++) {
		if (theApp.GetEngine().IsLoaded(SlotIdx))
			m_PlugIdx.Add(SlotIdx);
	}
	if (m_PlugIdx.GetSize())	// if no plugins, don't include plugin line
		m_PlugIdx.Add(SPI_PLUGIN);
	m_PlugIdx.Add(SPI_MISC);
	// first plugin combo item is reserved for unassigned state; this shifts normal
	// plugin combo items up one, so plugin item indices starts with one, not zero
	m_PluginCombo.AddString(LDS(IDS_METAPARM_UNASSIGNED));
	int	PluginItems = m_PlugIdx.GetSize();
	int	CurSel = 0;
	for (int i = 0; i < PluginItems; i++) {
		CString	s;
		int	PlugIdx = m_PlugIdx[i];
		theApp.GetEngine().GetMidiPlugName(PlugIdx, s);
		if (PlugIdx < 0)	// if special plugin index
			s += LDS(IDS_METAPARM_PROP_SUFFIX);	// add property suffix to name
		m_PluginCombo.AddString(s);
		if (PlugIdx == m_Parm.m_Target.SlotIdx)
			CurSel = i + 1;	// first item is unassigned state
	}
	if (m_Parm.m_Name.IsEmpty())
		CurSel = 0;
	m_PluginCombo.SetCurSel(CurSel);
	SetPlugin(CurSel);
}
void CMetaparmPropsDlg::UpdateUI()
{
	int	PageType;
	CString	Name;
	TARGET	Target;
	bool	IsAssigned = GetTarget(Target);
	bool	CanSave = TRUE;
	if (IsAssigned) {
		PageType = theApp.GetEngine().GetMidiPageType(Target.SlotIdx);
		// if showing parameters page but plugin has no parameters,
		// do special handling to prevent possible access violation
		if (PageType == MPT_PARAM 
		&& !theApp.GetEngine().GetMidiParmCount(Target.SlotIdx)) {
			IsAssigned = FALSE;	// target is invalid
			CanSave = FALSE;	// disable save to avoid bogus assignment
		} else
			MakeMetaparmName(Target, Name);
	} else
		PageType = MPT_PARAM;
	// set name, truncated to maximum parameter name length specified by freeframe
	m_NameEdit.SetWindowText(Name.Left(FF_MAX_PARAM_NAME));
	// enable controls if we have a target
	m_NameEdit.EnableWindow(IsAssigned);
	m_RangeStartEdit.EnableWindow(IsAssigned);
	m_RangeStartSpin.EnableWindow(IsAssigned);
	m_RangeEndEdit.EnableWindow(IsAssigned);
	m_RangeEndSpin.EnableWindow(IsAssigned);
	// set target combo box captions
	m_TargCapPlug.SetWindowText(LDS(m_TargCap[PageType].PlugId));
	m_TargCapParm.SetWindowText(LDS(m_TargCap[PageType].ParmId));
	m_TargCapProp.SetWindowText(LDS(m_TargCap[PageType].PropId));
	GetDlgItem(IDOK)->EnableWindow(CanSave);
}
Exemple #4
0
bool CMoviePlayerDlg::Play()
{
	CMainFrame::TimerState	ts(FALSE);	// stop timer, dtor restores it
	CMultiFileDlg	fd(TRUE, EXT_MOVIE, NULL, OFN_HIDEREADONLY,
		LDS(IDS_FILTER_MOVIE), LDS(IDS_MOVIE_OPEN));
	return(fd.DoModal() == IDOK && Play(fd.GetPathName()));
}
Exemple #5
0
bool CMainFrame::MakeWave(const WAVEGEN_PARMS& Parms)
{
	POSITION	pos = theApp.GetFirstDocTemplatePosition();
	CDocTemplate	*pTpl = theApp.GetNextDocTemplate(pos);
	CWaveShopDoc	*pDoc = DYNAMIC_DOWNCAST(CWaveShopDoc, pTpl->CreateNewDocument());
	if (pDoc == NULL)
		return(FALSE);
	bool	retc, canceled;
	{
		CProgressDlg	ProgDlg;
		if (!ProgDlg.Create())	// create progress dialog
			AfxThrowResourceException();
		ProgDlg.SetWindowText(LDS(IDS_MAIN_GENERATING_AUDIO));
		retc = CWaveGenDlg::MakeWave(Parms, pDoc->m_Wave, &ProgDlg);
		canceled = ProgDlg.Canceled();
	}	// destroy progress dialog
	if (!retc) {	// if generation failed
		if (!canceled)	// if user canceled
			AfxMessageBox(IDS_MAIN_CANT_MAKE_WAVE);
		return(FALSE);
	}
	CDocument	*pEmptyDoc = pTpl->OpenDocumentFile(NULL);	// create new view
	if (pEmptyDoc == NULL || m_View == NULL)
		return(FALSE);
	CString	title = pEmptyDoc->GetTitle();
	pEmptyDoc->RemoveView(m_View);	// remove empty document from view
	pDoc->SetTitle(title);	// copy empty document's title to generated document
	pDoc->AddView(m_View);	// add generated document to view
	m_View->OnInitialUpdate();
	OnActivateView(m_View);
	// view is still linked to empty document's undo manager; must relink
	m_View->SetUndoManager(&pDoc->m_UndoMgr);	// link view to undo manager
	pDoc->m_UndoMgr.SetRoot(m_View);	// link undo manager to view
	return(TRUE);
}
Exemple #6
0
bool CCrossDlg::Save(int Sel)
{
	ASSERT(Sel >= 0 && Sel < SELS);
	CPathStr	FileName;
	GetName(Sel, FileName);
	CFileDialog	fd(FALSE, EXT_PATCH, FileName, OFN_OVERWRITEPROMPT, LDS(IDS_FILTER_PATCH));
	if (fd.DoModal() != IDOK)
		return(FALSE);
	CStdioFile	fp;
	CFileException	e;
	if (!fp.Open(fd.GetPathName(), CFile::modeCreate | CFile::modeWrite, &e)) {
		e.ReportError();
		return(FALSE);
	}
	CPatch	Patch;
	Patch = m_Info[Sel];	// assign parm info
	m_Frm->GetPatch(Patch);	// get master and main info
	if (!Patch.Write(fp))
		return(FALSE);
	m_Modified[Sel] = FALSE;
	FileName = fd.GetFileName();
	FileName.RemoveExtension();
	SetName(Sel, FileName);
	return(TRUE);
}
Exemple #7
0
bool CCrossDlg::Open(int Sel)
{
	CFileDialog	fd(TRUE, EXT_PATCH, NULL, OFN_HIDEREADONLY, LDS(IDS_FILTER_PATCH));
	if (fd.DoModal() != IDOK)
		return(FALSE);
	return(Open(Sel, fd.GetPathName()));
}
void COptsMidiDlg::UpdateDevCombo()
{
	m_MidiDevCombo.ResetContent();
	m_MidiDevCombo.AddString(LDS(IDS_OPTS_NO_MIDI_IN));
	for (int i = 0; i < m_DevList.GetSize(); i++)
		m_MidiDevCombo.AddString(m_DevList[i]);
	m_MidiDevCombo.SetCurSel(m_MidiDev + 1);
}
Exemple #9
0
void CPatchBar::SetRowInfo(int RowIdx, CPatchRow& Row)
{
	if (m_Engine->GetSlotCount()) {
		INPUT_INFO&	info = m_Input[RowIdx];
		CFFPluginEx	*slot = m_Engine->GetSlot(info.SlotIdx);
		CString	name;
		Row.m_Source.ResetContent();
		int	ShowEnable;
		bool	IsEnabled, TakesInput;
		if (slot != NULL) {
			name = slot->GetName();
			if (info.NumInputs > 1) {
				TCHAR	suffix[3] = {' ', TCHAR('A' + info.InpIdx)};
				name += suffix;
			}
			name += ':';
			int	plugs = m_Engine->GetPluginCount();
			TakesInput = !slot->IsSource();
			int	SelSrc;
			if (TakesInput) {
				Row.m_Source.AddString(LDS(IDS_FF_INPUT_DEFAULT));
				for (int PlugIdx = 0; PlugIdx < plugs; PlugIdx++)
					Row.m_Source.AddString(m_Engine->GetPlugin(PlugIdx).GetName());
				SelSrc = slot->GetInputPlugin(info.InpIdx) + 1;
			} else {
				Row.m_Source.AddString(LDS(IDS_FF_INPUT_NONE));
				SelSrc = 0;
			}
			Row.m_Source.SetCurSel(SelSrc);
			ShowEnable = !info.InpIdx;	// for mixers, show checkbox on first row only
			IsEnabled = !slot->GetBypass();
		} else {	// empty slot
			ShowEnable = TRUE;
			IsEnabled = FALSE;
			TakesInput = FALSE;
		}
		Row.m_Enable.ShowWindow(ShowEnable ? SW_SHOW : SW_HIDE);
		Row.m_Enable.SetCheck(IsEnabled);
		Row.m_Enable.EnableWindow(slot != NULL);
		Row.m_Source.EnableWindow(TakesInput);	// disable drop list for source plugins
		Row.m_Input.SetWindowText(name);
		Row.m_SlotIdx = info.SlotIdx;
		Row.m_NumInputs = info.NumInputs;
		Row.m_InpIdx = info.InpIdx;
	}
}
Exemple #10
0
int CMovieResizeDlg::DoModal() 
{
	CMultiFileDlg	fd(TRUE, EXT_MOVIE, NULL, OFN_HIDEREADONLY,
		LDS(IDS_FILTER_MOVIE), LDS(IDS_MOVIE_OPEN));
	if (fd.DoModal() != IDOK)
		return(IDCANCEL);
	CSnapMovie	sm;
	CMainFrame	*Frm = CMainFrame::GetThis();
	sm.SetView(Frm->GetView());
	if (!sm.Open(fd.GetPathName(), TRUE))
		return(IDABORT);
	m_Width = sm.GetFrameSize().cx;
	m_Height = sm.GetFrameSize().cy;
	if (CDialog::DoModal() == IDOK) {
		sm.Close();
		CSize	sz(m_Width, m_Height);
		sm.Resize(fd.GetPathName(), sz);
	}
	return(IDOK);
}
LONG CCrossfaderBar::OnInitDialog(UINT wParam, LONG lParam)
{
	CAutoSliderDlgBar::OnInitDialog(wParam, lParam);

	SetWindowText(LDS(CROSSFADER));
	SetBarCaption(LDS(CROSSFADER_CAPTION));
	m_Slider.SetDefaultPos(m_Slider.GetRangeMax() / 2);
	m_SrcA.SetCurSel(m_SrcA.AddString(LDS(NO_INPUT)));
	m_SrcB.SetCurSel(m_SrcB.AddString(LDS(NO_INPUT)));
	m_FaderTypeButton.SetIcons(IDI_CFLINEAR, IDI_CFDIPLESS);
	// add additional controls to base class resizing object
	m_Resize.AddControl(IDC_SOURCE_A, BIND_LEFT);
	m_Resize.AddControl(IDC_SOURCE_B, BIND_RIGHT);
	m_Resize.AddControl(IDC_FADER_TYPE, BIND_RIGHT);
	m_Resize.FixControls();


	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Exemple #12
0
void CMixereView::OnDropFiles(CChannel *Chan, HDROP hDropInfo)
{
	char	Path[MAX_PATH];
	UINT	Files = DragQueryFile(hDropInfo, -1, 0, 0);
	DragQueryFile(hDropInfo, 0, Path, MAX_PATH);
	CString	MixerExt;
	GetExtension(MixerExt);
	CStringArray	ChanExt;
	CChannel::GetExtensionList(ChanExt);
	int	Pos = Chan != NULL ? Chan->GetIndex() : GetItemCount();
	// assume any non-mixer files are audio files
	CStringArray	LoadErr;
	CStringArray	FormatErr;
	for (UINT i = 0; i < Files; i++) {
		DragQueryFile(hDropInfo, i, Path, MAX_PATH);
		if (stricmp(PathFindExtension(Path), MixerExt)) {
			for (int j = 0; j < ChanExt.GetSize(); j++) {
				if (!stricmp(PathFindExtension(Path), ChanExt[j]))
					break;
			}
			if (j < ChanExt.GetSize()) {
				if (!LoadAudio(Pos++, Path))
					AddStringUnique(LoadErr, Path);
			} else
				AddStringUnique(FormatErr, Path);
		}
	}
	// if audio files couldn't be loaded, display error message
	if (LoadErr.GetSize())
		MsgBoxStrList(LDS(CANT_LOAD_AUDIO), LoadErr);
	// if audio files had invalid formats, display error message
	if (FormatErr.GetSize())
		MsgBoxStrList(LDS(BAD_FILE_FORMAT), FormatErr);
	// now open mixer files if any
	for (i = 0; i < Files; i++) {
		DragQueryFile(hDropInfo, i, Path, MAX_PATH);
		if (!stricmp(PathFindExtension(Path), MixerExt))
			AfxGetApp()->OpenDocumentFile(Path);
	}
}
Exemple #13
0
CMultiMix::CMultiMix(CMainFrame *Frame) :
#pragma warning(disable : 4355)	// 'this' used in base member initializer list
	// these ctors don't access 'this', they only copy it to a member var
	m_MasterVolBar(this),
	m_CrossfaderBar(this),
#pragma warning(default : 4355)
	m_OptionsDlg(LDS(OPTIONS))
{
	m_Frm = Frame;
	m_Timer = 0;
	m_DlgBar[DLGBAR_MASTERVOL] = &m_MasterVolBar;
	m_DlgBar[DLGBAR_CROSSFADER] = &m_CrossfaderBar;
}
Exemple #14
0
bool CMixereView::SetInfo(const CMixerInfo& Info)
{
	CWaitCursor	wc;
	m_MSFadeBar.SetInfo(Info.m_MSFade);	// before creating channels
	// set the column widths
	int	cols = Info.m_ColumnWidth.GetSize();
	for (int i = 0; i < cols; i++)
		SetColumnWidth(i, Info.m_ColumnWidth[i]);
	// set the channel count
	int	chans = Info.m_Chan.GetSize();
	if (SetItemCount(chans) < chans)	// if create failed, bail out
		return(FALSE);
	// set the mixer controls
	CStringArray	ErrPath;
	for (i = 0; i < chans; i++) {
		if (!GetChan(i)->OpenItem(&Info.m_Chan[i]))		// if can't load audio file
			AddStringUnique(ErrPath, Info.m_Chan[i].m_Path);	// add its path to list
	}
	// if audio files couldn't be loaded, display error message
	if (ErrPath.GetSize())
		MsgBoxStrList(LDS(CANT_LOAD_AUDIO), ErrPath);
	m_VolumeBar.SetInfo(Info.m_AutoVol);
	m_TempoBar.SetInfo(Info.m_AutoTempo);
	m_ChanDefaults = Info.m_ChanDefaults;
	m_ChanIDs = Info.m_ChanIDs;
	// redraw channels all at once, looks and sounds better
	for (i = 0; i < chans; i++)
		GetChan(i)->SetInfo(&Info.m_Chan[i]);
	ScrollToPosition(CPoint(0, 0));
	ClearSelection();
	SetCurPos(0);
	ClearUndoHistory();
	// restore our bar state
	if (CMainFrame::VerifyDockState(Info.m_DockState, m_ChildFrm))
		m_ChildFrm->SetDockState(Info.m_DockState);
	// restoring bar state enables bar tool tips; reapply our tip state
	for (i = 0; i < DLGBARS; i++)
		m_DlgBar[i]->EnableToolTips(m_HasToolTips);
	// attach to snapshot object and update our snapshot bar
	m_Snapshot = const_cast<CSnapshot *>(&Info.m_Snapshot);
	m_Snapshot->SetMixer(this);
	m_Snapshot->UpdateList();
	// enable status bar panes as needed; see note in CColorStatusBar::Reset
	CColorStatusBar	*csb = ((CMainFrame *)AfxGetMainWnd())->GetStatusBar();
	if (GetMuteCount())
		csb->EnablePane(CMainFrame::SBP_MUTE);
	if (GetSoloCount())
		csb->EnablePane(CMainFrame::SBP_SOLO);
	return(TRUE);
}
Exemple #15
0
BOOL COptsMidiDlg::OnInitDialog() 
{
	CPropertyPage::OnInitDialog();

	m_MidiDev.AddString(LDS(IDS_OP_NO_MIDI_IN));
	for (int i = 0; i < m_DevList.GetSize(); i++)
		m_MidiDev.AddString(m_DevList[i]);
	m_MidiDev.SetCurSel(m_st.MidiDev + 1);
	m_MidiSync = m_st.MidiSync;
	UpdateData(FALSE);	// init dialog
	UpdateUI();

	return TRUE;  // return TRUE unless you set the focus to a control
}
void	CReportCtrl::SetColumns(int Columns, const RES_COL *Column)
{
	m_Columns = Columns;
	m_ColHeap = new COLUMN[Columns];
	m_Title.SetSize(Columns);
	for (int i = 0; i < Columns; i++) {
		m_Title[i] = LDS(Column[i].TitleID);
		m_ColHeap[i].Title		= m_Title[i];
		m_ColHeap[i].Align		= Column[i].Align;
		m_ColHeap[i].Width		= Column[i].Width;
		m_ColHeap[i].InitSort	= Column[i].InitSort;
	}
	m_Column = m_ColHeap;
}
Exemple #17
0
void CMixereView::LoadAudio()
{
	CFileDialog	fd(TRUE, ".wav", NULL,
		OFN_ALLOWMULTISELECT | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
		CChannel::GetFileFilter());
	// prepare OPENFILENAME struct for multiple select
	CString	Buffer;
	const	BUFSIZE = 0x7fff;
	LPTSTR	FileBuf = Buffer.GetBufferSetLength(BUFSIZE);
	ZeroMemory(FileBuf, BUFSIZE);
	fd.m_ofn.lpstrFile = FileBuf;
	fd.m_ofn.nMaxFile = BUFSIZE;
	fd.m_ofn.nFileOffset = 0;
	CString	Title(LDS(LOAD_AUDIO));
	fd.m_ofn.lpstrTitle = Title;
	// display the dialog
	int	retc = fd.DoModal();
	int	Pos = m_CurPos;
	if (retc == IDOK) {
		// iterate through the results
		CStringArray	ErrPath;
		POSITION	FilePos;
        FilePos = fd.GetStartPosition();
        while (FilePos != NULL) {
			CString	Path = fd.GetNextPathName(FilePos);
			if (!LoadAudio(Pos++, Path))
				AddStringUnique(ErrPath, Path);
		}
		// if audio files couldn't be opened, display error message
		if (ErrPath.GetSize())
			MsgBoxStrList(LDS(CANT_LOAD_AUDIO), ErrPath);
	} else {
		if (CommDlgExtendedError())
			AfxMessageBox(LDS(FILE_DIALOG_ERROR));
	}
}
Exemple #18
0
LONG CMSFadeBar::OnInitDialog(UINT wParam, LONG lParam)
{
	CDialogBarEx::OnInitDialog(wParam, lParam);
	SetWindowText(LDS(MS_FADE_BAR));
	SetBarCaption(LDS(MS_FADE_CAPTION));
	m_Slider.SetRange(0, CAutoSliderDlg::SLIDER_RANGE);
	m_Slider.CreateTicks(CAutoSliderDlg::SLIDER_TICKS);
	// give edit control a fatter font
	m_TimeEdit.SendMessage(WM_SETFONT, (WPARAM)GetStockObject(SYSTEM_FONT));
	m_TimeEdit.SetUndoTitle(LDS(MS_FADE_EDIT));
	m_Slider.SetRange(0, 60);
	m_Minutes.SetIcons(IDI_MINUTESU, IDI_MINUTESD);
	// add controls to resizing object
	m_Resize.AddControl(IDC_MS_FADE_SLIDER, BIND_LEFT | BIND_RIGHT);
	m_Resize.AddControl(IDC_MS_FADE_MINUTES, BIND_RIGHT);
	m_Resize.AddControl(IDC_MS_FADE_EDIT, BIND_RIGHT);
	m_Resize.AddControl(IDC_MS_FADE_SPIN, BIND_RIGHT);
	m_Resize.FixControls();
	// these controls send undo notifications, but we handle save/restore
	m_Slider.SetUndoHandler(this);
	m_Minutes.SetUndoHandler(this);

	return TRUE;
}
do_gfreemem()
{
	char msg[150];
	extern long MemUsed;
	long left;
	long sys_left;

	left = avail_mem - MemUsed;
	if( left < 0L )
		left = 0;

	sys_left = Malloc( -1L );

	sprintf( msg, LDS( 376, "[1][%ld bytes free][ OK ]"), left );
	form_alert( 1, msg );
}
void CFileBrowserListCtrl::Init()
{
	for (int i = 0; i < COLUMNS; i++) {	// make columns
		const COL_INFO&	info = m_ColInfo[i];
		InsertColumn(i, LDS(info.Title), info.Align, info.Width);
	}
	SetImageList(&m_FileInfoCache.GetImageList(ICON_SMALL), LVSIL_SMALL);
	SetImageList(&m_FileInfoCache.GetImageList(ICON_BIG), LVSIL_NORMAL);
	// create header image list containing sort arrows
	m_HdrImgList.Create(8, 8, ILC_MASK, 1, 1);
	m_HdrImgList.Add(AfxGetApp()->LoadIcon(IDI_SORT_UP));
	m_HdrImgList.Add(AfxGetApp()->LoadIcon(IDI_SORT_DOWN));
	GetHeaderCtrl()->SetImageList(&m_HdrImgList);
	DrawSortArrow(DEFAULT_SORT_COL, DEFAULT_SORT_DIR);
	m_ViewType = GetStyle() & LVS_TYPEMASK;
}
Exemple #21
0
void CMixereView::OnCreateView()
{
	m_ChildFrm = GetParentFrame();	// must do this first
	// create dialog bars and dock them in a row
	CreateDlgBars();
	// register with mixer manager
	m_MultiMix->AddMixer(this);
	// copy the document's data into the mixer
	bool	retc = SetInfo(GetDocument()->m_MixerInfo);
	if (!retc) {	// item creation failed; probably one too many docs open
		SetItemCount(0);	// free up resources, else message box could fail
		AfxMessageBox(LDS(CANT_CREATE_VIEW));
		GetDocument()->Close();
	}
	DragAcceptFiles(TRUE);	// so we can drop files over view background
}
Exemple #22
0
BOOL CFindDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	CWaveShopView	*view = theApp.GetMain()->GetView();
	CWaveProcess&	wave = view->GetWave();
	CStringArray	ChanName;
	wave.GetChannelNames(ChanName);
	int	chans = wave.GetChannels();
	m_ChannelCombo.AddString(LDS(IDS_FIND_ALL_CHANNELS));
	for (int iChan = 0; iChan < chans; iChan++)
		m_ChannelCombo.AddString(ChanName[iChan]);
	m_ChannelCombo.SetCurSel(m_Channel + 1);
		
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
BOOL CAutoSliderDlg::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) 
{
	NMHDR	*nmh = (NMHDR *)lParam;
	switch (nmh->code) {
	case AUTOSLIDER_CREATE:
		{
			CString	Text;
			GetWindowText(Text);
			m_Slider.SetAutoDlgTitle(LDS(AUTO) + " " + Text);
		}
		break;
	case AUTOSLIDER_CLOSE:
		m_Slider.SetFocus();
		return(TRUE);
	}	
	return CDialogEx::OnNotify(wParam, lParam, pResult);
}
int CHistoryBar::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CMySizingControlBar::OnCreate(lpCreateStruct) == -1)
		return -1;

	UINT	style = WS_CHILD | WS_VISIBLE | LVS_REPORT 
		| LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | LVS_OWNERDATA;
	if (!m_List.Create(style, CRect(0, 0, 0, 0), this, IDC_HISTORY_LIST))
		return -1;
	int	width = DEF_VERT_DOCK_WIDTH - ((GetSystemMetrics(SM_CXFRAME) << 1) + 2);
	m_List.InsertColumn(0, LDS(IDS_HIST_COL_ACTION), LVCFMT_LEFT, width);
	if (!m_StateImgList.Create(IDB_HISTORY_POS, 6, 0, RGB(0, 128, 128)))
		return -1;
	m_List.SetImageList(&m_StateImgList, LVSIL_STATE);

	return 0;
}
bool CFindServersDlg::FindServersAddressRange()
{
	UINT	start, end;
	if (!GetIPAddrRange(m_RangeStart, m_RangeEnd, start, end)) {
		AfxMessageBox(IDS_FSRV_BAD_IP_RANGE);
		return(FALSE);
	}
	if (!m_Done.Create(NULL, FALSE, FALSE, NULL))
		return(FALSE);
	m_Kill = FALSE;
	AfxBeginThread(RcvThread, this);
	bool	retc = TRUE;
	try {
		CProgressDlg	dlg;
		dlg.Create();
		dlg.SetRange(start, end);
		dlg.SetWindowText(LDS(IDS_FSRV_PROGRESS_CAP));
		for (UINT i = start; i <= end; i++) {
			dlg.SetPos(i);
			if (!IsBroadcastAddr(i)) {	// exclude broadcast address
				SOCKADDR_IN	addr;
				addr.sin_family = AF_INET;
				addr.sin_port = htons(m_PortNumber);
				addr.sin_addr.s_addr = ntohl(i);
				m_Finder->RequestReply(addr);	// request reply
			} 
			if (dlg.Canceled()) {
				retc = FALSE;
				break;
			}
		}
		CWaitCursor	wc;
		if (retc)
			Sleep(1000);	// give last replies a chance to come in
		m_Kill = TRUE;
		WaitForSingleObject(m_Done, INFINITE);
	}
	catch (const WError& e) {
		CString	msg(e.what());
		AfxMessageBox(msg);
		return(FALSE);
	}
	return(retc);
}
bool CHistoryBar::SetUndoPos(int Pos)
{
	CUndoManager	*UndoMgr = theApp.GetMain()->GetUndoManager();
	if (UndoMgr == NULL)	// if no documents
		return(FALSE);
	int	CurPos = UndoMgr->GetPos();
	ASSERT(Pos >= 0 && Pos <= UndoMgr->GetSize());
	if (Pos == CurPos)	// if undo position unchanged
		return(TRUE);	// nothing to do
	CProgressDlgEx	ProgDlg(IDD_PROGRESS_DUAL);	// allow nested progress
	if (!ProgDlg.Create())	// create progress dialog
		AfxThrowResourceException();
	int	CaptionID = Pos < CurPos ? IDS_HIST_UNDOING : IDS_HIST_REDOING;
	ProgDlg.SetWindowText(LDS(CaptionID));	// set appropriate caption
	ProgDlg.SetRange(0, abs(Pos - CurPos));	// set upper range to position delta
	m_ProgressPos = 0;
	m_ProgressDlg = &ProgDlg;	// derived progress dialog's dtor resets pointer
	UndoMgr->SetPos(Pos);	// undo or redo to selected history state
	return(TRUE);
}
BOOL CJobControlDlg::OnInitDialog() 
{
	CToolDlg::OnInitDialog();
	
	m_Main = theApp.GetMain();
	m_Resize.AddControlList(this, m_CtrlList);
	for (int i = 0; i < COLS; i++) {	// create list columns
		const LIST_COL& lc = m_ListCol[i];
		m_List.InsertColumn(i, LDS(lc.TitleID), lc.Align, lc.Width);
	}
	GetWindowRect(m_InitRect);	// save dialog's initial size
	SetIcon(AfxGetApp()->LoadIcon(IDR_MAINFRAME), FALSE);
	DWORD	ExStyle = m_List.GetExtendedStyle();
	ExStyle |= LVS_EX_FULLROWSELECT;
	m_List.SetExtendedStyle(ExStyle);
	ReadJobFile();

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Exemple #28
0
bool CMainFrame::CreateToolbars()
{
	DWORD	style = WS_CHILD | WS_VISIBLE | CBRS_TOP
		| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC;
	CRect	rc(0, 0, 0, 0);
	for (int iBar = 0; iBar < TOOLBARS; iBar++) {
		const BAR_INFO&	info = m_ToolbarInfo[iBar];
		CToolBar	*pBar = STATIC_DOWNCAST(CToolBar, GetBarAtOffset(info.Offset));
		if (!pBar->CreateEx(this, TBSTYLE_FLAT, style, rc, info.BarID))
			return(FALSE);
		if (!pBar->LoadToolBar(info.BarResID))
			return(FALSE);
		pBar->SetWindowText(LDS(info.CaptionID));
		pBar->EnableDocking(CBRS_ALIGN_ANY);
		if (info.LeftOf) {
			CControlBar	*LeftOf = GetBarAtOffset(info.LeftOf);
			CWinAppEx::DockControlBarLeftOf(this, pBar, LeftOf);
		} else
			DockControlBar(pBar);
	}
	return(TRUE);
}
void CMidiTargetDlg::OnGetdispinfo(NMHDR* pNMHDR, LRESULT* pResult) 
{
	LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
	LVITEM&	item = pDispInfo->item;
	int	iItem = item.iItem;
	if (item.mask & LVIF_TEXT) {
		switch (item.iSubItem) {
		case COL_NAME:
			_tcsncpy(item.pszText, LDS(GetTargetInfo(iItem).NameID), item.cchTextMax);
			break;
		case COL_PORT:
			_stprintf(item.pszText, _T("%d"), m_Target[iItem].m_Inst.Port);
			break;
		case COL_CHAN:
			_stprintf(item.pszText, _T("%d"), m_Target[iItem].m_Inst.Chan + 1);
			break;
		case COL_EVENT:
			_tcsncpy(item.pszText, m_Target[iItem].GetEventTypeName(), item.cchTextMax);
			break;
		case COL_CONTROL:
			_stprintf(item.pszText, _T("%d"), m_Target[iItem].m_Control);
			break;
		case COL_RANGE_START:
			_stprintf(item.pszText, _T("%g"), m_Target[iItem].m_RangeStart);
			break;
		case COL_RANGE_END:
			_stprintf(item.pszText, _T("%g"), m_Target[iItem].m_RangeEnd);
			break;
		case COL_VALUE:
			_stprintf(item.pszText, _T("%d"), GetShadowValue(iItem));
			break;
		default:
			NODEFAULTCASE;
		}
	}
}
CString	CMidiTargetDlg::GetTargetName(int RowIdx) const
{
	return(LDS(GetTargetInfo(RowIdx).NameID));
}