public DialogCreatorControl(DialogData d)
 {
     data = d;
     InitializeComponent();
     graphicsControl1.Parent = this;
     TBMaxInstances.Text = d.MaxInstances == null ? "" : d.MaxInstances.ToString();
 }
 public DialogCreatorControl()
 {
     data = new DialogData();
     Dialog mainDialog = new Dialog(null, new Rectangle(0, 0, 500, 400), data);
     mainDialog.Anchor = Dialog_Creator.Enums.Anchor.Center;
     data.Dialogs.Add(mainDialog);
     InitializeComponent();
     graphicsControl1.Parent = this;
 }
Ejemplo n.º 3
0
        public DialogCreatorControl()
        {
            data = new DialogData();
            Dialog mainDialog = new Dialog(null, new Rectangle(0, 0, 500, 400), data);

            mainDialog.Anchor = Dialog_Creator.Enums.Anchor.Center;
            data.Dialogs.Add(mainDialog);
            InitializeComponent();
            graphicsControl1.Parent = this;
        }
Ejemplo n.º 4
0
        private void MakeNewDialog()
        {
            if (openProjectDir == null)
            {
            //Open an unsaved file

            }
            else
            {
            //Make file, and open it
                //Find it's position in the gui tree
                TreeNode folderNode = projectView.SelectedNode ??
                                        ProjectProperties.CurrentProjectPropperties.SrcFolder.GUINode;

                DirItem markedChild = (DirItem) folderNode.Tag;
                FolderItem parentFolder = (FolderItem) (markedChild.Parent ?? markedChild);
                if (markedChild is FolderItem)
                    parentFolder = (FolderItem) markedChild;

                //Find a default unique name
                string name = "New dialog.Dialog";
                int i = 1;
                while (parentFolder.Children.Any(child => child.Text == name))
                {
                    i++;
                    name = "New dialog" + i + ".Dialog";
                }
                DialogItem item = new DialogItem(parentFolder);
                item.Name = name;

                //Create the file
                DialogData dialogData = new DialogData();
                Dialog mainDialog = new Dialog(null, new Rectangle(0, 0, 500, 400), dialogData);
                mainDialog.Anchor = Dialog_Creator.Enums.Anchor.TopLeft;
                dialogData.Dialogs.Add(mainDialog);
                dialogData.Save(item.FullName);

                //Todo: Add to compiler

                item.GUINode = new TreeNode(name);
                item.GUINode.SelectedImageIndex = item.GUINode.ImageIndex = 5;
                item.GUINode.Tag = item;
                //Image index

                //Insert into tree
                int insertAt = parentFolder.Children.IndexOf(markedChild) + 1;
                if (insertAt == 0 || insertAt == parentFolder.Children.Count)
                {
                    parentFolder.Children.Add(item);
                    parentFolder.GUINode.Nodes.Add(item.GUINode);
                }
                else
                {
                    parentFolder.Children.Insert(insertAt, item);
                    parentFolder.GUINode.Nodes.Insert(insertAt, item.GUINode);
                }

                item.CodeGUINode = new TreeNode(name.Substring(0, name.LastIndexOf(".Dialog")) + ".galaxy++");
                item.CodeGUINode.SelectedImageIndex = item.CodeGUINode.ImageIndex = 2;
                item.CodeGUINode.Tag = item;
                item.GUINode.Nodes.Add(item.CodeGUINode);

                item.DesignerGUINode =
                    new TreeNode(name.Substring(0, name.LastIndexOf(".Dialog")) + ".Designer.galaxy++");
                item.DesignerGUINode.SelectedImageIndex = item.DesignerGUINode.ImageIndex = 2;
                item.DesignerGUINode.Tag = item;
                item.GUINode.Nodes.Add(item.DesignerGUINode);

                compiler.AddDialogFile(item);

                ProjectProperties.CurrentProjectPropperties.Save();
                UploadedChangesToMap = false;
                UploadToMap();

                projectView.SelectedNode = item.GUINode;
                item.GUINode.EnsureVisible();
                BeginRename(item.GUINode);
            }
        }
Ejemplo n.º 5
0
        private void CloseFile(DialogData file, FATabStripItem tabPage, out bool cancel, bool ignoreChanges = false)
        {
            if (tabPage == file.TabPage)
            {
                if (file.Changed && !ignoreChanges)
                {
                    DialogResult result = MessageBox.Show(this,
                                                          LocRM.GetString("Text28.Text"),
                                                          LocRM.GetString("Text29.Text"),
                                                          MessageBoxButtons.YesNoCancel);
                    if (result == DialogResult.Cancel)
                    {
                        cancel = true;
                        return;
                    }
                    if (result == DialogResult.Yes)
                        file.Save(file.DialogItem.FullName);
                }

                //ProjectProperties.CurrentProjectPropperties.Save();
                tabStrip.RemoveTab(tabPage);
                //openFiles.Remove(file);
                file.TabPage = null;
                file.GUINode = null;
                if (file.CodeTabPage == null && file.DesignerTabPage == null)
                    file.DialogItem.OpenFileData = null;
            }
            else if (tabPage == file.CodeTabPage)
            {
                if (file.CodeChanged && !ignoreChanges)
                {
                    DialogResult result = MessageBox.Show(this,
                                                          LocRM.GetString("Text28.Text"),
                                                          LocRM.GetString("Text29.Text"),
                                                          MessageBoxButtons.YesNoCancel);
                    if (result == DialogResult.Cancel)
                    {
                        cancel = true;
                        return;
                    }
                    if (result == DialogResult.Yes)
                        file.Save(file.DialogItem.FullName);
                }

                //ProjectProperties.CurrentProjectPropperties.Save();
                tabStrip.RemoveTab(tabPage);
                //openFiles.Remove(file);
                file.CodeTabPage = null;
                file.CodeGUINode = null;
                if (file.TabPage == null && file.DesignerTabPage == null)
                    file.DialogItem.OpenFileData = null;
            }
            else if (tabPage == file.DesignerTabPage)
            {
                //ProjectProperties.CurrentProjectPropperties.Save();
                tabStrip.RemoveTab(tabPage);
                //openFiles.Remove(file);
                file.DesignerTabPage = null;
                file.DesignerGUINode = null;
                if (file.TabPage == null && file.CodeTabPage == null)
                    file.DialogItem.OpenFileData = null;
            }
            cancel = false;
        }
Ejemplo n.º 6
0
 public void SetDialogData(DialogData d)
 {
     Data             = d;
     d.CurrentControl = this;
 }
 public void SetDialogData(DialogData d)
 {
     Data = d;
     d.CurrentControl = this;
 }