示例#1
0
void AddFolderToHistory( clPtr<FS>* fs, FSPath* path )
{
	if ( fs && fs->Ptr() && path )
	{
		// collect all needed path information
		PathList::Data data;

		if ( PathListFSToData( data, fs, path ) )
		{
			// check if item already exists in the list
			const int index = g_dataList.FindByName( data.name.data() );

			if ( index != -1 )
			{
				// remove existing item
				g_dataList.Remove( index );
			}

			// add item to the and of the list
			g_dataList.Add( data.name.data(), data.conf );

			// limit number of elements in the list
			while ( g_dataList.GetCount() > MAX_FOLDERS_HISTORY_COUNT )
			{
				g_dataList.Remove( 0 );
			}
		}
	}
}
示例#2
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;
}
示例#3
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;
}
示例#4
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 );
	}
}
示例#5
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 );
	}
}