Ticket #96: copy_example.diff

File copy_example.diff, 2.5 KB (added by trompetin17, 10 years ago)
  • source/tools/atlas/AtlasUI/ScenarioEditor/Tools/TransformObject.cpp

     
    167167                obj->GetScenarioEditor().GetObjectSettings().NotifyObservers();
    168168                return true;
    169169            }
     170            else if (evt.GetModifiers() == wxMOD_CONTROL)
     171            {
     172                switch (evt.GetKeyCode())
     173                {
     174                case 'C': //copy
     175                    POST_MESSAGE(SendToClipBoard,(obj->m_lastSelected));
     176                    break;
     177                default:
     178                    break;
     179                }
     180            }
    170181            else
    171182                return false;
    172183        }
     
    203214                SET_STATE(Waiting);
    204215
    205216                return true;
     217            }
     218            else if (evt.GetModifiers() == wxMOD_CONTROL)
     219            {
     220                switch (evt.GetKeyCode())
     221                {
     222                case 'C': //copy
     223                    POST_MESSAGE(SendToClipBoard,(obj->m_lastSelected));
     224                    break;
     225                default:
     226                    break;
     227                }
    206228            }
    207229            else
    208230                return false;
  • source/tools/atlas/GameInterface/Handlers/ObjectHandlers.cpp

     
    4949#include "simulation2/components/ICmpTemplateManager.h"
    5050#include "simulation2/components/ICmpVisual.h"
    5151#include "simulation2/helpers/Selection.h"
     52#include "simulation2/system/ParamNode.h"
     53#include "lib/sysdep/clipboard.h"
    5254
    5355
    5456namespace AtlasMessage {
     
    754756    AtlasView::GetView_Game()->SetBandbox(msg->show, (float)msg->sx0, (float)msg->sy0, (float)msg->sx1, (float)msg->sy1);
    755757}
    756758
     759MESSAGEHANDLER(SendToClipBoard)
     760{
     761    int selectedObject = msg->id;
     762
     763    CmpPtr<ICmpTemplateManager> cmpTemplateManager(*g_Game->GetSimulation2(), SYSTEM_ENTITY);
     764    if (cmpTemplateManager)
     765    {
     766        const CParamNode* node = cmpTemplateManager->LoadLatestTemplate(selectedObject);
     767
     768        std::wstring xml = node->ToXML();
     769
     770        sys_clipboard_set(xml.c_str());
     771    }
    757772}
     773}
  • source/tools/atlas/GameInterface/Messages.h

     
    628628        ((bool, lines))
    629629        );
    630630
     631MESSAGE(SendToClipBoard,
     632        ((int,id)));
     633
    631634//////////////////////////////////////////////////////////////////////////
    632635
    633636enum eTriggerListType