Beispiel #1
0
        private void Viewfinder_Load(object sender, EventArgs e)
        {
            DebugLog.Log("==============================================");
            DebugLog.Log("Babel starting");
            LoadSettings();

            AppDomain currentDomain = AppDomain.CurrentDomain;

            currentDomain.AssemblyResolve += new ResolveEventHandler(MyResolveEventHandler);


            if (Properties.Settings.Default.WaiverSigned != true)
            {
                Disclaimer dc = new Disclaimer();
                dc.ShowDialog(this);
            }

            OCRResult   = null;
            PhraseRects = new List <PhraseRect>();

            SnapRegion = new Rectangle(0, 0, 640, 480);

            Text = "Viewfinder - Ready";
            ChangeState(State.ready);

            vfw               = new Viewfinder();
            vfw.MainForm      = this;
            vfw.StartPosition = FormStartPosition.Manual;
            vfw.Location      = new Point(this.Left + 50, this.Top + 50);

            Picker = new frmWindowPicker();

            AutoOCR         = false;
            Auto_Autophrase = false;
            Autofit         = true;

            NewPhraseMode = PhraseRectMode.intersects;

            SafeAsyncOCR_Callback = AsyncOCR_callback;

            WorkerErrors = new List <WorkerError>();

            SafeIncrementOdometer = new SafeIncrementOdometer_Delegate(IncrementOdometer);

            TrackingWindow = (IntPtr)0;

            DebugLog.Log("Babel started");

#if DEBUG
            //ToggleVFW(); // Show viewfinder immediately
#endif
        }
Beispiel #2
0
            public PhraseRect(Rectangle Location, IAsyncOCR OCRResult, PhraseRectMode Mode, frmBabel BabelForm, TranslationCallback callback = null)
            {
                this.Location = Location;

                this.BabelForm = BabelForm;

                this.mode = Mode;
                if (Autofit)
                {
                    DoAutoFit(OCRResult);
                }
                UpdateText(OCRResult, callback);
            }
Beispiel #3
0
            private static IEnumerable <OCRBox> GetBoxesInRect(Rectangle rect, IEnumerable <OCRBox> boxes, PhraseRectMode mode)
            {
                switch (mode)
                {
                default:
                case PhraseRectMode.intersects:
                    return(boxes.Where(box => rect.IntersectsWith(box.rect)));

                case PhraseRectMode.contains:
                    return(boxes.Where(box => rect.Contains(box.rect)));
                }
            }
Beispiel #4
0
 private void tsbContainsMode_Click(object sender, EventArgs e)
 {
     NewPhraseMode             = PhraseRectMode.contains;
     tsbIntersectsMode.Checked = false;
     tsbContainsMode.Checked   = true;
 }