Example #1
0
 private void RefreshProjects()
 {
     Display.Items.Refresh();
     FilterBox.RefreshFilter();
     Display.SelectedItem = Display.SelectedItem;
     MainWindow.Us.UpdateRecentProjectsMenu();
 }
Example #2
0
 protected override void OnGotFocus(RoutedEventArgs e)
 {
     base.OnGotFocus(e);
     if (e.OriginalSource == this)
     {
         FilterBox.Focus();
     }
 }
Example #3
0
        private void RefreshModelSystems()
        {
            var selected = Display.SelectedItem;

            Display.Items.Refresh();
            FilterBox.RefreshFilter();
            Display.SelectedItem = selected;
        }
Example #4
0
 private void ModelSystemsDisplay_Loaded(object sender, RoutedEventArgs e)
 {
     // This needs to be executed via the dispatcher to avoid an issue with AvalonDock
     Dispatcher.BeginInvoke(new Action(() =>
     {
         FilterBox.Focus();
     }));
 }
Example #5
0
 public OpenWindow()
 {
     InitializeComponent();
     InternalModel.PropertyChanged += (o, e) =>
     {
         FilterBox.RefreshFilter();
     };
 }
        private void LuaFunctionList_Load(object sender, EventArgs e)
        {
            _functionList = _docs
                            .OrderBy(l => l.Library)
                            .ThenBy(l => l.Name)
                            .ToList();
            UpdateList();
            FilterBox.Focus();

            ToWikiMarkupButton.Visible = VersionInfo.DeveloperBuild;
        }
        private void LuaFunctionList_Load(object sender, EventArgs e)
        {
            FunctionList = GlobalWin.Tools.LuaConsole.LuaImp.Docs
                           .OrderBy(x => x.Library)
                           .ThenBy(x => x.Name)
                           .ToList();
            UpdateList();
            FilterBox.Focus();

            ToWikiMarkupButton.Visible = VersionInfo.DeveloperBuild;
        }
Example #8
0
        private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
        {
            AppModel model = (AppModel)((Page)sender).DataContext;

            if (model.Servers != null && model.Servers.Any())
            {
                FilterBox.Focus();
            }
            else
            {
                AddServerBorder.Width = 200;
                AddServerBox.Focus();
            }
        }
Example #9
0
        private void CreateTooltips()
        {
            ShowErrorToggleButton.SetTooltip(LogViewerCommands.Logging.ToggleErrorInputGesture);
            ShowWarningToggleButton.SetTooltip(LogViewerCommands.Logging.ToggleWarningInputGesture);
            ShowInfoToggleButton.SetTooltip(LogViewerCommands.Logging.ToggleInfoInputGesture);
            ShowDebugToggleButton.SetTooltip(LogViewerCommands.Logging.ToggleDebugInputGesture);

            EnableTimestampToggleButton.SetTooltip(LogViewerCommands.Logging.ToggleTimestampInputGesture, "Show timestamps");
            FilterBox.SetTooltip(LogViewerCommands.Logging.FilterInputGesture);

            ClearButton.SetTooltip(LogViewerCommands.Logging.ClearInputGesture);
            CopyButton.SetTooltip(LogViewerCommands.Logging.CopyToClipboardInputGesture);
            OpenButton.SetTooltip(LogViewerCommands.Logging.OpenInEditorInputGesture);
        }
 private void LoadWindow(object sender, RoutedEventArgs e)
 {
     PredefinedColors = MainWindow.GetColors();  // Holt die Farben aus der Config
     FilterBox.Focus();
 }
Example #11
0
        private void DrawContent()
        {
            // init menu form
            ShowInTaskbar = false;
            StartPosition = FormStartPosition.Manual;

            Controls.Clear();

            // evaluates the width needed to draw the control
            var maxWidth = MenuList.Select(item => item.Level * 8 + TextRenderer.MeasureText(item.SubText ?? "", FontManager.GetFont(FontFunction.Small)).Width + TextRenderer.MeasureText(item.DisplayText ?? "", FontManager.GetStandardFont()).Width).Concat(new[] { 0 }).Max();

            maxWidth += MenuList.Exists(item => item.SubText != null) ? 10 : 0;
            maxWidth += (MenuList.Exists(item => item.ItemImage != null) ? 35 : 8) + 30;
            if (FormMaxSize.Width > 0)
            {
                maxWidth = maxWidth.ClampMax(FormMaxSize.Width);
            }
            if (FormMinSize.Width > 0)
            {
                maxWidth = maxWidth.ClampMin(FormMinSize.Width);
            }
            Width = maxWidth;

            int yPos = BorderWidth;

            // title
            HtmlLabel title = null;

            if (HtmlTitle != null)
            {
                title = new HtmlLabel {
                    Anchor             = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right,
                    Location           = new Point(BorderWidth, yPos),
                    AutoSizeHeightOnly = true,
                    Width                = Width - BorderWidth * 2,
                    BackColor            = Color.Transparent,
                    Text                 = HtmlTitle,
                    IsSelectionEnabled   = false,
                    IsContextMenuEnabled = false,
                    Enabled              = false
                };
                yPos += title.Height;
            }

            // display filter box?
            if (DisplayFilterBox)
            {
                FilterBox.Anchor   = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                FilterBox.Location = new Point(BorderWidth, yPos + 5);
                FilterBox.Size     = new Size(Width - BorderWidth * 2, 20);
                FilterBox.Padding  = new Padding(5, 0, 5, 0);
                if (MenuList.Exists(item => item.CanExpand))
                {
                    _isExpanded            = MenuList.Exists(item => item.IsExpanded);
                    FilterBox.ExtraButtons = new List <YamuiFilterBox.YamuiFilterBoxButton> {
                        new YamuiFilterBox.YamuiFilterBoxButton {
                            Image   = _isExpanded ? Resources.Resources.Collapse : Resources.Resources.Expand,
                            OnClic  = buttonExpandRetract_Click,
                            ToolTip = "Toggle <b>Expand/Collapse</b>"
                        }
                    };
                }
                yPos += 30;
            }

            // list
            Padding = new Padding(BorderWidth, yPos, BorderWidth, BorderWidth);
            YamuiList.NoCanExpandItem = !MenuList.Exists(item => item.CanExpand);
            YamuiList.Dock            = DockStyle.Fill;
            if (!DisplayNbItems)
            {
                YamuiList.BottomHeight = 0;
            }
            YamuiList.SetItems(MenuList.Cast <ListItem>().ToList());
            YamuiList.MouseDown    += YamuiListOnMouseDown;
            YamuiList.EnterPressed += YamuiListOnEnterPressed;
            YamuiList.RowClicked   += YamuiListOnRowClicked;
            yPos += YamuiList.Items.Count.ClampMin(1) * YamuiList.RowHeight;

            if (YamuiList.Items.Count > 0)
            {
                var selectedIdx = YamuiList.Items.Cast <YamuiMenuItem>().ToList().FindIndex(item => item.IsSelectedByDefault);
                if (selectedIdx > 0)
                {
                    YamuiList.SelectedItemIndex = selectedIdx;
                }
            }

            // add controls
            if (title != null)
            {
                Controls.Add(title);
            }
            if (DisplayFilterBox)
            {
                FilterBox.Initialize(YamuiList);
                Controls.Add(FilterBox);
            }
            Controls.Add(YamuiList);

            // Size the form
            var height = yPos + BorderWidth + (DisplayNbItems ? YamuiList.BottomHeight : 0);

            if (FormMaxSize.Height > 0)
            {
                height = height.ClampMax(FormMaxSize.Height);
            }
            if (FormMinSize.Height > 0)
            {
                height = height.ClampMin(FormMinSize.Height);
            }
            Size = new Size(maxWidth, height);

            // position / size
            Location = ParentWindowRectangle.Width > 0 ? GetBestCenteredPosition(ParentWindowRectangle) : (AutocompletionLineHeight != 0 ? GetBestAutocompPosition(SpawnLocation, AutocompletionLineHeight) : GetBestMenuPosition(SpawnLocation));
            ResizeFormToFitScreen();
            MinimumSize = Size;

            // default focus
            if (DisplayFilterBox)
            {
                FilterBox.ClearAndFocusFilter();
            }
            else
            {
                ActiveControl = YamuiList;
            }

            // Filter?
            if (!string.IsNullOrEmpty(InitialFilterString) && DisplayFilterBox)
            {
                FilterBox.Text = InitialFilterString;
            }

            // So that the OnKeyDown event of this form is executed before the HandleKeyDown event of the control focused
            KeyPreview = true;
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        protected override void OnKeyDown(KeyEventArgs e)
        {
            base.OnKeyDown(e);
            if (e.Handled == false)
            {
                if (EditorController.IsShiftDown() && EditorController.IsControlDown())
                {
                    switch (e.Key)
                    {
                    case Key.F:
                        if (QuickParameterDisplay2.IsEnabled)
                        {
                            QuickParameterDialogHost.IsOpen = true;
                        }
                        else if (ModuleParameterDisplay.IsEnabled)
                        {
                            ModuleParameterDialogHost.IsOpen = true;
                        }

                        break;
                    }
                }

                if (EditorController.IsControlDown())
                {
                    switch (e.Key)
                    {
                    case Key.M:
                        if (EditorController.IsAltDown())
                        {
                            //SetMetaModuleStateForSelected(false);
                        }
                        else if (EditorController.IsShiftDown())
                        {
                            //SetMetaModuleStateForSelected(true);
                        }
                        else
                        {
                            SelectReplacement();
                        }

                        e.Handled = true;
                        break;

                    case Key.R:
                        //ParameterTabControl.SelectedIndex = 2;
                        //Mo.Focus();
                        // Keyboard.Focus(ParameterFilterBox);
                        e.Handled = true;
                        break;

                    case Key.P:
                        //ParameterTabControl.SelectedIndex = 1;
                        //ModuleParameterTab.Focus();
                        ModuleParameterDisplay.Focus();
                        Keyboard.Focus(ParameterFilterBox);
                        e.Handled = true;
                        break;

                    case Key.E:
                        FilterBox.Focus();
                        e.Handled = true;
                        break;

                    case Key.W:
                        Close();
                        e.Handled = true;
                        break;

                    case Key.L:
                        ShowLinkedParameterDialog(true);
                        e.Handled = true;
                        break;

                    case Key.N:
                        CopyParameterName();
                        e.Handled = true;
                        break;

                    case Key.O:
                        OpenParameterFileLocation(false, false);
                        e.Handled = true;
                        break;

                    case Key.F:
                        SelectFileForCurrentParameter();
                        e.Handled = true;
                        break;

                    case Key.D:
                        if (ModuleParameterDisplay.IsKeyboardFocusWithin || QuickParameterDisplay2.IsKeyboardFocusWithin)
                        {
                            SelectDirectoryForCurrentParameter();
                        }
                        e.Handled = true;
                        break;

                    case Key.Z:
                        Undo();
                        e.Handled = true;
                        break;

                    case Key.Y:
                        Redo();
                        e.Handled = true;
                        break;

                    case Key.C:
                        CopyCurrentModule();
                        e.Handled = true;
                        break;

                    case Key.V:
                        PasteCurrentModule();
                        e.Handled = true;
                        break;

                    case Key.Q:

                        if (EditorController.IsShiftDown())
                        {
                            ToggleQuickParameterDisplay();
                            e.Handled = true;
                        }
                        else
                        {
                            ToggleQuickParameterDisplaySearch();

                            e.Handled = true;
                            break;
                        }


                        break;
                    }
                }
                else
                {
                    switch (e.Key)
                    {
                    case Key.F2:
                        if (EditorController.IsShiftDown())
                        {
                            RenameDescription();
                        }
                        else
                        {
                            RenameParameter();
                        }

                        break;

                    case Key.F1:
                        ShowDocumentation();
                        e.Handled = true;
                        break;

                    case Key.Delete:
                        if ((ModelSystemDisplayContent.Content as UserControl).IsKeyboardFocusWithin)
                        {
                            RemoveSelectedModules();
                            e.Handled = true;
                        }

                        break;

                    case Key.F5:
                        e.Handled = true;
                        SaveCurrentlySelectedParameters();
                        ExecuteRun();

                        break;

                    case Key.Escape:
                        FilterBox.Box.Text = string.Empty;
                        break;
                    }
                }
            }
        }
Example #13
0
        // This is where I set up keyboard accelerators and do some ridiculous hacks
        // to get keyboard control+focus working the way I want it.
        // Space should ALWAYS toggle playback, unless the search box has focus.
        // Escape should clear+exit the search box.
        // Enter should start playing a file when in the file view

        #region KeyboardStuff

        private void SetUpKeyboardAccelerators()
        {
            KeyboardAccelerator CreateAccelerator(VirtualKeyModifiers modifier, VirtualKey key,
                                                  TypedEventHandler <KeyboardAccelerator, KeyboardAcceleratorInvokedEventArgs> eventHandler)
            {
                KeyboardAccelerator ret = new KeyboardAccelerator()
                {
                    Modifiers = modifier, Key = key
                };

                ret.Invoked += eventHandler;

                return(ret);
            }

            //pull

            KeyboardAccelerator pullAccelerator = CreateAccelerator(VirtualKeyModifiers.Control, VirtualKey.P,
                                                                    async(sender, args) => {
                args.Handled = true;
                await ViewModel.PullEventsCommand.ExecuteAsync(null);
            });

            KeyboardAccelerators.Add(pullAccelerator);

            //push
            KeyboardAccelerators.Add(CreateAccelerator(VirtualKeyModifiers.Control | VirtualKeyModifiers.Shift, VirtualKey.P,
                                                       async(sender, args) => {
                args.Handled = true;
                await ViewModel.PushEventsCommand.ExecuteAsync(null);
            }));

            //search accelerator
            KeyboardAccelerators.Add(CreateAccelerator(VirtualKeyModifiers.Control, VirtualKey.F,
                                                       (sender, args) => {
                args.Handled = true;
                FilterBox.Focus(FocusState.Keyboard);
                FilterBox.SelectAll();
            }));

            //open local folder
            KeyboardAccelerators.Add(CreateAccelerator(VirtualKeyModifiers.Control, VirtualKey.E,
                                                       async(sender, args) => {
                args.Handled = true;
                await Launcher.LaunchFolderAsync(Windows.Storage.ApplicationData.Current.LocalFolder);
            }));

            //open music folder
            KeyboardAccelerators.Add(CreateAccelerator(VirtualKeyModifiers.Control, VirtualKey.M,
                                                       async(sender, args) => {
                args.Handled = true;
                await ViewModel.OpenLibraryFolder();
            }));

            //open library DB
            KeyboardAccelerators.Add(CreateAccelerator(VirtualKeyModifiers.Control, VirtualKey.D,
                                                       async(sender, args) => {
                args.Handled = true;
                Windows.Storage.StorageFile dbFile = await FileHelper.GetLibraryDbFileAsync();
                await Launcher.LaunchFileAsync(dbFile);
            }));

            //show selected item(s) in File Explorer
            KeyboardAccelerators.Add(CreateAccelerator(VirtualKeyModifiers.Control, VirtualKey.L,
                                                       async(sender, args) => {
                args.Handled = true;

                LibraryItem selected = (LibraryItem)libraryDataGrid.SelectedItem;
                await ViewModel.ShowItemInExplorer(selected);
            }));

            //show item info
            KeyboardAccelerators.Add(CreateAccelerator(VirtualKeyModifiers.Control, VirtualKey.I,
                                                       async(sender, args) => {
                args.Handled = true;

                LibraryItem selected = libraryDataGrid.SelectedItem as LibraryItem;
                if (selected != null)
                {
                    LibraryItemInfo dialog = new LibraryItemInfo(selected);
                    await dialog.ShowAsync();
                }
            }));

            //play a random bookmark
            KeyboardAccelerators.Add(CreateAccelerator(VirtualKeyModifiers.Control, VirtualKey.R,
                                                       async(sender, args) => {
                args.Handled = true;
                await ViewModel.PlayRandomBookmark();
            }));
        }
Example #14
0
 protected override void OnGotFocus(RoutedEventArgs e)
 {
     base.OnGotFocus(e);
     FilterBox.Focus();
 }
Example #15
0
 protected override void OnActivated(EventArgs e)
 {
     base.OnActivated(e);
     FilterBox.Focus();
 }
Example #16
0
 private void SelectAuthorWindow_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     ViewModel.GetAuthors();
     ViewModel.Filter = string.Empty;
     FilterBox.Focus();
 }
Example #17
0
 private void ClearButtonClicked(object sender, RoutedEventArgs e)
 {
     _data.FilterString = string.Empty;
     FilterBox.Focus();
 }
Example #18
0
 private void FilterButton_Click(object sender, EventArgs e)
 {
     FilterBox.Text = "";
     FilterBox.Focus();
 }
Example #19
0
 private void SearchTextBox_Search(object sender, RoutedEventArgs e)
 {
     var expression = FilterBox.GetBindingExpression(TraceLab.UI.WPF.Controls.SearchTextBox.TextProperty);
     //expression.UpdateSource();
 }