Ejemplo n.º 1
0
        public SessionClient(IPAddress address, int Port, int type, int mode)
        {
            this.address = address;
            this.port    = Port;
            this.type    = type;
            this.mode    = mode;

            switch (type)
            {
            case KEYBOARD:
            case MOUSE:
                Task.Factory.StartNew(new Action(() =>
                {
                    MouseTracker mt = new MouseTracker(this);
                    mt.Show();
                }), CancellationToken.None, TaskCreationOptions.None, TaskScheduler.FromCurrentSynchronizationContext());
                break;

            case FILEVIEW:
                Task.Factory.StartNew(new Action(() =>
                {
                    FileViewer fv = new FileViewer(this);
                    fv.Show();
                }), CancellationToken.None, TaskCreationOptions.None, TaskScheduler.FromCurrentSynchronizationContext());
                break;

            case SMSVIEW:
                break;

            default:
                throw new Exception("Неизвестный тип сессии");
            }
        }
Ejemplo n.º 2
0
        public WelcomePageFirstRun()
        {
            VisibleWindow = false;
            SetSizeRequest(WidgetSize.Width, WidgetSize.Height);

            string iconFile = BrandingService.GetString("ApplicationIcon");

            if (iconFile != null)
            {
                iconFile    = BrandingService.GetFile(iconFile);
                brandedIcon = Xwt.Drawing.Image.FromFile(iconFile);
            }

            TitleOffset = TextOffset = IconOffset = new Gdk.Point();

            tracker             = new MouseTracker(this);
            tracker.MouseMoved += (sender, e) => {
                ButtonHovered = new Gdk.Rectangle(ButtonPosistion, ButtonSize).Contains(tracker.MousePosition);
            };

            tracker.HoveredChanged += (sender, e) => {
                if (!tracker.Hovered)
                {
                    ButtonHovered = false;
                }
            };
        }
Ejemplo n.º 3
0
        public DockBarItem(DockBar bar, DockItem it, int size)
        {
            Events        = Events | Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask;
            this.size     = size;
            this.bar      = bar;
            this.it       = it;
            VisibleWindow = false;
            UpdateTab();
            lastFrameSize            = bar.Frame.Allocation.Size;
            bar.Frame.SizeAllocated += HandleBarFrameSizeAllocated;

            tracker                 = new MouseTracker(this);
            tracker.TrackMotion     = false;
            tracker.HoveredChanged += (sender, e) => {
                if (crossfade == null)
                {
                    return;
                }

                AnimateHover(tracker.Hovered);
                if (tracker.Hovered)
                {
                    crossfade.ShowSecondary();
                }
                else
                {
                    crossfade.ShowPrimary();
                }
            };
        }
Ejemplo n.º 4
0
        public TabStrip(DockNotebook notebook)
        {
            TabWidth    = 125;
            TargetWidth = 125;
            tracker     = new MouseTracker(this);
            GtkWorkarounds.FixContainerLeak(this);

            this.notebook = notebook;
            WidgetFlags  |= Gtk.WidgetFlags.AppPaintable;
            Events       |= Gdk.EventMask.PointerMotionMask | Gdk.EventMask.LeaveNotifyMask | Gdk.EventMask.ButtonPressMask;

            var arr = new Gtk.Image(Gdk.Pixbuf.LoadFromResource("tabbar-prev.png"));

            arr.HeightRequest         = arr.WidthRequest = 10;
            PreviousButton            = new Button(arr);
            PreviousButton.Relief     = ReliefStyle.None;
            PreviousButton.CanDefault = PreviousButton.CanFocus = false;

            arr = new Gtk.Image(Gdk.Pixbuf.LoadFromResource("tabbar-next.png"));
            arr.HeightRequest     = arr.WidthRequest = 10;
            NextButton            = new Button(arr);
            NextButton.Relief     = ReliefStyle.None;
            NextButton.CanDefault = NextButton.CanFocus = false;

            DropDownButton            = new MenuButton();
            DropDownButton.Relief     = ReliefStyle.None;
            DropDownButton.CanDefault = DropDownButton.CanFocus = false;

            PreviousButton.ShowAll();
            NextButton.ShowAll();
            DropDownButton.ShowAll();

            PreviousButton.Name = "MonoDevelop.DockNotebook.BarButton";
            NextButton.Name     = "MonoDevelop.DockNotebook.BarButton";
            DropDownButton.Name = "MonoDevelop.DockNotebook.BarButton";

            PreviousButton.Parent = this;
            NextButton.Parent     = this;
            DropDownButton.Parent = this;

            children.Add(PreviousButton);
            children.Add(NextButton);
            children.Add(DropDownButton);

            tracker.HoveredChanged += (sender, e) => {
                if (!tracker.Hovered)
                {
                    SetHighlightedTab(null);
                    UpdateTabWidth(tabEndX - tabStartX);
                    QueueDraw();
                }
            };

            notebook.PageAdded   += (object sender, EventArgs e) => QueueResize();
            notebook.PageRemoved += (object sender, EventArgs e) => QueueResize();

            closingTabs = new Dictionary <int, DockNotebookTab> ();
        }
Ejemplo n.º 5
0
        public void MousePosition_Returns_Sensible_X_Value()
        {
            int          BAD_X_VALUE  = 100000;
            MouseTracker mouseTracker = new MouseTracker(-BAD_X_VALUE, 0);

            var(currentX, _) = MouseTracker.GetMousePosition();
            Console.WriteLine(currentX);
            Assert.IsFalse(mouseTracker.PreviousXPos > currentX);
            Assert.IsFalse(BAD_X_VALUE < mouseTracker.PreviousXPos);
        }
Ejemplo n.º 6
0
        public AbstractControl(BlendingController bcon, Blending blending,
                               MouseTracker mouseTracker, BlendingController.MousePosition mouseCurr)
        {
            this.bcon         = bcon;
            this.blending     = blending;
            this.mouseTracker = mouseTracker;
            this.mouseCurr    = mouseCurr;

            FsmActivity = new FSM <ActivityEnum>(FSM.TransitionModeEnum.Immediate);
        }
Ejemplo n.º 7
0
        public void MousePosition_Returns_Sensible_Y_Value()
        {
            int          BAD_Y_VALUE  = 100000;
            MouseTracker mouseTracker = new MouseTracker(0, -BAD_Y_VALUE);

            var(_, currentY) = MouseTracker.GetMousePosition();
            Console.WriteLine(currentY);
            Assert.IsFalse(mouseTracker.PreviousYPos > currentY);
            Assert.IsFalse(BAD_Y_VALUE < mouseTracker.PreviousYPos);
        }
Ejemplo n.º 8
0
 public PaintZone(double width, double height)
 {
     this.theme = Theme.Default();
     this.paintZoneData = BitmapFactory.New(width.Round(), height.Round());
     this.tracker = new MouseTracker();
     this.tracker.OnMouseMoove += new MouseTracker.OnMouseMooveHandler(this.HandleMouseMoove);
     this.tracker.OnMouseStill += new MouseTracker.OnMouseStillHandler(this.HandleMouseStill);
     this.stillCounter = 0;
     this.ResetImage();
 }
Ejemplo n.º 9
0
 void InitAll()
 {
     _objHolder      = new ObjectHolder();
     _destManager    = new DestructionManager(_objHolder);
     _collManager    = new CollisionManager(_objHolder);
     _initSceneSpawn = new InitialSceneSpawner(_objHolder, _collManager);
     _gameLogics     = new GameLogics(_objHolder);
     _mouseTrack     = new MouseTracker();
     _keyboardTrack  = new KeyBoardTracker();
 }
Ejemplo n.º 10
0
        public CornerControl(BlendingController bcon, Blending blending,
                             MouseTracker mouseTracker, BlendingController.MousePosition mouseCurr)
            : base(bcon, blending, mouseTracker, mouseCurr)
        {
            fsmOperation = new FSM <OperationEnum>(FSM.TransitionModeEnum.Immediate);

            FsmActivity.State(ActivityEnum.Inactive);
            FsmActivity.State(ActivityEnum.Active).Enter(fsm => {
                mouseTracker.OnSelectionDown += (mt, f) => {
                    switch (f)
                    {
                    case MouseTracker.ButtonFlag.Left:
                        if (mouseCurr.TryInitVertexMode())
                        {
                            fsmOperation.Goto(OperationEnum.MoveCorner);
                        }
                        break;

                    case MouseTracker.ButtonFlag.Right:
                        break;
                    }
                };
                mouseTracker.OnSelection += (mt, f) => {
                    fsmOperation.Update();
                };
                mouseTracker.OnSelectionUp += (mt, f) => {
                    fsmOperation.Goto(OperationEnum.None);
                };
            }).Update(fsm => {
                fsmOperation.Update();
            }).Exit(fsm => {
                fsmOperation.Goto(OperationEnum.None);
                mouseTracker.Clear();
            });
            FsmActivity.Init();

            fsmOperation.State(OperationEnum.None);
            fsmOperation.State(OperationEnum.MoveCorner).Update(fsm => {
                if (bcon.IsOverGUI)
                {
                    return;
                }

                mouseCurr.Update();
                var duv     = mouseCurr.WorldDuv;
                var data    = blending.BlendingData;
                var iscreen = mouseCurr.selectedScreen.x + mouseCurr.selectedScreen.y * data.Screens.x;
                var trap    = data.Trapeziums[iscreen];
                trap[mouseCurr.selectedVertex] += duv;
                trap.Clamp01();
                data.Trapeziums[iscreen] = trap;
                data.Invalidate();
            });
            fsmOperation.Init();
        }
Ejemplo n.º 11
0
        public InteractivePlot()
        {
            InitializeComponent();
            skglControl1.MouseWheel += skglControl1_MouseWheel;

            Plot = new Plot();
            Plot.FigureBackground.Color = Renderer.Color.Convert(SystemColors.Control);
            Plot.DataBackground.Color   = Renderer.Colors.White;
            MouseTracker = new MouseTracker(Plot);
            Render();
        }
Ejemplo n.º 12
0
        public BlendControl(BlendingController bcon, Blending blending,
                            MouseTracker mouseTracker, BlendingController.MousePosition mouseCurr)
            : base(bcon, blending, mouseTracker, mouseCurr)
        {
            fsmOperation = new FSM <OperationEnum>();

            FsmActivity.State(ActivityEnum.Inactive);
            FsmActivity.State(ActivityEnum.Active).Enter(fsm => {
                mouseTracker.OnSelectionDown += (mt, f) => {
                    switch (f)
                    {
                    case MouseTracker.ButtonFlag.Left:
                        if (mouseCurr.TryInitEdgeMode())
                        {
                            fsmOperation.Goto(OperationEnum.MoveBlendWidth);
                        }
                        break;

                    case MouseTracker.ButtonFlag.Right:
                        break;
                    }
                };
                mouseTracker.OnSelection += (mt, f) => {
                    fsmOperation.Update();
                };
                mouseTracker.OnSelectionUp += (mt, f) => {
                    fsmOperation.Goto(OperationEnum.None);
                };
            }).Update(fsm => {
                fsmOperation.Update();
            }).Exit(fsm => {
                fsmOperation.Goto(OperationEnum.None);
                mouseTracker.Clear();
            });
            FsmActivity.Init();

            fsmOperation.State(OperationEnum.None);
            fsmOperation.State(OperationEnum.MoveBlendWidth).Update(fsm => {
                if (bcon.IsOverGUI)
                {
                    return;
                }

                mouseCurr.Update();

                var duv       = mouseCurr.WorldDuv;
                var data      = blending.BlendingData;
                var ej        = new EdgeJoint(data, mouseCurr.selectedScreen, mouseCurr.selectedEdge);
                ej.Bandwidth += duv[ej.axis];
                UvMapper.UpdateUv(data.Screens, data.Edges, data.ViewportOffsets);
                data.Invalidate();
            });
            fsmOperation.Init();
        }
Ejemplo n.º 13
0
        protected override void OnStartup(StartupEventArgs e)
        {
            TrackingDataContext trackingDataContext = new TrackingDataContext();
            MouseTracker        mouseTracker        = new MouseTracker();
            KeyboardTracker     keyboardTracker     = new KeyboardTracker();


            //Set timer to record activity data every second
            DispatcherTimer timer = new DispatcherTimer
            {
                Interval = TimeSpan.FromMilliseconds(1000)
            };

            //Start tracking productivity and logging it
            timer.Tick += (o, e) =>
            {
                var newTrackingRecord = new TrackingRecord
                {
                    Active      = false,
                    ProcessName = ProcessTracker.GetActiveProcessName(),
                    Timestamp   = DateTime.Now
                };

                if (mouseTracker.HasMouseMoved() || keyboardTracker.GetTimeElapsedSinceLastKeyPress() < timer.Interval.TotalMilliseconds)
                {
                    newTrackingRecord.Active = true;
                    trackingDataContext.Add(newTrackingRecord);
                }
                else
                {
                    trackingDataContext.Add(newTrackingRecord);
                }

                trackingDataContext.SaveChanges();
            };
            timer.IsEnabled = true;

            //Code for setting up MVVM
            ViewNavigator viewNavigator    = new ViewNavigator();
            MainViewModel defaultViewModel = new MainViewModel(viewNavigator);

            viewNavigator.CurrentViewModel = defaultViewModel;
            Window window = new MainWindow();

            window.DataContext = defaultViewModel;
            window.Show();
            base.OnStartup(e);
        }
Ejemplo n.º 14
0
        public DockBarItem(DockBar bar, DockItem it, int size)
        {
            var actionHandler = new ActionDelegate(this);

            actionHandler.PerformPress += OnPerformPress;

            Events        = Events | Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask;
            this.size     = size;
            this.bar      = bar;
            this.it       = it;
            CanFocus      = true;
            VisibleWindow = false;
            UpdateTab();
            lastFrameSize            = bar.Frame.Allocation.Size;
            bar.Frame.SizeAllocated += HandleBarFrameSizeAllocated;

            tracker                 = new MouseTracker(this);
            tracker.TrackMotion     = false;
            tracker.HoveredChanged += (sender, e) => {
                if (crossfade == null)
                {
                    return;
                }

                AnimateHover(tracker.Hovered);
                if (tracker.Hovered)
                {
                    crossfade.ShowSecondary();
                }
                else
                {
                    crossfade.ShowPrimary();
                }
            };

            Styles.Changed += UpdateStyle;

            Accessible.Name = "DockbarItem";
            Accessible.Role = Atk.Role.PushButton;
        }
Ejemplo n.º 15
0
        static void Main()
        {
            MouseTracker.RegisterClicks(OnLeftClick);
            KeyboardTracker.RegisterKeys(OnKeyPress);
            TrayManager.HideInTray.Track();

            client = new DiscordRpcClient("793662574088290325");

            client.Initialize();

            started_at = DateTime.UtcNow;

            Console.WriteLine("Successfully started RPC in " + (compact ? "compact" : "full") + " mode.");
            Console.WriteLine("To exit, simply close the command prompt window.");

            Thread MainThread = new Thread(StartRPCUpdates);

            MainThread.Start();

            Console.WriteLine("Main update thread spawned.");

            Console.ReadLine();
        }
Ejemplo n.º 16
0
        public MainWindow()
        {
            InitializeComponent();
            state = new MainWindowState();
            state.Shortcuts.CollectionChanged += OnUpdateShortcuts;
            DataContext = state;

            Width  = 300;
            Height = SystemParameters.VirtualScreenHeight;

            Top  = 0;
            Left = SystemParameters.VirtualScreenWidth - this.Width;

            var xMin = SystemParameters.VirtualScreenWidth - this.Width;
            var xMax = SystemParameters.VirtualScreenWidth;
            var yMin = 0;
            var yMax = SystemParameters.VirtualScreenHeight;

            mousePosition = new MouseTracker();
            mousePosition.OnCursorInside  += MouseInPosition;
            mousePosition.OnCursorOutside += MouseOutPosition;
            mousePosition.RegisterPositionRectangle(xMin, xMax, yMin, yMax);
            mousePosition.StartTracking();
        }
Ejemplo n.º 17
0
        public Epsilon()
        {
            _graphicsDeviceManager = new GraphicsDeviceManager(this)
            {
                PreferredBackBufferWidth  = Constants.ScreenBufferWidth,
                PreferredBackBufferHeight = Constants.ScreenBufferHeight
            };

            Content.RootDirectory = "_Content";

            _eventManager = new EventManager();

            _map = new Map(_eventManager);

            _mouseTracker    = new MouseTracker();
            _keyBoardTracker = new KeyboardTracker();

            // TODO: Maybe use some assembly scanning technique to pick all IActors up...
            _actors = new List <IActor>
            {
                new Stars(_eventManager, _map),
                new Terrain(_map, _eventManager)
            };
        }
Ejemplo n.º 18
0
 public void Track(string playerId, Vec2d pos)
 {
     if (!trackers.ContainsKey(playerId))
     {
         trackers[playerId] = new MouseTracker
         {
             dirty = true,
             mouse = new Mouse
             {
                 PlayerId = playerId,
                 Pos      = pos
             }
         };
     }
     else
     {
         MouseTracker mouseTracker = trackers[playerId];
         if (mouseTracker.mouse.Pos.X != pos.X || mouseTracker.mouse.Pos.Y != pos.Y)
         {
             mouseTracker.dirty     = true;
             mouseTracker.mouse.Pos = pos;
         }
     }
 }
Ejemplo n.º 19
0
 private void OnMouseMoveOnTrackedElement(object sender, MouseEventArgs e)
 {
     MouseTracker?.SetCurrent(sender as UIElement);
     e.Handled = true;
 }
Ejemplo n.º 20
0
        public TabStrip(DockNotebook notebook)
        {
            if (notebook == null)
            {
                throw new ArgumentNullException("notebook");
            }

            Accessible.SetRole(AtkCocoa.Roles.AXTabGroup);

            // Handle focus for the tabs.
            CanFocus = true;

            TabWidth    = 125;
            TargetWidth = 125;
            tracker     = new MouseTracker(this);
            GtkWorkarounds.FixContainerLeak(this);

            innerBox = new HBox(false, 0);
            innerBox.Accessible.SetShouldIgnore(true);
            Add(innerBox);

            this.notebook = notebook;
            WidgetFlags  |= Gtk.WidgetFlags.AppPaintable;
            Events       |= EventMask.PointerMotionMask | EventMask.LeaveNotifyMask | EventMask.ButtonPressMask;

            var arr = new Xwt.ImageView(tabbarPrevImage);

            arr.HeightRequest = arr.WidthRequest = 10;

            var alignment = new Alignment(0.5f, 0.5f, 0.0f, 0.0f);

            alignment.Add(arr.ToGtkWidget());
            PreviousButton                 = new Button(alignment);
            PreviousButton.TooltipText     = Core.GettextCatalog.GetString("Switch to previous document");
            PreviousButton.Relief          = ReliefStyle.None;
            PreviousButton.CanDefault      = false;
            PreviousButton.CanFocus        = true;
            PreviousButton.Accessible.Name = "DockNotebook.Tabstrip.PreviousButton";
            PreviousButton.Accessible.SetTitle(Core.GettextCatalog.GetString("Previous document"));
            PreviousButton.Accessible.Description = Core.GettextCatalog.GetString("Switch to previous document");

            arr = new Xwt.ImageView(tabbarNextImage);
            arr.HeightRequest = arr.WidthRequest = 10;

            alignment = new Alignment(0.5f, 0.5f, 0.0f, 0.0f);
            alignment.Add(arr.ToGtkWidget());
            NextButton                 = new Button(alignment);
            NextButton.TooltipText     = Core.GettextCatalog.GetString("Switch to next document");
            NextButton.Relief          = ReliefStyle.None;
            NextButton.CanDefault      = false;
            NextButton.CanFocus        = true;
            NextButton.Accessible.Name = "DockNotebook.Tabstrip.NextButton";
            NextButton.Accessible.SetTitle(Core.GettextCatalog.GetString("Next document"));
            NextButton.Accessible.Description = Core.GettextCatalog.GetString("Switch to next document");

            DropDownButton                 = new MenuButton();
            DropDownButton.TooltipText     = Core.GettextCatalog.GetString("Document List");
            DropDownButton.Relief          = ReliefStyle.None;
            DropDownButton.CanDefault      = false;
            DropDownButton.CanFocus        = true;
            DropDownButton.Accessible.Name = "DockNotebook.Tabstrip.DocumentListButton";
            DropDownButton.Accessible.SetTitle(Core.GettextCatalog.GetString("Document list"));
            DropDownButton.Accessible.Description = Core.GettextCatalog.GetString("Display the document list menu");

            PreviousButton.ShowAll();
            PreviousButton.NoShowAll = true;
            NextButton.ShowAll();
            NextButton.NoShowAll = true;
            DropDownButton.ShowAll();

            PreviousButton.Name = "MonoDevelop.DockNotebook.BarButton";
            NextButton.Name     = "MonoDevelop.DockNotebook.BarButton";
            DropDownButton.Name = "MonoDevelop.DockNotebook.BarButton";

            innerBox.PackStart(PreviousButton, false, false, 0);
            innerBox.PackStart(NextButton, false, false, 0);
            innerBox.PackEnd(DropDownButton, false, false, 0);

            tracker.HoveredChanged += (sender, e) => {
                if (!tracker.Hovered)
                {
                    SetHighlightedTab(null);
                    UpdateTabWidth(tabEndX - tabStartX);
                    QueueDraw();
                }
            };

            foreach (var tab in notebook.Tabs)
            {
                Accessible.AddAccessibleElement(tab.Accessible);
            }
            UpdateAccessibilityTabs();
            notebook.PageAdded     += PageAddedHandler;
            notebook.PageRemoved   += PageRemovedHandler;
            notebook.TabsReordered += PageReorderedHandler;

            closingTabs = new Dictionary <int, DockNotebookTab> ();
        }
Ejemplo n.º 21
0
    void Start()
    {
        enemies = new List<Entity>();
        players = new List<PlayerController>();

        PlayerController player = (Instantiate(Resources.Load("Player/PlayerObject")) as GameObject).GetComponent<PlayerController>();
        GameObject[] points = GameObject.FindGameObjectsWithTag("Waypoint");
        foreach (GameObject point in points) {
            if (point.transform.name.Contains("End")) {
                Vector3 targetPos = point.transform.position;
                targetPos.y += StartYPosition;
                player.transform.position = targetPos;
                break;
            }
        }
        players.Add(player);

        miniMapCam = GameObject.FindGameObjectWithTag("MiniMapCam");

        audioSources = new Dictionary<string, AudioSource>();

        addAudioSource("Background", BackgroundMusic);
        addAudioSource("Build", BuildMusic, 0.5f, true);
        addAudioSource("Combat", CombatMusic, 0.1f, true);

        qHandler = this.GetComponent<QuestionnaireHandler>();
        if (qHandler == null) {
            qHandler = this.GetComponentInChildren<QuestionnaireHandler>();
        }

        if (!qHandler.QuestionnaireEnabled) {
            CurrentGameState = GameState.MENU;
        }

        scenarioHandler = GameObject.FindGameObjectWithTag("ScenarioHandler").GetComponent<ScenarioHandler>();

        menuController = this.GetComponent<MenuController>();
        if (menuController == null) {
            menuController = this.GetComponentInChildren<MenuController>();
        }

        mouseTracker = this.GetComponent<MouseTracker>();
        if (mouseTracker == null)
            mouseTracker = this.GetComponentInChildren<MouseTracker>();
            if (mouseTracker == null)
                Debug.LogWarning("GameController could not find mouse tracker");

        dbHandler = scenarioHandler.gameObject.GetComponent<DatabaseHandler> ();
    }
Ejemplo n.º 22
0
		public DockBarItem (DockBar bar, DockItem it, int size)
		{
			Events = Events | Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask;
			this.size = size;
			this.bar = bar;
			this.it = it;
			VisibleWindow = false;
			UpdateTab ();
			lastFrameSize = bar.Frame.Allocation.Size;
			bar.Frame.SizeAllocated += HandleBarFrameSizeAllocated;

			tracker = new MouseTracker (this);
			tracker.TrackMotion = false;
			tracker.HoveredChanged += (sender, e) => {

				if (crossfade == null)
					return;
	
				AnimateHover (tracker.Hovered);
				if (tracker.Hovered)
					crossfade.ShowSecondary ();
				else
					crossfade.ShowPrimary ();
			};
		}
Ejemplo n.º 23
0
 public void initMouseTracker(MouseTracker tracker = null)
 {
     _mouseTracker?.dispose();
     _mouseTracker = tracker ?? new MouseTracker(pointerRouter, renderView.hitTestMouseTrackers);
 }
Ejemplo n.º 24
0
        public TabStrip(DockNotebook notebook)
        {
            if (notebook == null)
            {
                throw new ArgumentNullException("notebook");
            }
            TabWidth    = 125;
            TargetWidth = 125;
            tracker     = new MouseTracker(this);
            GtkWorkarounds.FixContainerLeak(this);

            this.notebook = notebook;
            WidgetFlags  |= Gtk.WidgetFlags.AppPaintable;
            Events       |= EventMask.PointerMotionMask | EventMask.LeaveNotifyMask | EventMask.ButtonPressMask;

            var arr = new Xwt.ImageView(tabbarPrevImage);

            arr.HeightRequest = arr.WidthRequest = 10;

            var alignment = new Alignment(0.5f, 1, 0.0f, 0.0f);

            alignment.Add(arr.ToGtkWidget());
            PreviousButton            = new Button(alignment);
            PreviousButton.Relief     = ReliefStyle.None;
            PreviousButton.CanDefault = PreviousButton.CanFocus = false;

            arr = new Xwt.ImageView(tabbarNextImage);
            arr.HeightRequest = arr.WidthRequest = 10;

            alignment = new Alignment(0.5f, 1, 0.0f, 0.0f);
            alignment.Add(arr.ToGtkWidget());
            NextButton            = new Button(alignment);
            NextButton.Relief     = ReliefStyle.None;
            NextButton.CanDefault = NextButton.CanFocus = false;

            DropDownButton            = new MenuButton();
            DropDownButton.Relief     = ReliefStyle.None;
            DropDownButton.CanDefault = DropDownButton.CanFocus = false;

            PreviousButton.ShowAll();
            NextButton.ShowAll();
            DropDownButton.ShowAll();

            PreviousButton.Name = "MonoDevelop.DockNotebook.BarButton";
            NextButton.Name     = "MonoDevelop.DockNotebook.BarButton";
            DropDownButton.Name = "MonoDevelop.DockNotebook.BarButton";

            PreviousButton.Parent = this;
            NextButton.Parent     = this;
            DropDownButton.Parent = this;

            children.Add(PreviousButton);
            children.Add(NextButton);
            children.Add(DropDownButton);

            tracker.HoveredChanged += (sender, e) => {
                if (!tracker.Hovered)
                {
                    SetHighlightedTab(null);
                    UpdateTabWidth(tabEndX - tabStartX);
                    QueueDraw();
                }
            };

            notebook.PageAdded   += (sender, e) => QueueResize();
            notebook.PageRemoved += (sender, e) => QueueResize();

            closingTabs = new Dictionary <int, DockNotebookTab> ();
        }
Ejemplo n.º 25
0
        public EdgeControl(BlendingController bcon, Blending blending,
                           MouseTracker mouseTracker, BlendingController.MousePosition mouseCurr)
            : base(bcon, blending, mouseTracker, mouseCurr)
        {
            fsmOperation = new FSM <OperationEnum>();

            FsmActivity.State(ActivityEnum.Inactive);
            FsmActivity.State(ActivityEnum.Active).Enter(fsm => {
                mouseTracker.OnSelectionDown += (mt, f) => {
                    switch (f)
                    {
                    case MouseTracker.ButtonFlag.Left:
                        if (mouseCurr.TryInitEdgeMode())
                        {
                            fsmOperation.Goto(OperationEnum.MoveEdge);
                        }
                        break;

                    case MouseTracker.ButtonFlag.Right:
                        break;
                    }
                };
                mouseTracker.OnSelection += (mt, f) => {
                    fsmOperation.Update();
                };
                mouseTracker.OnSelectionUp += (mt, f) => {
                    fsmOperation.Goto(OperationEnum.None);
                };
            }).Update(fsm => {
                fsmOperation.Update();
            }).Exit(fsm => {
                fsmOperation.Goto(OperationEnum.None);
                mouseTracker.Clear();
            });
            FsmActivity.Init();

            fsmOperation.State(OperationEnum.None);
            fsmOperation.State(OperationEnum.MoveEdge).Update(fsm => {
                if (bcon.IsOverGUI)
                {
                    return;
                }

                mouseCurr.Update();

                var duv       = mouseCurr.WorldDuv;
                var screen    = mouseCurr.selectedScreen;
                var data      = blending.BlendingData;
                var iscreen   = screen.x + screen.y * data.Screens.x;
                var trap      = data.Trapeziums[iscreen];
                var iv0       = ScreenSelector.PAIR_EDGES[2 * mouseCurr.selectedEdge];
                var iv1       = ScreenSelector.PAIR_EDGES[2 * mouseCurr.selectedEdge + 1];
                var dx        = ScreenSelector.ScreenSize(data.Screens);
                var worldTrap = ScreenSelector.LocalToWorld(screen.x, screen.y, trap, dx);
                var tan       = (worldTrap[iv1] - worldTrap[iv0]).normalized;
                duv          -= Vector2.Dot(duv, tan) * tan;
                trap[iv0]    += duv;
                trap[iv1]    += duv;
                trap.Clamp01();
                data.Trapeziums[iscreen] = trap;
                data.Invalidate();
            });
            fsmOperation.Init();
        }
Ejemplo n.º 26
0
 /// <summary>
 /// private Constructor
 /// </summary>
 private SelectAction()
 {
     this.FocusTracker = new FocusTracker(SetCandidateElement);
     this.MouseTracker = new MouseTracker(SetCandidateElement);
     this.TreeTracker  = new TreeTracker(this.SetCandidateElement, this);
 }
Ejemplo n.º 27
0
        public TabSelector(bool active)
        {
            Active      = active;
            ActiveIndex = -1;
            mTracker    = new MouseTracker(this)
            {
                MotionEvents        = true,
                EnterLeaveEvents    = true,
                ButtonPressedEvents = true
            };

            mTracker.EnterNotify += (sender, e) =>
            {
                QueueDraw();
            };

            mTracker.LeaveNotify += (sender, e) =>
            {
                QueueDraw();
            };

            mTracker.MouseMoved += (sender, e) =>
            {
                QueueDraw();
            };

            mTracker.ButtonPressed += (sender, e) =>
            {
                if (e.Event.TriggersContextMenu())
                {
                    int index;
                    if (CalculateIndexAtPosition(mTracker.MousePosition.X, out index))
                    {
                        var t = mTabs.ElementAt(index).DockItemTitleTab;
                        if (t != null)
                        {
                            t.item.ShowDockPopupMenu(e.Event.Time, this);
                        }
                    }
                }
                else if (e.Event.Button == 1 && e.Event.Type == Gdk.EventType.ButtonPress)
                {
                    int index;
                    if (CalculateIndexAtPosition(mTracker.MousePosition.X, out index))
                    {
                        if (ActiveIndex != index)
                        {
                            ActiveIndex = index;
                            CurrentTab  = ActiveIndex;
                            if (SelectTab != null)
                            {
                                SelectTab(this, new SelectTabEventArgs(ActiveIndex, true));
                            }
                            QueueDraw();
                        }
                        // else
                        {
                            tabPressed = true;
                            pressX     = e.Event.X;
                            pressY     = e.Event.Y;
                        }
                    }
                }
            };

            mTracker.ButtonReleased += (sender, e) =>
            {
                const int LEFT_MOUSE_BUTTON = 1;

                var t = mTabs.ElementAt(m_CurrentTab).DockItemTitleTab;
                if (tabActivated)
                {
                    tabActivated = false;
                    if (t.item.Status == DockItemStatus.AutoHide)
                    {
                        t.item.Status = DockItemStatus.Dockable;
                    }
                    else
                    {
                        t.item.Status = DockItemStatus.AutoHide;
                    }
                }
                else if (!e.Event.TriggersContextMenu() && e.Event.Button == LEFT_MOUSE_BUTTON)
                {
                    t.frame.DockInPlaceholder(t.item);
                    t.frame.HidePlaceholder();
                    if (GdkWindow != null)
                    {
                        GdkWindow.Cursor = null;
                    }
                    t.frame.Toplevel.KeyPressEvent   -= HeaderKeyPress;
                    t.frame.Toplevel.KeyReleaseEvent -= HeaderKeyRelease;
                    DockItem.SetFocus(t.Page);
                }
                tabPressed = false;
            };

            mTracker.MouseMoved += (sender, e) =>
            {
                if (m_CurrentTab != -1)
                {
                    var t = mTabs.ElementAt(m_CurrentTab).DockItemTitleTab;

                    if (tabPressed && !t.item.Behavior.HasFlag(DockItemBehavior.NoGrip) && Math.Abs(e.Event.X - pressX) > 3 && Math.Abs(e.Event.Y - pressY) > 3)
                    {
                        t.frame.ShowPlaceholder(t.item);
                        GdkWindow.Cursor = fleurCursor;
                        t.frame.Toplevel.KeyPressEvent   += HeaderKeyPress;
                        t.frame.Toplevel.KeyReleaseEvent += HeaderKeyRelease;
                        allowPlaceholderDocking           = true;
                        tabPressed = false;
                    }
                    t.frame.UpdatePlaceholder(t.item, Allocation.Size, allowPlaceholderDocking);
                }
            };
        }
Ejemplo n.º 28
0
		public TabStrip (DockNotebook notebook)
		{
			if (notebook == null)
				throw new ArgumentNullException ("notebook");
			TabWidth = 125;
			TargetWidth = 125;
			tracker = new MouseTracker (this);
			GtkWorkarounds.FixContainerLeak (this);

			this.notebook = notebook;
			WidgetFlags |= Gtk.WidgetFlags.AppPaintable;
			Events |= EventMask.PointerMotionMask | EventMask.LeaveNotifyMask | EventMask.ButtonPressMask;

			var arr = new ImageView (tabbarPrevImage);
			arr.HeightRequest = arr.WidthRequest = 10;
			PreviousButton = new Button (arr);
			PreviousButton.Relief = ReliefStyle.None;
			PreviousButton.CanDefault = PreviousButton.CanFocus = false;

			arr = new ImageView (tabbarNextImage);
			arr.HeightRequest = arr.WidthRequest = 10;
			NextButton = new Button (arr);
			NextButton.Relief = ReliefStyle.None;
			NextButton.CanDefault = NextButton.CanFocus = false;

			DropDownButton = new MenuButton ();
			DropDownButton.Relief = ReliefStyle.None;
			DropDownButton.CanDefault = DropDownButton.CanFocus = false;

			PreviousButton.ShowAll ();
			NextButton.ShowAll ();
			DropDownButton.ShowAll ();

			PreviousButton.Name = "MonoDevelop.DockNotebook.BarButton";
			NextButton.Name = "MonoDevelop.DockNotebook.BarButton";
			DropDownButton.Name = "MonoDevelop.DockNotebook.BarButton";

			PreviousButton.Parent = this;
			NextButton.Parent = this;
			DropDownButton.Parent = this;

			children.Add (PreviousButton);
			children.Add (NextButton);
			children.Add (DropDownButton);

			tracker.HoveredChanged += (sender, e) => {
				if (!tracker.Hovered) {
					SetHighlightedTab (null);
					UpdateTabWidth (tabEndX - tabStartX);
					QueueDraw ();
				}
			};

			notebook.PageAdded += (sender, e) => QueueResize ();
			notebook.PageRemoved += (sender, e) => QueueResize ();

			closingTabs = new Dictionary<int, DockNotebookTab> ();
		}
Ejemplo n.º 29
0
 /// <summary>
 /// Creates a new mouse key tracker.
 /// </summary>
 /// <param name="code">The key code to track.</param>
 /// <param name="tracker">The tracker to use for drag events.</param>
 public MouseKeyTracker(KeyCode code, MouseTracker mouse)
     : base(code)
 {
     this.mouse = mouse;
 }
Ejemplo n.º 30
0
        public StatusArea()
        {
            theme     = new StatusAreaTheme();
            renderArg = new RenderArg();

            mainContext   = new MainStatusBarContextImpl(this);
            activeContext = mainContext;
            contexts.Add(mainContext);

            VisibleWindow = false;
            NoShowAll     = true;
            WidgetFlags  |= Gtk.WidgetFlags.AppPaintable;

            statusIconBox.BorderWidth = 0;
            statusIconBox.Spacing     = 3;

            Action <bool> animateProgressBar =
                showing => this.Animate("ProgressBarFade",
                                        val => renderArg.ProgressBarAlpha = val,
                                        renderArg.ProgressBarAlpha,
                                        showing ? 1.0f : 0.0f,
                                        easing: Easing.CubicInOut);

            ProgressBegin += delegate {
                renderArg.ShowProgressBar = true;
//				StartBuildAnimation ();
                renderArg.ProgressBarFraction = 0;
                QueueDraw();
                animateProgressBar(true);
            };

            ProgressEnd += delegate {
                renderArg.ShowProgressBar = false;
//				StopBuildAnimation ();
                QueueDraw();
                animateProgressBar(false);
            };

            ProgressFraction += delegate(object sender, FractionEventArgs e) {
                renderArg.ProgressBarFraction = (float)e.Work;
                QueueDraw();
            };

            contentBox.PackStart(messageBox, true, true, 0);
            contentBox.PackEnd(statusIconBox, false, false, 0);
            contentBox.PackEnd(statusIconSeparator = new StatusAreaSeparator(), false, false, 0);
            contentBox.PackEnd(buildResultWidget   = CreateBuildResultsWidget(Orientation.Horizontal), false, false, 0);

            HasTooltip    = true;
            QueryTooltip += messageBoxToolTip;

            mainAlign              = new Alignment(0, 0.5f, 1, 0);
            mainAlign.LeftPadding  = 12;
            mainAlign.RightPadding = 8;
            mainAlign.Add(contentBox);
            Add(mainAlign);

            mainAlign.ShowAll();
            statusIconBox.Hide();
            statusIconSeparator.Hide();
            buildResultWidget.Hide();
            Show();

            this.ButtonPressEvent += delegate {
                if (sourcePad != null)
                {
                    sourcePad.BringToFront(true);
                }
            };

            statusIconBox.Shown += delegate {
                UpdateSeparators();
            };

            statusIconBox.Hidden += delegate {
                UpdateSeparators();
            };

            messageQueue = new Queue <Message> ();

            tracker                 = new MouseTracker(this);
            tracker.MouseMoved     += (sender, e) => QueueDraw();
            tracker.HoveredChanged += (sender, e) => {
                this.Animate("Hovered",
                             x => renderArg.HoverProgress = x,
                             renderArg.HoverProgress,
                             tracker.Hovered ? 1.0f : 0.0f,
                             easing: Easing.SinInOut);
            };

            IdeApp.FocusIn += delegate {
                // If there was an error while the application didn't have the focus,
                // trigger the error animation again when it gains the focus
                if (errorAnimPending)
                {
                    errorAnimPending = false;
                    TriggerErrorAnimation();
                }
            };
        }
Ejemplo n.º 31
0
    //private ScenarioHandler scenarioHandler = null;
    void Start()
    {
        /*scenarioHandler = this.GetComponent<ScenarioHandler>();
        if (scenarioHandler == null) {
            scenarioHandler = this.GetComponentInChildren<ScenarioHandler>();
        }*/

        //if (!scenarioHandler.DoneTesting) {
            if (questionsDict == null) {
                StartCoroutine(LoadQuestions());
            }

            answersForm = new WWWForm();
        //}

        mouseTracker = GameObject.FindGameObjectWithTag("GameController").GetComponent<MouseTracker>();
        if (mouseTracker == null)
            Debug.LogError("Could not locate MouseTracker component on GameController");
    }