Exemplo n.º 1
0
 public DEngine(UndoRedoArea area)
 {
     // setup undo/redo manager
     if (area == null)
         undoRedoArea = new UndoRedoArea("");
     else
         undoRedoArea = area;
     undoRedoArea.CommandDone += new EventHandler<CommandDoneEventArgs>(undoRedoArea_CommandDone);
     // create viewer handler
     viewerHandler = new DViewerHandler();
     viewerHandler.MouseMove += new DMouseMoveEventHandler(viewerHandler_MouseMove);
     viewerHandler.MouseDown += new DMouseButtonEventHandler(viewerHandler_MouseDown);
     viewerHandler.MouseUp += new DMouseButtonEventHandler(viewerHandler_MouseUp);
     // create figure handler
     figureHandler = new DFigureHandler();
     figureHandler.SelectedFiguresChanged += new SelectedFiguresHandler(DoSelectedFiguresChanged);
     figureHandler.AddedFigure += delegate(DEngine de, Figure fig, bool fromHsm)
     {
         if (AddedFigure != null)
             AddedFigure(this, fig, fromHsm);
     };
     // create state machine
     hsm = new DHsm(undoRedoArea, viewerHandler, figureHandler);
     #if DEBUG
     hsm.DebugMessage += new DebugMessageHandler(hsm_DebugMessage);
     #endif
     hsm.FigureClick += new ClickHandler(hsm_FigureClick);
     hsm.FigureContextClick += new ClickHandler(hsm_FigureContextClick);
     hsm.FigureLockClick += new ClickHandler(hsm_FigureLockClick);
     hsm.ContextClick += new ClickHandler(hsm_ContextClick);
     hsm.DragFigureStart += new DragFigureHandler(hsm_DragFigureStart);
     hsm.DragFigureEvt += new DragFigureHandler(hsm_DragFigureEvt);
     hsm.DragFigureEnd += new DragFigureHandler(hsm_DragFigureEnd);
     hsm.MeasureRect += new SelectMeasureHandler(hsm_MeasureRect);
     hsm.StateChanged += new HsmStateChangedHandler(hsm_StateChanged);
     hsm.TextCut += new HsmTextHandler(hsm_TextCut);
     hsm.TextCopy += new HsmTextHandler(hsm_TextCopy);
 }
Exemplo n.º 2
0
 public DHsm(UndoRedoArea undoRedoArea, DViewerHandler viewerHandler, DFigureHandler figureHandler)
     : base()
 {
     // undo redo manager
     this.undoRedoArea = undoRedoArea;
     // viewer handler
     this.viewerHandler = viewerHandler;
     viewerHandler.NeedRepaint += new DPaintEventHandler(dv_NeedRepaint);
     viewerHandler.MouseDown += new DMouseButtonEventHandler(dv_MouseDown);
     viewerHandler.MouseMove += new DMouseMoveEventHandler(dv_MouseMove);
     viewerHandler.MouseUp += new DMouseButtonEventHandler(dv_MouseUp);
     viewerHandler.DoubleClick += new DMouseMoveEventHandler(dv_DoubleClick);
     viewerHandler.KeyDown += new DKeyEventHandler(dv_KeyDown);
     viewerHandler.KeyPress += new DKeyPressEventHandler(dv_KeyPress);
     viewerHandler.KeyUp += new DKeyEventHandler(dv_KeyUp);
     // figure handler
     this.figureHandler = figureHandler;
     // QHsm Init
     Init();
 }