daily pastebin goal
15%
SHARE
TWEET

Untitled

a guest Feb 19th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class XMTelestration:
  2.     public InputHandler,
  3.     public enable_defer,
  4.     public std::enable_shared_from_this<XMTelestration>,
  5.     public ControlChannelHubObserver
  6.  
  7. {
  8. private:
  9.  
  10.     const int width = 1024;
  11.     const int height = 1024;
  12.     const float previewScale;
  13.  
  14.     PTR<ControlChannelHub> hub;
  15.     PTR<XMRendererInterface> renderer;
  16.     std::vector<PTR<XMTelestrationNode>> nodes;
  17.     std::stack<PTR<XMTelestrationNode>> undoStack;
  18.     std::map<int, PTR<XMTelestrationLine>> currentDrawings;
  19.     Stroke stroke;
  20.     PortableMutex<std::recursive_mutex> mtx;
  21.    
  22.     PTR<InvokeQueue> updateQueue;
  23.    
  24.    
  25.     PTR<XMTelestrationLine> existingDrawingFor(int index);
  26.  
  27.     struct Layers
  28.     {
  29.         PTR<XMRendererSVGLayer> primary = nullptr;
  30.         PTR<XMRendererSVGLayer> preview = nullptr;
  31.     } layers;
  32.  
  33.     enum UpdateMode { Primary, Preview, Both };
  34.  
  35.     void updateLayers(UpdateMode mode);
  36.  
  37.     virtual void onMessage(ControlChannelHub* hub, PTR<XMUser> sender, ControlMessage* msg) override;
  38.  
  39.     void removeNode(const std::string& nodeId, bool redraw, bool notifyRemote);
  40.     PTR<XMTelestrationNode> getNode(const std::string& nodeId);
  41.  
  42.     virtual void onTouchDown(int index, float x, float y) override;
  43.     virtual void onTouchMoved(int index, float x, float y) override;
  44.     virtual void onTouchReleased(int index) override;
  45.  
  46. public:
  47.     XMTelestration(PTR<ControlChannelHub> hub, const Stroke& stroke, float previewScale);
  48.  
  49.     const std::vector<PTR<XMTelestrationNode>>& getNodes();
  50.     void clear(bool notifyRemote = true);
  51.     void undo();
  52.     void attach(PTR<LayerFactoryInterface> layerFactory, PTR<XMRendererInterface> renderer);
  53.     void detach();
  54.  
  55.     Stroke getStroke();
  56.     void setStroke(const Stroke& stroke);
  57.  
  58.     static PTR<XMTelestration> create(PTR<ControlChannelHub> controlChannelHub, const Stroke& stroke, float previewScale);
  59. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top