public FormSpeciesDescription(C3mbSpeciesModel SpeMdl)
        {
            m_speMdl = SpeMdl;
            InitializeComponent();

            ShortDescriptionTextBox.Text = m_speMdl.szShortDescription;
            LongCommentTextBox.Text = m_speMdl.szLongComment;
            LongCommentTextBox.MaxLength = m_speMdl.longCommentMaxAllowedLenth-1;
            ShortDescriptionTextBox.MaxLength = m_speMdl.shortDescriptionMaxAllowedLenth-1;


            if(ShortDescriptionTextBox.Text.Length > 0)
                m_shortDescModified = true;
            else
                ShortDescriptionTextBox.Text = "Enter a short description here";
            UpdateShortDescriptionText();

            if(LongCommentTextBox.Text.Length > 0)
                m_longCommentModified = true;
            else
                LongCommentTextBox.Text =
                    "Enter general information here (description, comments, authorship, etc.)";
            UpdateLongCommentText();

            m_initializing = false;
        }
 public FormNormalModelSelect(C3mbSpeciesModel Species, int ThisIndex)
 {
     InitializeComponent();
     m_speMdl = Species;
     m_res = RESLT.CANCEL;
     m_myIndex = ThisIndex;
     CopyNormalButtons();
     UpdateNormalBehaviorStates();
 }
 public FormBehavior(C3mbSpeciesModel Species, int ThisIndex)
 {
     InitializeComponent();
     m_beh = Species.GetBehaviorCopy(ThisIndex);
     m_spe = Species;
     m_myIndex = ThisIndex;
     BehNameButton.Text = m_beh.name;
     this.Text = m_szTitleBar1 + "(" + (m_myIndex+1) + " of " + m_spe.BehaviorCount + ")" + m_szTitleBar2;
     UpdatePanel();
     ModelOKButton.Text = "Done";
     m_initializing = false;
 }
        public FormAcstcAvrsn(C3mbSpeciesModel SpeciesMdl)
        {
            m_initializing = true;
            m_speMdl = SpeciesMdl;

            // Added.
            m_beachingDepth = m_speMdl.beachingDepth;
            m_podBreaksOnAE = m_speMdl.podBreaksOnAE;


            m_aa = SpeciesMdl.AcousticAversion.GetCopy();
            InitializeComponent();
            UpdateEntireForm();
            this.Text = m_szTitle;
            AcousticAversionLabel.Text = m_behName;
            m_initializing = false;
        }
        public FormDepthValues(C3mbSpeciesModel SpeMdl)
        {
            InitializeComponent();
            m_speMdl = SpeMdl;
            Text = "Species Depth Values";
            m_shoreFollowingValue = m_speMdl.shoreFollowDepth;
            m_shallowSeedingLimit = m_speMdl.seedMinDepth;
            m_deepSeedingLimitEnabled = m_speMdl.seedingDepthLimitEnabled;
            m_deepSeedingLimitValue = m_speMdl.seedingDepthLimit;
            
            ShoreFollowingTextBox.Text = "" + m_shoreFollowingValue;
            ShallowSeedingTextBox.Text = "" + m_shallowSeedingLimit;
            DeepSeedingTextBox.Text = "" + m_deepSeedingLimitValue;
            DeepSeedingTextBox.Enabled = m_deepSeedingLimitEnabled;
            DeepSeedingDisabledLabel.Visible = !m_deepSeedingLimitEnabled;

            m_limitsBad = false;
            EnforceLimitRules();
        }
        void SetUpFresh()
        {
            //CDepthSpan spanRef;
            m_mmmbs = new C3mbs();
            //mbsCONFIG config;

            //--------------------------------------------------------------------------//
            // Set up the intial species model.
            //---------------------------------//
            m_speMdl = new C3mbSpeciesModel();

            m_szFileName = "NewSpeciesModel.spe";
            FileNameLabel.Text = m_szFileName;
            m_fileNamed = false;
            m_fileEverWasNamed = false;

            m_szTitleBar = "3MB Species Builder Version " + m_speMdl.speciesCurrentSuperVer +
                "." + String.Format("{0:00}", m_speMdl.speciesCurrentSubVer) + " - Biomimetica";


            // A new species model is being created.  A default normal behavior will be
            // automatically added.  Change its name.
            //beh = m_speMdl.GetBehaviorDuplicate(0);

            Text = m_szTitleBar;
            SpeciesVersopmLabel.Text = "species version:";
            SaveVerLabel.Text = "" + m_speMdl.speciesCurrentSuperVer + "." + String.Format("{0:00}", m_speMdl.speciesCurrentSubVer);

            UpdateEntireForm();

            m_bathyDepth = DEFAULT_BATHYMETRY_DEPTH;

            /* Set the initial scenario duration (hours). */
            m_durationHrsUser = INIT_HRS_PER_BEHAVIOR * (uint)m_speMdl.BehaviorCount;
            m_durationLastActual = m_durationHrsUser;
            DurationHoursTextBox.Text = "" + m_durationLastActual;

            /* Set the initial seed value for the scenario randomizer. */
            //config = m_mmmbs.GetConfiguration();
            m_seedUser = DEFAULT_RANDOMIZER_SEED;
            RandomizerTextBox.Text = "" + DEFAULT_RANDOMIZER_SEED;

            InitializeBitMapVars(m_durationHrsUser*SECS_PER_HOUR + 1);
            ToggleTargetDepthDisplayButton.BackColor = m_bitmapMgr.TargetDepthColor;
            ToggleBathymetryDisplayButton.BackColor = m_bitmapMgr.BathyColor;

            DepthInputButton.Text = "Bathy Depth:" + String.Format("{0:00}", m_bathyDepth);

            ConfirmDurationButton.Enabled = false;

            Run3MB(false, false);
        }
        private void Open()
        {
            C3mbSpeciesModel mdl = new C3mbSpeciesModel(); ;
            mbsRESULT res;
            switch(VerifySaveOldBeforeOpenNew())
            {
            case 1: // Do Not Save
                break;
            case 2: // Save and continue
                Save();
                break;
            case 3:// Cancel
                return;
            default:
                break;
            }

            OpenFileDialog dlg = new OpenFileDialog();
            dlg.CheckFileExists = true;
            dlg.Filter = "3MBS Species Models (*.spe)|*.spe";

            if(m_fileNamed == true)
                dlg.FileName = m_szFileName;

            DialogResult result = dlg.ShowDialog();
            this.BringToFront();
            if(result == DialogResult.Cancel)
            {
                return;
            }

            m_fileNamed = true;
            m_fileEverWasNamed = true;
            m_szFileName = dlg.FileName;
            if(mbsRESULT.OK != (res = mdl.LoadFromBinFile(m_szFileName)))
            {
                // message box.
                FmMsgBox msgBox = new FmMsgBox();
                msgBox.Text = "Load Species File Error";
                msgBox.labelText = m_mmmbs.MbsResultToString(res);

                if(res == mbsRESULT.OBSOLETE_SPECIES_VERSION)
                {
                    msgBox.labelText = msgBox.labelText +
                        "\n\nPlease contact support.";
                }
                else if(res == mbsRESULT.OBSOLETE_3MBS_VERSION)
                {
                    msgBox.labelText = msgBox.labelText +
                        "\n\nPlease download the latest 3MB package to load this species.";
                }
                msgBox.ShowDialog(this);
                return;
            }
            //m_additionalSimHours = 0;
            m_speMdl = mdl;
            m_durationHrsUser = INIT_HRS_PER_BEHAVIOR * (uint)m_speMdl.BehaviorCount;
            m_durationLastActual = m_durationHrsUser;

            DurationHoursTextBox.Text = "" + m_durationHrsUser;

            m_seedUser = DEFAULT_RANDOMIZER_SEED;
            RandomizerTextBox.Text = "" + DEFAULT_RANDOMIZER_SEED;

            m_bathyDepth = DEFAULT_BATHYMETRY_DEPTH;
            UpdateEntireForm();
            Run3MB(false, false);
        }
        public RmBehTransVec(TRANSITIONALMODELTYPE TransType, C3mbSpeciesModel Species, CBehavior Behavior, int BehaviorIndex, string szTitle)
        {
            int i;

            InitializeComponent();
            m_initializing = true;
            m_spe = Species;
            m_beh = Behavior;
            m_behIndex = BehaviorIndex;
            m_szTitle = szTitle;
            m_behaviorCnt = Species.BehaviorCount;
            m_transModelType = TransType;

            CBehavior beh;
            CEnvAttrBehTrans transModel;

            this.Text = szTitle;

            m_vectorTextBoxArray[0] = VectorTextBox00;
            m_vectorTextBoxArray[1] = VectorTextBox01;
            m_vectorTextBoxArray[2] = VectorTextBox02;
            m_vectorTextBoxArray[3] = VectorTextBox03;
            m_vectorTextBoxArray[4] = VectorTextBox04;
            m_vectorTextBoxArray[5] = VectorTextBox05;
            m_vectorTextBoxArray[6] = VectorTextBox06;
            m_vectorTextBoxArray[7] = VectorTextBox07;

            m_behNameLabelArray[0] = NameLabel00;
            m_behNameLabelArray[1] = NameLabel01;
            m_behNameLabelArray[2] = NameLabel02;
            m_behNameLabelArray[3] = NameLabel03;
            m_behNameLabelArray[4] = NameLabel04;
            m_behNameLabelArray[5] = NameLabel05;
            m_behNameLabelArray[6] = NameLabel06;
            m_behNameLabelArray[7] = NameLabel07;

            m_T50TextBoxArray[0] = T50TextBox00;
            m_T50TextBoxArray[1] = T50TextBox01;
            m_T50TextBoxArray[2] = T50TextBox02;
            m_T50TextBoxArray[3] = T50TextBox03;
            m_T50TextBoxArray[4] = T50TextBox04;
            m_T50TextBoxArray[5] = T50TextBox05;
            m_T50TextBoxArray[6] = T50TextBox06;
            m_T50TextBoxArray[7] = T50TextBox07;

            m_slopeTextBoxArray[0] = SlopeTextBox00;
            m_slopeTextBoxArray[1] = SlopeTextBox01;
            m_slopeTextBoxArray[2] = SlopeTextBox02;
            m_slopeTextBoxArray[3] = SlopeTextBox03;
            m_slopeTextBoxArray[4] = SlopeTextBox04;
            m_slopeTextBoxArray[5] = SlopeTextBox05;
            m_slopeTextBoxArray[6] = SlopeTextBox06;
            m_slopeTextBoxArray[7] = SlopeTextBox07;

            //m_refreshing = true;
            for(i=0; i<m_spe.BehaviorCount && i<NUM_NRML_BUTTONS; i++)
            {
                if(i == m_behIndex)
                    beh = m_beh;
                else
                    beh = m_spe.GetBehaviorCopy(i);

                switch(m_transModelType)
                {
                //case TRANSITIONALMODELTYPE.BEHAVIORAL:
                  //  transModel = beh.nrmlBehTrans;
                   // break;
                case TRANSITIONALMODELTYPE.DEPTHENV:
                    transModel = beh.depthBehTrans;
                    break;
                case TRANSITIONALMODELTYPE.TEMPERATUREENV:
                    transModel = beh.temperatureBehTrans;
                    break;
                default:
                    transModel = beh.depthBehTrans;
//                    transModel = beh.nrmlBehTrans;
                    break;
                }

                m_behNameLabelArray[i].Text = beh.name;
                m_vectorTextBoxArray[i].Text = transModel.vector.ConvertToString();
                m_T50TextBoxArray[i].Text = "" + transModel.meanTimeInBehMinuites;
                m_slopeTextBoxArray[i].Text = "" + transModel.slopeCoeff_goesAway;
            }


            for(; i<NUM_NRML_BUTTONS; i++)
            {
                m_behNameLabelArray[i].Text = "";
                m_behNameLabelArray[i].Enabled = false;

                m_vectorTextBoxArray[i].Text = "";
                m_vectorTextBoxArray[i].Enabled = false;

                m_T50TextBoxArray[i].Text = "";
                m_T50TextBoxArray[i].Enabled = false;

                m_slopeTextBoxArray[i].Text = "";
                m_slopeTextBoxArray[i].Enabled = false;
            }


            DoneButton.Enabled = true;
            RefreshButton.Enabled = false;
            UpdateVectorModel();
            m_initializing = false;
            //m_refreshing = false;
        }