Example #1
0
        public ObjectManager(ProcessStream stream, ObjectAssociations objAssoc, List <WatchVariable> objectData, ObjectDataGui objectGui)
            : base(stream, objectData, objectGui.ObjectFlowLayout)
        {
            _objGui   = objectGui;
            _objAssoc = objAssoc;

            // Register controls on the control (for drag-and-drop)
            RegisterControlEvents(_objGui.ObjectBorderPanel);
            foreach (Control control in _objGui.ObjectBorderPanel.Controls)
            {
                RegisterControlEvents(control);
            }

            _objGui.ObjAddressLabelValue.Click += ObjAddressLabel_Click;
            _objGui.ObjAddressLabel.Click      += ObjAddressLabel_Click;

            // Register buttons
            objectGui.CloneButton.Click       += CloneButton_Click;
            objectGui.UnloadButton.Click      += UnloadButton_Click;
            objectGui.MoveMarioToButton.Click += MoveMarioToButton_Click;
            objectGui.MoveToMarioButton.Click += MoveToMarioButton_Click;
        }
Example #2
0
        private void StroopMainForm_Load(object sender, EventArgs e)
        {
            // Temp: Remove "Other" tab
#if RELEASE
            tabControlMain.TabPages.Remove(tabPageExpressions);
#endif

            _sm64Stream           = new ProcessStream();
            _sm64Stream.OnUpdate += OnUpdate;

            _disManager    = new DisassemblyManager(this, richTextBoxDissasembly, maskedTextBoxDisStart, _sm64Stream, buttonDisGo);
            _scriptManager = new ScriptManager(_sm64Stream, _scriptParser, checkBoxUseRomHack);
            _hackManager   = new HackManager(_sm64Stream, _romHacks, checkedListBoxHacks);

            // Create map manager
            MapGui mapGui = new MapGui();
            mapGui.GLControl              = glControlMap;
            mapGui.MapIdLabel             = labelMapId;
            mapGui.MapNameLabel           = labelMapName;
            mapGui.MapSubNameLabel        = labelMapSubName;
            mapGui.PuValueLabel           = labelMapPuValue;
            mapGui.QpuValueLabel          = labelMapQpuValue;
            mapGui.MapIconSizeTrackbar    = trackBarMapIconSize;
            mapGui.MapZoomTrackbar        = trackBarMapZoom;
            mapGui.MapShowInactiveObjects = checkBoxMapShowInactive;
            mapGui.MapShowMario           = checkBoxMapShowMario;
            mapGui.MapShowObjects         = checkBoxMapShowObj;
            mapGui.MapShowHolp            = checkBoxMapShowHolp;
            mapGui.MapShowCamera          = checkBoxMapShowCamera;
            mapGui.MapShowFloorTriangle   = checkBoxMapShowFloor;
            _mapManager = new MapManager(_sm64Stream, _mapAssoc, _objectAssoc, mapGui);

            _marioManager    = new MarioManager(_sm64Stream, _marioData, panelMarioBorder, flowLayoutPanelMario, _mapManager);
            _hudManager      = new HudManager(_sm64Stream, _hudData, tabPageHud);
            _miscManager     = new MiscManager(_sm64Stream, _miscData, flowLayoutPanelMisc, groupBoxPuController);
            _cameraManager   = new CameraManager(_sm64Stream, _cameraData, panelCameraBorder, flowLayoutPanelCamera);
            _triangleManager = new TriangleManager(_sm64Stream, tabPageTriangles, _triangleData);
            _debugManager    = new DebugManager();

            // Create object manager
            var objectGui = new ObjectDataGui()
            {
                ObjectBorderPanel     = panelObjectBorder,
                ObjectFlowLayout      = flowLayoutPanelObject,
                ObjectImagePictureBox = pictureBoxObject,
                ObjAddressLabelValue  = labelObjAddValue,
                ObjAddressLabel       = labelObjAdd,
                ObjBehaviorLabel      = labelObjBhvValue,
                ObjectNameTextBox     = textBoxObjName,
                ObjSlotIndexLabel     = labelObjSlotIndValue,
                ObjSlotPositionLabel  = labelObjSlotPosValue,
                CloneButton           = buttonObjClone,
                MoveMarioToButton     = buttonObjGoTo,
                MoveToMarioButton     = buttonObjRetrieve,
                UnloadButton          = buttonObjUnload
            };
            _objectManager = new ObjectManager(_sm64Stream, _objectAssoc, _objectData, objectGui);

            // Create options manager
            var optionGui = new OptionsGui();
            optionGui.CheckBoxStartFromOne = checkBoxStartSlotIndexOne;
            _optionsManager = new OptionsManager(optionGui);

            // Create Object Slots
            _slotManagerGui.TabControl                  = tabControlMain;
            _slotManagerGui.LockLabelsCheckbox          = checkBoxObjLockLabels;
            _slotManagerGui.MapObjectToggleModeComboBox = comboBoxMapToggleMode;
            _slotManagerGui.FlowLayoutContainer         = flowLayoutPanelObjects;
            _slotManagerGui.SortMethodComboBox          = comboBoxSortMethod;
            _slotManagerGui.LabelMethodComboBox         = comboBoxLabelMethod;
            _objectSlotManager = new ObjectSlotsManager(_sm64Stream, _objectAssoc, _objectManager, _slotManagerGui, _mapManager, _miscManager);

            SetupViews();

            _resizing               = false;
            _defaultSplitValue      = splitContainerMain.SplitterDistance;
            labelVersionNumber.Text = _version;

            // Load process
            var processes = GetAvailableProcesses();
            if (processes.Count == 1)
            {
                if (MessageBox.Show(String.Format("Found process \"{0}\". Connect?", processes[0].ProcessName),
                                    "Process Found", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    var processSelect = new ProcessSelection(processes[0]);
                    comboBoxProcessSelection.Items.Add(processSelect);
                    comboBoxProcessSelection.SelectedIndex = 0;
                }
            }
        }