Beispiel #1
0
        public ImageSetup(bool invert, Callback c)
        {
            Glade.XML gxml = new Glade.XML(Assembly.GetExecutingAssembly(), "ImageSetup.glade", "ImageSetupWindow", null);
            gxml.BindFields(this);

            ImageSetupWindow.DeleteEvent += CloseWindow;
            CloseButton.Clicked          += CloseWindow;

            InvertButton.Active   = invert;
            InvertButton.Toggled += delegate(object o, EventArgs args) { c(InvertButton.Active); };

            ImageSetupWindow.ShowAll();
        }
Beispiel #2
0
        public MultiplierSetup(int num, Callback c)
        {
            Glade.XML gxml = new Glade.XML(Assembly.GetExecutingAssembly(), "Multiplier.glade", "MultiplierWindow", null);
            gxml.BindFields(this);

            MultiplierWindow.DeleteEvent += CloseWindow;
            CloseButton.Clicked          += CloseWindow;

            Spin.Value         = num;
            Spin.ValueChanged += delegate(object o, EventArgs args) { c(Spin.ValueAsInt); };

            MultiplierWindow.ShowAll();
        }
Beispiel #3
0
        public DeHaarSetup(int levels, Callback c)
        {
            Glade.XML gxml = new Glade.XML(Assembly.GetExecutingAssembly(), "DeHaar.glade", "DeHaarWindow", null);
            gxml.BindFields(this);

            DeHaarWindow.DeleteEvent += CloseWindow;
            CloseButton.Clicked      += CloseWindow;

            HaarSpin.Value         = levels;
            HaarSpin.ValueChanged += delegate(object o, EventArgs args) { c(HaarSpin.ValueAsInt); };

            DeHaarWindow.ShowAll();
        }
Beispiel #4
0
        public EdgeSetup(bool energy, Callback c)
        {
            Glade.XML gxml = new Glade.XML(Assembly.GetExecutingAssembly(), "Edge.glade", "EdgeWindow", null);
            gxml.BindFields(this);

            EdgeWindow.DeleteEvent += CloseWindow;
            CloseButton.Clicked    += CloseWindow;

            EnergyButton.Active   = energy;
            EnergyButton.Toggled += delegate(object o, EventArgs args) { c(EnergyButton.Active); };

            EdgeWindow.ShowAll();
        }
Beispiel #5
0
        public RandomSplit(Callback c)
        {
            Glade.XML gxml = new Glade.XML(Assembly.GetExecutingAssembly(), "Random.glade", "RandomWindow", null);
            gxml.BindFields(this);

            RandomWindow.DeleteEvent += CloseWindow;
            CloseButton.Clicked      += CloseWindow;

            SplitButton.Clicked += delegate(object o, EventArgs args)
            {
                c(Spin.ValueAsInt, ExactButton.Active);
                RandomWindow.Destroy();
            };

            RandomWindow.ShowAll();
        }
Beispiel #6
0
        public PluginList()
        {
            Glade.XML gxml = new Glade.XML("PluginList.glade", "PluginListWindow");
            gxml.BindFields(this);

            PluginListWindow.DeleteEvent += CloseWindow;
            CloseButton.Clicked          += CloseWindow;

            PluginListWindow.IconList = new Gdk.Pixbuf[2] {
                new Gdk.Pixbuf(null, "plugin-48.png"),
                new Gdk.Pixbuf(null, "plugin-16.png")
            };
            PluginImage.FromPixbuf = new Gdk.Pixbuf(null, "plugin-48.png");

            PluginListDisplay.Buffer = new PluginListContent();

            PluginListWindow.ShowAll();
        }
Beispiel #7
0
        public Badness(int total, int matched, Category[] cat)
        {
            Glade.XML gxml = new Glade.XML(Assembly.GetExecutingAssembly(), "Badness.glade", "BadnessWindow", null);
            gxml.BindFields(this);

            BadnessWindow.DeleteEvent += CloseWindow;
            CloseButton.Clicked       += CloseWindow;

            GeneralResult.Text = String.Format(Catalog.GetPluralString(
                                                   "Incorrectly recognized <b>{0}</b> image out of <b>{1}</b>. ({2:p})",
                                                   "Incorrectly recognized <b>{0}</b> images out of <b>{1}</b>. ({2:p})", matched),
                                               matched, total, ((double)matched) / total);
            GeneralResult.UseMarkup = true;

            ResultSocket.AddWithViewport(new CategoryList(cat));

            BadnessWindow.ShowAll();
        }
Beispiel #8
0
        public LoadError(ArrayList errors)
        {
            Glade.XML gxml = new Glade.XML(Assembly.GetExecutingAssembly(), "LoadError.glade", "LoadErrorWindow", null);
            gxml.BindFields(this);

            LoadErrorWindow.IconList = new Gdk.Pixbuf[2] {
                new Gdk.Pixbuf(Assembly.GetEntryAssembly(), "dialog-error.png"), new Gdk.Pixbuf(Assembly.GetEntryAssembly(), "dialog-error-16.png")
            };

            LoadErrorWindow.DeleteEvent += CloseWindow;
            CloseButton.Clicked         += CloseWindow;

            StopImage.FromPixbuf = new Gdk.Pixbuf(Assembly.GetEntryAssembly(), "dialog-error.png");

            ErrorListSocket.AddWithViewport(new LoadErrorList(errors));

            LoadErrorWindow.ShowAll();
        }
Beispiel #9
0
        public SimpleDBSetup(ArrayList fl, IBlock b)
        {
            Glade.XML gxml = new Glade.XML(Assembly.GetExecutingAssembly(), "SimpleDB.glade", "SimpleDBWindow", null);
            gxml.BindFields(this);

            SimpleDBWindow.DeleteEvent += CloseWindow;
            CloseButton.Clicked        += CloseWindow;
            AddButton.Clicked          += OnAdd;
            AddButton.Image             = new Image(Assembly.GetEntryAssembly(), "list-add.png");
            RemoveButton.Clicked       += OnRemove;
            RemoveButton.Image          = new Image(Assembly.GetEntryAssembly(), "list-remove.png");

            filelist = new FileList(fl, b);
            FileListSocket.AddWithViewport(filelist);

            UpdateCount();

            SimpleDBWindow.ShowAll();
        }
Beispiel #10
0
        public ResultData(Gdk.Pixbuf[] ibase, Gdk.Pixbuf[] itest, IResult[] res, int[] match)
        {
            Glade.XML gxml = new Glade.XML(Assembly.GetExecutingAssembly(), "ResultData.glade", "ResultDataWindow", null);
            gxml.BindFields(this);

            ResultDataWindow.DeleteEvent += CloseWindow;
            CloseButton.Clicked          += CloseWindow;

            DataTable.Resize((uint)ibase.Length + 1, (uint)itest.Length + 1);

            DataTable.Attach(new Image(Assembly.GetExecutingAssembly(), "testbase.png"), 0, 1, 0, 1, 0, 0, 1, 1);

            for (uint i = 0; i < ibase.Length; i++)
            {
                DataTable.Attach(new Image(ibase[i]), i + 1, i + 2, 0, 1, 0, 0, 1, 1);
            }
            for (uint i = 0; i < itest.Length; i++)
            {
                DataTable.Attach(new Image(itest[i]), 0, 1, i + 1, i + 2, 0, 0, 1, 1);
            }

            for (uint b = 0; b < ibase.Length; b++)
            {
                for (uint t = 0; t < itest.Length; t++)
                {
                    Label l = new Label();

                    if (match[t] == b)
                    {
                        l.Text      = "<b>" + res[t][(int)b].ToString("N") + "</b>";
                        l.UseMarkup = true;
                    }
                    else
                    {
                        l.Text = res[t][(int)b].ToString("N");
                    }

                    DataTable.Attach(l, b + 1, b + 2, t + 1, t + 2, 0, 0, 1, 1);
                }
            }

            ResultDataWindow.ShowAll();
        }
Beispiel #11
0
        public ClassDBSetup(ArrayList cat, IBlock b)
        {
            Glade.XML gxml = new Glade.XML(Assembly.GetExecutingAssembly(), "ClassDB.glade", "ClassDBWindow", null);
            gxml.BindFields(this);

            ClassDBWindow.DeleteEvent += CloseWindow;
            CloseButton.Clicked       += CloseWindow;
            AddButton.Clicked         += OnAdd;
            AddButton.Image            = new Image(Assembly.GetEntryAssembly(), "list-add.png");
            RemoveButton.Clicked      += OnRemove;
            RemoveButton.Image         = new Image(Assembly.GetEntryAssembly(), "list-remove.png");
            SplitButton.Clicked       += delegate(object o, EventArgs args) { new Modify(cat, filelist, b); };

            filelist = new FileList(cat, b);
            FileListSocket.AddWithViewport(filelist);

            UpdateCount();

            ClassDBWindow.ShowAll();
        }
Beispiel #12
0
        public XofYSetup(int x, int y, Callback c)
        {
            this.c = c;

            Glade.XML gxml = new Glade.XML(Assembly.GetExecutingAssembly(), "X-of-Y.glade", "BestWindow", null);
            gxml.BindFields(this);

            BestWindow.DeleteEvent += CloseWindow;
            CloseButton.Clicked    += CloseWindow;

            SpinIn.Value         = y;
            SpinIn.ValueChanged += SpinInChanged;

            SetMinValues();

            SpinMin.Value         = x;
            SpinMin.ValueChanged += delegate(object o, EventArgs args) { c(SpinMin.ValueAsInt, SpinIn.ValueAsInt); };

            BestWindow.ShowAll();
        }
Beispiel #13
0
        public FFTSetup(bool z, Callback c, bool dct)
        {
            Glade.XML gxml = new Glade.XML(Assembly.GetExecutingAssembly(), "FFT.glade", "FFTWindow", null);
            gxml.BindFields(this);

            FFTWindow.DeleteEvent += CloseWindow;
            CloseButton.Clicked   += CloseWindow;

            if (dct)
            {
                FFTWindow.Title      = "DCT";
                TitleLabel.Text      = "<big><big><b>DCT</b></big></big>";
                TitleLabel.UseMarkup = true;
            }

            ZeroButton.Active   = z;
            ZeroButton.Toggled += delegate(object o, EventArgs args) { c(ZeroButton.Active); };

            FFTWindow.ShowAll();
        }
Beispiel #14
0
        public About()
        {
            Glade.XML gxml = new Glade.XML("About.glade", "AboutWindow");
            gxml.BindFields(this);

            AboutWindow.IconList = new Gdk.Pixbuf[2] {
                new Gdk.Pixbuf(null, "help-browser-48.png"), new Gdk.Pixbuf(null, "help-browser.png")
            };

            AboutWindow.Title = String.Format(Catalog.GetString("About {0}"), Name);

            AboutWindow.DeleteEvent += CloseWindow;
            CloseButton.Clicked     += CloseWindow;

            LogoImage.FromPixbuf     = new Gdk.Pixbuf(null, "zsrr.jpg");
            ProgramVersion.Text      = String.Format("<big><big><b>{0} v{1}</b></big></big>", Name, Program.Version);
            ProgramVersion.UseMarkup = true;

            AboutWindow.ShowAll();
        }
Beispiel #15
0
        public LoadError(string fn, ArrayList errors)
        {
            Glade.XML gxml = new Glade.XML("LoadError.glade", "LoadErrorWindow");
            gxml.BindFields(this);

            LoadErrorWindow.IconList = new Gdk.Pixbuf[2] {
                new Gdk.Pixbuf(null, "dialog-error.png"), new Gdk.Pixbuf(null, "dialog-error-16.png")
            };

            LoadErrorWindow.DeleteEvent += CloseWindow;
            CloseButton.Clicked         += CloseWindow;

            StopImage.FromPixbuf = new Gdk.Pixbuf(null, "dialog-error.png");

            ErrorText.Text      = String.Format(Catalog.GetString("File <i>{0}</i> cannot be open because the following plugins are not available:"), fn);
            ErrorText.UseMarkup = true;

            ErrorListSocket.AddWithViewport(new LoadErrorList(errors));

            LoadErrorWindow.ShowAll();
        }
Beispiel #16
0
        public Preview(string fn)
        {
            Glade.XML gxml = new Glade.XML(Assembly.GetExecutingAssembly(), "Preview.glade", "PreviewWindow", null);
            gxml.BindFields(this);

            Gdk.Pixbuf buf = new Gdk.Pixbuf(fn);

            PreviewWindow.IconList = new Gdk.Pixbuf[1] {
                buf
            };

            PreviewWindow.DeleteEvent += CloseWindow;
            CloseButton.Clicked       += CloseWindow;

            PreviewLabel.Text      = Catalog.GetString("Image <i>") + fn + "</i>";
            PreviewLabel.UseMarkup = true;

            PreviewImage.FromPixbuf = buf;

            PreviewWindow.ShowAll();
        }
Beispiel #17
0
        public CorrectnessSetup(Callback c, bool first)
        {
            Glade.XML gxml = new Glade.XML(Assembly.GetExecutingAssembly(), "Setup.glade", "SetupWindow", null);
            gxml.BindFields(this);

            SetupWindow.DeleteEvent += CloseWindow;
            CloseButton.Clicked     += CloseWindow;

            if (first)
            {
                FirstButton.Active = true;
            }
            else
            {
                LastButton.Active = true;
            }

            FirstButton.Clicked += delegate(object o, EventArgs args) { c(true); };
            LastButton.Clicked  += delegate(object o, EventArgs args) { c(false); };

            SetupWindow.ShowAll();
        }
Beispiel #18
0
        public DialogMessage(string msg)
        {
            Glade.XML gxml = new Glade.XML(Assembly.GetExecutingAssembly(), "DialogMessage.glade", "DialogMessageWindow", null);
            gxml.BindFields(this);

            DialogMessageWindow.IconList = new Gdk.Pixbuf[2] {
                new Gdk.Pixbuf(Assembly.GetEntryAssembly(), "dialog-error.png"), new Gdk.Pixbuf(Assembly.GetEntryAssembly(), "dialog-error-16.png")
            };
            DialogMessageWindow.Title = "Error";

            DialogMessageWindow.DeleteEvent += CloseWindow;
            CloseButton.Clicked             += CloseWindow;

            DialogImage.FromPixbuf = new Gdk.Pixbuf(Assembly.GetEntryAssembly(), "dialog-error.png");

            Message.Text      = msg;
            Message.UseMarkup = true;

            DialogMessageWindow.ShowAll();

            Application.Run();
        }
Beispiel #19
0
        public ResultView(Gdk.Pixbuf[] img1, Gdk.Pixbuf[] img2, Gdk.Pixbuf[] thumbs, int[] res, int[] cat1, int[] cat2,
                          bool[] match)
        {
            this.img1  = img1;
            this.img2  = img2;
            this.res   = res;
            this.cat1  = cat1;
            this.cat2  = cat2;
            this.match = match;

            Glade.XML gxml = new Glade.XML(Assembly.GetExecutingAssembly(), "ResultView.glade", "ResultViewWindow", null);
            gxml.BindFields(this);

            ResultViewWindow.DeleteEvent += CloseWindow;
            CloseButton.Clicked          += CloseWindow;

            CounterText.Text      = String.Format(Catalog.GetPluralString("<i>Viewing results for {0} image</i>", "<i>Viewing results for {0} images</i>", img2.Length), img2.Length);
            CounterText.UseMarkup = true;

            TestIcon.FromPixbuf = new Gdk.Pixbuf(Assembly.GetEntryAssembly(), "image-test-22.png");
            BaseIcon.FromPixbuf = new Gdk.Pixbuf(Assembly.GetEntryAssembly(), "image-base-22.png");

            SetDisplay(0);

            HButtonBox hb = new HButtonBox();

            hb.Layout = ButtonBoxStyle.Start;
            for (int i = 0; i < thumbs.Length; i++)
            {
                ImageButton b = new ImageButton(new Image(thumbs[i]), i);
                b.Clicked += OnClicked;
                hb.PackEnd(b, false, false, 0);
            }

            ImageListSocket.AddWithViewport(hb);

            ResultViewWindow.ShowAll();
        }
Beispiel #20
0
        public DialogQuestion(string msg)
        {
            Glade.XML gxml = new Glade.XML(Assembly.GetExecutingAssembly(), "DialogQuestion.glade", "DialogQuestionWindow", null);
            gxml.BindFields(this);

            // FIXME use correct icons
            DialogQuestionWindow.IconList = new Gdk.Pixbuf[2] {
                new Gdk.Pixbuf(Assembly.GetEntryAssembly(), "dialog-warning.png"), new Gdk.Pixbuf(Assembly.GetEntryAssembly(), "dialog-warning-16.png")
            };
            DialogQuestionWindow.Title = Catalog.GetString("Question");

            DialogQuestionWindow.DeleteEvent += CloseWindow;
            NoButton.Clicked  += CloseWindow;
            YesButton.Clicked += YesAction;

            // FIXME use correct icons
            DialogImage.FromPixbuf = new Gdk.Pixbuf(Assembly.GetEntryAssembly(), "dialog-warning.png");

            Message.Text      = msg;
            Message.UseMarkup = true;

            DialogQuestionWindow.ShowAll();
        }
Beispiel #21
0
        public HistogramSetup(int num, bool black, bool white, bool splithalf, Callback c)
        {
            this.c = c;

            Glade.XML gxml = new Glade.XML(Assembly.GetExecutingAssembly(), "Histogram.glade", "HistogramWindow", null);
            gxml.BindFields(this);

            HistogramWindow.DeleteEvent += CloseWindow;
            CloseButton.Clicked         += CloseWindow;

            this.num           = num;
            Spin.Value         = num;
            Spin.ValueChanged += SpinChanged;

            BlackButton.Active       = black;
            BlackButton.Toggled     += delegate(object o, EventArgs args) { c(this.num, BlackButton.Active, WhiteButton.Active, SplitHalfButton.Active); };
            WhiteButton.Active       = white;
            WhiteButton.Toggled     += delegate(object o, EventArgs args) { c(this.num, BlackButton.Active, WhiteButton.Active, SplitHalfButton.Active); };
            SplitHalfButton.Active   = splithalf;
            SplitHalfButton.Toggled += delegate(object o, EventArgs args) { c(this.num, BlackButton.Active, WhiteButton.Active, SplitHalfButton.Active); };

            HistogramWindow.ShowAll();
        }
Beispiel #22
0
        public ResizeSetup(bool relative, int x, int y, Gdk.InterpType mode, Callback c)
        {
            this.mode = mode;
            this.c    = c;

            Glade.XML gxml = new Glade.XML(Assembly.GetExecutingAssembly(), "ResizeSetup.glade", "ResizeSetupWindow", null);
            gxml.BindFields(this);

            ResizeSetupWindow.DeleteEvent += CloseWindow;
            CloseButton.Clicked           += CloseWindow;

            if (relative)
            {
                RelativeButton.Active = true;
                rx = x;
                ry = y;
                ax = 128;
                ay = 128;
                SetupRelative();
            }
            else
            {
                AbsoluteButton.Active = true;
                ax = x;
                ay = y;
                rx = 50;
                ry = 50;
                SetupAbsolute();
            }

            if (mode == Gdk.InterpType.Nearest)
            {
                NearestButton.Active = true;
            }
            else if (mode == Gdk.InterpType.Tiles)
            {
                TilesButton.Active = true;
            }
            else if (mode == Gdk.InterpType.Bilinear)
            {
                BilinearButton.Active = true;
            }
            else
            {
                HyperButton.Active = true;
            }

            NearestButton.Clicked += delegate(object o, EventArgs args)
            {
                mode = Gdk.InterpType.Nearest;
                UpdateValues();
            };
            TilesButton.Clicked += delegate(object o, EventArgs args)
            {
                mode = Gdk.InterpType.Tiles;
                UpdateValues();
            };
            BilinearButton.Clicked += delegate(object o, EventArgs args)
            {
                mode = Gdk.InterpType.Bilinear;
                UpdateValues();
            };
            HyperButton.Clicked += delegate(object o, EventArgs args)
            {
                mode = Gdk.InterpType.Hyper;
                UpdateValues();
            };

            ResizeSetupWindow.ShowAll();
        }
Beispiel #23
0
        public Modify(ArrayList cat, FileList filelist, IBlock b)
        {
            this.cat      = cat;
            this.filelist = filelist;
            this.b        = b;

            Glade.XML gxml = new Glade.XML(Assembly.GetExecutingAssembly(), "Modify.glade", "ModifyWindow", null);
            gxml.BindFields(this);

            ModifyWindow.DeleteEvent += CloseWindow;
            CloseButton.Clicked      += CloseWindow;

            InverseButton.Clicked    += InverseClicked;
            BaseButton.Clicked       += BaseClicked;
            TestButton.Clicked       += TestClicked;
            OddEvenButton.Clicked    += OddEvenClicked;
            FirstHalfButton.Clicked  += FirstHalfClicked;
            SecondHalfButton.Clicked += SecondHalfClicked;
            RandomButton.Clicked     += RandomClicked;

            Inv1.FromPixbuf = TestIcon;
            Inv2.FromPixbuf = BaseIcon;
            Inv3.FromPixbuf = TestIcon;
            Inv4.FromPixbuf = Arrow;
            Inv5.FromPixbuf = BaseIcon;
            Inv6.FromPixbuf = TestIcon;
            Inv7.FromPixbuf = BaseIcon;

            Base1.FromPixbuf = BaseIcon;
            Base2.FromPixbuf = BaseIcon;
            Base3.FromPixbuf = BaseIcon;
            Base4.FromPixbuf = BaseIcon;

            Test1.FromPixbuf = TestIcon;
            Test2.FromPixbuf = TestIcon;
            Test3.FromPixbuf = TestIcon;
            Test4.FromPixbuf = TestIcon;

            Odd1.FromPixbuf = BaseIcon;
            Odd2.FromPixbuf = TestIcon;
            Odd3.FromPixbuf = BaseIcon;
            Odd4.FromPixbuf = TestIcon;
            Odd5.FromPixbuf = BaseIcon;
            Odd6.FromPixbuf = TestIcon;

            First1.FromPixbuf = TestIcon;
            First2.FromPixbuf = TestIcon;
            First3.FromPixbuf = TestIcon;
            First4.FromPixbuf = BaseIcon;
            First5.FromPixbuf = BaseIcon;
            First6.FromPixbuf = BaseIcon;

            Last1.FromPixbuf = BaseIcon;
            Last2.FromPixbuf = BaseIcon;
            Last3.FromPixbuf = BaseIcon;
            Last4.FromPixbuf = TestIcon;
            Last5.FromPixbuf = TestIcon;
            Last6.FromPixbuf = TestIcon;

            bool   rbase = false, rtest = false;
            Random r = new Random();

            if (r.NextDouble() < 0.5)
            {
                rbase            = true;
                Rand1.FromPixbuf = BaseIcon;
            }
            else
            {
                rtest            = true;
                Rand1.FromPixbuf = TestIcon;
            }
            if (r.NextDouble() < 0.5)
            {
                rbase            = true;
                Rand2.FromPixbuf = BaseIcon;
            }
            else
            {
                rtest            = true;
                Rand2.FromPixbuf = TestIcon;
            }
            if (r.NextDouble() < 0.5)
            {
                rbase            = true;
                Rand3.FromPixbuf = BaseIcon;
            }
            else
            {
                rtest            = true;
                Rand3.FromPixbuf = TestIcon;
            }
            if (r.NextDouble() < 0.5)
            {
                rbase            = true;
                Rand4.FromPixbuf = BaseIcon;
            }
            else
            {
                rtest            = true;
                Rand4.FromPixbuf = TestIcon;
            }
            if (r.NextDouble() < 0.5)
            {
                rbase            = true;
                Rand5.FromPixbuf = BaseIcon;
            }
            else
            {
                rtest            = true;
                Rand5.FromPixbuf = TestIcon;
            }
            if (!rbase)
            {
                Rand6.FromPixbuf = BaseIcon;
            }
            else if (!rtest)
            {
                Rand6.FromPixbuf = TestIcon;
            }
            else if (r.NextDouble() < 0.5)
            {
                Rand6.FromPixbuf = BaseIcon;
            }
            else
            {
                Rand6.FromPixbuf = TestIcon;
            }

            ModifyWindow.ShowAll();
        }