Пример #1
0
 private static void DisplayActionButtonsCreate()
 {
     GUILayout.BeginHorizontal();
     if (GUILayout.Button("Create", GUILayout.MaxWidth(80)))
     {
         var kerbalFound = false;
         while (!kerbalFound)
         {
             SelectedKerbal = RMKerbal.CreateKerbal();
             if (SelectedKerbal.Trait == KerbalProfession && SelectedKerbal.Gender == Gender)
             {
                 kerbalFound = true;
             }
         }
         if (!RMLifeSpan.Instance.RMKerbals.AllrmKerbals.ContainsKey(SelectedKerbal.Name))
         {
             RMLifeSpan.Instance.RMKerbals.AllrmKerbals.Add(SelectedKerbal.Name, SelectedKerbal);
         }
         DisplayMode = DisplayModes.Edit;
     }
     if (GUILayout.Button("Cancel", GUILayout.MaxWidth(80)))
     {
         SelectedKerbal = null;
         DisplayMode    = DisplayModes.Index;
     }
     GUILayout.EndHorizontal();
 }
Пример #2
0
        public static void SetInputMethod(DisplayModes keyboardDisplayMode, bool isFull)
        {
            foreach (CultureInfo lang in InputLanguageManager.Current.AvailableInputLanguages)
            {
                if (keyboardDisplayMode == DisplayModes.Japanese)
                {
                    if (lang.TwoLetterISOLanguageName == "ja")
                    {
                        if (InputLanguageManager.Current.CurrentInputLanguage.TwoLetterISOLanguageName != "ja")
                        {
                            _PreviousInputLanguageName = InputLanguageManager.Current.CurrentInputLanguage.TwoLetterISOLanguageName;
                        }
                        InputLanguageManager.Current.CurrentInputLanguage = lang;

                        InputMethod.Current.ImeSentenceMode   = ImeSentenceModeValues.PhrasePrediction;
                        InputMethod.Current.ImeConversionMode = ImeConversionModeValues.FullShape | ImeConversionModeValues.Native | ImeConversionModeValues.Roman;
                        InputMethod.Current.ImeState          = isFull ? InputMethodState.On : InputMethodState.Off;
                    }
                }
                else
                {
                    if (lang.TwoLetterISOLanguageName == _PreviousInputLanguageName)
                    {
                        InputLanguageManager.Current.CurrentInputLanguage = lang;
                        InputMethod.Current.ImeState = InputMethodState.Off;
                        break;
                    }
                }
            }
        }
Пример #3
0
    public WorldChunk(Coord _coord, GameObject _chunkObject, WorldChunkSettings setting, DisplayModes _displayMode, ChunkStates _requireState)
    {
        this.coord        = _coord;
        this.state        = ChunkStates.Created;
        this.displayMode  = _displayMode;
        this.isVisible    = false;
        this.isLoading    = false;
        this.isComputing  = false;
        this.isMeshing    = false;
        this.requireState = _requireState;

        this.chunkObject = _chunkObject;
        this.chunkObject.transform.parent        = setting.parent;
        this.chunkObject.transform.localScale    = new Vector3(setting.size, .01f, setting.size);
        this.chunkObject.transform.localPosition = this.coord.ToWorldPosition(setting);
        MapDisplay.instance.UpdateChunkName(this, setting);

        // Request Data
        if (this.requireState >= ChunkStates.Loaded)
        {
            this.requestData(setting);
        }
        else
        {
            MapDisplay.instance.UpdateChunkDisplay(this);
        }
    }
Пример #4
0
        private MoviesViewModel GetNewViewModel(int currentPage, DisplayModes displayMode, Guid? searchId)
        {
            MoviesViewModel viewModel = new MoviesViewModel()
            {
                CurrentPage = currentPage + 1,
                ControllerName = RouteData.Values["controller"].ToString(),
                DisplayMode = displayMode
            };

            if (displayMode == DisplayModes.Catalog || displayMode == DisplayModes.Search)
            {
                string lastQuery = HttpContext.Session.Get<string>("LastQuery");
                if (string.IsNullOrWhiteSpace(lastQuery))
                {
                    viewModel.Collection = Movie.SelectAll(new QueryOptions() { MaximumResults = 10, Offset = currentPage * 10 });
                }
                else
                {
                    viewModel.Collection = Movie.SelectList(q => q.Name.Contains(lastQuery, StringComparison.InvariantCultureIgnoreCase), new QueryOptions() { MaximumResults = 10, Offset = currentPage * 10 });
                }
                LoadCatalogs(ref viewModel);
            }
            else if (displayMode == DisplayModes.Edit)
            {
                viewModel.Selected = Movie.Select(type => type.Id == searchId.GetValueOrDefault());
                LoadCatalogs(ref viewModel);
            }
            else if (displayMode == DisplayModes.New)
            {
                viewModel.Selected = new Movie();
                LoadCatalogs(ref viewModel);
            }

            return viewModel;
        }
Пример #5
0
        internal static void DisplayActionButtonsEdit()
        {
            GUILayout.BeginHorizontal();
            const string label   = "Apply";
            const string toolTip = "Applies the changes made to this Kerbal.\r\nDesired Name and Profession will be Retained after save.";

            if (GUILayout.Button(new GUIContent(label, toolTip), GUILayout.MaxWidth(50)))
            {
                if (RMSettings.EnableKerbalRename)
                {
                    SelectedKerbal.Trait = KerbalProfession;
                }
                RMAddon.SaveMessage = SelectedKerbal.SubmitChanges();
                if (string.IsNullOrEmpty(RMAddon.SaveMessage))
                {
                    SelectedKerbal = null;
                    DisplayMode    = DisplayModes.Index;
                }
            }
            var rect = GUILayoutUtility.GetLastRect();

            if (Event.current.type == EventType.Repaint && RMSettings.ShowToolTips)
            {
                ToolTip = RMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10);
            }
            if (GUILayout.Button("Cancel", GUILayout.MaxWidth(50)))
            {
                SelectedKerbal = null;
                DisplayMode    = DisplayModes.Index;
            }
            GUILayout.EndHorizontal();
        }
Пример #6
0
        void VerifyDisplayMode(DisplayModes mode)
        {
            switch (mode)
            {
            case DisplayModes.Auto:
            case DisplayModes.ComboBox:
                VerifyComboBoxEnabled();
                VerifyNumberBoxDisabled();
                VerifyNumberPanelDisabled();
                break;

            case DisplayModes.NumberBox:
                VerifyComboBoxDisabled();
                VerifyNumberBoxEnabled();
                VerifyNumberPanelDisabled();
                break;

            case DisplayModes.NumberPanel:
                VerifyComboBoxDisabled();
                VerifyNumberBoxDisabled();
                VerifyNumberPanelEnabled();
                break;

            default:
                break;
            }
        }
Пример #7
0
 private void SetDisplayMode(DisplayModes displayMode)
 {
     if (View != null)
     {
         View.SetDisplayMode(displayMode);
     }
 }
Пример #8
0
        private void ChangeDisplayMode(DisplayModes newDisplayMode)
        {
            _state.DisplayMode = newDisplayMode;
            byte byteDisplayMode = (byte)_state.DisplayMode;

            if (!_state.Enabled)
            {
                return;
            }

            // We strip the last 2 bits of STAT and replace them with the mode
            _state.STAT = (byte)((_state.STAT & 0xFC) | byteDisplayMode);
            this._memory.LowLevelWrite((ushort)MMR.STAT, _state.STAT);

            // We check if we have to trigger vertical blanking
            if (_state.DisplayMode == DisplayModes.Mode01) // We just change to V-BLANK Mode
            {
                _interruptController.SetInterrupt(Interrupts.VerticalBlanking);
            }

            // NOTE(Cristian): The bits that determine which interrupt is enabled
            //                 are ordered in the same numbers that the mode numbering
            //                 So basically we can shift by the mode numbering to get
            //                 the corresponding bit for the current mode being changed.
            //                 Bit 5: Mode 10
            //                               Bit 4: Mode 01
            //                               Bit 3: Mode 00
            if ((newDisplayMode != DisplayModes.Mode11) &&
                ((_state.STAT >> (byteDisplayMode + 3)) & 1) == 1)
            {
                _interruptController.SetInterrupt(Interrupts.LCDCStatus);
            }
        }
Пример #9
0
 /// <summary>
 /// Attempts to find a <see cref="DisplayMode"/> for the given <see cref="Display"/> that
 /// closely matches the requested parameters.
 /// </summary>
 /// <param name="size">The <see cref="Size"/> to match.</param>
 /// <param name="bitsPerPixel">The bits per pixel to match. If null, the highest available bits per pixel will be used.</param>
 /// <param name="refreshRate">The refresh rate in hertz. If null, the highest available refresh rate will be used.</param>
 /// <returns></returns>
 public DisplayMode FindDisplayMode(Size size, int?bitsPerPixel = null, int?refreshRate = null) =>
 DisplayModes.Where(mode => mode.Size.Width <= size.Width && mode.Size.Height <= size.Height &&
                    (bitsPerPixel == null || mode.BitsPerPixel == bitsPerPixel) &&
                    (refreshRate == null || mode.RefreshRate == refreshRate))
 .OrderByDescending(mode => mode.Size.Width)
 .ThenByDescending(mode => mode.Size.Height)
 .ThenByDescending(mode => mode.RefreshRate)
 .ThenByDescending(mode => mode.BitsPerPixel)
 .FirstOrDefault();
Пример #10
0
        private static IPresenter Create_Presenter(DisplayModes optsMode)
        {
            if (optsMode == DisplayModes.Web)
            {
                return(new JsonPresenter());
            }

            var consolePresenter = new ConsolePresenter();

            return(consolePresenter);
        }
Пример #11
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AuthConfig.RegisterAuth();
            DisplayModes.ConfigureDisplayModes();
        }
Пример #12
0
        public void UpdateDevMode()
        {
            NativeMethods.DEVMODE devmode = new NativeMethods.DEVMODE(true);

            int i = 0;

            while (NativeMethods.EnumDisplaySettingsEx(DeviceName, i, ref devmode, 0))
            {
                DisplayModes.Add(new DisplayMode(devmode));
                i++;
            }
        }
Пример #13
0
        private static void DisplayActionButtonsIndex()
        {
            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Create Kerbal"))
            {
                DisplayMode = DisplayModes.Create;
            }
            var settingsStyle = WindowSettings.ShowWindow ? RMStyle.ButtonToggledStyle : RMStyle.ButtonStyle;

            if (GUILayout.Button("Settings", settingsStyle))
            {
                try
                {
                    WindowSettings.ShowWindow = !WindowSettings.ShowWindow;
                    if (WindowSettings.ShowWindow)
                    {
                        // Store settings in case we cancel later...
                        RMSettings.StoreTempSettings();
                    }
                }
                catch (Exception ex)
                {
                    Utilities.LogMessage(string.Format(" opening Settings Window.  Error:  {0} \r\n\r\n{1}", ex.Message, ex.StackTrace), "Error", true);
                }
            }

            if (RMLifeSpan.Instance.RMGameSettings.EnableSalaries)
            {
                var disputesStyle = WindowContracts.ShowWindow ? RMStyle.ButtonToggledStyle : RMStyle.ButtonStyle;
                if (GUILayout.Button("Salary Contracts", disputesStyle))
                {
                    try
                    {
                        WindowContracts.ShowWindow = !WindowContracts.ShowWindow;
                    }
                    catch (Exception ex)
                    {
                        Utilities.LogMessage(string.Format(" opening Salary Contracts Window.  Error:  {0} \r\n\r\n{1}", ex.Message, ex.StackTrace), "Error", true);
                    }
                }
            }

            var rect = GUILayoutUtility.GetLastRect();

            if (Event.current.type == EventType.Repaint && ShowToolTips)
            {
                ToolTip = RMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10);
            }
            GUILayout.EndHorizontal();
        }
Пример #14
0
 public void Load(DisplayModes _displayMode)
 {
     if (_displayMode != this.displayMode)
     {
         this.isVisible   = true;
         this.displayMode = _displayMode;
         MapDisplay.instance.UpdateChunkDisplay(this);
     }
     if (!this.isVisible)
     {
         this.isVisible = true;
         MapDisplay.instance.UpdateChunkDisplay(this, true);
     }
 }
Пример #15
0
 /// <summary>
 /// Updates the GUI to reflect the state of the program.
 /// </summary>
 /// <param name="mode">Can be a value of DisplayModes enum.</param>
 private void updateGUI(DisplayModes mode)
 {
     if (mode == DisplayModes.Generating)
     {
         // how GUI looks when random numbers are being generated
         generateButton.Text = "...";
     }
     else if (mode == DisplayModes.Generated)
     {
         // how GUI looks when random numbers are generated
         this.Height         = 427;
         generateButton.Text = "Regenerate";
     }
 }
Пример #16
0
 public void ToggleMode()
 {
     if (CurrentMode == DisplayModes.Globe)
     {
         CurrentMode = DisplayModes.Map;
         _camera.GetComponent <CameraController>().state = CameraState.ORBIT_TO_PLANE;
         ShowMap();
         StoreCamera();
     }
     else
     {
         CurrentMode = DisplayModes.Globe;
         _camera.GetComponent <CameraController>().state = CameraState.PLANE_TO_ORBIT;
         ShowGlobe();
         RestoreCamera();
     }
 }
Пример #17
0
        private OriginsViewModel GetNewViewModel(int currentPage, DisplayModes displayMode, Guid?searchId)
        {
            Result <Origin> result       = null;
            QueryOptions    queryOptions = new QueryOptions()
            {
                MaximumResults = 10, Offset = currentPage * 10
            };
            OriginsViewModel viewModel = new OriginsViewModel()
            {
                CurrentPage    = currentPage + 1,
                ControllerName = RouteData.Values["controller"].ToString(),
                DisplayMode    = displayMode
            };

            if (displayMode == DisplayModes.Catalog || displayMode == DisplayModes.Search)
            {
                string lastQuery = HttpContext.Session.Get <string>("LastQuery");
                if (string.IsNullOrWhiteSpace(lastQuery))
                {
                    result = Manager <Origin> .SelectAll(queryOptions);

                    viewModel.IsFromCache = result.IsFromCache;
                    viewModel.Collection  = result.Data.ToList();
                }
                else
                {
                    result = Manager <Origin> .Select(q => q.Name.Contains(lastQuery, StringComparison.InvariantCultureIgnoreCase), queryOptions);

                    viewModel.IsFromCache = result.IsFromCache;
                    viewModel.Collection  = result.Data.ToList();
                }
            }
            else if (displayMode == DisplayModes.Edit)
            {
                viewModel.Selected = Origin.Select(type => type.Id == searchId.GetValueOrDefault());
            }
            else if (displayMode == DisplayModes.New)
            {
                viewModel.Selected = new Origin();
            }

            return(viewModel);
        }
        protected void VerifyDisplayMode(DisplayModes mode)
        {
            switch (mode)
            {
            case DisplayModes.Auto:
                if (Convert.ToInt32(elements.GetNumberOfPagesTextBlock().GetText()) < AutoDisplayModeThresholdValue)
                {
                    VerifyComboBoxEnabled();
                    VerifyNumberBoxDisabled();
                    VerifyNumberPanelDisabled();
                }
                else
                {
                    VerifyNumberBoxEnabled();
                    VerifyComboBoxDisabled();
                    VerifyNumberPanelDisabled();
                }
                break;

            case DisplayModes.ComboBox:
                VerifyComboBoxEnabled();
                VerifyNumberBoxDisabled();
                VerifyNumberPanelDisabled();
                break;

            case DisplayModes.NumberBox:
                VerifyComboBoxDisabled();
                VerifyNumberBoxEnabled();
                VerifyNumberPanelDisabled();
                break;

            case DisplayModes.NumberPanel:
                VerifyComboBoxDisabled();
                VerifyNumberBoxDisabled();
                VerifyNumberPanelEnabled();
                break;

            default:
                break;
            }
        }
Пример #19
0
        private void CreateIcon()
        {
            panel1.Visible = false;

            if (Pictures != null)
            {
                Pictures = null;
            }
            szIconSize.Width  = (int)numericWidth.Value;
            szIconSize.Height = (int)numericHeight.Value;

            FillColumnsHeaders();

            iPagesNb = (int)Math.Ceiling((double)szIconSize.Height / 8);

            panel1.Controls.Clear();


            if (rbHorMode.Checked == true)
            {
                dModes = DisplayModes.Horizontal;
            }
            else
            {
                dModes = DisplayModes.Vertical;
            }
            int xPos, yPos;

            int iColNum, iPageNum;

            iColNum  = 0;
            iPageNum = 0;

            Pictures = new PictureBox[szIconSize.Width * (iPagesNb) * 8 + 1];
            lbHEX    = new Label[iPagesNb * szIconSize.Width];

            int iPixelNumber = 0;
            int iLblNumber   = 0;



            while (iPixelNumber < szIconSize.Width * iPagesNb * 8)
            {
                xPos = 20 + iColNum * szRectSize.Width;
                yPos = iPageNum * ((szRectSize.Height) * 8 + 15);
                for (int iByte = 0; iByte < 8; iByte++)
                {
                    Pictures[iPixelNumber] = new PictureBox();

                    Pictures[iPixelNumber].BackColor   = Color.Azure;
                    Pictures[iPixelNumber].Size        = new Size(szRectSize.Width, szRectSize.Height);
                    Pictures[iPixelNumber].Location    = new Point(xPos, yPos);
                    Pictures[iPixelNumber].Visible     = true;
                    Pictures[iPixelNumber].BorderStyle = BorderStyle.FixedSingle;
                    Pictures[iPixelNumber].Click      += new EventHandler(ImageClick);
                    Pictures[iPixelNumber].Tag         = iPixelNumber;

                    panel1.Controls.Add(Pictures[iPixelNumber]);

                    iPixelNumber++;

                    yPos = yPos + szRectSize.Height;
                }
                lbHEX[iLblNumber]             = new Label();
                lbHEX[iLblNumber].Text        = "00";
                lbHEX[iLblNumber].Location    = new Point(xPos, yPos);
                lbHEX[iLblNumber].Visible     = true;
                lbHEX[iLblNumber].BorderStyle = BorderStyle.FixedSingle;
                lbHEX[iLblNumber].AutoSize    = true;

                panel1.Controls.Add(lbHEX[iLblNumber]);
                iLblNumber++;

                if (rbHorMode.Checked == true)
                {
                    iColNum++;
                    if (iColNum > szIconSize.Width - 1)
                    {
                        iColNum = 0;
                        iPageNum++;
                    }
                }
                else
                {
                    iPageNum++;
                    if (iPageNum > iPagesNb - 1)
                    {
                        iPageNum = 0;
                        iColNum++;
                    }
                }
            }

            FillPagesNumber();

            bmIcon   = new Bitmap(szIconSize.Width, iPagesNb * 8);
            bmMedium = new Bitmap(szIconSize.Width * 2, iPagesNb * 16);

            Graphics grMedium = Graphics.FromImage(bmMedium);

            Graphics grSmall = Graphics.FromImage(bmIcon);

            grSmall.FillRectangle(Brushes.Black, 0, 0, szIconSize.Width, iPagesNb * 8);
            grMedium.FillRectangle(Brushes.Black, 0, 0, szIconSize.Width * 2, iPagesNb * 16);

            pbIconSmall.Image = bmIcon;

            panel1.Visible  = true;
            button2.Enabled = true;
        }
Пример #20
0
        private static void DisplayRosterViewer()
        {
            try
            {
                // We have changed to an Update refreshed list, so I've moved filtering and sorting to the beginning of the routine, instead of the end.
                FilterRosterList(FilteredBy);
                SortRosterList(RMAddon.AllCrewSort);
                DisplayRosterHeader();

                _scrollViewerPosition = GUILayout.BeginScrollView(_scrollViewerPosition, RMStyle.ScrollStyle, GUILayout.Height(230), GUILayout.Width(680));
                //foreach (ProtoCrewMember kerbal in RMAddon.AllCrew
                foreach (var rmkerbal in RMAddon.AllCrew)
                {
                    var kerbal     = rmkerbal.Value.Kerbal;
                    var labelStyle = GetLabelStyle(kerbal, rmkerbal);

                    // What vessel is this Kerbal Assigned to?
                    var rosterDetails = "";
                    if (kerbal.rosterStatus == ProtoCrewMember.RosterStatus.Assigned)
                    {
                        rosterDetails = RosterVesselDetails(rmkerbal.Value);
                    }
                    else if (InstalledMods.IsDfInstalled && kerbal.type == ProtoCrewMember.KerbalType.Unowned)
                    {
                        // This kerbal could be frozen.  Lets find out...
                        rosterDetails = GetFrozenDetials(kerbal);
                        labelStyle    = RMStyle.LabelStyleCyan;
                    }
                    else if (rmkerbal.Value.SalaryContractDispute)
                    {
                        // This kerbal is in contract dispute
                        rosterDetails = rmkerbal.Value.Trait == "Tourist" ? "Contract Cancelled - Strike" : "Contract Dispute";
                    }
                    else
                    {
                        // Since the kerbal has no vessel assignment, lets show what their status...
                        rosterDetails = kerbal.rosterStatus.ToString();
                    }
                    GUILayout.BeginHorizontal();
                    // Column Name (is a Button)
                    var          buttonText    = kerbal.name;
                    const string buttonToolTip = "Opens the Edit section for this kerbal.";
                    var          btnStyle      = SelectedKerbal == null || SelectedKerbal.Kerbal != kerbal ? RMStyle.ButtonStyleLeft : RMStyle.ButtonToggledStyleLeft;
                    if (GUILayout.Button(new GUIContent(buttonText, buttonToolTip), btnStyle, GUILayout.Width(160)))
                    {
                        if (SelectedKerbal == null || SelectedKerbal.Kerbal != kerbal)
                        {
                            //Find the RMKerbal entry for the selected kerbal.
                            SelectedKerbal = RMLifeSpan.Instance.RMKerbals.AllrmKerbals.FirstOrDefault(a => a.Key == kerbal.name).Value;
                            if (SelectedKerbal == null)
                            //Didn't find the RMKerbal entry? Should never happen? Create a new one just in case.
                            {
                                SelectedKerbal = new RMKerbal(Planetarium.GetUniversalTime(), kerbal, true, false);
                                RMLifeSpan.Instance.RMKerbals.AllrmKerbals.Add(kerbal.name, SelectedKerbal);
                            }
                            else
                            {
                                SelectedKerbal.IsNew = false;
                            }
                            SetProfessionFlag();
                            Gender      = SelectedKerbal.Gender;
                            DisplayMode = DisplayModes.Edit;
                        }
                        else
                        {
                            SelectedKerbal = null;
                            DisplayMode    = DisplayModes.Index;
                            Gender         = ProtoCrewMember.Gender.Male;
                        }
                    }
                    var rect = GUILayoutUtility.GetLastRect();
                    if (Event.current.type == EventType.Repaint && ShowToolTips)
                    {
                        ToolTip = RMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10);
                    }

                    // Column Gender
                    GUILayout.Label(kerbal.gender.ToString(), labelStyle, GUILayout.Width(50));
                    if (RMLifeSpan.Instance.RMGameSettings.EnableAging)
                    {
                        var kerbalInfo = RMLifeSpan.Instance.RMKerbals.AllrmKerbals.FirstOrDefault(a => a.Key == kerbal.name);
                        if (kerbalInfo.Key != null)
                        {
                            GUILayout.Label(kerbalInfo.Value.Age.ToString("##0"), labelStyle, GUILayout.Width(35));
                        }
                    }
                    // Column Salary
                    GUILayout.Label(rmkerbal.Value.SalaryContractDispute ? rmkerbal.Value.RealTrait : kerbal.trait, labelStyle, GUILayout.Width(75));
                    // Column Skill level
                    GUILayout.Label(kerbal.experienceLevel.ToString(), labelStyle, GUILayout.Width(35));
                    // column Experience
                    GUILayout.Label(kerbal.experience.ToString(CultureInfo.InvariantCulture), labelStyle, GUILayout.Width(75));
                    // Column Status
                    var statusWidth = GUILayout.Width(240);
                    if (RMLifeSpan.Instance.RMGameSettings.EnableAging)
                    {
                        statusWidth = GUILayout.Width(200);
                    }
                    GUILayout.Label(rosterDetails, labelStyle, statusWidth);
                    GUILayout.EndHorizontal();
                    GUI.enabled = true;
                }

                GUILayout.EndScrollView();
            }
            catch (Exception ex)
            {
                Utilities.LogMessage(string.Format(" in RosterListViewer.  Error:  {0} \r\n\r\n{1}", ex.Message, ex.StackTrace), "Error", true);
            }
        }
Пример #21
0
        internal static void Display(int windowId)
        {
            // Reset Tooltip active flag...
            ToolTipActive = false;

            // Close window button
            var rect = new Rect(Position.width - 20, 4, 16, 16);

            if (GUI.Button(rect, new GUIContent("", "Close Window")))
            {
                SelectedKerbal = null;
                DisplayMode    = DisplayModes.Index;
                ToolTip        = "";
                if (HighLogic.LoadedScene == GameScenes.SPACECENTER || HighLogic.LoadedScene == GameScenes.EDITOR || HighLogic.LoadedScene == GameScenes.TRACKSTATION || HighLogic.LoadedScene == GameScenes.FLIGHT)
                {
                    RMAddon.OnRMRosterToggle();
                }
                else
                {
                    ShowWindow = false;
                }
            }
            if (Event.current.type == EventType.Repaint && ShowToolTips)
            {
                ToolTip = RMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10);
            }

            // Ok, now lets render the window...
            try
            {
                GUILayout.BeginVertical();
                DisplayRosterFilter();
                DisplayRosterViewer();

                switch (DisplayMode)
                {
                case DisplayModes.Index:
                    DisplayActionButtonsIndex();
                    break;

                case DisplayModes.Edit:
                    GUILayout.Label("Kerbal Manager", RMStyle.LabelStyleBoldCenter, GUILayout.Width(680));
                    DisplayTabButtons();
                    DisplaySelectedTab();
                    break;

                case DisplayModes.Create:
                    GUILayout.Label("Create a Kerbal", RMStyle.LabelStyleBoldCenter, GUILayout.Width(680));
                    DisplaySelectProfession();
                    DisplaySelectGender();
                    DisplayActionButtonsCreate();
                    break;

                default:
                    DisplayActionButtonsIndex();
                    break;
                }
                GUILayout.EndVertical();
                GUI.DragWindow(new Rect(0, 0, Screen.width, 30));
                RMSettings.RepositionWindows("WindowRoster");
            }
            catch (Exception ex)
            {
                Utilities.LogMessage(string.Format(" in Roster Window.  Error:  {0} \r\n\r\n{1}", ex.Message, ex.StackTrace), "Error", true);
            }
        }
Пример #22
0
 private void OnModeChanged(DisplayModes mode)
 {
     IsCreation = mode.HasFlag(DisplayModes.Creation);
     IsEditing  = mode.HasFlag(DisplayModes.Editing);
 }
Пример #23
0
 public VersionLabel()
 {
     DisplayMode = DisplayModes.Comment;
 }
Пример #24
0
        public void FillData()
        {
            //engine setting
            uint width, height;

            Engine.Instance.Driver.GetDisplayMode(out width, out height);
            SVideoSetting videoSetting = Engine.Instance.VideoSetting;

            //
            DisplayModes.Clear();
            DisplayModes.Add(new DisplayMode()
            {
                WindowMode = true
            });
            _cbDisplayModes.SelectedIndex     = 0;
            _cbDisplayModes.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //
            Resolutions.Clear();
            Resolutions.Add(new Resolution()
            {
                Width = width, Height = height
            });

            _cbResolutions.SelectedIndex     = 0;
            _cbResolutions.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //

            RefreshRates.Default();
            _cbRefreshRates.SelectedIndex     = 0;
            _cbRefreshRates.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //
            VideoDevices.Clear();
            VideoDevices.Add(new VideoDevice()
            {
                Index = 0
            });

            _cbVideoDevices.SelectedIndex     = 0;
            _cbVideoDevices.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //
            MultiSamples.Default();
            _cbMultisamples.SelectedItem      = (from x in MultiSamples where x.Sample == videoSetting.antialias select x).ToArray()[0];
            _cbMultisamples.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //
            _cbVsyncs.SelectedItem      = (from x in VSyncs where x.On == videoSetting.vsync select x).ToArray()[0];
            _cbVsyncs.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //
            MatResolutions.Clear();
            MatResolutions.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_LOW
            });
            MatResolutions.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_FAIR
            });
            MatResolutions.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_GOOD
            });
            MatResolutions.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_HIGH
            });

            _cbMatResolutions.SelectedItem      = (from x in MatResolutions where x.Level == videoSetting.textureResolution select x).ToArray()[0];
            _cbMatResolutions.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //
            _cbMatTextureFilters.SelectedItem      = (from x in MatTextureFilters where x.Filter == videoSetting.textureFiltering select x).ToArray()[0];
            _cbMatTextureFilters.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //
            _cbMatProjections.SelectedItem      = (from x in MatProjections where x.On == false select x).ToArray()[0];
            _cbMatProjections.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //
            ViewDistances.Default();
            _cbViewDistances.SelectedItem      = (from x in ViewDistances where x.Level == videoSetting.viewDistance select x).ToArray()[0];
            _cbViewDistances.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            EnvDetails.Default();
            _cbEnvDetails.SelectedItem      = (from x in EnvDetails where x.Level == videoSetting.envDetail select x).ToArray()[0];
            _cbEnvDetails.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            GroundScenes.Default();
            _cbGroundScenes.SelectedItem      = (from x in GroundScenes where x.Level == videoSetting.groundClutter select x).ToArray()[0];
            _cbGroundScenes.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            ShadowQualities.Default();
            _cbShadowQuality.SelectedItem      = (from x in ShadowQualities where x.Level == videoSetting.shadowQuality select x).ToArray()[0];
            _cbShadowQuality.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            LiquidDetails.Clear();
            LiquidDetails.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_LOW
            });
            LiquidDetails.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_FAIR
            });
            LiquidDetails.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_GOOD
            });
            LiquidDetails.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_ULTRA
            });
            _cbLiquidDetail.SelectedItem      = (from x in LiquidDetails where x.Level == videoSetting.liquidDetail select x).ToArray()[0];
            _cbLiquidDetail.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            SunLightEffects.Clear();
            SunLightEffects.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_DISABLE
            });
            SunLightEffects.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_LOW
            });
            SunLightEffects.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_HIGH
            });
            _cbSunLightEffect.SelectedItem      = (from x in SunLightEffects where x.Level == videoSetting.sunshafts select x).ToArray()[0];
            _cbSunLightEffect.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            ParticleDensities.Default();
            _cbParticleDensity.SelectedItem      = (from x in ParticleDensities where x.Level == videoSetting.particleDensity select x).ToArray()[0];
            _cbParticleDensity.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            SSAOLevels.Clear();
            SSAOLevels.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_DISABLE
            });
            SSAOLevels.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_LOW
            });
            SSAOLevels.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_HIGH
            });
            _cbSSAO.SelectedItem      = (from x in SSAOLevels where x.Level == videoSetting.SSAO select x).ToArray()[0];
            _cbSSAO.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);
        }
Пример #25
0
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed ||
                Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            _state = Keyboard.GetState();

            if (_displayMode == DisplayModes.Game)
            {
                _sampleGame.Update(gameTime, _state);
            }

            Window.Title = "F1 - F3: static images, F4: game, F5 - F11: LUTs";

            /*
             * //Create LUT
             * if (_state.IsKeyDown(Keys.F12))
             * {
             *  _colorGradingFilter.CreateLUT(GraphicsDevice, ColorGradingFilter.LUTSizes.Size4, "LUT4.png");
             *  _colorGradingFilter.CreateLUT(GraphicsDevice, ColorGradingFilter.LUTSizes.Size16, "LUT16.png");
             *  _colorGradingFilter.CreateLUT(GraphicsDevice, ColorGradingFilter.LUTSizes.Size32, "LUT32.png");
             *  _colorGradingFilter.CreateLUT(GraphicsDevice, ColorGradingFilter.LUTSizes.Size64, "LUT64.png");
             * }
             */

            //Change display mode
            if (_state.IsKeyDown(Keys.F1))
            {
                _displayMode = DisplayModes.Kingfisher;
            }
            if (_state.IsKeyDown(Keys.F2))
            {
                _displayMode = DisplayModes.Church;
            }
            if (_state.IsKeyDown(Keys.F3))
            {
                _displayMode = DisplayModes.Winebar;
            }
            if (_state.IsKeyDown(Keys.F4))
            {
                _displayMode = DisplayModes.Game;
            }

            //Change LUTs
            if (_state.IsKeyDown(Keys.F5))
            {
                _lutModes = LUTModes.ver1;
            }
            if (_state.IsKeyDown(Keys.F6))
            {
                _lutModes = LUTModes.ver2;
            }
            if (_state.IsKeyDown(Keys.F7))
            {
                _lutModes = LUTModes.ver3;
            }
            if (_state.IsKeyDown(Keys.F8))
            {
                _lutModes = LUTModes.ver4;
            }
            if (_state.IsKeyDown(Keys.F9))
            {
                _lutModes = LUTModes.ver5;
            }
            if (_state.IsKeyDown(Keys.F10))
            {
                _lutModes = LUTModes.ver6;
            }
            if (_state.IsKeyDown(Keys.F11))
            {
                _lutModes = LUTModes.ver7;
            }
        }
Пример #26
0
        private void ChangeDisplayMode(DisplayModes newDisplayMode)
        {
            _state.DisplayMode = newDisplayMode;
              byte byteDisplayMode = (byte)_state.DisplayMode;

              if (!_state.Enabled) { return; }

              // We strip the last 2 bits of STAT and replace them with the mode
              _state.STAT = (byte)((_state.STAT & 0xFC) | byteDisplayMode);
              this._memory.LowLevelWrite((ushort)MMR.STAT, _state.STAT);

              // We check if we have to trigger vertical blanking
              if (_state.DisplayMode == DisplayModes.Mode01) // We just change to V-BLANK Mode
              {
            _interruptController.SetInterrupt(Interrupts.VerticalBlanking);
              }

              // NOTE(Cristian): The bits that determine which interrupt is enabled
              //                 are ordered in the same numbers that the mode numbering
              //                 So basically we can shift by the mode numbering to get
              //                 the corresponding bit for the current mode being changed.
              //                 Bit 5: Mode 10
              // 								 Bit 4: Mode 01
              // 								 Bit 3: Mode 00
              if ((newDisplayMode != DisplayModes.Mode11) &&
              ((_state.STAT >> (byteDisplayMode + 3)) & 1) == 1)
              {
            _interruptController.SetInterrupt(Interrupts.LCDCStatus);
              }
        }
Пример #27
0
 private void SetDisplayMode(DisplayModes displayMode)
 {
     if (View != null)
         View.SetDisplayMode(displayMode);
 }
Пример #28
0
 /// <summary>
 /// Updates the GUI to reflect the state of the program.
 /// </summary>
 /// <param name="mode">Can be a value of DisplayModes enum.</param>
 private void updateGUI(DisplayModes mode)
 {
     if (mode == DisplayModes.Generating)
     {
         // how GUI looks when random numbers are being generated
         generateButton.Text = "...";
     }
     else if (mode == DisplayModes.Generated)
     {
         // how GUI looks when random numbers are generated
         this.Height = 427;
         generateButton.Text = "Regenerate";
     }
 }
Пример #29
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Get physical path from url
        string physicalImagePath = Request.QueryString["path"];
        // Get display moden
        DisplayModes mode = DisplayModes.Thumbnail;

        if (Request.QueryString["mode"] != null && Request.QueryString["mode"].Trim().ToUpper() == "FULL")
        {
            mode = DisplayModes.Full;
        }

        // Check path
        if (physicalImagePath == null || physicalImagePath.Length == 0 || !File.Exists(physicalImagePath))
        {
            // If can not get the path or get a empty path or get a wrong path, then do noting
            return;
        }

        if (mode != DisplayModes.Full && Holder.ContainsPhysicalImagePath(physicalImagePath))
        {
            try
            {
                using (MemoryStream imageStream = new MemoryStream())
                {
                    // Set thumbnail quality
                    EncoderParameters encoderPara = new EncoderParameters(1);
                    encoderPara.Param[0] = new EncoderParameter(Encoder.Quality, Convert.ToInt64(Consts.ThumbnailImageQuality));
                    ImageCodecInfo imageCodecInfo = this.GetEncoderInfo(Consts.ThumbnailImageMimeType);

                    // Put image to the temp space with jpg format
                    Holder.GetImageByPhysicalImagePath(physicalImagePath).Save(imageStream, imageCodecInfo, encoderPara);
                    // Clear the reponse buffer
                    Response.Clear();
                    // Set the http stream as a jpg file
                    Response.ContentType = Consts.ThumbnailImageMimeType;
                    // Put the image stream to the http stream from temp space from Holder
                    imageStream.WriteTo(Response.OutputStream);
                }
                return;
            }
            catch (Exception ex_)
            {
                // do nothing
                ;
            }
        }

        // Temp space for the image file
        using (MemoryStream imageStream = new MemoryStream())
        {
            try
            {
                // Load image file from physical disk
                System.Drawing.Image image = System.Drawing.Image.FromFile(physicalImagePath);

                if (mode == DisplayModes.Full)
                {
                    using (FileStream fs = new FileStream(physicalImagePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                    {
                        byte[] buffer = new byte[fs.Length];
                        fs.Read(buffer, 0, Convert.ToInt32(fs.Length));

                        // Clear the reponse buffer
                        Response.Clear();
                        // Set the http stream as a jpg file
                        Response.ContentType = Consts.ThumbnailImageMimeType;
                        // Put the image stream to the http stream from temp space
                        Response.BinaryWrite(buffer);
                    }
                }
                else
                {
                    using (Stream bmpImage = new MemoryStream())
                    {
                        if (!Consts.UseExifThumbnailImage)
                        {
                            // Reload image as BitMap format
                            // The JPG file which with EXIF format maybe include a ThumbnailImage
                            image.Save(bmpImage, ImageFormat.Bmp);
                            image = System.Drawing.Image.FromStream(bmpImage);
                        }

                        //init thumbnail object
                        System.Drawing.Image imageThumbnail = null;

                        // Get the thumbnail image
                        imageThumbnail = image.GetThumbnailImage(Consts.ThumbnailImageWidth,
                                                                 Convert.ToInt32((Convert.ToDouble(Consts.ThumbnailImageWidth) / image.Width) * image.Height),
                                                                 new System.Drawing.Image.GetThumbnailImageAbort(ReturnFalse),
                                                                 IntPtr.Zero);
                        // Save to Holder
                        Holder.AddImage(physicalImagePath, imageThumbnail);

                        // Set thumbnail quality
                        EncoderParameters encoderPara = new EncoderParameters(1);
                        encoderPara.Param[0] = new EncoderParameter(Encoder.Quality, Convert.ToInt64(Consts.ThumbnailImageQuality));
                        ImageCodecInfo imageCodecInfo = this.GetEncoderInfo(Consts.ThumbnailImageMimeType);

                        // Put image to the temp space with jpg format
                        imageThumbnail.Save(imageStream, imageCodecInfo, encoderPara);

                        // Clear the reponse buffer
                        Response.Clear();
                        // Set the http stream as a jpg file
                        Response.ContentType = Consts.ThumbnailImageMimeType;
                        // Put the image stream to the http stream from temp space
                        imageStream.WriteTo(Response.OutputStream);
                    }
                }
            }
            catch (Exception ex)
            {
                System.Console.WriteLine(ex.StackTrace);
                // If any exception be throwed, then do nothing
                return;
            }
        }
    }
Пример #30
0
 /// <summary>
 /// Checks whether the graphics card supports a certain monitor resolution
 /// </summary>
 /// <param name="width">The resolution width</param>
 /// <param name="height">The resolution height</param>
 /// <returns><c>true</c> if the level is supported</returns>
 public bool CheckResolution(int width, int height)
 {
     return(DisplayModes.Any(mode => mode.Width == width && mode.Height == height));
 }