本文整理汇总了C++中UndoManager类的典型用法代码示例。如果您正苦于以下问题:C++ UndoManager类的具体用法?C++ UndoManager怎么用?C++ UndoManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UndoManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: processDragSelection
void SelectionPlugin::onMouseButtonRelease( const MouseButtonEvent& event )
{
if( event.button != MouseButton::Left )
return;
SceneDocument* sceneDocument = (SceneDocument*) editor->getDocument();
sceneDocument->getRenderWindow()->setCursorCapture(false);
editor->getDocument()->getWindow()->flagRedraw();
SelectionOperation* selection = nullptr;
if(selections->dragRectangle)
selection = processDragSelection(event);
else
selection = processSelection(event);
if( !selection ) return;
const SelectionCollection& selected = selections->getSelections();
// Prevent duplication of selection events.
if( selected.isSame(selection->selections) )
{
LogDebug("Ignoring duplicated selection");
Deallocate(selection);
return;
}
selection->redo();
UndoManager* undoManager = sceneDocument->getUndoManager();
undoManager->registerOperation(selection);
}
开发者ID:,项目名称:,代码行数:34,代码来源:
示例2: submitUndo
void GuiRoadEditorCtrl::submitUndo( const UTF8 *name )
{
// Grab the mission editor undo manager.
UndoManager *undoMan = NULL;
if ( !Sim::findObject( "EUndoManager", undoMan ) )
{
Con::errorf( "GuiRoadEditorCtrl::submitUndo() - EUndoManager not found!" );
return;
}
// Setup the action.
GuiRoadEditorUndoAction *action = new GuiRoadEditorUndoAction( name );
action->mObjId = mSelRoad->getId();
action->mBreakAngle = mSelRoad->mBreakAngle;
action->mMaterialName = mSelRoad->mMaterialName;
action->mSegmentsPerBatch = mSelRoad->mSegmentsPerBatch;
action->mTextureLength = mSelRoad->mTextureLength;
action->mRoadEditor = this;
for( U32 i = 0; i < mSelRoad->mNodes.size(); i++ )
{
action->mNodes.push_back( mSelRoad->mNodes[i] );
}
undoMan->addAction( action );
}
开发者ID:AlkexGas,项目名称:Torque3D,代码行数:27,代码来源:guiRoadEditorCtrl.cpp
示例3: deleteSelectedDecal
void GuiDecalEditorCtrl::deleteSelectedDecal()
{
if ( !mSELDecal )
return;
// Grab the mission editor undo manager.
UndoManager *undoMan = NULL;
if ( !Sim::findObject( "EUndoManager", undoMan ) )
{
Con::errorf( "GuiMeshRoadEditorCtrl::on3DMouseDown() - EUndoManager not found!" );
return;
}
// Create the UndoAction.
DIDeleteUndoAction *action = new DIDeleteUndoAction("Delete Decal");
action->deleteDecal( *mSELDecal );
action->mEditor = this;
// Submit it.
undoMan->addAction( action );
if ( isMethod( "onDeleteInstance" ) )
{
char buffer[512];
dSprintf(buffer, 512, "%i", mSELDecal->mId);
Con::executef( this, "onDeleteInstance", String(buffer).c_str(), mSELDecal->mDataBlock->lookupName.c_str() );
}
gDecalManager->removeDecal( mSELDecal );
mSELDecal = NULL;
}
开发者ID:BadBehavior,项目名称:BadBehavior_T3D,代码行数:31,代码来源:guiDecalEditorCtrl.cpp
示例4: getScene
bool Object::destroyRenderer(qlib::uid_t uid)
{
// get renderer ptr/check consistency
rendtab_t::iterator i = m_rendtab.find(uid);
if (i==m_rendtab.end())
return false;
RendererPtr pRend = i->second;
ScenePtr pScene = getScene();
if (pScene.isnull() || pRend.isnull()) {
LOG_DPRINTLN("Object::destroyRenderer> fatal error pScene or pRend is NULL!");
return false;
}
// detach renderer from the view-related resources (DL, VBO, etc)
pRend->unloading();
// Detach the parent scene from the renderer event source
pRend->removeListener(pScene.get());
// Fire the SCE_REND_REMOVING Event, before removing the renderer
{
MB_DPRINTLN("Object> Firing SCE_REND_REMOVING event...");
SceneEvent ev;
ev.setType(SceneEvent::SCE_REND_REMOVING);
ev.setSource(getSceneID());
ev.setTarget(pRend->getUID());
pScene->fireSceneEvent(ev);
}
// remove the rend from the scene's cache list
pScene->removeRendCache(pRend);
// 2012/9/30
// Detach the rend from obj HERE is very important!!
// (This call remove the rend from object's event listener list.
// Otherwise, deleted ptr will remain in the listener list, and thus cause crash!!)
qlib::uid_t objid = pRend->detachObj();
// MB_ASSERT(objid==this->m_uid);
// 2012/9/30
// Setting scene ID to null will cause removing pRend from the scene's listener list
// (Without this, deleted ptr will remain in scene's listener list, after clearing the UNDO data!!)
pRend->setSceneID(qlib::invalid_uid);
// Remove from the renderer table
m_rendtab.erase(i);
// Record undo/redo info
UndoManager *pUM = pScene->getUndoMgr();
if (pUM->isOK()) {
ObjLoadEditInfo *pPEI = MB_NEW ObjLoadEditInfo;
pPEI->setupRendDestroy(getUID(), pRend);
pUM->addEditInfo(pPEI);
}
return true;
}
开发者ID:biochem-fan,项目名称:cuemol2,代码行数:59,代码来源:Object.cpp
示例5: cancel
bool UndoTransaction::commit()
{
if (!m_data)
return false;
TransactionData* data = static_cast<TransactionData*>(m_data.data());
UndoManager* UM = data->UM;
int stackLevel = data->stackLevel;
if (!UM->undoEnabled_)
{
cancel();
return false;
}
UndoObject *tmpu = UM->transactions_.at(stackLevel)->transactionObject;
TransactionState *tmps = UM->transactions_.at(stackLevel)->transactionState;
switch (m_data->m_status)
{
case Transaction::STATE_OPEN:
// qDebug() << "UndoManager::commitTransaction" << data << data->transactionObject->getUName() << data->transactionState->getName() << stackLevel;
m_data->m_status = Transaction::STATE_COMMITTED;
// brutal for now:
assert (stackLevel + 1 == signed(UM->transactions_.size()));
if (stackLevel < signed(UM->transactions_.size()))
{
UM->transactions_.erase(UM->transactions_.begin() + stackLevel);
}
if (tmps->sizet() > 0) // are there any actions inside the committed transaction
{
if (tmps->getName().isEmpty())
tmps->useActionName();
UM->action(tmpu, tmps);
} // if not just delete objects
else
{
delete tmpu;
tmpu = 0;
delete tmps;
tmps = 0;
}
return true;
break;
case STATE_WILLFAIL:
return cancel();
break;
default:
// qDebug() << "UndoManager::commitTransaction ** already closed **";
// nothing
break;
}
return false;
}
开发者ID:Fahad-Alsaidi,项目名称:scribus-svn,代码行数:56,代码来源:undotransaction.cpp
示例6: retargetDecalDatablock
void GuiDecalEditorCtrl::retargetDecalDatablock( String dbFrom, String dbTo )
{
DecalData * ptrFrom = dynamic_cast<DecalData*> ( Sim::findObject(dbFrom.c_str()) );
DecalData * ptrTo = dynamic_cast<DecalData*> ( Sim::findObject(dbTo.c_str()) );
if( !ptrFrom || !ptrTo )
return;
// Grab the mission editor undo manager.
UndoManager *undoMan = NULL;
if ( !Sim::findObject( "EUndoManager", undoMan ) )
{
Con::errorf( "GuiMeshRoadEditorCtrl::on3DMouseDown() - EUndoManager not found!" );
return;
}
// Create the UndoAction.
DBRetargetUndoAction *action = new DBRetargetUndoAction("Retarget Decal Datablock");
action->mEditor = this;
action->mDBFromId = ptrFrom->getId();
action->mDBToId = ptrTo->getId();
Vector<DecalInstance*> mDecalQueue;
Vector<DecalInstance *>::iterator iter;
mDecalQueue.clear();
const Vector<DecalSphere*> &grid = gDecalManager->getDecalDataFile()->getSphereList();
for ( U32 i = 0; i < grid.size(); i++ )
{
const DecalSphere *decalSphere = grid[i];
mDecalQueue.merge( decalSphere->mItems );
}
for ( iter = mDecalQueue.begin();iter != mDecalQueue.end();iter++ )
{
if( !(*iter) )
continue;
if( (*iter)->mDataBlock->lookupName.compare( dbFrom ) == 0 )
{
if( (*iter)->mId != -1 )
{
action->retargetDecal((*iter));
(*iter)->mDataBlock = ptrTo;
forceRedraw((*iter));
}
}
}
undoMan->addAction( action );
}
开发者ID:BadBehavior,项目名称:BadBehavior_T3D,代码行数:50,代码来源:guiDecalEditorCtrl.cpp
示例7: AssertFatal
void ForestTool::_submitUndo( UndoAction *action )
{
AssertFatal( action, "ForestTool::_submitUndo() - No undo action!" );
// Grab the mission editor undo manager.
UndoManager *undoMan = NULL;
if ( !Sim::findObject( "EUndoManager", undoMan ) )
{
Con::errorf( "ForestTool::_submitUndo() - EUndoManager not found!" );
return;
}
undoMan->addAction( action );
mEditor->updateCollision();
}
开发者ID:03050903,项目名称:Torque3D,代码行数:16,代码来源:forestTool.cpp
示例8: GetActiveProject
// ApplyChain returns true on success, false otherwise.
// Any error reporting to the user has already been done.
bool BatchCommands::ApplyChain(const wxString & filename)
{
mFileName = filename;
unsigned int i;
bool res = true;
mAbort = false;
for (i = 0; i < mCommandChain.GetCount(); i++) {
if (!ApplyCommandInBatchMode(mCommandChain[i], mParamsChain[i]) || mAbort) {
res = false;
break;
}
}
mFileName.Empty();
AudacityProject *proj = GetActiveProject();
if (!res)
{
if(proj) {
// Chain failed or was cancelled; revert to the previous state
UndoManager *um = proj->GetUndoManager();
proj->SetStateTo(um->GetCurrentState());
}
return false;
}
// Chain was successfully applied; save the new project state
wxString longDesc, shortDesc;
wxString name = gPrefs->Read(wxT("/Batch/ActiveChain"), wxEmptyString);
if (name.IsEmpty())
{
longDesc = wxT("Applied batch chain");
shortDesc = wxT("Apply chain");
}
else
{
longDesc = wxString::Format(wxT("Applied batch chain '%s'"), name.c_str());
shortDesc = wxString::Format(wxT("Apply '%s'"), name.c_str());
}
if (!proj)
return false;
proj->PushState(longDesc, shortDesc);
return true;
}
开发者ID:JordanGraves,项目名称:TabMagic,代码行数:49,代码来源:BatchCommands.cpp
示例9: AssertFatal
void GuiRiverEditorCtrl::deleteSelectedRiver( bool undoAble )
{
AssertFatal( mSelRiver != NULL, "GuiRiverEditorCtrl::deleteSelectedRiver() - No River IS selected" );
// Not undoAble? Just delete it.
if ( !undoAble )
{
mSelRiver->deleteObject();
mIsDirty = true;
Con::executef( this, "onRiverSelected" );
mSelNode = -1;
return;
}
// Grab the mission editor undo manager.
UndoManager *undoMan = NULL;
if ( !Sim::findObject( "EUndoManager", undoMan ) )
{
// Couldn't find it? Well just delete the River.
Con::errorf( "GuiRiverEditorCtrl::on3DMouseDown() - EUndoManager not found!" );
return;
}
else
{
// Create the UndoAction.
MEDeleteUndoAction *action = new MEDeleteUndoAction("Deleted River");
action->deleteObject( mSelRiver );
mIsDirty = true;
// Submit it.
undoMan->addAction( action );
}
// ScriptCallback with 'NULL' parameter for no River currently selected.
Con::executef( this, "onRiverSelected" );
// Clear the SelectedNode (it has been deleted along with the River).
setSelectedNode( -1 );
mSelNode = -1;
// SelectedRiver is a SimObjectPtr and will be NULL automatically.
}
开发者ID:adhistac,项目名称:ee-client-2-0,代码行数:43,代码来源:guiRiverEditorCtrl.cpp
示例10: CompoundUndoAction
void ForestEditorCtrl::deleteMeshSafe( ForestItemData *mesh )
{
UndoManager *undoMan = NULL;
if ( !Sim::findObject( "EUndoManager", undoMan ) )
{
Con::errorf( "ForestEditorCtrl::deleteMeshSafe() - EUndoManager not found." );
return;
}
// CompoundUndoAction which will delete the ForestItemData, ForestItem(s), and ForestBrushElement(s).
CompoundUndoAction *compoundAction = new CompoundUndoAction( "Delete Forest Mesh" );
// Find ForestItem(s) referencing this datablock and add their deletion
// to the undo action.
if ( mForest )
{
Vector<ForestItem> foundItems;
mForest->getData()->getItems( mesh, &foundItems );
ForestDeleteUndoAction *itemAction = new ForestDeleteUndoAction( mForest->getData(), this );
itemAction->removeItem( foundItems );
compoundAction->addAction( itemAction );
}
// Find ForestBrushElement(s) referencing this datablock.
SimGroup *brushGroup = ForestBrush::getGroup();
sKey = mesh;
Vector<SimObject*> foundElements;
brushGroup->findObjectByCallback( &findMeshReferences, foundElements );
// Add UndoAction to delete the ForestBrushElement(s) and the ForestItemData.
MEDeleteUndoAction *elementAction = new MEDeleteUndoAction();
elementAction->deleteObject( foundElements );
elementAction->deleteObject( mesh );
// Add compound action to the UndoManager. Done.
undoMan->addAction( compoundAction );
updateCollision();
}
开发者ID:campadrenalin,项目名称:terminal-overload,代码行数:40,代码来源:forestEditorCtrl.cpp
示例11: MoveAllSelectedEffects
void EffectLayer::MoveAllSelectedEffects(int deltaMS, UndoManager& undo_mgr)
{
std::unique_lock<std::recursive_mutex> locker(lock);
for(int i=0; i<mEffects.size();i++)
{
if(mEffects[i]->GetSelected() == EFFECT_LT_SELECTED && mEffects[i]->GetTagged())
{
if( undo_mgr.GetCaptureUndo() ) {
undo_mgr.CaptureEffectToBeMoved( mParentElement->GetName(), mIndex, mEffects[i]->GetID(),
mEffects[i]->GetStartTimeMS(), mEffects[i]->GetEndTimeMS() );
}
mEffects[i]->SetStartTimeMS( mEffects[i]->GetStartTimeMS() + deltaMS);
}
else if(mEffects[i]->GetSelected() == EFFECT_RT_SELECTED && mEffects[i]->GetTagged())
{
if( undo_mgr.GetCaptureUndo() ) {
undo_mgr.CaptureEffectToBeMoved( mParentElement->GetName(), mIndex, mEffects[i]->GetID(),
mEffects[i]->GetStartTimeMS(), mEffects[i]->GetEndTimeMS() );
}
mEffects[i]->SetEndTimeMS( mEffects[i]->GetEndTimeMS() + deltaMS);
}
else if(mEffects[i]->GetSelected() == EFFECT_SELECTED && mEffects[i]->GetTagged())
{
if( undo_mgr.GetCaptureUndo() ) {
undo_mgr.CaptureEffectToBeMoved( mParentElement->GetName(), mIndex, mEffects[i]->GetID(),
mEffects[i]->GetStartTimeMS(), mEffects[i]->GetEndTimeMS() );
}
mEffects[i]->SetStartTimeMS( mEffects[i]->GetStartTimeMS() + deltaMS);
mEffects[i]->SetEndTimeMS( mEffects[i]->GetEndTimeMS() + deltaMS);
}
mEffects[i]->SetTagged(false);
}
}
开发者ID:bagumondigi,项目名称:xLights,代码行数:33,代码来源:EffectLayer.cpp
示例12: AssertFatal
void GuiRoadEditorCtrl::deleteSelectedRoad( bool undoAble )
{
AssertFatal( mSelRoad != NULL, "GuiRoadEditorCtrl::deleteSelectedRoad() - No road IS selected" );
// Not undo-able? Just delete it.
if ( !undoAble )
{
DecalRoad *lastRoad = mSelRoad;
setSelectedRoad(NULL);
lastRoad->deleteObject();
mIsDirty = true;
return;
}
// Grab the mission editor undo manager.
UndoManager *undoMan = NULL;
if ( !Sim::findObject( "EUndoManager", undoMan ) )
{
// Couldn't find it? Well just delete the road.
Con::errorf( "GuiRoadEditorCtrl::on3DMouseDown() - EUndoManager not found!" );
return;
}
else
{
DecalRoad *lastRoad = mSelRoad;
setSelectedRoad(NULL);
// Create the UndoAction.
MEDeleteUndoAction *action = new MEDeleteUndoAction("Deleted Road");
action->deleteObject( lastRoad );
mIsDirty = true;
// Submit it.
undoMan->addAction( action );
}
}
开发者ID:AlkexGas,项目名称:Torque3D,代码行数:39,代码来源:guiRoadEditorCtrl.cpp
示例13: ShownScene
void SceneStructureWindow::SetShownScene(const ScenePtr &newScene)
{
if (!scene.expired() && newScene == scene.lock())
return;
ScenePtr previous = ShownScene();
if (previous)
{
disconnect(previous.get());
Clear();
}
scene = newScene;
treeWidget->SetScene(newScene);
if (newScene)
{
// Now that treeWidget has scene, it also has UndoManager.
UndoManager *undoMgr = treeWidget->GetUndoManager();
undoButton_->setMenu(undoMgr->UndoMenu());
redoButton_->setMenu(undoMgr->RedoMenu());
connect(undoMgr, SIGNAL(CanUndoChanged(bool)), this, SLOT(SetUndoEnabled(bool)), Qt::UniqueConnection);
connect(undoMgr, SIGNAL(CanRedoChanged(bool)), this, SLOT(SetRedoEnabled(bool)), Qt::UniqueConnection);
connect(undoButton_, SIGNAL(clicked()), undoMgr, SLOT(Undo()), Qt::UniqueConnection);
connect(redoButton_, SIGNAL(clicked()), undoMgr, SLOT(Redo()), Qt::UniqueConnection);
Scene* s = ShownScene().get();
connect(s, SIGNAL(EntityAcked(Entity *, entity_id_t)), SLOT(AckEntity(Entity *, entity_id_t)));
connect(s, SIGNAL(EntityCreated(Entity *, AttributeChange::Type)), SLOT(AddEntity(Entity *)));
connect(s, SIGNAL(EntityTemporaryStateToggled(Entity *, AttributeChange::Type)), SLOT(UpdateEntityTemporaryState(Entity *)));
connect(s, SIGNAL(EntityRemoved(Entity *, AttributeChange::Type)), SLOT(RemoveEntity(Entity *)));
connect(s, SIGNAL(ComponentAdded(Entity *, IComponent *, AttributeChange::Type)), SLOT(AddComponent(Entity *, IComponent *)));
connect(s, SIGNAL(ComponentRemoved(Entity *, IComponent *, AttributeChange::Type)), SLOT(RemoveComponent(Entity *, IComponent *)));
connect(s, SIGNAL(SceneCleared(Scene*)), SLOT(Clear()));
Populate();
}
}
开发者ID:360degrees-fi,项目名称:tundra,代码行数:38,代码来源:SceneStructureWindow.cpp
示例14: DeleteSelectedEffects
void EffectLayer::DeleteSelectedEffects(UndoManager& undo_mgr)
{
std::unique_lock<std::recursive_mutex> locker(lock);
for (std::vector<Effect*>::iterator it = mEffects.begin(); it != mEffects.end(); it++) {
if ((*it)->GetSelected() != EFFECT_NOT_SELECTED) {
IncrementChangeCount((*it)->GetStartTimeMS(), (*it)->GetEndTimeMS());
undo_mgr.CaptureEffectToBeDeleted( mParentElement->GetName(), mIndex, (*it)->GetEffectName(),
(*it)->GetSettingsAsString(), (*it)->GetPaletteAsString(),
(*it)->GetStartTimeMS(), (*it)->GetEndTimeMS(),
(*it)->GetSelected(), (*it)->GetProtected() );
}
}
mEffects.erase(std::remove_if(mEffects.begin(), mEffects.end(),ShouldDeleteSelected),mEffects.end());
}
开发者ID:bagumondigi,项目名称:xLights,代码行数:14,代码来源:EffectLayer.cpp
示例15: deleteDecalDatablock
void GuiDecalEditorCtrl::deleteDecalDatablock( String lookupName )
{
DecalData * datablock = dynamic_cast<DecalData*> ( Sim::findObject(lookupName.c_str()) );
if( !datablock )
return;
// Grab the mission editor undo manager.
UndoManager *undoMan = NULL;
if ( !Sim::findObject( "EUndoManager", undoMan ) )
{
Con::errorf( "GuiMeshRoadEditorCtrl::on3DMouseDown() - EUndoManager not found!" );
return;
}
// Create the UndoAction.
DBDeleteUndoAction *action = new DBDeleteUndoAction("Delete Decal Datablock");
action->mEditor = this;
action->mDatablockId = datablock->getId();
Vector<DecalInstance*> mDecalQueue;
Vector<DecalInstance *>::iterator iter;
mDecalQueue.clear();
const Vector<DecalSphere*> &grid = gDecalManager->getDecalDataFile()->getSphereList();
for ( U32 i = 0; i < grid.size(); i++ )
{
const DecalSphere *decalSphere = grid[i];
mDecalQueue.merge( decalSphere->mItems );
}
for ( iter = mDecalQueue.begin();iter != mDecalQueue.end();iter++ )
{
if( !(*iter) )
continue;
if( (*iter)->mDataBlock->lookupName.compare( lookupName ) == 0 )
{
if( (*iter)->mId != -1 )
{
//make sure to call onDeleteInstance as well
if ( isMethod( "onDeleteInstance" ) )
{
char buffer[512];
dSprintf(buffer, 512, "%i", (*iter)->mId);
Con::executef( this, "onDeleteInstance", String(buffer).c_str(), (*iter)->mDataBlock->lookupName.c_str() );
}
action->deleteDecal( *(*iter) );
if( mSELDecal == (*iter) )
mSELDecal = NULL;
if( mHLDecal == (*iter) )
mHLDecal = NULL;
}
gDecalManager->removeDecal( (*iter) );
}
}
undoMan->addAction( action );
mCurrentDecalData = NULL;
}
开发者ID:BadBehavior,项目名称:BadBehavior_T3D,代码行数:63,代码来源:guiDecalEditorCtrl.cpp
示例16: wxMessageBox
//.........这里部分代码省略.........
return;
}
wxString path = gPrefs->Read(wxT("/DefaultOpenPath"), ::wxGetCwd());
wxString prompt = project->GetCleanSpeechMode() ?
_("Select vocal file(s) for batch CleanSpeech Chain...") :
_("Select file(s) for batch processing...");
wxString fileSelector = project->GetCleanSpeechMode() ?
_("Vocal files (*.wav;*.mp3)|*.wav;*.mp3|WAV files (*.wav)|*.wav|MP3 files (*.mp3)|*.mp3") :
_("All files (*.*)|*.*|WAV files (*.wav)|*.wav|AIFF files (*.aif)|*.aif|AU files (*.au)|*.au|MP3 files (*.mp3)|*.mp3|Ogg Vorbis files (*.ogg)|*.ogg|FLAC files (*.flac)|*.flac"
);
FileDialog dlog(this, prompt,
path, wxT(""), fileSelector,
wxFD_OPEN | wxFD_MULTIPLE | wxRESIZE_BORDER);
if (dlog.ShowModal() != wxID_OK) {
return;
}
wxArrayString files;
dlog.GetPaths(files);
files.Sort();
wxDialog d(this, wxID_ANY, GetTitle());
ShuttleGui S(&d, eIsCreating);
S.StartVerticalLay(false);
{
S.StartStatic(_("Applying..."), 1);
{
wxImageList *imageList = new wxImageList(9, 16);
imageList->Add(wxIcon(empty_9x16_xpm));
imageList->Add(wxIcon(arrow_xpm));
S.SetStyle(wxSUNKEN_BORDER | wxLC_REPORT | wxLC_HRULES | wxLC_VRULES |
wxLC_SINGLE_SEL);
mList = S.AddListControlReportMode();
mList->AssignImageList(imageList, wxIMAGE_LIST_SMALL);
mList->InsertColumn(0, _("File"), wxLIST_FORMAT_LEFT);
}
S.EndStatic();
S.StartHorizontalLay(wxCENTER, false);
{
S.Id(wxID_CANCEL).AddButton(_("&Cancel"));
}
S.EndHorizontalLay();
}
S.EndVerticalLay();
int i;
for (i = 0; i < (int)files.GetCount(); i++ ) {
mList->InsertItem(i, files[i], i == 0);
}
// Set the column size for the files list.
mList->SetColumnWidth(0, wxLIST_AUTOSIZE);
int width = mList->GetColumnWidth(0);
wxSize sz = mList->GetClientSize();
if (width > sz.GetWidth() && width < 500) {
sz.SetWidth(width);
mList->SetInitialSize(sz);
}
d.Layout();
d.Fit();
d.SetSizeHints(d.GetSize());
d.CenterOnScreen();
d.Move(-1, 0);
d.Show();
Hide();
mBatchCommands.ReadChain(name);
for (i = 0; i < (int)files.GetCount(); i++) {
wxWindowDisabler wd(&d);
if (i > 0) {
//Clear the arrow in previous item.
mList->SetItemImage(i - 1, 0, 0);
}
mList->SetItemImage(i, 1, 1);
mList->EnsureVisible(i);
project->OnRemoveTracks();
project->Import(files[i]);
project->OnSelectAll();
if (!mBatchCommands.ApplyChain()) {
break;
}
if (!d.IsShown() || mAbort) {
break;
}
UndoManager *um = project->GetUndoManager();
um->ClearStates();
}
project->OnRemoveTracks();
}
开发者ID:,项目名称:,代码行数:101,代码来源:
示例17: selectDecal
void GuiDecalEditorCtrl::on3DMouseDragged(const Gui3DMouseEvent & event)
{
if ( !mSELDecal )
return;
// Doing a drag copy of the decal?
if ( event.modifier & SI_SHIFT && !mPerformedDragCopy )
{
mPerformedDragCopy = true;
DecalInstance *newDecal = gDecalManager->addDecal( mSELDecal->mPosition,
mSELDecal->mNormal,
0.0f,
mSELDecal->mDataBlock,
1.0f,
-1,
PermanentDecal | SaveDecal );
newDecal->mTangent = mSELDecal->mTangent;
newDecal->mSize = mSELDecal->mSize;
newDecal->mTextureRectIdx = mSELDecal->mTextureRectIdx;
// TODO: This is crazy... we should move this sort of tracking
// inside of the decal manager... IdDecal flag maybe or just a
// byproduct of PermanentDecal?
//
newDecal->mId = gDecalManager->mDecalInstanceVec.size();
gDecalManager->mDecalInstanceVec.push_back( newDecal );
selectDecal( newDecal );
// Grab the mission editor undo manager.
UndoManager *undoMan = NULL;
if ( Sim::findObject( "EUndoManager", undoMan ) )
{
// Create the UndoAction.
DICreateUndoAction *action = new DICreateUndoAction("Create Decal");
action->addDecal( *mSELDecal );
action->mEditor = this;
undoMan->addAction( action );
if ( isMethod( "onCreateInstance" ) )
{
char buffer[512];
dSprintf( buffer, 512, "%i", mSELDecal->mId );
Con::executef( this, "onCreateInstance", buffer, mSELDecal->mDataBlock->lookupName.c_str());
}
}
}
// Update the Gizmo.
if (mGizmo->getSelection() != Gizmo::None)
{
mGizmo->on3DMouseDragged( event );
// Pull out the Gizmo transform
// and position.
const MatrixF &gizmoMat = mGizmo->getTransform();
const Point3F &gizmoPos = gizmoMat.getPosition();
// Get the new projection vector.
VectorF upVec, rightVec;
gizmoMat.getColumn( 0, &rightVec );
gizmoMat.getColumn( 2, &upVec );
const Point3F &scale = mGizmo->getScale();
// Assign the appropriate changed value back to the decal.
if ( mGizmo->getMode() == ScaleMode )
{
// Save old size.
const F32 oldSize = mSELDecal->mSize;
// Set new size.
mSELDecal->mSize = ( scale.x + scale.y ) * 0.5f;
// See if the decal properly clips/projects at this size. If not,
// stick to the old size.
mSELEdgeVerts.clear();
if ( !gDecalManager->clipDecal( mSELDecal, &mSELEdgeVerts ) )
mSELDecal->mSize = oldSize;
}
else if ( mGizmo->getMode() == MoveMode )
mSELDecal->mPosition = gizmoPos;
else if ( mGizmo->getMode() == RotateMode )
{
mSELDecal->mNormal = upVec;
mSELDecal->mTangent = rightVec;
}
gDecalManager->notifyDecalModified( mSELDecal );
Con::executef( this, "syncNodeDetails" );
}
}
开发者ID:BadBehavior,项目名称:BadBehavior_T3D,代码行数:95,代码来源:guiDecalEditorCtrl.cpp
示例18: setFirstResponder
void GuiDecalEditorCtrl::on3DMouseDown(const Gui3DMouseEvent & event)
{
mPerformedDragCopy = false;
if ( !isFirstResponder() )
setFirstResponder();
bool dblClick = ( event.mouseClickCount > 1 );
// Gather selected decal information
RayInfo ri;
bool hit = getRayInfo( event, &ri );
Point3F start = event.pos;
Point3F end = start + event.vec * 3000.0f; // use visible distance here??
DecalInstance *pDecal = gDecalManager->raycast( start, end );
if( mMode.compare("AddDecalMode") != 0 )
{
if ( mSELDecal )
{
// If our click hit the gizmo we are done.
if ( mGizmo->getSelection() != Gizmo::None )
{
mGizmo->on3DMouseDown( event );
char returnBuffer[256];
dSprintf(returnBuffer, sizeof(returnBuffer), "%f %f %f %f %f %f %f",
mSELDecal->mPosition.x, mSELDecal->mPosition.y, mSELDecal->mPosition.z,
mSELDecal->mTangent.x, mSELDecal->mTangent.y, mSELDecal->mTangent.z,
mSELDecal->mSize);
Con::executef( this, "prepGizmoTransform", Con::getIntArg(mSELDecal->mId), returnBuffer );
return;
}
}
if ( mHLDecal && pDecal == mHLDecal )
{
mHLDecal = NULL;
selectDecal( pDecal );
if ( isMethod( "onSelectInstance" ) )
{
char idBuf[512];
dSprintf(idBuf, 512, "%i", pDecal->mId);
Con::executef( this, "onSelectInstance", String(idBuf).c_str(), pDecal->mDataBlock->lookupName.c_str() );
}
return;
}
else if ( hit && !pDecal)
{
if ( dblClick )
setMode( String("AddDecalMode"), true );
return;
}
}
else
{
// If we accidently hit a decal, then bail(probably an accident). If the use hits the decal twice,
// then boot them into selection mode and select the decal.
if ( mHLDecal && pDecal == mHLDecal )
{
if ( dblClick )
{
mHLDecal = NULL;
selectDecal( pDecal );
if ( isMethod( "onSelectInstance" ) )
{
char idBuf[512];
dSprintf(idBuf, 512, "%i", pDecal->mId);
Con::executef( this, "onSelectInstance", String(idBuf).c_str(), pDecal->mDataBlock->lookupName.c_str() );
}
setMode( String("SelectDecalMode"), true );
}
return;
}
if ( hit && mCurrentDecalData ) // Create a new decal...
{
U8 flags = PermanentDecal | SaveDecal;
DecalInstance *decalInst = gDecalManager->addDecal( ri.point, ri.normal, 0.0f, mCurrentDecalData, 1.0f, -1, flags );
if ( decalInst )
{
// Give the decal an id
decalInst->mId = gDecalManager->mDecalInstanceVec.size();
gDecalManager->mDecalInstanceVec.push_back(decalInst);
selectDecal( decalInst );
// Grab the mission editor undo manager.
UndoManager *undoMan = NULL;
if ( !Sim::findObject( "EUndoManager", undoMan ) )
//.........这里部分代码省略.........
开发者ID:BadBehavior,项目名称:BadBehavior_T3D,代码行数:101,代码来源:guiDecalEditorCtrl.cpp
示例19: setFirstResponder
//.........这里部分代码省略.........
}
}
DecalRoad *newRoad = new DecalRoad;
newRoad->mMaterialName = mMaterialName;
newRoad->registerObject();
// Add to MissionGroup
SimGroup *missionGroup;
if ( !Sim::findObject( "MissionGroup", missionGroup ) )
Con::errorf( "GuiDecalRoadEditorCtrl - could not find MissionGroup to add new DecalRoad" );
else
missionGroup->addObject( newRoad );
newRoad->insertNode( tPos, mDefaultWidth, 0 );
U32 newNode = newRoad->insertNode( tPos, mDefaultWidth, 1 );
// Always add to the end of the road, the first node is the start.
mAddNodeIdx = U32_MAX;
setSelectedRoad( newRoad );
setSelectedNode( newNode );
mMode = mAddNodeMode;
// Disable the hover node while in addNodeMode, we
// don't want some random node enlarged.
mHoverNode = -1;
// Grab the mission editor undo manager.
UndoManager *undoMan = NULL;
if ( !Sim::findObject( "EUndoManager", undoMan ) )
{
Con::errorf( "GuiRoadEditorCtrl::on3DMouseDown() - EUndoManager not found!" );
return;
}
// Create the UndoAction.
MECreateUndoAction *action = new MECreateUndoAction("Create Road");
action->addObject( newRoad );
// Submit it.
undoMan->addAction( action );
//send a callback to script after were done here if one exists
if ( isMethod( "onRoadCreation" ) )
Con::executef( this, "onRoadCreation" );
return;
}
else if ( mMode == mAddNodeMode )
{
// Oops the road got deleted, maybe from an undo action?
// Back to NormalMode.
if ( mSelRoad )
{
// A double-click on a node in Normal mode means set AddNode mode.
if ( clickedNodeIdx == 0 )
{
submitUndo( "Add Node" );
mAddNodeIdx = clickedNodeIdx;
mMode = mAddNodeMode;
mSelNode = mSelRoad->insertNode( tPos, mDefaultWidth, mAddNodeIdx );
开发者ID:AlkexGas,项目名称:Torque3D,代码行数:67,代码来源:guiRoadEditorCtrl.cpp
示例20: WXUNUSED
//.........这里部分代码省略.........
if (dlog.ShowModal() != wxID_OK) {
return;
}
wxArrayString files;
dlog.GetPaths(files);
files.Sort();
wxDialog * pD = safenew wxDialog(this, wxID_ANY, GetTitle());
pD->SetName(pD->GetTitle());
ShuttleGui S(pD, eIsCreating);
S.StartVerticalLay(false);
{
S.StartStatic(_("Applying..."), 1);
{
wxImageList *imageList = new wxImageList(9, 16);
imageList->Add(wxIcon(empty9x16_xpm));
imageList->Add(wxIcon(arrow_xpm));
S.SetStyle(wxSUNKEN_BORDER | wxLC_REPORT | wxLC_HRULES | wxLC_VRULES |
wxLC_SINGLE_SEL);
mList = S.Id(CommandsListID).AddListControlReportMode();
mList->AssignImageList(imageList, wxIMAGE_LIST_SMALL);
mList->InsertColumn(0, _("File"), wxLIST_FORMAT_LEFT);
}
S.EndStatic();
S.StartHorizontalLay(wxCENTER, false);
{
S.Id(wxID_CANCEL).AddButton(_("&Cancel"));
}
S.EndHorizontalLay();
}
S.EndVerticalLay();
int i;
for (i = 0; i < (int)files.GetCount(); i++ ) {
mList->InsertItem(i, files[i], i == 0);
}
// Set the column size for the files list.
mList->SetColumnWidth(0, wxLIST_AUTOSIZE);
int width = mList->GetColumnWidth(0);
wxSize sz = mList->GetClientSize();
if (width > sz.GetWidth() && width < 500) {
sz.SetWidth(width);
mList->SetInitialSize(sz);
}
pD->Layout();
pD->Fit();
pD->SetSizeHints(pD->GetSize());
pD->CenterOnScreen();
pD->Move(-1, 0);
pD->Show();
Hide();
mBatchCommands.ReadChain(name);
for (i = 0; i < (int)files.GetCount(); i++) {
wxWindowDisabler wd(pD);
if (i > 0) {
//Clear the arrow in previous item.
mList->SetItemImage(i - 1, 0, 0);
}
mList->SetItemImage(i, 1, 1);
mList->EnsureVisible(i);
project->Import(files[i]);
project->OnSelectAll();
if (!mBatchCommands.ApplyChain()) {
break;
}
if (!pD->IsShown() || mAbort) {
break;
}
UndoManager *um = project->GetUndoManager();
um->ClearStates();
project->OnSelectAll();
project->OnRemoveTracks();
}
project->OnRemoveTracks();
// Under Linux an EndModal() here crashes (Bug #1221).
// But sending a close message instead is OK.
#if !defined(__WXMAC__)
wxCloseEvent Evt;
Evt.SetId( wxID_OK );
Evt.SetEventObject( this);
ProcessWindowEvent( Evt );
#else
EndModal(wxID_OK);
#endif
// Raise myself again, and the parent window with me
Show();
}
开发者ID:AkiraShirase,项目名称:audacity,代码行数:101,代码来源:BatchProcessDialog.cpp
注:本文中的UndoManager类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论