Exemplo n.º 1
0
        public OptionForm(List <iConfig> optionPanels, MEF_Interfaces.iAccess access)
        {
            FormUtils.SizeFormsForAccessibility(this, access.FontSizeForForm);
            this.KeyPreview = true;
            this.Icon       = MainFormBase.MainFormIcon;
            this.Width      = 700;
            this.Height     = 600;
            this.Name       = "optionform";

            Panel bottom = new Panel();

            bottom.Parent = this;
            bottom.Dock   = DockStyle.Bottom;
            bottom.Height = 40;

            Button OK = new Button();

            OK.Text = Loc.Instance.GetString("OK");

            OK.Dock   = DockStyle.Right;
            OK.Click += HandleOkayClick;


            Button Cancel = new Button();

            Cancel.Text         = Loc.Instance.GetString("Cancel");
            Cancel.Padding      = new System.Windows.Forms.Padding(5);
            Cancel.Dock         = DockStyle.Right;
            Cancel.DialogResult = DialogResult.Cancel;


            container = new SplitContainer();


            container.BorderStyle        = BorderStyle.FixedSingle;
            container.Parent             = this;
            container.Dock               = DockStyle.Fill;
            container.Panel1.BorderStyle = BorderStyle.FixedSingle;
            container.Panel2.BorderStyle = BorderStyle.FixedSingle;
            container.Panel1.Padding     = new Padding(5);
            container.Panel2.Padding     = new Padding(5);
            container.BringToFront();

            OK.Parent     = bottom;
            Cancel.Parent = bottom;

            foreach (iConfig panel in optionPanels)
            {
                Button button = new Button();
                button.Text   = panel.ConfigName;
                button.Tag    = panel;
                button.Dock   = DockStyle.Top;
                button.Parent = container.Panel1;
                button.Click += HandleOptionButtonClick;
            }
        }
Exemplo n.º 2
0
        public SplitContainer InitDesignSplit()
        {
            splitCon.Panel1.Controls.Add(InitDesignPart());
            splitCon.Panel2.Controls.Add(InitCodePart());
            splitCon.Orientation = Orientation.Horizontal;
            this.Controls.Add(splitCon);

            splitCon.Dock = DockStyle.Fill;
            splitCon.BringToFront();
            splitCon.Panel2Collapsed = true;
            return(splitCon);
        }
Exemplo n.º 3
0
        public void LoadTagEditor(CachedTag tag)
        {
            if (tag == null || (CurrentTag != null && CurrentTag.Index == tag.Index))
            {
                return;
            }

            LoadingTag = true;

            object definition = null;

            if (CurrentTags.ContainsKey(tag.Index))
            {
                definition = CurrentTags[tag.Index];
            }

            tagTreeView.Enabled = false;

            tagEditorPanel.Controls.Clear();

            var tagName = tag.Name ?? $"0x{tag.Index:X4}";

            var groupName = Cache.StringTable.GetString(tag.Group.Name);

            statusLabel.Text = $"Loading {tagName}.{ groupName}...";

            progressBar.Style = ProgressBarStyle.Marquee;
            progressBar.MarqueeAnimationSpeed = 30;

            if (definition == null)
            {
                using (var stream = Cache.OpenCacheRead())
                    definition = Cache.Deserialize(stream, tag);
            }

            if (tagName.Contains("\\"))
            {
                var index = tagName.LastIndexOf('\\') + 1;
                tagName = tagName.Substring(index, tagName.Length - index);
            }

            statusLabel.Text = $"Generating {groupName} interface...";
            Application.DoEvents();

            var point = new Point();

            if (tag.IsInGroup("matg") || tag.IsInGroup("mulg") || tag.IsInGroup("scnr") || tag.IsInGroup("sbsp"))
            {
                var control = new StructMultiControl(this, Cache, tag, definition)
                {
                    Dock = DockStyle.Fill
                };

                control.GetFieldValue(null, definition, definition);

                tagEditorPanel.Controls.Add(control);
            }
            // todo: fixup/clean model rendering code
            // todo: finish bitm editing (save/import dds, add size scaling to image)
            else if (tag.IsInGroup("bitm") || tag.IsInGroup("obje"))
            {
                var splitContainer = new SplitContainer
                {
                    Dock        = DockStyle.Fill,
                    Orientation = Orientation.Horizontal
                };

                splitContainer.FixedPanel = FixedPanel.Panel1;

                tagEditorPanel.Controls.Add(splitContainer);
                splitContainer.BringToFront();

                /*if (tag.IsInGroup("bitm"))
                 *  splitContainer.SplitterDistance = 384;//Math.Min((short)512, Math.Max((short)16, ((TagTool.Tags.Definitions.Bitmap)definition).Images[0].Height));
                 * else if (tag.IsInGroup("obje"))
                 *  splitContainer.SplitterDistance = 384;*/

                if (tag.IsInGroup("bitm"))
                {
                    var bitmDefinition = (TagTool.Tags.Definitions.Bitmap)definition;

                    if (Cache.ResourceCache.GetBitmapTextureInteropResource(bitmDefinition.Resources[0]) != null)
                    {
                        splitContainer.SplitterDistance = 384;

                        var bitmapControl = new BitmapControl(Cache, bitmDefinition)
                        {
                            Dock = DockStyle.Fill
                        };

                        splitContainer.Panel1.Controls.Add(bitmapControl);
                        bitmapControl.BringToFront();
                    }
                }

                /*else if (tag.IsInGroup("obje"))
                 * {
                 *  var modelControl = new ObjectControl(Cache, (GameObject)definition)
                 *  {
                 *      Dock = DockStyle.Fill
                 *  };
                 *
                 *  splitContainer.Panel1.Controls.Add(modelControl);
                 *  modelControl.BringToFront();
                 * }*/

                var control = tag.IsInGroup("obje") ?
                              (Control) new StructMultiControl(this, Cache, tag, definition)
                {
                    Dock = DockStyle.Fill
                } :
                new StructControl(this, Cache, definition.GetType(), null);

                ((IFieldControl)control).GetFieldValue(null, definition, definition);
                control.Location = point;

                splitContainer.Panel2.Controls.Add(control);
                splitContainer.Panel2.AutoScroll = true;
            }
            else
            {
                if (tag.IsInGroup("snd!"))
                {
                    var soundControl = new SoundControl(Cache, tag, (Sound)definition)
                    {
                        Dock = DockStyle.Top
                    };

                    tagEditorPanel.Controls.Add(soundControl);
                    soundControl.BringToFront();

                    point.Y = soundControl.Bottom;
                }

                var control = new StructControl(this, Cache, definition.GetType(), null);
                control.GetFieldValue(null, definition, definition);

                control.Location = point;

                tagEditorPanel.Controls.Add(control);
            }

            statusLabel.Text = "";

            progressBar.Style = ProgressBarStyle.Continuous;
            progressBar.MarqueeAnimationSpeed = 0;

            tagTreeView.Enabled = true;
            CurrentTag          = tag;

            if (!CurrentTags.ContainsKey(tag.Index))
            {
                CurrentTags[tag.Index] = definition;

                var item = new TagInstanceItem {
                    Cache = Cache, Tag = tag
                };
                currentTagsComboBox.Items.Add(item);

                currentTagsComboBox.SelectedItem = item;
            }
            else
            {
                for (var i = 0; i < currentTagsComboBox.Items.Count; i++)
                {
                    var item = (TagInstanceItem)currentTagsComboBox.Items[i];

                    if (item.Tag.Index == tag.Index)
                    {
                        currentTagsComboBox.SelectedIndex = i;
                        break;
                    }
                }
            }

            LoadingTag = false;
        }
Exemplo n.º 4
0
            private void InitializeComponent()
            {
                _addRootButton  = new Button();
                _addChildButton = new Button();
                _deleteButton   = new Button();
                _dialogBlock    = new NuGenCollectionEditorDialogBlock();
                _mainBlock      = new NuGenCollectionEditorMainBlock();
                _moveDownButton = _mainBlock.GetMoveDownButton();
                _moveUpButton   = _mainBlock.GetMoveUpButton();
                _propertyBlock  = new NuGenCollectionEditorPropertyBlock();
                _splitContainer = new SplitContainer();
                _treeView       = new NodesEditorTreeView();

                this.SuspendLayout();

                /* DialogBlock */

                _dialogBlock.Dock     = DockStyle.Bottom;
                _dialogBlock.Parent   = this;
                _dialogBlock.TabIndex = 10;

                Button okButton     = _dialogBlock.GetOkButton();
                Button cancelButton = _dialogBlock.GetCancelButton();

                okButton.Click     += _okButton_Click;
                cancelButton.Click += _cancelButton_Click;

                /* SplitContainer */

                _splitContainer.Dock          = DockStyle.Fill;
                _splitContainer.Panel1MinSize = 250;
                _splitContainer.Panel2MinSize = 100;
                _splitContainer.Parent        = this;
                _splitContainer.BringToFront();

                /* MainBlock */

                _mainBlock.Dock     = DockStyle.Fill;
                _mainBlock.Parent   = _splitContainer.Panel1;
                _mainBlock.TabIndex = 20;
                _mainBlock.SetTitle(Resources.Text_TreeNodeCollectionEditor_mainTitle);

                /* Action buttons */

                _moveDownButton.Click += _moveDownButton_Click;
                _moveUpButton.Click   += _moveUpButton_Click;

                _deleteButton.Dock   = DockStyle.Top;
                _deleteButton.Image  = Resources.Delete;
                _deleteButton.Click += _deleteButton_Click;

                Control.ControlCollection actionControls = _mainBlock.GetActionControls();
                actionControls.Add(_deleteButton);
                _deleteButton.BringToFront();

                /* Populate buttons */

                _addRootButton.Dock     = DockStyle.Left;
                _addRootButton.TabIndex = 10;
                _addRootButton.Text     = Resources.Text_TreeNodeCollectionEditor_addRootButton;
                _addRootButton.Click   += _addRootButton_Click;

                _addChildButton.Dock     = DockStyle.Left;
                _addChildButton.TabIndex = 20;
                _addChildButton.Text     = Resources.Text_TreeNodeCollectionEditor_addChildButton;
                _addChildButton.Click   += _addChildButton_Click;

                Control.ControlCollection populateControls = _mainBlock.GetPopulateControls();
                populateControls.Add(_addChildButton);
                populateControls.Add(_addRootButton);

                /* PropertyBlock */

                _propertyBlock.Dock     = DockStyle.Fill;
                _propertyBlock.Parent   = _splitContainer.Panel2;
                _propertyBlock.TabIndex = 30;
                _propertyBlock.SetTitle(Resources.Text_TreeNodeCollectionEditor_propertyTitleNone);
                _propertyBlock.SelectedObjectsChanged += _propertyBlock_SelectedObjectsChanged;

                /* TreeView */

                _treeView.Dock   = DockStyle.Fill;
                _treeView.Parent = _mainBlock;
                _treeView.BringToFront();
                _treeView.AfterSelect += _treeView_AfterSelect;

                /* Form */

                NuGenCollectionEditorInitializer.InitializeEditorForm(this);
                this.AcceptButton = okButton;
                this.CancelButton = cancelButton;
                this.Size         = new Size(580, 480);
                this.MinimumSize  = this.Size;
                this.Text         = Resources.Text_TreeNodeCollectionEditor_EditorForm;
                base.ResumeLayout(false);
            }
Exemplo n.º 5
0
 private void SetSplitContainerToFill(SplitContainer container)
 {
     container.Dock = DockStyle.Fill;
     container.BringToFront();
 }
Exemplo n.º 6
0
        private void ViewEmpBtn_MouseClick(object sender, MouseEventArgs e)
        {
            List <EmployeeClass> emplist = empnow.viewemployee(empnow.id);

            ViewProjUC.editProj.Hide();
            ViewProjUC.projInfo.Hide();
            //ViewProjUC.viewtasks.Hide();
            ViewProjUC.tasksPanel.Hide();
            ViewEmpUC.editData.Hide();
            flowLayoutPanel1.Controls.Clear();
            OnHome.Visible     = false;
            OnAddProj.Visible  = false;
            OnViewEmp.Visible  = true;
            OnViewProj.Visible = false;

            SplitContainer empViewCont = new SplitContainer();

            empViewCont.Dock             = DockStyle.Fill;
            empViewCont.Orientation      = Orientation.Horizontal;
            empViewCont.SplitterDistance = 50;
            empViewCont.BorderStyle      = BorderStyle.FixedSingle;
            empViewCont.FixedPanel       = FixedPanel.Panel1;
            splitContainer2.Panel2.Controls.Add(empViewCont);
            empViewCont.BringToFront();

            TextBox search = new TextBox();

            search.Size     = new Size(300, 25);
            search.Text     = "Search";
            search.Location = new Point(450, 13);
            empViewCont.Panel1.Controls.Add(search);

            FlowLayoutPanel flowPanel = new FlowLayoutPanel();

            flowPanel.Controls.Clear();
            flowPanel.Dock          = DockStyle.Fill;
            flowPanel.AutoScroll    = true;
            flowPanel.FlowDirection = FlowDirection.TopDown;
            empViewCont.Panel2.Controls.Add(flowPanel);
            //search.TextChanged += new EventHandler(text_filter_change);
            //void text_filter_change(object textsender, EventArgs texte)
            //{
            //    flowPanel.Controls.Clear();
            //    for (int i = 0; i < emplist.Count; i++)
            //    {
            //        if (emplist[i].name.Contains(search.Text))
            //        {
            //            ViewEmpUC viewEmp = new ViewEmpUC();
            //            string fname = "", lname = "";
            //            int j;
            //            for (j = 0; j < emplist[i].name.Length; j++)
            //            {
            //                if (emplist[i].name[j] == ' ')
            //                    break;
            //                fname += emplist[i].name[j];
            //            }
            //            for (; j < emplist[i].name.Length; j++)
            //            {
            //                lname += emplist[i].name[j];
            //            }
            //            viewEmp.ViewFName.Text = "First name : " + fname;
            //            viewEmp.ViewLName.Text = "Last name : " + lname;
            //            viewEmp.ViewGender.Text = "Gender : " + emplist[i].gender;
            //            viewEmp.ViewHours.Text = "Hours : " + emplist[i].hours;
            //            viewEmp.ViewJoinDate.Text = "Join Date : " + emplist[i].join_date.ToString();
            //            viewEmp.ViewSalary.Text = "Salary : " + (emplist[i].hours * emplist[i].salary).ToString();
            //            viewEmp.viewRank.Text = "Rank : " + emplist[i].rank;
            //            viewEmp.ViewPhoneNum.Text = "Phone : " + emplist[i].phone;
            //            viewEmp.ViewEmail.Text = "Email : " + emplist[i].mail;
            //            viewEmp.ViewAddress.Text = "Address : " + emplist[i].address;
            //            viewEmp.closeBtn.Visible = false;

            //            viewEmp._id = emplist[i].id;
            //            viewEmp.emp = emplist[i];
            //            flowPanel.Controls.Add(viewEmp);
            //        }
            //    }
            //}



            for (int i = 0; i < emplist.Count; i++)
            {
                ViewEmpUC viewEmp = new ViewEmpUC();
                string    fname = "", lname = "";
                int       j;
                for (j = 0; j < emplist[i].name.Length; j++)
                {
                    if (emplist[i].name[j] == ' ')
                    {
                        break;
                    }
                    fname += emplist[i].name[j];
                }
                for (; j < emplist[i].name.Length; j++)
                {
                    lname += emplist[i].name[j];
                }
                viewEmp.ViewFName.Text    = "First name : " + fname;
                viewEmp.ViewLName.Text    = "Last name : " + lname;
                viewEmp.ViewGender.Text   = "Gender : " + emplist[i].gender;
                viewEmp.ViewHours.Text    = "Hours : " + emplist[i].hours;
                viewEmp.ViewJoinDate.Text = "Join Date : " + emplist[i].join_date.ToString();
                viewEmp.ViewSalary.Text   = "Salary : " + (emplist[i].hours * emplist[i].salary).ToString();
                viewEmp.viewRank.Text     = "Rank : " + emplist[i].rank;
                viewEmp.ViewPhoneNum.Text = "Phone : " + emplist[i].phone;
                viewEmp.ViewEmail.Text    = "Email : " + emplist[i].mail;
                viewEmp.ViewAddress.Text  = "Address : " + emplist[i].address;
                viewEmp.closeBtn.Visible  = false;

                viewEmp._id = emplist[i].id;
                viewEmp.emp = emplist[i];
                flowPanel.Controls.Add(viewEmp);
            }
        }