Ejemplo n.º 1
0
        public Annotation() : base(0, 0, 1, 1)
        {
            d_vbox = new VBox(false, 6);
            d_vbox.Show();

            SetPadding(6, 6, 6, 6);

            d_eventBox = new EventBox();
            d_eventBox.Show();
            d_eventBox.AddEvents((int)Gdk.EventMask.AllEventsMask);

            d_labelInfo = new Label();
            d_labelInfo.Show();
            d_labelInfo.SetAlignment(0, 0);
            d_labelInfo.Wrap         = true;
            d_labelInfo.LineWrapMode = Pango.WrapMode.WordChar;

            d_eventBox.Add(d_labelInfo);
            d_vbox.PackStart(d_eventBox, true, true, 0);

            d_editorWindow = new ScrolledWindow();
            d_editorWindow.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);
            d_editorWindow.ShadowType = ShadowType.EtchedIn;

            d_editor          = new TextView();
            d_editor.WrapMode = WrapMode.WordChar;
            d_editor.Show();

            d_editorWindow.Add(d_editor);

            d_vbox.PackStart(d_editorWindow, true, true, 0);

            d_eventBox.ButtonPressEvent += OnEventBoxButtonPress;

            d_editor.KeyPressEvent += OnEditorKeyPressEvent;
            d_editor.FocusOutEvent += OnEditorFocusOutEvent;

            Update(null);

            Add(d_vbox);
        }
Ejemplo n.º 2
0
        public void Init()
        {
            gtkWin = new Window("DRAL Retag");

            var size = gtkWin.Display.PrimaryMonitor.Workarea.Size;

            Image <Pixel> icon = new Image <Pixel>(32, 32);

            icon.ApplyFilter((_, _2) => Pixels.Black);
            Graphics.FromImage(icon).DrawString("DR", new FontSize(BaseFonts.Premia, 2), Pixels.Red, 0, 0);
            Graphics.FromImage(icon).DrawString("AL", new FontSize(BaseFonts.Premia, 2), Pixels.Red, 0, 16);
            gtkWin.Icon = GtkWrapper.ToPixbuf(icon);
            gtkWin.Resize(size.Width, size.Height);

            //Wfrm = 13/9 of Wimg
            //Wimg = 9*Wfrm/13
            int maxImageWidth  = 9 * size.Width / 13;
            int maxImageHeight = size.Height - 100;
            int maxImageWidthTakingImageHeight = maxImageHeight * 4 / 3;
            int maxImageHeightTakingImageWidth = maxImageWidth * 3 / 4;

            var imageWidth  = Math.Min(maxImageWidth, maxImageWidthTakingImageHeight);
            var imageHeight = Math.Min(maxImageHeight, maxImageHeightTakingImageWidth);

            Box    bx               = new Box(Orientation.Vertical, 1);
            Box    menu             = new Box(Orientation.Horizontal, 1);
            Button buttonLoadLabels = new Button()
            {
                Label = "Load labels"
            };

            buttonLoadLabels.Clicked += ButtonLoadLabels_Clicked;
            menu.Add(buttonLoadLabels);
            buttons.Add(buttonLoadLabels);
            Button buttonLoadImages = new Button()
            {
                Label = "Load Image"
            };

            buttonLoadImages.Clicked += ButtonLoadImages_Clicked;
            menu.Add(buttonLoadImages);
            buttons.Add(buttonLoadImages);
            Button buttonSave = new Button()
            {
                Label = "Save"
            };

            buttonSave.Clicked += ButtonSave_Clicked;
            menu.Add(buttonSave);
            buttons.Add(buttonSave);
            Button btnFixMissing = new Button()
            {
                Label = "Repair Dataset"
            };

            btnFixMissing.Clicked += BtnFixMissing_Clicked;
            menu.Add(btnFixMissing);
            buttons.Add(btnFixMissing);
            chkGenNow        = new CheckButton("Generate now");
            chkGenNow.Active = true;
            menu.Add(chkGenNow);

            lblCount = new Label("0");
            menu.Add(lblCount);
            Label lblImageInTraining = new Label("images in training");

            menu.Add(lblImageInTraining);

            Box      bottom = new Box(Orientation.Horizontal, 1);
            EventBox evt    = new EventBox();

            left = new Fixed();
            evt.Add(left);

            pictureBox = new FixedSizeImage(new MoyskleyTech.ImageProcessing.Image.Size(imageWidth, imageHeight));
            pictureBox.WidthRequest = imageWidth;
            left.Put(pictureBox, 0, 0);

            evt.AddEvents((int)Gdk.EventMask.AllEventsMask);
            evt.MotionNotifyEvent  += Left_MotionNotifyEvent;
            evt.ButtonPressEvent   += Evt_ButtonPressEvent;
            evt.ButtonReleaseEvent += Evt_ButtonReleaseEvent;

            right = new Box(Orientation.Vertical, 1);
            right.WidthRequest = 200;
            var siz = new MoyskleyTech.ImageProcessing.Image.Size(imageWidth * 4 / 9, imageHeight / 3);

            iOri        = new FixedSizeImage(siz);
            iActivated  = new FixedSizeImage(siz);
            iActivation = new FixedSizeImage(siz);
            right.Add(iOri);
            right.Add(iActivated);
            right.Add(iActivation);

            rectangle_top    = new DrawingArea();
            rectangle_left   = new DrawingArea();
            rectangle_right  = new DrawingArea();
            rectangle_bottom = new DrawingArea();

            rectangle_top.Drawn    += Black_Drawn;
            rectangle_left.Drawn   += Black_Drawn;
            rectangle_right.Drawn  += Black_Drawn;
            rectangle_bottom.Drawn += Black_Drawn;

            viewCircle = new DrawingArea();
            viewCircle.WidthRequest  = windowSize;
            viewCircle.HeightRequest = windowSize;
            viewCircle.Drawn        += Da_Drawn;

            left.Put(rectangle_top, 0, 0);
            left.Put(rectangle_left, 0, 0);
            left.Put(rectangle_right, 0, 0);
            left.Put(rectangle_bottom, 0, 0);
            left.Put(viewCircle, 0, 0);

            bottom.Add(evt);
            bottom.Add(right);

            menu.HeightRequest = 30;
            bx.Add(menu);
            bx.Add(bottom);
            gtkWin.KeyPressEvent += GtkWin_KeyPressEvent;
            gtkWin.Add(bx);
            //Show Everything
            gtkWin.DeleteEvent += delegate { Application.Quit(); };
        }
Ejemplo n.º 3
0
    /// <summary>
    ///     The set up buttons.
    /// </summary>
    private void SetUpButtons()
    {
        var x = 5; 
        var y = 5;

        this._fixedContainer = new Fixed();
        this._weatherButton = new CWeatherButton(0, 300);
        this._watchButton = new CWatchButton(0, 375);

        IRemoteDevice[] devs = CommLayerManager.Instance.GetAllDevices(DeviceAuthorizedEnum.Authorized).ToArray();

        foreach (IRemoteDevice dev in devs)
        {
            var p1 = new CThemperatureButton(x, y, dev);
            var e1 = new EventBox();
            e1.VisibleWindow = false;
            e1.Add(p1);

            e1.AddEvents((int)(
                EventMask.ButtonPressMask | 
                EventMask.ButtonReleaseMask | 
                EventMask.KeyPressMask | 
                EventMask.PointerMotionMask));

            e1.ButtonPressEvent += HandleButtonPressEvent;

            _fixedContainer.Put(e1, x, y);
            x += p1.WidthRequest + 5;
        }

        _fixedContainer.Add(this._weatherButton);
        _fixedContainer.Add(this._watchButton);

        //var chart = new CChart(0, 120);
        //chart.Show();
        //_fixedContainer.Add(chart);
        //test(_fixedContainer);

        this.Add(_fixedContainer);

    }
Ejemplo n.º 4
0
        public void Init(string image)
        {
            gtkWin = new Window("DRAL tagger[" + image + "]");

            var size = gtkWin.Display.PrimaryMonitor.Workarea.Size;

            Image <Pixel> icon = new Image <Pixel>(32, 32);

            icon.ApplyFilter((_, _2) => Pixels.Black);
            Graphics.FromImage(icon).DrawString("DR", new FontSize(BaseFonts.Premia, 2), Pixels.Red, 0, 0);
            Graphics.FromImage(icon).DrawString("AL", new FontSize(BaseFonts.Premia, 2), Pixels.Red, 0, 16);
            gtkWin.Icon = GtkWrapper.ToPixbuf(icon);
            gtkWin.Resize(size.Width, size.Height);

            int maxImageWidth  = size.Width - 100;
            int maxImageHeight = size.Height - 100;
            int maxImageWidthTakingImageHeight = maxImageHeight * 4 / 3;
            int maxImageHeightTakingImageWidth = maxImageWidth * 3 / 4;

            var imageWidth  = Math.Min(maxImageWidth, maxImageWidthTakingImageHeight);
            var imageHeight = Math.Min(maxImageHeight, maxImageHeightTakingImageWidth);

            Box bx   = new Box(Orientation.Vertical, 1);
            Box menu = new Box(Orientation.Horizontal, 1);


            Button buttonSave = new Button()
            {
                Label = "Save"
            };

            buttonSave.Clicked += ButtonSave_Clicked;
            menu.Add(buttonSave);
            buttons.Add(buttonSave);
            Button btnCancel = new Button()
            {
                Label = "Cancel"
            };

            btnCancel.Clicked += BtnCancel_Clicked;
            menu.Add(btnCancel);
            buttons.Add(btnCancel);

            EventBox evt = new EventBox();

            imgBox = new DrawingArea();
            evt.Add(imgBox);

            imgBox.WidthRequest  = imageWidth;
            imgBox.HeightRequest = imageHeight;
            imgBox.Drawn        += ImgBox_Drawn;

            evt.AddEvents((int)Gdk.EventMask.AllEventsMask);
            evt.MotionNotifyEvent  += ImgBox_MotionNotifyEvent;
            evt.ButtonPressEvent   += Evt_ButtonPressEvent;
            evt.ButtonReleaseEvent += Evt_ButtonReleaseEvent;


            menu.HeightRequest = 30;
            bx.Add(evt);
            bx.Add(menu);

            gtkWin.KeyPressEvent += GtkWin_KeyPressEvent;
            gtkWin.Add(bx);

            gtkWin.DeleteEvent += GtkWin_DeleteEvent;
        }