Пример #1
0
        public void SetXenObjects(IXenObject orig, IXenObject clone)
        {
            if (clone == null)
            {
                return;
            }
            this.xenObjectCopy = clone;
            this.xenObjectOrig = orig;

            if (tagsEditor != null)
            {
                tagsEditor.Dispose();
            }
            tagsEditor          = new TagsEditor(GetTagsFromXenObjectCopy(), tagsPanel);
            tagsEditor.Location = new Point(5, 5);
            tagsEditor.Size     = new Size(tagsPanel.Width - 10, tagsPanel.Height - 10);
            tagsEditor.Anchor   = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;

            if (folderEditor != null)
            {
                folderEditor.Dispose();
            }
            folderEditor          = new FolderEditor(clone.Path);
            folderEditor.Parent   = folderPanel;
            folderEditor.Location = new Point(0, 2);
            folderEditor.Size     = new Size(folderPanel.Width - 6, folderPanel.Height - 4);
            folderEditor.Anchor   = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;

            Repopulate();
        }
Пример #2
0
        public SettingsDialog()
        {
            Text        = "ROMniscience settings";
            MinimumSize = new System.Drawing.Size(500, 500);
            Size        = MinimumSize;

            Label datFolderLabel = new Label()
            {
                Text   = "Datfile folder",
                Left   = 10,
                Top    = 10,
                Size   = new System.Drawing.Size(100, 30),               //I hope that'll be enough
                Anchor = AnchorStyles.Top | AnchorStyles.Left,
            };

            Controls.Add(datFolderLabel);
            datFolderBox = new TextBox()
            {
                Left   = datFolderLabel.Left + datFolderLabel.Width,
                Top    = 10,
                Size   = new System.Drawing.Size(ClientSize.Width - (datFolderLabel.Width + 20 + 80), 30),
                Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right,
                Text   = SettingsManager.readSetting("datfiles"),
            };

            Controls.Add(datFolderBox);
            Button datFolderButt = new Button()
            {
                Text   = "Browse...",
                Top    = 10,
                Left   = datFolderBox.Left + datFolderBox.Width + 10,
                Size   = new System.Drawing.Size(ClientSize.Width - (datFolderLabel.Width + datFolderBox.Width + 30), 30),
                Anchor = AnchorStyles.Top | AnchorStyles.Right,
            };

            Controls.Add(datFolderButt);
            datFolderButt.Click += delegate {
                browseForFolder(datFolderBox);
            };

            showExtra = new CheckBox()
            {
                Text = "Show extra information in table view",
                Top  = 40,
                Left = 10,
                Size = new System.Drawing.Size(ClientSize.Width - 20, 30),
            };
            if (bool.TryParse(SettingsManager.readSetting("show_extra"), out bool result))
            {
                showExtra.Checked = result;
            }
            Controls.Add(showExtra);


            GroupBox editorHolder = new GroupBox()
            {
                Left   = 10,
                Top    = 70,
                Size   = new System.Drawing.Size(ClientSize.Width - 20, ClientSize.Height - 120),
                Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right | AnchorStyles.Left,
                Text   = "Folder Locations",               //FIXME Why the f**k is this covered up by some shit and isn't visible... You know what I don't even care anymore
            };
            ScrollableControl scrollArea = new ScrollableControl()
            {
                Dock       = DockStyle.Fill,
                AutoScroll = true,
                Text       = String.Empty,
            };

            editorHolder.Controls.Add(scrollArea);
            Controls.Add(editorHolder);

            int last = scrollArea.ClientRectangle.Top + scrollArea.Padding.Vertical;

            foreach (Handler h in Handler.allHandlers.OrderBy((Handler h) => h.name))
            {
                FolderEditor fe = new FolderEditor(last, h.name)
                {
                    Width = scrollArea.Width,
                };
                last = fe.Bottom;
                scrollArea.Controls.Add(fe);
                editors.Add(fe);
            }

            Panel buttonHolder = new Panel()
            {
                Top    = editorHolder.Top + editorHolder.Height,
                Left   = 10,
                Size   = new System.Drawing.Size(ClientSize.Width - 20, 50),
                Anchor = AnchorStyles.Bottom | AnchorStyles.Right,
            };

            Controls.Add(buttonHolder);

            Button cancelButton = new Button()
            {
                Text         = "Cancel",
                Anchor       = AnchorStyles.Right | AnchorStyles.Bottom,
                DialogResult = DialogResult.Cancel
            };

            cancelButton.Top    = (buttonHolder.ClientSize.Height - cancelButton.ClientSize.Height) - cancelButton.Margin.Vertical;
            cancelButton.Left   = (buttonHolder.ClientSize.Width - cancelButton.ClientSize.Width) - cancelButton.Margin.Horizontal;
            cancelButton.Click += delegate {
                Close();
            };
            CancelButton = cancelButton;
            buttonHolder.Controls.Add(cancelButton);

            Button okButton = new Button()
            {
                Text         = "OK",
                Anchor       = AnchorStyles.Right | AnchorStyles.Bottom,
                DialogResult = DialogResult.OK
            };

            okButton.Top    = cancelButton.Top;
            okButton.Left   = (cancelButton.Left - cancelButton.Margin.Left) - okButton.Width;
            okButton.Click += delegate {
                saveSettings();
                Close();
            };
            AcceptButton = okButton;
            buttonHolder.Controls.Add(okButton);
        }