Пример #1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public SketchJournalMainForm()
        {
            InitializeComponent();

            // Initialize and add InkPicture to form
            toolStripContainer1.ContentPanel.SuspendLayout();
            sketchPanel      = new SketchPanel();
            sketchPanel.Dock = DockStyle.Fill;
            toolStripContainer1.ContentPanel.Controls.Add(sketchPanel);
            toolStripContainer1.ContentPanel.ResumeLayout();

            // Attach a (demo) recognizer
            //recognizer = new TimeoutRecognizer();
            recognizer = new GateRecognizer();
            //recognizer = new PartialGateRecognizer();
            recognizer.SubscribeToPanel(sketchPanel);
            sketchPanel.ResultReceived += new RecognitionResultReceivedHandler(sketchPanel_ResultReceived);

            // Add and configure feedback
            circuitColorFeedback = new ColorFeedback(sketchPanel, FilenameConstants.DefaultCircuitDomainFilePath);

            // Set up selection clearing callback for toolbar
            // FOR ALL NEW TOOLS, should add
            lassoMenuButton.CheckedChanged       += new EventHandler(lassoMenuButton_CheckedChanged);
            lassoSortedMenuButton.CheckedChanged += new EventHandler(lassoSortedMenuButton_CheckedChanged);
            lassoRegroupButton.CheckedChanged    += new EventHandler(lassoRegroupButton_CheckedChanged);
            retraceButton.CheckedChanged         += new EventHandler(retraceButton_CheckedChanged);


            // Set up correction tool
            commandManager      = new CommandManagement.CommandManager();
            lassoMenuStaticTool = new LassoMenuStaticTool(commandManager);
            lassoSortedMenuTool = new LassoMenuStaticTool(commandManager); // Same type as static for now
            lassoRegroupTool    = new LassoRegroupTool(commandManager);
        }
Пример #2
0
 public DragBoxSelect(ref SketchPanelLib.SketchPanel sketchPanel)
     : base(ref sketchPanel)
 {
     selectionMade   = false;
     makingSelection = false;
     this.selectBox  = new System.Windows.Shapes.Rectangle();
 }
Пример #3
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public SketchJournalMainForm()
        {
            InitializeComponent();
            doneButton.Text = "Begin";
            gates[0]        = AND;
            gates[1]        = OR;
            gates[2]        = XOR;
            gates[3]        = NAND;
            gates[4]        = NOR;
            gates[5]        = NOT;
            copies[0]       = COPY1;
            copies[1]       = COPY2;
            eqs[0]          = EQ1;
            eqs[1]          = EQ2;
            gates           = shuffle(gates);
            copies          = shuffle(copies);
            eqs             = shuffle(eqs);

            // Initialize and add InkPicture to form
            toolStripContainer1.ContentPanel.SuspendLayout();
            sketchPanel      = new SketchPanel();
            sketchPanel.Dock = DockStyle.Fill;
            toolStripContainer1.ContentPanel.Controls.Add(sketchPanel);
            toolStripContainer1.ContentPanel.ResumeLayout();

            // Attach a (demo) recognizer
            recognizer = new TimeoutRecognizer();
            recognizer.SubscribeToPanel(sketchPanel);
        }
Пример #4
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public SketchJournalMainForm()
        {
            InitializeComponent();

            // Initialize and add InkPicture to form
            toolStripContainer1.ContentPanel.SuspendLayout();
            sketchPanel      = new SketchPanel();
            sketchPanel.Dock = DockStyle.Fill;
            toolStripContainer1.ContentPanel.Controls.Add(sketchPanel);
            toolStripContainer1.ContentPanel.ResumeLayout();

            // Attach a (demo) recognizer
            //recognizer = new TimeoutSketchRecognizer();
            recognizer = new GateSketchRecognizer();
            //recognizer = new PartialGateSketchRecognizer();
            recognizer.SubscribeToPanel(sketchPanel);
            sketchPanel.ResultReceived += new RecognitionResultReceivedHandler(sketchPanel_ResultReceived);
        }
        /// <summary>
        /// Handles recogntion trigger events.  Forwards recognition arguments to the real recognizer.
        /// </summary>
        /// <param name="source">The source panel of this trigger event</param>
        /// <param name="ra">The recognition arguments to forward (e.g., the sketch to be recognized)</param>
        private void panel_RecognitionTriggered(SketchPanel source, RecognitionArgs ra)
        {
            FireRecognition frDelegate = new FireRecognition(this.Recognize);

            frDelegate.BeginInvoke(ra, this.processRecognitionResult, null);
        }
 /// <summary>
 /// Subscribes this recognizer to the given panel's trigger events.
 /// </summary>
 /// <param name="panel">Given panel to which we want to subscribe</param>
 public void SubscribeToPanel(SketchPanel panel)
 {
     panel.RecognitionTriggered += new RecognitionTriggerEventHandler(panel_RecognitionTriggered);
     parentPanel = panel;
 }
 /// <summary>
 /// Constructor.  Subscribes to the given
 /// SketchPanel.
 /// </summary>
 /// <param name="panel">The SketchPanel to which we want to subscribe.</param>
 public SketchRecognizer(SketchPanel panel)
 {
     SubscribeToPanel(panel);
 }
Пример #8
0
 /// <summary>
 /// Subscribes to relevant events on parent SketchPanel (e.g. stroke add/delete events,
 /// zoom events, file load events, recognition result events, etc.)
 /// </summary>
 /// <param name="parentPanel">The parent panel to which we want to attach</param>
 public virtual void SubscribeToPanel(ref SketchPanel parentPanel)
 {
     this.sketchPanel = parentPanel;
 }
Пример #9
0
 /// <summary>
 /// Constructor.  Subscribes to the parentPanel and
 /// initializes this SketchPanelSubscriber.
 /// </summary>
 /// <param name="parentPanel">The parent panel to subscribe to</param>
 public SketchPanelSubscriber(ref SketchPanel parentPanel)
 {
     sketchPanel = parentPanel;
     this.idGuid = parentPanel.InkSketch.IDGuid;
     SubscribeToPanel(ref parentPanel);
 }
 /// <summary>
 /// Constructor.  Subscribes to the parentPanel and
 /// initializes this SketchPanelSubscriber.
 /// </summary>
 /// <param name="parentPanel">The parent panel to subscribe to</param>
 public SketchPanelSubscriber(SketchPanel parentPanel)
 {
     sketchPanel = parentPanel;
     SubscribeToPanel(parentPanel);
 }