public StartupForm(MainWindow owner) { InitializeComponent(); this.owner = owner; this.Background = Statics.FormBackground; Statics.AddImageToButton(CloseButton, "Tango Icons\\emblem-unreadable.png"); StackPanel stackPanel = new StackPanel(); stackPanel.Orientation = Orientation.Horizontal; var image = (Image)CloseButton.Content; CloseButton.Content = stackPanel; stackPanel.Children.Add(image); var label = new Label(); label.Content = CloseButton.ToolTip.ToString(); label.VerticalAlignment = VerticalAlignment.Center; stackPanel.Children.Add(label); CloseButton.Width = 100; CloseButton.Background = Brushes.White; if (Statics.IsShowStratupScreen) { DontShowCheckBox.IsChecked = false; } else { DontShowCheckBox.IsChecked = true; } }
private void init() { splashScreen = new SplashScreen(); splashScreen.Show(); MainGrid.Margin = new Thickness(0, 5, 0, 0); Statics.FormBackground = this.Background; Statics.AddImageToButton(NewButton, "Tango Icons\\x-office-drawing.png"); Statics.AddImageToButton(OpenButton, "Tango Icons\\document-open.png"); Statics.AddImageToButton(SaveButton, "Tango Icons\\document-save.png"); Statics.AddImageToButton(NewButton1, "Tango Icons\\x-office-drawing.png"); Statics.AddImageToButton(OpenButton1, "Tango Icons\\document-open.png"); Statics.AddImageToButton(SaveButton1, "Tango Icons\\document-save.png"); Statics.AddImageToButton(SaveAsButton, "Tango Icons\\document-save-as.png"); Statics.AddImageToButton(ClipDocumentButton, "Clip48.png"); Statics.AddImageToButton(ExporttButton, "Tango Icons\\image-x-generic.png"); Statics.AddImageToButton(WebsiteButton, "Tango Icons\\internet-web-browser.png"); Statics.AddImageToButton(AboutButton, "Tango Icons\\dialog-information.png"); Statics.AddImageToButton(AboutButton1, "Tango Icons\\dialog-information.png"); Statics.AddImageToButton(HelpButton, "Tango Icons\\help-browser.png"); Statics.AddImageToButton(HelpButton1, "Tango Icons\\help-browser.png"); Statics.AddImageToButton(StartupButton, "Tango Icons\\go-home.png"); DefaultEdgeTypeComboBox.ToolTip = "Default edge ends"; Statics.AddImageToComboBox(DefaultEdgeTypeComboBox, "arrow1.png"); Statics.AddImageToComboBox(DefaultEdgeTypeComboBox, "arrow2.png"); Statics.AddImageToComboBox(DefaultEdgeTypeComboBox, "arrow3.png"); Statics.AddImageToComboBox(DefaultEdgeTypeComboBox, "arrow4.png"); Statics.AddImageToComboBox(DefaultEdgeTypeComboBox, "arrow5.png"); Statics.AddImageToComboBox(DefaultEdgeTypeComboBox, "arrow6.png"); Statics.AddImageToComboBox(DefaultEdgeTypeComboBox, "arrow7.png"); DefaultEdgeTypeComboBox.SelectedIndex = 1; DefaultEdgeBrushComboBox.ToolTip = "Default edge brush"; Statics.AddImageToComboBox(DefaultEdgeBrushComboBox, "arrow1.png"); Statics.AddImageToComboBox(DefaultEdgeBrushComboBox, "arrow8.png"); Statics.AddImageToComboBox(DefaultEdgeBrushComboBox, "arrow9.png"); DefaultEdgeBrushComboBox.SelectedIndex = 0; defineShapes(); defineStyles(); scrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible; newGraph(); this.PreviewKeyDown += new KeyEventHandler(OnKeyDown); }
void graph_SelectionChanged() { FunctionsStackPanel.Children.Clear(); StylesExpander.Visibility = System.Windows.Visibility.Hidden; FunctionsExpander.Visibility = System.Windows.Visibility.Collapsed; if (graph.SelectionManager.IsMultipleSelected()) { if (graph.SelectionManager.IsOnlyNodesSelected()) { FunctionsExpander.Visibility = System.Windows.Visibility.Visible; Button button = new Button(); button.Background = Brushes.White; button.Margin = new Thickness(2); button.Content = "Remove nodes (Del)"; foreach (Node node in graph.SelectionManager.SelectedNodes) { button.Click += node.Remove; } Statics.AddImageToButton(button, "Tango Icons\\edit-delete.png"); FunctionsStackPanel.Children.Add(button); StylesExpander.Visibility = System.Windows.Visibility.Visible; } return; } else if (graph.SelectionManager.SelectedNodes.Count == 1) { FunctionsExpander.Visibility = System.Windows.Visibility.Visible; WrapPanel nodeButtonsWrapPanel = new WrapPanel() { Orientation = Orientation.Horizontal }; FunctionsStackPanel.Children.Add(nodeButtonsWrapPanel); Button button = new Button(); button.Background = Brushes.White; button.Margin = new Thickness(2); button.Content = "Node properties (Enter)"; button.Click += graph.SelectionManager.SelectedNodes[0].PropertiesWindow; Statics.AddImageToButton(button, "Tango Icons\\document-properties.png"); nodeButtonsWrapPanel.Children.Add(button); button = new Button(); button.Background = Brushes.White; button.Margin = new Thickness(2); button.Content = "Remove node (Del)"; button.Click += graph.SelectionManager.SelectedNodes[0].Remove; Statics.AddImageToButton(button, "Tango Icons\\edit-delete.png"); nodeButtonsWrapPanel.Children.Add(button); button = new Button(); button.Background = Brushes.White; button.Margin = new Thickness(2); button.Content = "Bring into front"; button.Click += graph.SelectionManager.SelectedNodes[0].BringIntoFront; Statics.AddImageToButton(button, "Tango Icons\\go-top.png"); nodeButtonsWrapPanel.Children.Add(button); button = new Button(); button.Background = Brushes.White; button.Margin = new Thickness(2); button.Content = "Send to back"; button.Click += graph.SelectionManager.SelectedNodes[0].SendToBack; Statics.AddImageToButton(button, "Tango Icons\\go-bottom.png"); nodeButtonsWrapPanel.Children.Add(button); button = new Button(); button.Background = Brushes.White; button.Margin = new Thickness(2); button.Content = "Duplicate (D)"; button.Click += graph.SelectionManager.SelectedNodes[0].Duplicate; Statics.AddImageToButton(button, "Tango Icons\\edit-copy.png"); nodeButtonsWrapPanel.Children.Add(button); StylesExpander.Visibility = System.Windows.Visibility.Visible; } else if (graph.SelectionManager.SelectedEdgePart != null) { FunctionsExpander.Visibility = System.Windows.Visibility.Visible; Label label = new Label(); label.Content = "Whole edge functions :"; label.Margin = new Thickness(5); FunctionsStackPanel.Children.Add(label); StackPanel edgeButtonsStackPanel = new StackPanel() { Orientation = Orientation.Horizontal }; FunctionsStackPanel.Children.Add(edgeButtonsStackPanel); Button button = new Button(); button.Background = Brushes.White; button.Margin = new Thickness(2); button.Content = "Edge properties (Space)"; button.Click += graph.SelectionManager.SelectedEdgePart.Edge.Properties; Statics.AddImageToButton(button, "Tango Icons\\document-properties.png"); edgeButtonsStackPanel.Children.Add(button); button = new Button(); button.Background = Brushes.White; button.Margin = new Thickness(2); button.Content = "Remove Edge (Del)"; button.Click += graph.SelectionManager.SelectedEdgePart.Edge.Remove; Statics.AddImageToButton(button, "Tango Icons\\edit-delete.png"); edgeButtonsStackPanel.Children.Add(button); label = new Label(); label.Content = "Edge part functions :"; label.Margin = new Thickness(5); FunctionsStackPanel.Children.Add(label); StackPanel edgePartButtonsStackPanel = new StackPanel() { Orientation = Orientation.Horizontal }; FunctionsStackPanel.Children.Add(edgePartButtonsStackPanel); button = new Button(); button.Background = Brushes.White; button.Margin = new Thickness(2); button.Content = "Edge part properties (Enter)"; button.Click += graph.SelectionManager.SelectedEdgePart.Properties; Statics.AddImageToButton(button, "Tango Icons\\document-properties.png"); edgePartButtonsStackPanel.Children.Add(button); button = new Button(); button.Background = Brushes.White; button.Margin = new Thickness(2); button.Content = "Break Edge part (B)"; button.Click += graph.SelectionManager.SelectedEdgePart.Break; Statics.AddImageToButton(button, "Break48.png"); edgePartButtonsStackPanel.Children.Add(button); } else if (graph.SelectionManager.SelectedEdgeBreak != null) { FunctionsExpander.Visibility = System.Windows.Visibility.Visible; graph.UICanvas.ContextMenu = new ContextMenu(); var edgeBreak = graph.SelectionManager.SelectedEdgeBreak; if (edgeBreak.IsRemovable()) { Button button = new Button(); button.Background = Brushes.White; button.Margin = new Thickness(2); button.Content = "Remove edge break (Del)"; button.Click += edgeBreak.Remove; Statics.AddImageToButton(button, "Tango Icons\\edit-delete.png"); FunctionsStackPanel.Children.Add(button); } else { var textblock = new TextBlock(); textblock.Text = "It can't be removed\nTo remove it, remove the edge"; FunctionsStackPanel.Children.Add(textblock); } } }