bool RageFileDriverDirect::Remove( const RString &sPath_ )
{
	RString sPath = sPath_;
	FDB->ResolvePath( sPath );
	switch( this->GetFileType(sPath) )
	{
	case RageFileManager::TYPE_FILE:
		TRACE( ssprintf("remove '%s'", (m_sRoot + sPath).c_str()) );
		if( DoRemove(m_sRoot + sPath) == -1 )
		{
			WARN( ssprintf("remove(%s) failed: %s", (m_sRoot + sPath).c_str(), strerror(errno)) );
			return false;
		}
		FDB->DelFile( sPath );
		return true;

	case RageFileManager::TYPE_DIR:
		TRACE( ssprintf("rmdir '%s'", (m_sRoot + sPath).c_str()) );
		if( DoRmdir(m_sRoot + sPath) == -1 )
		{
			WARN( ssprintf("rmdir(%s) failed: %s", (m_sRoot + sPath).c_str(), strerror(errno)) );
			return false;
		}
		FDB->DelFile( sPath );
		return true;

	case RageFileManager::TYPE_NONE: return false;
	default: ASSERT(0); return false;
	}
}
示例#2
0
void Scene::Remove(Interactor* i) {
    DoRemove(i);
    i->parent = nil;
    if (i->canvas != nil) {
	Unmap(i);
	i->Orphan();
    }
}
//--------------------------------------------------------------------
//--------------------------------------------------------------------
//
void CPosLmNameIndex::Remove( TPosLmItemId aLmid )
    {
    TInt index = Find( aLmid );
    if ( index >= 0 )
        {
        DoRemove( index );
        }
    }
示例#4
0
bool wxMenuBase::DoDestroy(wxMenuItem *item)
{
    wxMenuItem *item2 = DoRemove(item);
    wxCHECK_MSG( item2, false, wxT("failed to delete menu item") );

    delete item2;

    return true;
}
示例#5
0
 virtual bool RemoveAll()
 {
     wxFSWatchEntries::iterator it = m_watches.begin();
     for ( ; it != m_watches.end(); ++it )
     {
         (void) DoRemove(it->second);
     }
     m_watches.clear();
     return true;
 }
示例#6
0
void Scene::Remove (Interactor* i) {
    DoRemove(i);
    i->parent = nil;
    if (i->canvas != nil) {
	Unmap(i);
	if (i->GetInteractorType() != InteriorInteractor) {
	    i->Deactivate();
	}
	Orphan(i);
    }
}
示例#7
0
bool wxMenuBase::DoDelete(wxMenuItem *item)
{
    wxMenuItem *item2 = DoRemove(item);
    wxCHECK_MSG( item2, false, wxT("failed to delete menu item") );

    // don't delete the submenu
    item2->SetSubMenu((wxMenu *)NULL);

    delete item2;

    return true;
}
示例#8
0
void DisplayList::RemoveObject(SObject* parent, U16 depth)
{
	// See if there is already an object at this depth or find the insertion point
	SObject* obj;
	SObject** link = &parent->bottomChild;
	for (;;) {
		obj = *link;
		if ( !obj ) break;
	 	if ( obj->depth >= depth ) 
			break;
		link = &obj->above;
	}

	if ( obj && obj->depth == depth )
		DoRemove(link);
}
示例#9
0
long ProjectPrefsGUI::HandleListDelItem(NativeControl Handle, NativeGUIWin NW, int CtrlID, void *ItemData)
{
if (NW == NativeWin)
	{
	switch (CtrlID)
		{
		case IDC_PARLIST:
			{
			DoRemove();
			break;
			} // IDC_PARLIST
		} // switch
	} // if

return(0);
} // ProjectPrefsGUI::HandleListDelItem
示例#10
0
wxMenuItem *wxMenuBase::Remove(wxMenuItem *item)
{
    wxCHECK_MSG( item, NULL, wxT("invalid item in wxMenu::Remove") );

    wxMenuItemList::compatibility_iterator node = m_items.Find(item);

    // if we get here, the item is valid or one of Remove() functions is broken
    wxCHECK_MSG( node, NULL, wxT("removing item not in the menu?") );

    // call DoRemove() before removing the item from the list of items as the
    // existing code in port-specific implementation may rely on the item still
    // being there (this is the case for at least wxMSW)
    wxMenuItem* const item2 = DoRemove(item);

    // we detach the item, but we do delete the list node (i.e. don't call
    // DetachNode() here!)
    m_items.Erase(node);

    return item2;
}
//--------------------------------------------------------------------
//--------------------------------------------------------------------
//
void CPosLmNameIndex::UpdateL( TPosLmItemId aLmid, HBufC* aName )
    {
    TInt index = Find( aLmid );
    if ( index >= 0 )
        {
        CIndexItem* entry = iArray->At( index );
        // if name is exactly same, no need to change anything
        if ( entry->Name().Compare( *aName ) != 0 )
            {
            DoRemove( index );
            InsertL( aLmid, aName );
            }
        else
            {
            delete aName;
            }
        }
    else
        {
        delete aName;
        }
    }
示例#12
0
wxMenuItem *wxMenuBase::Remove(wxMenuItem *item)
{
    wxCHECK_MSG( item, NULL, wxT("invalid item in wxMenu::Remove") );

    return DoRemove(item);
}
示例#13
0
	bool Remove(const key_type& key)
		{ return DoRemove(key); }
RageFileObjDirect::~RageFileObjDirect()
{
	bool bFailed = !FinalFlush();
	
	if( m_iFD != -1 )
	{
		if( close( m_iFD ) == -1 )
		{
			WARN( ssprintf("Error closing %s: %s", this->m_sPath.c_str(), strerror(errno)) );
			SetError( strerror(errno) );
			bFailed = true;
		}
	}

	if( !(m_iMode & RageFile::WRITE) || (m_iMode & RageFile::STREAMED) )
		return;

	/* We now have path written to MakeTempFilename(m_sPath).
	 * Rename the temporary file over the real path. */

	do
	{
		if( bFailed || WriteFailed() )
			break;

		/* We now have path written to MakeTempFilename(m_sPath). Rename the
		 * temporary file over the real path. This should be an atomic operation
		 * with a journalling filesystem. That is, there should be no
		 * intermediate state a JFS might restore the file we're writing (in the
		 * case of a crash/powerdown) to an empty or partial file. */

		RString sOldPath = MakeTempFilename(m_sPath);
		RString sNewPath = m_sPath;

#if defined(WIN32)
		if( WinMoveFile(DoPathReplace(sOldPath), DoPathReplace(sNewPath)) )
			return;

		/* We failed. */
		int err = GetLastError();
		const RString error = werr_ssprintf( err, "Error renaming \"%s\" to \"%s\"", sOldPath.c_str(), sNewPath.c_str() );
		WARN( ssprintf("%s", error.c_str()) );
		SetError( error );
		break;
#else
		if( rename( sOldPath, sNewPath ) == -1 )
		{
			WARN( ssprintf("Error renaming \"%s\" to \"%s\": %s", 
					sOldPath.c_str(), sNewPath.c_str(), strerror(errno)) );
			SetError( strerror(errno) );
			break;
		}


		if( m_iMode & RageFile::SLOW_FLUSH )
		{
			RString sError;
			if( !FlushDir(Dirname(m_sPath), sError) )
			{
				WARN( ssprintf("Error synchronizing fsync(%s dir): %s", this->m_sPath.c_str(), sError.c_str()) );
				SetError( sError );
			}
		}

		// Success.
		return;
#endif
	} while(0);

	// The write or the rename failed. Delete the incomplete temporary file.
	DoRemove( MakeTempFilename(m_sPath) );
}
示例#15
0
void DisplayList::FinishHold()
// Compare the old and the new list
// If an old object matches a new object, replace the new object with the old object
{
	FLASHASSERT(holdParent);

	SObject** oldLink = &holdList;
	SObject** newLink = &holdParent->bottomChild;

    for (;;) {
		SObject* oldObj = *oldLink;
		SObject* newObj = *newLink;

		if ( !oldObj )
			break;	// we are done

		if ( !newObj || oldObj->depth < newObj->depth ) {
			if ( oldObj->depth >= 0x4000 ) {
				// This is a cloned object, it always gets copied to the new list
				FLASHASSERT(!newObj);	// none of the new obj's should have a depth > 4000
				*oldLink = oldObj->above;	// remove from old list
				oldObj->above = *newLink;	// place on new list
				*newLink = oldObj;

			} else {
				// Get rid of the old object
				DoRemove(oldLink);
			}

		} else if ( oldObj->depth == newObj->depth ) {
			// Compare these objects
            BOOL remove = true;
			if (oldObj->character == newObj->character && oldObj->ratio == newObj->ratio && oldObj->clipDepth == newObj->clipDepth) 
            {
				// Check the matrix and cxform and ratio
				BOOL moved = !Equal(&oldObj->xform, &newObj->xform);
				if (!moved || oldObj->character->type == spriteChar) 
                {
					if ( moved && !oldObj->puppet) 
                    {
						oldObj->Modify();
						oldObj->xform = newObj->xform;
						//oldObj->ratio = newObj->ratio;
					}

					if ( button == newObj ) 
                    { 
						FLASHASSERT(oldObj->state == buttonState);
						button = oldObj;
						//UpdateButton(obj, state);
					}
                    remove = false;
				}
			}
            else if (
                oldObj->ratio == newObj->ratio && 
                (oldObj->character->type == spriteExternalChar || oldObj->character->type == spriteChar) && 
                (newObj->character->type == spriteChar || newObj->character->type == spriteExternalChar))
            {
                // we are dealing with externally loaded sprite
                // or an empty placeholder. It inherits the 
                // sprite ratio of the sprite we are replacing. 
                // This means that it goes away when the same 
                // time the replaced sprite should have gone away
				
                if (!Equal(&oldObj->xform, &newObj->xform))
                {
                        if (!oldObj->puppet)
                        {
						    oldObj->Modify();
						    oldObj->xform = newObj->xform;
                        }
			    }
                remove = false;
            }
            
            if (!remove)
            {
				DoRemove(newLink);			// delete the new obj
				*oldLink = oldObj->above;	// remove from old list
				oldObj->above = *newLink;	// place on new list
				*newLink = oldObj;
				continue;
            }
			
			newLink = &newObj->above;
			DoRemove(oldLink);

		} else {
			// Just look at the next new object
			FLASHASSERT(oldObj->depth > newObj->depth);
			newLink = &newObj->above;
		}
	}

#ifdef EDITTEXT
	// Update edit texts on hold list
	SObject* obj = holdParent->bottomChild;
	while (obj) {
		if (obj->character && obj->character->type == editTextChar) {
			obj->editText->UpdateFromVariable();
		}
		obj = obj->above;
	}
#endif

    holdParent = 0;
}
示例#16
0
long ProjectPrefsGUI::HandleButtonClick(NativeControl Handle, NativeGUIWin NW, int ButtonID)
{

if (SwapInProgress || MoveInProgress)
	{
	SwapInProgress = MoveInProgress = 0;
#ifdef _WIN32
	if (Curse)
		SetClassLong(GetDlgItem(NativeWin, IDC_PARLIST), GCL_HCURSOR, (long)Curse);
#endif // _WIN32
	EndPointer();
	} // if
switch (ButtonID)
	{
	case ID_KEEP:
		{
		AppScope->MCP->SetParam(1, WCS_TOOLBARCLASS_MODULES, WCS_TOOLBAR_CLOSE_MOD,
			WCS_TOOLBAR_ITEM_PPG, 0);
		break;
		} // 
	case IDCANCEL:
		{
		DoCancel();
		//AppScope->MCP->SetParam(1, WCS_TOOLBARCLASS_MODULES, WCS_TOOLBAR_CLOSE_MOD,
		//	WCS_TOOLBAR_ITEM_PPG, 0);
		break;
		} // 
	case IDC_MATRIX_1:
		{
		SetViewport(0);
		break;
		} // 
	case IDC_MATRIX_2:
		{
		SetViewport(1);
		break;
		} // 
	case IDC_MATRIX_3:
		{
		SetViewport(2);
		break;
		} // 
	case IDC_MATRIX_4:
		{
		SetViewport(3);
		break;
		} // 
	case IDC_MATRIX_5:
		{
		SetViewport(4);
		break;
		} // 
	case IDC_MATRIX_6:
		{
		SetViewport(5);
		break;
		} // 
	case IDC_MATRIX_7:
		{
		SetViewport(6);
		break;
		} // 
	case IDC_MATRIX_8:
		{
		SetViewport(7);
		break;
		} // 
	case IDC_MATRIX_9:
		{
		SetViewport(8);
		break;
		} // 
	case IDC_MATRIX_10:
		{
		SetViewport(9);
		break;
		} // 
	case IDC_MATRIX_11:
		{
		SetViewport(10);
		break;
		} // 
	case IDC_MATRIX_12:
		{
		SetViewport(11);
		break;
		} // 
	case ID_DEFAULT:
		{
		DoDefaultDir();
		break;
		} // 
	case IDC_ADD:
		{
		DoAdd();
		break;
		} // 
	case IDC_MOVEDLUP:
		{
		HandleMove(0); // up
		break;
		} // up
	case IDC_MOVEDLDOWN:
		{
		HandleMove(1); // down
		break;
		} // down
/*
	case IDC_SWAP:
		{
		//DoSwap(0);
		break;
		} // 
	case IDC_MOVE:
		{
		//DoMove(0);
		break;
		} // 
*/
	case IDC_REMOVE:
		{
		DoRemove();
		break;
		} // 
	case IDC_READONLY:
		{
		DoReadOnly();
		break;
		} // 
	case IDC_LOAD:
		{
		DoLoad();
		break;
		} // 
	case IDC_SET:
		{
		DoAdvConfig(1);
		break;
		} // SET
	case IDC_UNSET:
		{
		DoAdvConfig(2);
		break;
		} // IDC_UNSET
	} // switch

return(0);

} // ProjectPrefsGUI::HandleButtonClick