Пример #1
0
        private void SaveConfiguration(ConfigureEventArgs cpea)
        {
            var databaseFileNode = cpea.Document.CreateElement("databaseFile");

            databaseFileNode.SetAttribute("path", this.databaseFilename);
            cpea.RootNode.AppendChild(databaseFileNode);
        }
Пример #2
0
    /// <summary>
    /// Triggered when the drawing area is configured.
    /// </summary>
    private void OnConfigure(
        object obj,
        ConfigureEventArgs args)
    {
        // Pull out some fields
        EventConfigure ev     = args.Event;
        Window         window = ev.Window;
        int            width  = Allocation.Width;
        int            height = Allocation.Height;
        int            min    = Math.Min(width, height);

        viewport.Height = height;
        viewport.Width  = width;

        // Create the backing pixmap
        pixmap = new Pixmap(window, width, height, -1);

        // Update the current pane
        if (Sprite != null)
        {
            Sprite.Height = Sprite.Width = ((int)(min * 0.75));
        }

        // Mark ourselves as done
        args.RetVal = true;
    }
Пример #3
0
        private void SaveConfig(ConfigureEventArgs cea)
        {
            var pluginsNode = cea.Document.CreateElement("plugins");

            cea.ConfigNode.AppendChild(pluginsNode);
            this.savePluginConfigEvent.Fire(new ConfigurePluginEventArgs(cea.Document));
        }
Пример #4
0
    private void OnConfigure(object o, ConfigureEventArgs args)
    {
        if (!MakeCurrent())
        {
            LogManager.Log(LogLevel.Warning, "MakeCurrent() - OnConfigure failed");
            return;
        }

        GlUtil.ContextValid = true;

        // setup opengl state and transform
        gl.Disable(gl.DEPTH_TEST);
        gl.Disable(gl.CULL_FACE);
        gl.Enable(gl.TEXTURE_2D);
        gl.Enable(gl.BLEND);
        gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);

        gl.ClearColor(0f, 0f, 0f, 0f);
        gl.Viewport(0, 0, Allocation.Width, Allocation.Height);
        gl.MatrixMode(gl.PROJECTION);
        gl.LoadIdentity();
        gl.Ortho(0, Allocation.Width, Allocation.Height, 0,
                 -1.0f, 1.0f);
        gl.MatrixMode(gl.MODELVIEW);
        gl.LoadIdentity();

        GlUtil.Assert("After setting opengl transforms");

        GlUtil.ContextValid = false;
    }
Пример #5
0
 protected virtual void OnConfigure(ConfigureEventArgs e)
 {
     if (Configure != null)
     {
         Configure(this, e);
     }
 }
Пример #6
0
        private void OnFloatingConfigure(object o, ConfigureEventArgs e)
        {
            floatX = e.Event.X;
            floatY = e.Event.Y;
            width  = e.Event.Width;
            height = e.Event.Height;

            e.RetVal = false;
        }
Пример #7
0
        private void SaveConfig(ConfigureEventArgs cea)
        {
            var rootNode = cea.RootNode;
            var newestKnownVersionNode = cea.Document.CreateElement("newestKnownVersion");

            newestKnownVersionNode.SetAttribute("major", this.NewestKnownVersion.Major.ToString());
            newestKnownVersionNode.SetAttribute("minor", this.NewestKnownVersion.Minor.ToString());
            rootNode.AppendChild(newestKnownVersionNode);
        }
Пример #8
0
 private void SaveConfig(ConfigureEventArgs cea)
 {
     if (this.PomodoroTimeSpan != defaultPomodoroTimeSpan)
     {
         var configNode   = cea.ConfigNode;
         var pomodoroNode = cea.Document.CreateElement("pomodoro");
         pomodoroNode.SetAttribute("timeSpan", this.PomodoroTimeSpan.ToString());
         configNode.AppendChild(pomodoroNode);
     }
 }
Пример #9
0
        private void LoadConfig(ConfigureEventArgs cea)
        {
            var newestKnownVersionNode = (XmlElement)cea.RootNode.SelectSingleNode("newestKnownVersion");

            if (newestKnownVersionNode != null)
            {
                var minor = int.Parse(newestKnownVersionNode.GetAttribute("minor"));
                var major = int.Parse(newestKnownVersionNode.GetAttribute("major"));
                this.NewestKnownVersion = new Version(major, minor);
            }
        }
Пример #10
0
 private void LoadConfig(ConfigureEventArgs cea)
 {
     if (cea.ConfigNode != null)
     {
         var pomodoroNode = cea.ConfigNode.SelectSingleNode("pomodoro") as XmlElement;
         if (pomodoroNode != null)
         {
             var timeSpanString = pomodoroNode.GetAttribute("timeSpan");
             this.PomodoroTimeSpan = TimeSpan.Parse(timeSpanString);
         }
     }
 }
Пример #11
0
        static void ConfigureEvent(object obj, ConfigureEventArgs args)
        {
            Gdk.EventConfigure ev         = args.Event;
            Gdk.Window         window     = ev.Window;
            Gdk.Rectangle      allocation = darea.Allocation;

            pixmap = new Gdk.Pixmap(window, allocation.Width, allocation.Height, -1);
            pixmap.DrawRectangle(darea.Style.WhiteGC, true, 0, 0,
                                 allocation.Width, allocation.Height);

            args.RetVal = true;
        }
Пример #12
0
        public void HandleToplevelConfigure(object o, ConfigureEventArgs args)
        {
            int x, y;

            x = args.Event.X - old_win_pos.X;
            y = args.Event.Y - old_win_pos.Y;

            GetPosition(out var loupe_x, out var loupe_y);
            Move(loupe_x + x, loupe_y + y);

            old_win_pos.X = args.Event.X;
            old_win_pos.Y = args.Event.Y;
        }
Пример #13
0
        private void SaveConfig(ConfigureEventArgs cea)
        {
            if (this.allReminders.Count != 0)
            {
                var configNode    = cea.ConfigNode;
                var remindersNode = cea.Document.CreateElement("reminders");
                configNode.AppendChild(remindersNode);

                foreach (var reminder in allReminders)
                {
                    this.AllReminderPlugins.GetPlugin(reminder).SaveReminder(reminder, remindersNode);
                }
            }
        }
Пример #14
0
        private void LoadConfiguration(ConfigureEventArgs cpea)
        {
            var databaseFileNode = (XmlElement)cpea.Document.SelectSingleNode("//cherryTomato/databaseFile");

            if (databaseFileNode != null)
            {
                this.databaseFilename = databaseFileNode.GetAttribute("path");
            }

            this.connection = new DatabaseConnection(this.databaseFilename);
            var ea = new ConnectToDbEventArgs(this.connection);

            this.connectToDbEvent.Fire(ea);
        }
Пример #15
0
        ///<summary>Handle the Configure Event</summary>
        void OnConfigured(object o, ConfigureEventArgs args)
        {
            if (widgetRealized == false)
            {
                return;
            }

            Gdk.EventConfigure conf = args.Event;

            Resize(conf.Width, conf.Height);

            // make sure the current offset is visible
            MakeOffsetVisible(dataView.Offset, ShowType.Start);
        }
Пример #16
0
        // Create a new pixmap of the appropriate size to store our scribbles
        private void ScribbleConfigure(object o, ConfigureEventArgs args)
        {
            Widget    widget     = o as Widget;
            Rectangle allocation = widget.Allocation;

            pixmap = new Pixmap(widget.GdkWindow, allocation.Width, allocation.Height, -1);

            // Initialize the pixmap to white
            pixmap.DrawRectangle(widget.Style.WhiteGC, true, 0, 0,
                                 allocation.Width, allocation.Height);

            // We've handled the configure event, no need for further processing.
            args.RetVal = true;
        }
Пример #17
0
    protected override void OnConfigure(object o, ConfigureEventArgs args)
    {
        EventConfigure eventConfigure = args.Event;

        Gdk.Window window = eventConfigure.Window;
        pixmap = new Pixmap(window,
                            Allocation.Width,
                            Allocation.Height,
                            -1);
        // Initialize the pixmap to white
        pixmap.DrawRectangle(Style.WhiteGC, true, 0, 0,
                             Allocation.Width, Allocation.Height);
        // We've handled the configure event, no need for further processing.
        args.RetVal = true;
    }
Пример #18
0
        private void LoadConfig(ConfigureEventArgs cea)
        {
            var reminderNodes = cea.ConfigNode.SelectNodes("reminders/reminder");

            foreach (XmlElement reminderNode in reminderNodes)
            {
                var typeName = reminderNode.GetAttribute("typeName");
                var plugin   = this.AllReminderPlugins.GetPlugin(typeName);
                if (plugin == null)
                {
                    Trace.WriteLine("Plugin for reminders of type '" + typeName + "' is not registered.");
                    continue;
                }

                var reminder = plugin.LoadReminder(reminderNode);
                this.AddReminder(reminder);
            }
        }
Пример #19
0
        /// <summary>Función encargada de responder a los cambios de
        /// tamaño del lienzo de dibujo.</summary>
        /// <param name="o"></param>
        /// <param name="args"></param>

        private void OnConfigureEvent(object o, ConfigureEventArgs args)
        {
            lock (this)
            {
                // TODO ver de donde sacamos window ahora
                Gdk.EventConfigure ev = args.Event;
                this.window = ev.Window;

                pixmap = new Pixmap(window, ev.Width, ev.Height, -1);
                _ancho = ev.Width;
                _alto  = ev.Height;
                this.Clean();
                if (rdd != null)
                {
                    rdd.ActualizarTodo();
                }
                SignalArgs sa = (SignalArgs)args;
                sa.RetVal = true;
            }
        }
Пример #20
0
        // Create a new surface of the appropriate size to store our scribbles
        private void ScribbleConfigure(object o, ConfigureEventArgs args)
        {
            Widget widget = o as Widget;

            if (surface != null)
            {
                surface.Destroy();
            }

            var allocation = widget.Allocation;

            surface = widget.Window.CreateSimilarSurface(Cairo.Content.Color, allocation.Width, allocation.Height);
            var cr = new Cairo.Context(surface);

            cr.SetSourceRGB(1, 1, 1);
            cr.Paint();
            ((IDisposable)cr).Dispose();

            // We've handled the configure event, no need for further processing.
            args.RetVal = true;
        }
Пример #21
0
        protected void Configure(object o, ConfigureEventArgs args)
        {
            Widget widget = o as Widget;

            if (surface != null)
            {
                surface.Dispose();
            }

            var allocation = widget.Allocation;

            surface = widget.Window.CreateSimilarSurface(Cairo.Content.Color, allocation.Width, allocation.Height);

            var cr = new Context(surface);

            cr.SetSourceRGB(1, 1, 1);
            cr.Paint();
            cr.Dispose();

            args.RetVal = true;
        }
Пример #22
0
        /// <summary>
        /// Triggered when the drawing area is configured.
        /// </summary>
        private void OnConfigure(
            object obj,
            ConfigureEventArgs args)
        {
            // Pull out some fields and figure out the sizes
            EventConfigure ev     = args.Event;
            Window         window = ev.Window;
            int            width  = Allocation.Width;
            int            height = Allocation.Height;
            int            min    = Math.Min(width, height);

            // Figure out the tile height
            tileSize = min / Game.Board.Size;
            log.Info("New tile size: {0}px", tileSize);

            // Adjust the viewport height
            viewport.Height = height;
            viewport.Width  = width;

            // Create the backing pixmap
            pixmap = new Pixmap(window, width, height, -1);

            // We moved, so rapid move the tiles
            foreach (ISprite sprite in sprites)
            {
                ContainerSprite cs = sprite as ContainerSprite;

                if (cs != null)
                {
                    cs.FireInvalidate();
                    cs.X = cs.TokenSprite.X = tileSize * cs.TokenSprite.Token.Column;
                    cs.FireInvalidate();
                }
            }

            // Mark ourselves as done
            QueueDraw();
            args.RetVal = true;
        }
Пример #23
0
    /// <summary>
    /// Triggered when the drawing area is configured.
    /// </summary>
    private void OnConfigure(
        object obj,
        ConfigureEventArgs args)
    {
        // Pull out some fields
        EventConfigure ev     = args.Event;
        Window         window = ev.Window;
        int            width  = Allocation.Width;
        int            height = Allocation.Height;

        // Create the backing pixmap
        pixmap = new Pixmap(window, width, height, -1);

        // Update the current pane
        // TODO, there is a bug with this and I don't know why
        if (currentPane != null)
        {
            currentPane.Configure(width, height - 50);
        }

        // Mark ourselves as done
        args.RetVal = true;
    }
Пример #24
0
        private void OnWinConfigure(object o, ConfigureEventArgs args)
        {
            Gdk.EventConfigure e = args.Event;

            if (_oldWidth != e.Width || _oldHeight != e.Height)
            {
                Gdk.Pixmap tmp = new Gdk.Pixmap(_window.GdkWindow, e.Width, e.Height, -1);

                int minw = e.Width < _oldWidth ? e.Width : _oldWidth;
                int minh = e.Height < _oldHeight ? e.Height : _oldHeight;

                using (Context context = Gdk.CairoHelper.Create(tmp))
                {
                    Gdk.CairoHelper.SetSourcePixmap(context, _pixmap, 0, 0);
                    context.Rectangle(0, 0, minw, minh);
                    context.Fill();
                }

                _pixmap = tmp;
            }

            _oldWidth  = e.Width;
            _oldHeight = e.Height;
        }
 private void SaveConfig(ConfigureEventArgs cea)
 {
     if (this.PomodoroTimeSpan != defaultPomodoroTimeSpan)
     {
         var configNode = cea.ConfigNode;
         var pomodoroNode = cea.Document.CreateElement("pomodoro");
         pomodoroNode.SetAttribute("timeSpan", this.PomodoroTimeSpan.ToString());
         configNode.AppendChild(pomodoroNode);
     }
 }
Пример #26
0
 void TopLevelConfigureEvent(object o, ConfigureEventArgs args)
 {
     this.Move(args.Event.X + (int)this.TransientPosition.X, args.Event.Y + (int)this.TransientPosition.Y);
 }
Пример #27
0
 private void on_MainWindow_configure_event(object o, ConfigureEventArgs e)
 {
     Gui.Settings.WindowSize     = new System.Drawing.Size(e.Event.Width, e.Event.Height);
     Gui.Settings.WindowPosition = new System.Drawing.Point(e.Event.X, e.Event.Y);
 }
Пример #28
0
 void HandleHostConfigure(object o, ConfigureEventArgs args)
 {
     Relocate();
 }
Пример #29
0
 private void OnToplevelConfigureEvent(object o, ConfigureEventArgs args)
 {
     Relocate();
 }
Пример #30
0
 /// <summary>
 /// Sets the viewport to redraw whenever the widget gets a configure event.
 /// </summary>
 /// <param name="o">The sending object.</param>
 /// <param name="args">The configuration arguments.</param>
 private void OnViewportConfigured(object o, ConfigureEventArgs args)
 {
     this.ViewportHasPendingRedraw = true;
 }
Пример #31
0
 protected virtual void OnConfigure(ConfigureEventArgs e)
 {
     if (Configure != null)
     Configure(this, e);
 }
 private void LoadConfig(ConfigureEventArgs cea)
 {
     if (cea.ConfigNode != null)
     {
         var pomodoroNode = cea.ConfigNode.SelectSingleNode("pomodoro") as XmlElement;
         if (pomodoroNode != null)
         {
             var timeSpanString = pomodoroNode.GetAttribute("timeSpan");
             this.PomodoroTimeSpan = TimeSpan.Parse(timeSpanString);
         }
     }
 }
Пример #33
0
            void OnConfigured(object o, ConfigureEventArgs args)
            {
                pixmap = new Pixmap (args.Event.Window,
                             Allocation.Width,
                             Allocation.Height);
                cairo = Gdk.CairoHelper.Create (pixmap);
                cairo.Rectangle (0, 0,
                         Allocation.Width,
                         Allocation.Height);
                cairo.Clip ();

                ArrayList oldlist = points;
                points = new ArrayList ();

                ComputePositions ();
                foreach (GraphPoint point in oldlist)
                {
                    __AddGameInfo (point.info);
                }

                UpdatePixmap ();
            }
Пример #34
0
        public void start(ushort ComPort, uint BaudRate)
        {
            if (isStarted)
            return;

              OnStatus(new StatusEventArgs("Initializing..."));

              // Start by sending the wake up command to the Flock
              if (!Bird.RS232WakeUp(GROUP_ID, true, 1, ref ComPort, BaudRate, READ_TIMEOUT, WRITE_TIMEOUT,
               Bird.GroupModeSettings.GMS_GROUP_MODE_ALWAYS))
              {
            OnStatus(new StatusEventArgs("Bird wake up failed"));
            return;
              }

              // Configure the device
              ConfigureEventArgs cfg = new ConfigureEventArgs();
              if (!Bird.GetSystemConfig(GROUP_ID, ref cfg.SystemConfig, false)) {
            OnStatus(new StatusEventArgs("Bird system configuration failed"));
            return;
              }

              if (!Bird.GetDeviceConfig(GROUP_ID, 1, ref cfg.DeviceConfig, false)) {
            OnStatus(new StatusEventArgs("Bird device configuration failed"));
            return;
              }

              OnConfigure(cfg);

              if (!Bird.SetSystemConfig(GROUP_ID, ref cfg.SystemConfig)) {
            OnStatus(new StatusEventArgs("Bird system configuration failed"));
            return;
              }

              if (!Bird.SetDeviceConfig(GROUP_ID, 1, ref cfg.DeviceConfig)) {
            OnStatus(new StatusEventArgs("Bird device configuration failed"));
            return;
              }

              // Start acquisition
              if (!Bird.StartFrameStream(GROUP_ID)) {
            OnStatus(new StatusEventArgs("Bird failed to start streaming"));
            return;
              }

              _PosScale = cfg.DeviceConfig.Scaling;

              // Start receiving frames asynchronously
              _StopRequest = false;
              _Worker = new AsyncRun(run);
              _WorkerResult = _Worker.BeginInvoke(AsyncOperationManager.CreateOperation(this),
            new SendOrPostCallback(OnPose),
            new SendOrPostCallback(OnStatus), null, null);

              OnStatus(new StatusEventArgs("Ok"));
        }
 private void SaveConfig(ConfigureEventArgs cea)
 {
     var pluginsNode = cea.Document.CreateElement("plugins");
     cea.ConfigNode.AppendChild(pluginsNode);
     this.savePluginConfigEvent.Fire(new ConfigurePluginEventArgs(cea.Document));
 }
Пример #36
0
 private void OnConfigureEvent(object sender, ConfigureEventArgs args)
 {
     QueueSaveState();
 }
 private void LoadConfig(ConfigureEventArgs cea)
 {
     var cpea = new ConfigurePluginEventArgs(cea.Document);
     this.loadPluginConfigEvent.Fire(new ConfigurePluginEventArgs(cea.Document));
 }