//-------------------------------------------------------------------------
        // New Layer Button click event
        //-------------------------------------------------------------------------
        private void newLayerButton_Click(object sender, EventArgs e)
        {
            // Add a new layer to the picture
            currentPicture.AddLayer();

            // Rebuild the layer display
            RebuildLayerControls();
        }
Ejemplo n.º 2
0
        void ExecuteCommands(IEnumerable <JToken> pInput)
        {
            foreach (JToken inputMessage in pInput)
            {
                string functionName = inputMessage.Value <string>("func");
                switch (functionName)
                {
                case "tool_down":     //tool_down comes with all the tool options
                    ToolDown(inputMessage);
                    break;

                case "tool_move":
                    if (m_currentTool != null) //tool_move can happend without tool beeing down
                    {
                        ToolMove(inputMessage);
                    }
                    break;

                case "tool_up":
                    if (m_currentTool != null) //tool_up can happend without tool beeing down
                    {
                        ToolUp(inputMessage);
                    }
                    break;

                case "clear":
                    ClearLayer(inputMessage);
                    break;

                case "undo":
                    Undo(inputMessage);
                    break;

                case "create_layer":
                    m_picture.AddLayer(inputMessage.Value <string>("layer"));
                    break;

                case "remove_layer":
                    RemoveLayer(inputMessage);
                    break;

                case "reorder_layers":
                    ReorderLayers(inputMessage);
                    break;

                case "rename_layer":
                    RenameLayer(inputMessage);
                    break;

                default:
                    break;
                }
                if (FunctionEventsEnabled)
                {
                    //Fire off the events!
                    List <FunctionEventHandler> handlers;
                    if (_functionHandlers.TryGetValue(functionName, out handlers) && handlers != null)
                    {
                        foreach (FunctionEventHandler h in handlers)
                        {
                            h(this, functionName, inputMessage);
                        }
                    }
                }
            }
        }