예제 #1
0
        private void PostInitializeComponent()
        {
            imageList.UserConfigManager      = UserConfigManager;
            thumbnailList1.UserConfigManager = UserConfigManager;
            int thumbnailSize = UserConfigManager.Config.ThumbnailSize;

            thumbnailList1.ThumbnailSize = new Size(thumbnailSize, thumbnailSize);

            RelayoutToolbar();
            InitLanguageDropdown();
            UpdateScanButton();

            if (layoutManager != null)
            {
                layoutManager.Deactivate();
            }
            btnZoomIn.Location  = new Point(btnZoomIn.Location.X, thumbnailList1.Height - 33);
            btnZoomOut.Location = new Point(btnZoomOut.Location.X, thumbnailList1.Height - 33);
            layoutManager       = new LayoutManager(this)
                                  .Bind(btnZoomIn, btnZoomOut)
                                  .BottomToForm()
                                  .Activate();
        }
예제 #2
0
        protected override void OnLoad(object sender, EventArgs e)
        {
            lvProfiles.LargeImageList = ilProfileIcons.IconsList;
            btnAdd.Enabled            = !(appConfigManager.Config.NoUserProfiles && profileManager.Profiles.Any(x => x.IsLocked));
            btnEdit.Enabled           = false;
            btnDelete.Enabled         = false;
            UpdateProfiles();
            SelectProfile(x => x.IsDefault);

            if (appConfigManager.Config.NoUserProfiles && profileManager.Profiles.Any(x => x.IsLocked))
            {
                contextMenuStrip.Items.Remove(ctxCopy);
                contextMenuStrip.Items.Remove(ctxPaste);
                contextMenuStrip.Items.Remove(toolStripSeparator2);
            }

            var lm = new LayoutManager(this)
                     .Bind(lvProfiles)
                     .WidthToForm()
                     .HeightToForm()
                     .Bind(btnAdd, btnEdit, btnDelete, btnDone)
                     .BottomToForm()
                     .Bind(btnDone, btnScan)
                     .RightToForm()
                     .Bind(btnEdit)
                     .LeftTo(() => btnAdd.Right)
                     .Bind(btnDelete)
                     .LeftTo(() => btnEdit.Right)
                     .Activate();

            iconButtonSizer.WidthOffset  = 20;
            iconButtonSizer.PaddingRight = 4;
            iconButtonSizer.MaxWidth     = 100;
            iconButtonSizer.ResizeButtons(btnAdd, btnEdit, btnDelete);

            lm.UpdateLayout();
        }
예제 #3
0
        protected override void OnLoad(object sender, EventArgs eventArgs)
        {
            if (SelectedImages != null && SelectedImages.Count > 1)
            {
                checkboxApplyToSelected.Text = string.Format(checkboxApplyToSelected.Text, SelectedImages.Count);
            }
            else
            {
                ConditionalControls.Hide(checkboxApplyToSelected, 6);
            }

            var lm = new LayoutManager(this)
                     .Bind(pictureBox)
                     .WidthToForm()
                     .HeightToForm()
                     .Bind(tbLeft, tbRight)
                     .WidthTo(() => (int)(GetImageWidthRatio() * pictureBox.Width))
                     .LeftTo(() => (int)((1 - GetImageWidthRatio()) * pictureBox.Width / 2))
                     .Bind(tbTop, tbBottom)
                     .HeightTo(() => (int)(GetImageHeightRatio() * pictureBox.Height))
                     .TopTo(() => (int)((1 - GetImageHeightRatio()) * pictureBox.Height / 2))
                     .Bind(tbBottom, btnOK, btnCancel)
                     .RightToForm()
                     .Bind(tbRight, checkboxApplyToSelected, btnRevert, btnOK, btnCancel)
                     .BottomToForm()
                     .Activate();

            Size = new Size(600, 600);

            workingImage  = scannedImageRenderer.Render(Image);
            workingImage2 = scannedImageRenderer.Render(Image);
            UpdateCropBounds();
            UpdatePreviewBox();

            lm.UpdateLayout();
        }
예제 #4
0
파일: FDesktop.cs 프로젝트: lapuinka/naps2
        /// <summary>
        /// Runs when the form is first loaded and every time the language is changed.
        /// </summary>
        private void PostInitializeComponent()
        {
            imageList.UserConfigManager = UserConfigManager;
            thumbnailList1.UserConfigManager = UserConfigManager;
            int thumbnailSize = UserConfigManager.Config.ThumbnailSize;
            thumbnailList1.ThumbnailSize = new Size(thumbnailSize, thumbnailSize);

            RelayoutToolbar();
            InitLanguageDropdown();
            UpdateScanButton();
            LoadToolStripLocation();

            if (layoutManager != null)
            {
                layoutManager.Deactivate();
            }
            btnZoomIn.Location = new Point(btnZoomIn.Location.X, thumbnailList1.Height - 33);
            btnZoomOut.Location = new Point(btnZoomOut.Location.X, thumbnailList1.Height - 33);
            btnZoomMouseCatcher.Location = new Point(btnZoomMouseCatcher.Location.X, thumbnailList1.Height - 33);
            layoutManager = new LayoutManager(this)
                   .Bind(btnZoomIn, btnZoomOut, btnZoomMouseCatcher)
                       .BottomTo(() => thumbnailList1.Height)
                   .Activate();

            thumbnailList1.MouseWheel += thumbnailList1_MouseWheel;
            thumbnailList1.SizeChanged += (sender, args) => layoutManager.UpdateLayout();
        }
예제 #5
0
파일: FProfiles.cs 프로젝트: v0id24/naps2
        protected override void OnLoad(object sender, EventArgs e)
        {
            lvProfiles.LargeImageList = ilProfileIcons.IconsList;
            btnEdit.Enabled = false;
            btnDelete.Enabled = false;
            UpdateProfiles();
            SelectProfile(x => x.IsDefault);

            var lm = new LayoutManager(this)
                .Bind(lvProfiles)
                    .WidthToForm()
                    .HeightToForm()
                .Bind(btnAdd, btnEdit, btnDelete, btnDone)
                    .BottomToForm()
                .Bind(btnDone, btnScan)
                    .RightToForm()
                .Bind(btnEdit)
                    .LeftTo(() => btnAdd.Right)
                .Bind(btnDelete)
                    .LeftTo(() => btnEdit.Right)
                .Activate();

            iconButtonSizer.WidthOffset = 20;
            iconButtonSizer.PaddingRight = 4;
            iconButtonSizer.MaxWidth = 100;
            iconButtonSizer.ResizeButtons(btnAdd, btnEdit, btnDelete);

            lm.UpdateLayout();
        }
예제 #6
0
 public BindingSyntax(LayoutManager layoutManager, Control[] controls)
 {
     this.layoutManager = layoutManager;
     this.controls      = controls;
 }
예제 #7
0
파일: FDesktop.cs 프로젝트: IASA-GR/naps2
        private void PostInitializeComponent()
        {
            imageList.UserConfigManager = UserConfigManager;
            thumbnailList1.UserConfigManager = UserConfigManager;
            int thumbnailSize = UserConfigManager.Config.ThumbnailSize;
            thumbnailList1.ThumbnailSize = new Size(thumbnailSize, thumbnailSize);

            RelayoutToolbar();
            InitLanguageDropdown();
            UpdateScanButton();

            if (layoutManager != null)
            {
                layoutManager.Deactivate();
            }
            btnZoomIn.Location = new Point(btnZoomIn.Location.X, thumbnailList1.Height - 33);
            btnZoomOut.Location = new Point(btnZoomOut.Location.X, thumbnailList1.Height - 33);
            layoutManager = new LayoutManager(this)
                   .Bind(btnZoomIn, btnZoomOut)
                       .BottomToForm()
                   .Activate();
        }
예제 #8
0
파일: FCrop.cs 프로젝트: cyanfish/naps2
        protected override void OnLoad(object sender, EventArgs eventArgs)
        {
            if (SelectedImages != null && SelectedImages.Count > 1)
            {
                checkboxApplyToSelected.Text = string.Format(checkboxApplyToSelected.Text, SelectedImages.Count);
            }
            else
            {
                ConditionalControls.Hide(checkboxApplyToSelected, 6);
            }

            var lm = new LayoutManager(this)
                .Bind(pictureBox)
                    .WidthToForm()
                    .HeightToForm()
                .Bind(tbLeft, tbRight)
                    .WidthTo(() => (int)(GetImageWidthRatio() * pictureBox.Width))
                    .LeftTo(() => (int)((1 - GetImageWidthRatio()) * pictureBox.Width / 2))
                .Bind(tbTop, tbBottom)
                    .HeightTo(() => (int)(GetImageHeightRatio() * pictureBox.Height))
                    .TopTo(() => (int)((1 - GetImageHeightRatio()) * pictureBox.Height / 2))
                .Bind(tbBottom, btnOK, btnCancel)
                    .RightToForm()
                .Bind(tbRight, checkboxApplyToSelected, btnRevert, btnOK, btnCancel)
                    .BottomToForm()
                .Activate();
            Size = new Size(600, 600);

            workingImage = Image.GetImage();
            workingImage2 = Image.GetImage();
            UpdateCropBounds();
            UpdatePreviewBox();

            lm.UpdateLayout();
        }
예제 #9
0
 public BindingSyntax(LayoutManager layoutManager, Control[] controls)
 {
     this.layoutManager = layoutManager;
     this.controls = controls;
 }
예제 #10
0
파일: FDesktop.cs 프로젝트: cyanfish/naps2
        /// <summary>
        /// Runs when the form is first loaded and every time the language is changed.
        /// </summary>
        private void PostInitializeComponent()
        {
            imageList.ThumbnailRenderer = thumbnailRenderer;
            thumbnailList1.ThumbnailRenderer = thumbnailRenderer;
            int thumbnailSize = UserConfigManager.Config.ThumbnailSize;
            thumbnailList1.ThumbnailSize = new Size(thumbnailSize, thumbnailSize);
            SetThumbnailSpacing(thumbnailSize);

            if (appConfigManager.Config.HideEmailButton)
            {
                tStrip.Items.Remove(tsdEmailPDF);
            }
            if (appConfigManager.Config.HidePrintButton)
            {
                tStrip.Items.Remove(tsPrint);
            }

            LoadToolStripLocation();
            RelayoutToolbar();
            InitLanguageDropdown();
            AssignKeyboardShortcuts();
            UpdateScanButton();

            if (layoutManager != null)
            {
                layoutManager.Deactivate();
            }
            btnZoomIn.Location = new Point(btnZoomIn.Location.X, thumbnailList1.Height - 33);
            btnZoomOut.Location = new Point(btnZoomOut.Location.X, thumbnailList1.Height - 33);
            btnZoomMouseCatcher.Location = new Point(btnZoomMouseCatcher.Location.X, thumbnailList1.Height - 33);
            layoutManager = new LayoutManager(this)
                   .Bind(btnZoomIn, btnZoomOut, btnZoomMouseCatcher)
                       .BottomTo(() => thumbnailList1.Height)
                   .Activate();

            thumbnailList1.MouseWheel += thumbnailList1_MouseWheel;
            thumbnailList1.SizeChanged += (sender, args) => layoutManager.UpdateLayout();

            notify = new NotificationManager(this, appConfigManager);
        }
예제 #11
0
파일: FProfiles.cs 프로젝트: cyanfish/naps2
        protected override void OnLoad(object sender, EventArgs e)
        {
            lvProfiles.LargeImageList = ilProfileIcons.IconsList;
            btnAdd.Enabled = !(appConfigManager.Config.NoUserProfiles && profileManager.Profiles.Any(x => x.IsLocked));
            btnEdit.Enabled = false;
            btnDelete.Enabled = false;
            UpdateProfiles();
            SelectProfile(x => x.IsDefault);

            if (appConfigManager.Config.NoUserProfiles && profileManager.Profiles.Any(x => x.IsLocked))
            {
                contextMenuStrip.Items.Remove(ctxCopy);
                contextMenuStrip.Items.Remove(ctxPaste);
                contextMenuStrip.Items.Remove(toolStripSeparator2);
            }

            var lm = new LayoutManager(this)
                .Bind(lvProfiles)
                    .WidthToForm()
                    .HeightToForm()
                .Bind(btnAdd, btnEdit, btnDelete, btnDone)
                    .BottomToForm()
                .Bind(btnDone, btnScan)
                    .RightToForm()
                .Bind(btnEdit)
                    .LeftTo(() => btnAdd.Right)
                .Bind(btnDelete)
                    .LeftTo(() => btnEdit.Right)
                .Activate();

            iconButtonSizer.WidthOffset = 20;
            iconButtonSizer.PaddingRight = 4;
            iconButtonSizer.MaxWidth = 100;
            iconButtonSizer.ResizeButtons(btnAdd, btnEdit, btnDelete);

            lm.UpdateLayout();
        }