GME  13
PendingObjectPosRequest.cpp
Go to the documentation of this file.
00001 // PendingObjectPosRequest.cpp: implementation of the CPendingObjectPosRequest class.
00002 //
00004 
00005 #include "stdafx.h"
00006 #include "GMEstd.h"
00007 #include "GuiObject.h"
00008 #include "GMEApp.h"
00009 #include "GMEview.h"
00010 #include "guimeta.h"
00011 #include "PendingObjectPosRequest.h"
00012 
00013 #ifdef _DEBUG
00014 #undef THIS_FILE
00015 static char THIS_FILE[]=__FILE__;
00016 #define new DEBUG_NEW
00017 #endif
00018 
00020 // Construction/Destruction
00022 
00023 CPendingObjectPosRequest::~CPendingObjectPosRequest()
00024 {
00025 
00026 }
00027 
00028 void CPendingObjectPosRequest::Execute(CGMEView *view)
00029 {
00030         // TRACE("\tXV: Pending request execute:");
00031         VERIFY(view->inTransaction);
00032         if (!object)
00033                 return;
00034         if (!object->mgaFco)
00035                 return;
00036         if(aspect < 0)
00037                 aspect = object->GetParentAspect();
00038         VERIFY(aspect >= 0);
00039         // TRACE(" object: %s, mgaptr: %p, location: %d-%d\n", object->name, object->mgaFco, (int)location.TopLeft().x, (int)location.TopLeft().y);
00040         try {
00041 
00042                 long status;
00043                 COMTHROW(object->mgaFco->get_Status(&status));
00044                 if (status != OBJECT_EXISTS)
00045                         return;
00046 
00047                 CComPtr<IMgaPart> part;
00048                 CGuiMetaAspect *guiAsp = view->guiMeta->FindAspect(aspect);
00049                 CComPtr<IMgaMetaBase> mBase = guiAsp->mgaMeta;
00050                 CComPtr<IMgaMetaAspect> mAspect;
00051                 COMTHROW(mBase.QueryInterface(&mAspect));
00052                 (object->mgaFco)->get_Part(mAspect,&part);
00053                 COMTHROW(part->SetGmeAttrs(0, location.left, location.top));
00054                 // TRACE(" \t\tEXECUTED\n");
00055         }
00056         catch(hresult_exception &) {
00057                 // AfxMessageBox("Cannot execute pendig request (ObjectPos)!");
00058         }
00059 }