Example #1
0
        public static StartupValues GetStartupValues()
        {
            StartupValues values = new StartupValues();

            values.StartFontSize = 14;
            values.StartupFileId = -1;
            RegistryKey rk = Registry.CurrentUser.OpenSubKey("Software\\LeHand\\StartupData", true);

            if (rk == null)
            {
                rk = Registry.CurrentUser.CreateSubKey("Software\\LeHand\\StartupData");
            }
            string[] names = rk.GetValueNames();
            for (int i = 0; i < names.Length; i++)
            {
                if (names[i] == StartupValues.keynames[0])
                {
                    values.StartFontSize = (int)rk.GetValue(names[i]);
                }
                if (names[i] == StartupValues.keynames[1])
                {
                    values.StartupFileId = (int)rk.GetValue(names[i]);
                }
                if (names[i] == StartupValues.keynames[2])
                {
                    values.ShowLineNumbers = (int)rk.GetValue(names[i]);
                }
                if (names[i] == StartupValues.keynames[3])
                {
                    values.LastSimpleFileSelected = (int)rk.GetValue(names[i]);
                }
            }

            return(values);
        }
Example #2
0
        public AdvancedMode()
        {
            InitializeComponent();

            LuaFileView.SelectionChanged += LuaFileView_SelectionChanged;
            FileManager.LoadAllFiles();

            inst      = this;
            Focusable = true;

            StartupValues val = LHregistry.GetStartupValues();

            //SimpleMode.LastFileOpened = val.LastSimpleFileSelected;
            textEditor.FontSize = val.StartFontSize;
            textEditor.Text     = "function Start()\n	print(\"preview\")\nend\n\n\n\n\n\n\n\n";
            LoadFileFromId(val.StartupFileId);

            textEditor.InputBindings.Add(
                new InputBinding(new SaveCommand(),
                                 new KeyGesture(Key.S, ModifierKeys.Control)
                                 ));
            textEditor.InputBindings.Add(
                new InputBinding(new LineToggleCommand(),
                                 new KeyGesture(Key.L, ModifierKeys.Control)
                                 ));
            textEditor.ShowLineNumbers = Convert.ToBoolean(val.ShowLineNumbers);

            //set file view to the listbox
            Listbox = LuaFileView;
            StyleLuaListbox();

            //get all the filenames from registry
            int len = LHregistry.GetAllFilenames().Length;

            for (int i = 0; i < len; i++)
            {
                Label  txtbox    = new Label();
                string wholePath = LHregistry.GetAllFilenames()[i];
                txtbox.Content = LHregistry.getSimpleName(wholePath);

                styleLabel(txtbox);
                txtbox.Foreground = white;
                txtbox.Background = transparent;

                LuaFileView.Items.Add(txtbox);
            }

            BypassTextChangedEvent = true;

            //Alle icoontjes
            PlusIcon.Source   = ImageSourceFromBitmap(LeHandUI.Properties.Resources.PALE_GREEN_AddIcon64x64);
            DeleteIcon.Source = ImageSourceFromBitmap(LeHandUI.Properties.Resources.WASHED_OUT_RED_DeleteIcon64x64);
            //RefreshIcon.Source = ImageSourceFromBitmap(LeHandUI.Properties.Resources.AQUA_RefreshIcon64x64);
            //AddReferenceIcon.Source = ImageSourceFromBitmap(LeHandUI.Properties.Resources.AddReference16x16);
            SaveIcon.Source    = ImageSourceFromBitmap(LeHandUI.Properties.Resources.SaveScript64x64);
            RunPrgmIcon.Source = ImageSourceFromBitmap(LeHandUI.Properties.Resources.StartScript64x64);
        }
Example #3
0
        public static void SetStartupValues(StartupValues values)
        {
            if (values.StartFontSize > 0)
            {
                Registry.SetValue(StartupValKey, StartupValues.keynames[0],
                                  values.StartFontSize, RegistryValueKind.DWord);
            }

            if (values.StartFontSize >= 0)
            {
                Registry.SetValue(StartupValKey, StartupValues.keynames[1],
                                  values.StartupFileId, RegistryValueKind.DWord);
            }

            Registry.SetValue(StartupValKey, StartupValues.keynames[2],
                              values.ShowLineNumbers, RegistryValueKind.DWord);
        }
Example #4
0
        private void Application_Exit(object sender, ExitEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine("LeHand is exiting...");
            if (!LeHandExited)
            {
                Communicator.quit();
            }
            LeHandExited = true;

            StartupValues values = new StartupValues();

            values.StartFontSize   = Convert.ToInt32(AdvancedMode.inst.textEditor.FontSize);
            values.StartupFileId   = FileManager.currentFileId;
            values.ShowLineNumbers = Convert.ToInt32(AdvancedMode.inst.textEditor.ShowLineNumbers);

            LHregistry.SetStartupValues(values);

            System.Windows.Application.Current.Shutdown();
            Environment.Exit(0);
        }