예제 #1
0
int GetCreateFileViewPosHistory( clPtr<FS>* Fs, FSPath* Path )
{
	if ( !g_WcmConfig.editSavePos || !Fs || !Fs->Ptr() || !Path )
	{
		return -1;
	}
	
	std::vector<unicode_t> Name = new_unicode_str( (*Fs)->Uri( *Path ).GetUnicode() );
	
	// check if item already exists in the list
	const int Index = g_ViewList.FindByName( Name.data() );
	if ( Index != -1 )
	{
		StrConfig* Cfg = g_ViewList.GetData( Index )->conf.ptr();
		return Cfg->GetIntVal( VIEW_POS );
	}
	
	// collect all needed path information
	PathList::Data Data;
	if ( PathListFSToData( Data, Fs, Path ) )
	{
		AddFileViewToHistory( -1, Data, 0 );
	}
	
	return 0;
}
예제 #2
0
bool GetCreateFileEditPosHistory( clPtr<FS>* Fs, FSPath* Path, sEditorScrollCtx& Ctx )
{
	if ( !g_WcmConfig.editSavePos || !Fs || !Fs->Ptr() || !Path )
	{
		return false;
	}
	
	std::vector<unicode_t> Name = new_unicode_str( (*Fs)->Uri( *Path ).GetUnicode() );
	
	// check if item already exists in the list
	const int Index = g_ViewList.FindByName( Name.data() );
	if ( Index != -1 )
	{
		StrConfig* Cfg = g_ViewList.GetData( Index )->conf.ptr();
		Ctx.m_FirstLine = Cfg->GetIntVal( EDIT_FIRST_LINE );
		Ctx.m_Point.line = Cfg->GetIntVal( EDIT_POINT_LINE );
		Ctx.m_Point.pos = Cfg->GetIntVal( EDIT_POINT_POS );
		return true;
	}
	
	// collect all needed path information
	PathList::Data Data;
	if ( PathListFSToData( Data, Fs, Path ) )
	{
		AddFileEditToHistory( Index, Data, 0, 0, 0 );
	}
	
	return false;
}
예제 #3
0
void UpdateFileViewPosHistory( const unicode_t* Name, const int Pos )
{
	if ( !g_WcmConfig.editSavePos )
	{
		return;
	}
	
	// check if item already exists in the list
	const int Index = g_ViewList.FindByName( Name );
	if ( Index != -1 )
	{
		// copy current data
		PathList::Data Data = *g_ViewList.GetData( Index );

		// update data in the history list
		AddFileViewToHistory( Index, Data, Pos );
	}
}
예제 #4
0
void UpdateFileEditPosHistory( const unicode_t* Name, const sEditorScrollCtx& Ctx )
{
	if ( !g_WcmConfig.editSavePos )
	{
		return;
	}
	
	// check if item already exists in the list
	const int Index = g_ViewList.FindByName( Name );
	if ( Index != -1 )
	{
		// copy current data
		PathList::Data Data = *g_ViewList.GetData( Index );

		// update data in the history list
		AddFileEditToHistory( Index, Data, Ctx.m_FirstLine, Ctx.m_Point.line, Ctx.m_Point.pos );
	}
}