Ejemplo n.º 1
0
 void OnNewUserConnected(ToolRunner pNewToolrunner)
 {
     if (m_canvasWindow.InvokeRequired)
     {
         m_canvasWindow.Invoke(new Controller.ToolrunnerHandler(OnNewUserConnected), pNewToolrunner);
     }
     else
     {
         if (pNewToolrunner.username == Controller.LOCAL_USER)
         {
             //add listeners for all functions that should redraw the main canvas
             pNewToolrunner.AddFunctionListener((pToolRunner, pFuncName, pToken) => { m_canvasWindow.Redraw(pToolRunner); }, "tool_down", "tool_up", "tool_move", "undo", "clear", "reorder_layers", "remove_layer");
             //add listeners for all functions that should rebuild the layer list
             pNewToolrunner.AddFunctionListener((pToolRunner, pFuncName, pToken) => { m_layerControl.RebuildLayerControls(); }, "reorder_layers", "rename_layer", "remove_layer", "create_layer");
             //ToolRunner pTarget, string pFunctionName, JToken inputMessage
             //add listeners for all functions that should update a layer thumbnail
             pNewToolrunner.AddFunctionListener((pToolRunner, pFuncName, pToken) => { m_layerControl.UpdateThumbnail(pToken.Value <string>("layer")); }, "tool_up", "undo", "clear");
             //add listeners for updating the status bar (:
             pNewToolrunner.AddFunctionListener((pA, pB, pC) => { m_mainForm.SetStatus("last action: " + pB); }, "tool_down", "tool_up", "tool_move", "undo", "clear", "reorder_layers", "remove_layer", "create_layer");
         }
         else   //network users don't push so many events
                //add listeners for all functions that should redraw the main canvas
         {
             pNewToolrunner.AddFunctionListener((pToolRunner, pFuncName, pToken) => { m_canvasWindow.Redraw(pToolRunner); }, "tool_up", "undo", "clear", "reorder_layers", "remove_layer");
             //add listeners for all functions that should rebuild the layer list
             pNewToolrunner.AddFunctionListener((pToolRunner, pFuncName, pToken) => { m_layerControl.RebuildLayerControls(); }, "reorder_layers", "rename_layer", "remove_layer", "create_layer");
             //ToolRunner pTarget, string pFunctionName, JToken inputMessage
             //add listeners for all functions that should update a layer thumbnail
             pNewToolrunner.AddFunctionListener((pToolRunner, pFuncName, pToken) => { m_layerControl.UpdateThumbnail(pToken.Value <string>("layer")); }, "tool_up", "undo", "clear");
         }
     }
 }
Ejemplo n.º 2
0
        //-------------------------------------------------------------------------
        // Constructor
        //-------------------------------------------------------------------------
        public CanvasSession(MainForm pMainForm, CanvasWindow pCanvasWindow, LayerControlForm pLayerControlForm)
        {
            m_toolRunner             = new ToolRunner("localUserInput", pCanvasWindow.GetPicture());
            m_mainForm               = pMainForm;
            m_canvasWindow           = pCanvasWindow;
            m_canvasWindow.m_session = this;
            m_layerControl           = pLayerControlForm;

            //setup first layer
            selectedLayerID = Gui_CreateLayer();
            Gui_ClearSelectedLayer();

            //add listeners for all functions that should redraw the main canvas
            m_toolRunner.AddFunctionListener((pA, pB, pC) => { m_canvasWindow.Redraw(pA); }, "tool_down", "tool_up", "tool_move", "undo", "clear", "reorder_layers", "remove_layer");

            //add listeners for all functions that should rebuild the layer list
            m_toolRunner.AddFunctionListener((pA, pB, pC) => { m_layerControl.RebuildLayerControls(); }, "reorder_layers", "rename_layer", "remove_layer", "create_layer");

            //add listeners for all functions that should update a layer thumbnail
            m_toolRunner.AddFunctionListener((pA, pB, pC) => { m_layerControl.UpdateThumbnail(pC["layer"] as string); }, "tool_up", "undo", "clear");

            //add listeners for updating the status bar (:
            m_toolRunner.AddFunctionListener((pA, pB, pC) => { m_mainForm.SetStatus("last action: " + pB); }, "tool_down", "tool_up", "tool_move", "undo", "clear", "reorder_layers", "remove_layer", "create_layer");
        }
        //-------------------------------------------------------------------------
        // Constructor
        //-------------------------------------------------------------------------
        public CanvasSession(MainForm pMainForm, CanvasWindow pCanvasWindow, LayerControlForm pLayerControlForm)
        {
            m_toolRunner = new ToolRunner("localUserInput", pCanvasWindow.GetPicture());
            m_mainForm = pMainForm;
            m_canvasWindow = pCanvasWindow;
            m_canvasWindow.m_session = this;
            m_layerControl = pLayerControlForm;

            //setup first layer
            selectedLayerID = Gui_CreateLayer();
            Gui_ClearSelectedLayer();

            //add listeners for all functions that should redraw the main canvas
            m_toolRunner.AddFunctionListener( (pA, pB, pC) => { m_canvasWindow.Redraw(pA); }, "tool_down", "tool_up", "tool_move", "undo", "clear", "reorder_layers", "remove_layer");

            //add listeners for all functions that should rebuild the layer list
            m_toolRunner.AddFunctionListener((pA, pB, pC) => { m_layerControl.RebuildLayerControls(); }, "reorder_layers", "rename_layer", "remove_layer", "create_layer");

            //add listeners for all functions that should update a layer thumbnail
            m_toolRunner.AddFunctionListener((pA, pB, pC) => { m_layerControl.UpdateThumbnail(pC["layer"] as string); }, "tool_up", "undo", "clear");

            //add listeners for updating the status bar (:
            m_toolRunner.AddFunctionListener((pA, pB, pC) => { m_mainForm.SetStatus("last action: " + pB); }, "tool_down", "tool_up", "tool_move", "undo", "clear", "reorder_layers", "remove_layer", "create_layer");
        }
Ejemplo n.º 4
0
 public PointerTool(ToolRunner pController)
     : base(pController)
 {
 }
Ejemplo n.º 5
0
 public BrushTool(ToolRunner pController)
     : base(pController)
 {
 }
Ejemplo n.º 6
0
        void OnNewUserConnected(ToolRunner pNewToolrunner)
        {
            if (m_canvasWindow.InvokeRequired) {
                m_canvasWindow.Invoke(new Controller.ToolrunnerHandler(OnNewUserConnected), pNewToolrunner);
            }
            else {
                if (pNewToolrunner.username == Controller.LOCAL_USER) {
                    //add listeners for all functions that should redraw the main canvas
                    pNewToolrunner.AddFunctionListener((pToolRunner, pFuncName, pToken) => { m_canvasWindow.Redraw(pToolRunner); }, "tool_down", "tool_up", "tool_move", "undo", "clear", "reorder_layers", "remove_layer");
                    //add listeners for all functions that should rebuild the layer list
                    pNewToolrunner.AddFunctionListener((pToolRunner, pFuncName, pToken) => { m_layerControl.RebuildLayerControls(); }, "reorder_layers", "rename_layer", "remove_layer", "create_layer");
                    //ToolRunner pTarget, string pFunctionName, JToken inputMessage
                    //add listeners for all functions that should update a layer thumbnail
                    pNewToolrunner.AddFunctionListener((pToolRunner, pFuncName, pToken) => { m_layerControl.UpdateThumbnail(pToken.Value<string>("layer")); }, "tool_up", "undo", "clear");
                    //add listeners for updating the status bar (:
                    pNewToolrunner.AddFunctionListener((pA, pB, pC) => { m_mainForm.SetStatus("last action: " + pB); }, "tool_down", "tool_up", "tool_move", "undo", "clear", "reorder_layers", "remove_layer", "create_layer");
                }
                else { //network users don't push so many events
                    //add listeners for all functions that should redraw the main canvas
                    pNewToolrunner.AddFunctionListener((pToolRunner, pFuncName, pToken) => { m_canvasWindow.Redraw(pToolRunner); }, "tool_up", "undo", "clear", "reorder_layers", "remove_layer");
                    //add listeners for all functions that should rebuild the layer list
                    pNewToolrunner.AddFunctionListener((pToolRunner, pFuncName, pToken) => { m_layerControl.RebuildLayerControls(); }, "reorder_layers", "rename_layer", "remove_layer", "create_layer");
                    //ToolRunner pTarget, string pFunctionName, JToken inputMessage
                    //add listeners for all functions that should update a layer thumbnail
                    pNewToolrunner.AddFunctionListener((pToolRunner, pFuncName, pToken) => { m_layerControl.UpdateThumbnail(pToken.Value<string>("layer")); }, "tool_up", "undo", "clear");
                }

            }
        }
Ejemplo n.º 7
0
 public PenTool(ToolRunner pController)
     : base(pController)
 {
 }
 public void Redraw(ToolRunner pController)
 {
     canvasBox.Invalidate(true);
     canvasBox.Update();
 }
Ejemplo n.º 9
0
 public PointerTool(ToolRunner pController) : base(pController)
 {
 }
Ejemplo n.º 10
0
 public class Options { } //base class for all tool options
 public Tool(ToolRunner pController)
 {
     m_controller = pController;
 }
Ejemplo n.º 11
0
        private void Execute(string p, JToken pToken)
        {
            ToolRunner t = _users[p];

            t.ParseJSON(pToken);
        }
Ejemplo n.º 12
0
 // Constructor
 public FreehandTool(ToolRunner pController)
     : base(pController)
 {
 }
Ejemplo n.º 13
0
 public BrushTool(ToolRunner pController)
     : base(pController)
 {
 }
Ejemplo n.º 14
0
 public void Redraw( ToolRunner pController )
 {
     canvasBox.Invalidate(true);
     canvasBox.Update();
 }
Ejemplo n.º 15
0
 public PenTool(ToolRunner pController)
     : base(pController)
 {
 }
Ejemplo n.º 16
0
 public Tool(ToolRunner pController)
 {
     m_controller = pController;
 }
Ejemplo n.º 17
0
 // Constructor
 public FreehandTool(ToolRunner pController)
     : base(pController)
 {
 }