コード例 #1
0
BOOL CSaxBasicDoc::OnOpenDocument(LPCTSTR lpszPathName) 
{
	CSbproAux* pSbproAux = CSbproAux::FindSbproAux(this);
	ASSERT(pSbproAux != NULL);
	if (pSbproAux)
	{
		OnNewDocument();
		pSbproAux->GetSbpro().SetFileName(lpszPathName);
	}

	return TRUE;
}
コード例 #2
0
BOOL CMyPaintDoc::OnOpenDocument(LPCTSTR name) {
  PixRect *image = PixRect::load(theApp.m_device, ByteInputFile(name));

  theApp.AddToRecentFileList(name);

  OnNewDocument();
  setImage(image);
  FileNameSplitter info(name);
  SetTitle(info.getFileName().cstr());
  SetPathName(name);
  setFileImage();
  return TRUE;
}
コード例 #3
0
void CPedidosDoc::OnNovoPedido() 
{
	if (NotLosingData())
	{
		if (OnNewDocument())
		{
			UpdateAllViews(NULL);
		}
		else
		{
			X("False!?");
		}
	}
}
コード例 #4
0
ファイル: ColorEyeIDoc.cpp プロジェクト: dwatow/ColorEyeI
BOOL CColorEyeIDoc::OnOpenDocument(LPCTSTR lpszPathName) 
{
    if (!CDocument::OnOpenDocument(lpszPathName))
        return FALSE;    
    // TODO: Add your specialized creation code here
    //點兩下會執行這個
    OnNewDocument();
//     OpenOmdFile(lpszPathName);
    SetPathName(lpszPathName);
    SetTitle(lpszPathName);
    SetModifiedFlag(FALSE);    

    UpdateAllViews(NULL);  //更新畫面
    return TRUE;
}
コード例 #5
0
ファイル: mfcterm.cpp プロジェクト: mbentz80/jzigbeercp
mfc_edit_doc::mfc_edit_doc(CMultiDocTemplate *mdt, int hist)
{
  mdt->AddDocument(this);
  m_pDocTemplate = mdt;
  mfc_edit_child *frame = new mfc_edit_child;
  CCreateContext context;
  context.m_pCurrentFrame = 0;
  context.m_pCurrentDoc = this;
  context.m_pNewViewClass = RUNTIME_CLASS(mfc_term_view);
  context.m_pNewDocTemplate = mdt;
  frame->LoadFrame(IDR_EDITFRAME, WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE,
                   0, &context);
  SetTitle(hist? "*history*" : "*terminal*");
  OnNewDocument();
  if (!hist)
    ((mfc_term_view *)GetView())->is_term = 1;
}
コード例 #6
0
//
// function will now recurse back into here if loading a script! (*.mvs)
//
BOOL CModViewDoc::OnOpenDocument(LPCTSTR lpszPathName) 
{
	string str = LengthenFilenameW95W98(lpszPathName);
	if (str.empty())	// if it was empty, then arg didn't eval to a filename (eg "#startminimized"), so return original
	{
		str = lpszPathName;
	}
	lpszPathName = str.c_str();

	if (strstr(lpszPathName,"#startminimized"))
	{
		extern bool gbStartMinimized;
		gbStartMinimized = true;		

		OnNewDocument();

		// None of this shit works, because whatever you set the current document to MS override it with a derived name,
		//	and since the CWinApp class can't even ask what it's own f*****g document pointer is without doing a hundred
		//	lines of shit deep within MFC then I'm going to f**k the whole lot off by storing a pointer which I can then
		//	use later in the CWinApp class to override the doc name. 
		//
		// All this f*****g bollocks was because MS insist on doing their own switch-comparing so I can't pass in 'real'
		//	switches, I have to use this '#' crap. Stupid f*****g incompetent MS dickheads. Like how hard would it be to
		//	pass command line switches to the app instead of just filenames?
		//
		strLastRealDocName = "Untitled";
		SetPathName(strLastRealDocName, false);	// I shouldn't have to do this, but MFC doesn't do it for some reason
		SetTitle(strLastRealDocName);
		gpLastOpenedModViewDoc = this;	
		return true;
	}

//	if (!CDocument::OnOpenDocument(lpszPathName))
//		return FALSE;

	// check for script file first...
	//
	if (lpszPathName && !stricmp(&lpszPathName[strlen(lpszPathName)-4],".mvs"))
	{
		Script_Read(lpszPathName);				// this will recurse back into this function
		SetPathName(lpszPathName, true);		// add script file to MRU
		SetPathName(strLastRealDocName);	// DOESN'T WORK!: set doc/app name to last real model load, not the script name
		return true;
	}

	
	if (lpszPathName && Model_LoadPrimary(lpszPathName))
	{
		strLastRealDocName = lpszPathName;
		strLastRealDocName.Replace("/","\\");
		SetPathName(strLastRealDocName, true);
		return true;
	}
	// model existed, but had some sort of error...
	//

	OnNewDocument();

	strLastRealDocName = "Untitled";
	SetPathName(strLastRealDocName, false);	// I shouldn't have to do this, but MFC doesn't do it for some reason
	return false;	
}
コード例 #7
0
bool CMusicStudioDoc::LoadMWMusicFile(CArchive &ar)
{
	if (!ar.IsLoading())
	{
		return false;
	}

	OnNewDocument();

	mGenericInfo = CString(_T("Originaly converted from the MW music file: ")) + ar.GetFile()->GetFileName() + _T("\x0d\x0a");

	Music music;
	CStringA filenameA(ar.GetFile()->GetFilePath());
	const char *filename = filenameA.GetBuffer();
	music.LoadMusic(filename);
	music.Compact();

	ZeroMemory(mTracks,sizeof(mTracks));
	ZeroMemory(mTablesControls,sizeof(mTablesControls));
	ZeroMemory(mTablesValues,sizeof(mTablesValues));

	for (int i = 0 ; i < MusicStudio1::MusicFile::kMaxEnvelopes ; i++)
	{
		mEnvelopeNames[i] = "";
		mEnvelopes[i] = MusicStudio1::Envelope();
	}

	OptimiseTables(true);

	const std::vector<Block> &tracks = music.getTracks();

	size_t channelPos[3] = {0,0,0};
	size_t blockIndex = 0;
	int channel = 0;

	for (size_t blockIndex = 0 ; blockIndex < tracks.size() ; blockIndex++)
	{
		channel = blockIndex % MusicStudio1::MusicFile::kMaxTracks;

		if (channelPos[channel] >= MusicStudio1::MusicFile::kMaxTrackLength)
		{
			break;
		}

		const Block &trackBlock = tracks[blockIndex];

		for (size_t i = 0 ; i < trackBlock.size() ; i++)
		{
			if (trackBlock[i] == 0xff )
			{
				mTracks[channel][channelPos[channel]] = MusicStudio1::kMusicPlayer_LoopTrack;
				channelPos[channel]++;
				break;
			}
			else if (trackBlock[i] == 0xfe )
			{
				mTracks[channel][channelPos[channel]] = MusicStudio1::kMusicPlayer_StopAllTracks;
				channelPos[channel]++;
				break;
			}
			else if (trackBlock[i] == 0xfd )
			{
				// TODO: fade down?
				mTracks[channel][channelPos[channel]] = MusicStudio1::kMusicPlayer_StopAllTracks;
				channelPos[channel]++;
				break;
			}
			if ((trackBlock[i] & 0x40) == 0x40)
			{
				// TODO: Loop start/end across a range of track entries
				// Ignore for now
				i++;
			}
			unsigned char numTimes = trackBlock[i];
			i++;
			unsigned char sequence = trackBlock[i];
			// TODO: Output a warning if the sequence/block index is out of range of MusicStudio1::MusicFile::kMaxBlocks ?
			// Finally the sequence number
			if (sequence >= MusicStudio1::MusicFile::kMaxBlocks)
			{
				continue;
			}

			if (numTimes > 2)
			{
				mTracks[channel][channelPos[channel]] = MusicStudio1::kMusicPlayer_RepeatBlock | numTimes;
				channelPos[channel]++;
				if (channelPos[channel] >= MusicStudio1::MusicFile::kMaxTrackLength)
				{
					break;
				}
			}

			// Finally the sequence number
			// The sequence range is less in this format
			mTracks[channel][channelPos[channel]] = sequence & (MusicStudio1::MusicFile::kMaxBlocks - 1);
			channelPos[channel]++;
			if (channelPos[channel] >= MusicStudio1::MusicFile::kMaxTrackLength)
			{
				break;
			}
			// Small optimisation to avoid a repeat block instruction being output
			if (numTimes == 2)
			{
				mTracks[channel][channelPos[channel]] = mTracks[channel][channelPos[channel]-1];
				channelPos[channel]++;
			}
		}
	}

	const std::vector<Block> &sequences = music.getSequences();
	for (size_t sequence = 0 ; sequence < sequences.size() ; sequence++)
	{
		if (sequence >= MusicStudio1::MusicFile::kMaxBlocks)
		{
			break;
		}

		const Block &sequenceBlock = sequences[sequence];

		CString blockText;
		unsigned char lastEnv = 0xff;
		unsigned char lastDur = 0xff;

		for (size_t i = 0 ; i < sequenceBlock.size() ; i++)
		{
			unsigned char lengthByte = sequenceBlock[i];
			i++;
			if (lengthByte == 0xff)
			{
				break;
			}

			if (lengthByte & 0x80)
			{
				// Change envelope
				if (i >= sequenceBlock.size())
				{
					break;
				}
				unsigned char env = sequenceBlock[i];
				i++;

				if (env & 0x80)
				{
					// TODO: Bend instead of voice change?
				}
				else
				{
					if (env != lastEnv)
					{
						lastEnv = env;
						blockText += L"ENV:" + GetNum(lastEnv) + L"\r\n";
					}
				}
			}

			lengthByte = lengthByte & 0x3f;
			if (lengthByte != lastDur)
			{
				lastDur = lengthByte;
				blockText += L"DUR:" + GetNum(lastDur) + L"\r\n";
			}
			if (i >= sequenceBlock.size())
			{
				break;
			}
			unsigned char noteByte = sequenceBlock[i];
			noteByte &= 0x7f;

			blockText += CString(MusicStudio1::BlockEntry::GetNoteFromNumber(noteByte).c_str()) + L"\r\n";
		}

		mBlocks[sequence] = blockText;
	}

	const std::vector<Block> &effect1 = music.getEffect1();
	const std::vector<Block> &effect2 = music.getEffect2();

	for (size_t effect = 0 ; effect < effect1.size() ; effect++)
	{
		if (effect >= MusicStudio1::MusicFile::kMaxEnvelopes)
		{
			break;
		}

		mEnvelopeNames[effect] = _T("A note");
		mEnvelopes[effect].mAttackDecay = effect1[effect][0];
		mEnvelopes[effect].mSustainRelease = effect1[effect][1];
		mEnvelopes[effect].mAllowVoiceEffects = true;
		int nextTableWave = getNextFreeTableControl(MusicStudio1::kTableIndex_Wave);
		int nextTableNote = getNextFreeTableControl(MusicStudio1::kTableIndex_Note);
		int nextTablePulse = getNextFreeTableControl(MusicStudio1::kTableIndex_Pulse);
		if (nextTableWave > 0)
		{
			mEnvelopes[effect].mActiveTableWave = true;
			mEnvelopes[effect].mTableWave = nextTableWave;
			mTablesControls[MusicStudio1::kTableIndex_Wave][nextTableWave] = effect1[effect][2];
			mTablesControls[MusicStudio1::kTableIndex_Wave][nextTableWave+1] = 0xff;

			if ( (effect1[effect][2] & MusicStudio1::kSIDVoiceControl_Mask_Pulse) && nextTablePulse > 0)
			{
				mEnvelopes[effect].mActiveTablePulse = true;
				mEnvelopes[effect].mTablePulse = nextTablePulse;
				mTablesControls[MusicStudio1::kTableIndex_Pulse][nextTablePulse] = effect1[effect][4] & 0x0f;
				mTablesValues[MusicStudio1::kTableIndex_Pulse][nextTablePulse] = effect1[effect][4];
				mTablesControls[MusicStudio1::kTableIndex_Pulse][nextTablePulse+1] = 0xff;
				// TODO: effect1[effect][5] is used for "PULSE WIDTH MODULATION CODE"
			}

			// Handle: ATK NOTE SPECIAL
			if ( (effect1[effect][3] & 0x20)  && nextTableNote > 0 )
			{
				mEnvelopes[effect].mActiveTableNote = true;
				mEnvelopes[effect].mTableNote = nextTableNote;
				if (effect2[effect][1] == 0)
				{
					mTablesControls[MusicStudio1::kTableIndex_Note][nextTableNote] = 0xb0 | (effect1[effect][7] & 0x0f);
					mTablesValues[MusicStudio1::kTableIndex_Note][nextTableNote] = 0;
					mTablesControls[MusicStudio1::kTableIndex_Note][nextTableNote+1] = 0xff;
				}
				else
				{
					mTablesControls[MusicStudio1::kTableIndex_Note][nextTableNote] = 0x10 | (effect1[effect][7] & 0x0f);
					mTablesValues[MusicStudio1::kTableIndex_Note][nextTableNote] = effect2[effect][1];
					mTablesControls[MusicStudio1::kTableIndex_Note][nextTableNote+1] = 0x20;
					mTablesControls[MusicStudio1::kTableIndex_Note][nextTableNote+2] = 0xff;
				}
			}
		}
		

//		OptimiseTables(true);
	}

	return true;
}
コード例 #8
0
void COCCDemoDoc::OnFileNew()
{
  OnNewDocument();
  Start();
}
コード例 #9
0
bool CMusicStudioDoc::LoadGoatTrackerSong(CArchive &ar,const int version)
{
    if (!ar.IsLoading())
    {
        return false;
    }

    OnNewDocument();

    // Get song title, author and release info
    char tempString[33];
    ar.Read(tempString,32);
    tempString[32] = 0;
    mTitleInfo = tempString;
    ar.Read(tempString,32);
    tempString[32] = 0;
    mAuthorInfo = tempString;
    ar.Read(tempString,32);
    tempString[32] = 0;
    mReleasedInfo = tempString;

    mGenericInfo = CString(_T("Originaly converted from the Goat Tracker file: ")) + ar.GetFile()->GetFileName();

    unsigned char tempUChar;
    short tempShort = 0;
    int tempInt = 0;

    unsigned char numSubTunes;

    // Number of sub-tunes
    ar >> numSubTunes;

    // Track data
    ZeroMemory(mTracks,sizeof(mTracks));
    int i,j;

    for (i=0; i<3; i++)
    {
        // Setup something by default
        mTracks[i][0] = MusicStudio1::kMusicPlayer_StopTrack;

        j = 0;
        int realNumSubTunes = numSubTunes;
        while (realNumSubTunes-- > 0)
        {
            unsigned char trackLen;
            ar >> trackLen;

            for (; trackLen>0; trackLen--)
            {
                ar >> tempUChar;
                // Hope that the file doesn't have a lot of blocks
                if (tempUChar < MusicStudio1::kMusicPlayer_RepeatBlock)
                {
                    mTracks[i][j++] = tempUChar;
                }
                else if (tempUChar == 0xff)
                {
                    mTracks[i][j++] = MusicStudio1::kMusicPlayer_StopTrack;
                    // Skip the next
                    ar >> tempUChar;
                }
                else
                {
                    OutputDebugStringA("Unknown\n");
                }
            }

            // Cap off the end of the track
            if (j > 0)
            {
                if (mTracks[i][j-1] < MusicStudio1::kMusicPlayer_RepeatBlock)
                {
                    mTracks[i][j] = MusicStudio1::kMusicPlayer_StopTrack;
                }
            }
        }
コード例 #10
-10
ファイル: belaviewDoc.cpp プロジェクト: philm001/Omni-FEM
void CbelaviewDoc::OnReload() 
{
	// TODO: Add your command handler code here
	CString pname = GetPathName();
	if(pname.GetLength()>0)
	{
		OnNewDocument();
		SetPathName(pname,FALSE);
		OnOpenDocument(pname);
	}
}