public static GlacialTreeList NewGlacialTreeList(string name) { GlacialTreeList list = new GlacialTreeList("0DAA8D90BB9ACC06C6FDDF11F7DD73E8"); list.Name = name; list.BackColor = System.Drawing.SystemColors.Window; list.BackgroundStretchToFit = true; list.Dock = System.Windows.Forms.DockStyle.Fill; list.ItemHeight = 19; list.Location = new System.Drawing.Point(0, 0); list.MultiSelect = false; list.ShowPlusMinus = false; list.HotColumnTracking = false; list.HotNodeTracking = false; list.SnapLastColumn = true; list.AlternateBackground = Color.AliceBlue; list.UnfocusedSelectionColor = Color.LightGray; list.ShowRootLines = false; list.ShowFocusRect = true; list.FastFind = false; list.AlternatingColors = false; list.OptimizeForHighNodeCount = false; list.HotTrackingColor = SystemColors.HotTrack; list.SelectedTextColor = SystemColors.HighlightText; list.SelectionColor = SystemColors.Highlight; list.ControlStyle = GTLControlStyles.XP; list.Font = new System.Drawing.Font("Tahoma", 9.25F); return(list); }
private void InitializeComponents() { // // Account List // accounts = ControlHelper.NewGlacialTreeList("AccountLimitPaneData"); accounts.SelectedIndexChanged += new GTSelectionChangedEventHandler( FireSelectedIndexChanged); // // account list columns // GTLColumn account_name = new GTLColumn(); account_name.BackColor = Color.White; account_name.CheckBoxes = false; account_name.ImageIndex = -1; account_name.Name = "account_name"; account_name.Text = "Account"; account_name.Width = 132; account_name.SortType = SortTypes.InsertionSort; accounts.Columns.AddRange(new GTLColumn [] { account_name }); // // Context Menu // ContextMenu ctxMenu = new ContextMenu(); // // First, build the actions that you can do // ctxMenu.MenuItems.AddRange(new MenuItem [] { new MenuItem("CREATE ACCOUNT", new EventHandler(FireCreateAccount)), new MenuItem("-"), new MenuItem("CLONE ACCOUNT", new EventHandler(FireCloneAccount)) }); ctxMenu.MenuItems[0].Enabled = false; ctxMenu.MenuItems[2].Enabled = false; accounts.ContextMenu = ctxMenu; this.Controls.AddRange(new Control[] { accounts }); }
private void InitializeComponents() { // // Account List // accounts = new GlacialTreeList("0DAA8D90BB9ACC06C6FDDF11F7DD73E8"); accounts.BackColor = System.Drawing.SystemColors.Window; accounts.BackgroundStretchToFit = true; accounts.Dock = System.Windows.Forms.DockStyle.Fill; accounts.ItemHeight = 19; accounts.Location = new System.Drawing.Point(10, 80); accounts.MultiSelect = false; accounts.ShowPlusMinus = false; accounts.HotColumnTracking = false; accounts.HotNodeTracking = false; accounts.SnapLastColumn = true; accounts.AlternateBackground = Color.AliceBlue; accounts.ShowRootLines = false; accounts.ShowFocusRect = true; accounts.FastFind = true; accounts.AlternatingColors = false; accounts.Name = "accounts"; accounts.OptimizeForHighNodeCount = false; accounts.HotTrackingColor = SystemColors.HotTrack; accounts.SelectedTextColor = SystemColors.HighlightText; accounts.SelectionColor = SystemColors.Highlight; accounts.UnfocusedSelectionColor = SystemColors.Highlight; accounts.ControlStyle = GTLControlStyles.XP; accounts.Font = new System.Drawing.Font("Tahoma", 9.25F); // // account list columns // GTLColumn account_name = new GTLColumn(); account_name.BackColor = Color.White; account_name.CheckBoxes = false; account_name.ImageIndex = -1; account_name.Name = "account_name"; account_name.Text = "Account"; account_name.Width = 132; account_name.SortType = SortTypes.InsertionSort; GTLColumn notional_pl = new GTLColumn(); notional_pl.BackColor = Color.White; notional_pl.CheckBoxes = false; notional_pl.ImageIndex = -1; notional_pl.Name = "notional_pl"; notional_pl.Text = "PL"; notional_pl.Width = 100; notional_pl.TextAlignment = ContentAlignment.MiddleRight; notional_pl.SortType = SortTypes.InsertionSort; accounts.Columns.AddRange(new GTLColumn [] { account_name, notional_pl }); // // Send to FIX checkbox // sendToFix = new CheckBox(); sendToFix.AutoSize = true; sendToFix.CausesValidation = false; sendToFix.Checked = false; sendToFix.Text = "Release to FIX Engine"; sendToFix.Location = new System.Drawing.Point(10, 24); sendToFix.Click += new EventHandler(FireSendToFixChanged); // // flatten menu-items // toolStripMenuItem = new ToolStripMenuItem(); toolStripMenuItem.Name = "ALL"; toolStripMenuItem.Size = new System.Drawing.Size(188, 22); toolStripMenuItem.Text = "Flatten ALL Open Positions"; //toolStripMenuItem.Click += new EventHandler( FireFlattenAccount ); // // toolStripSeparator // toolStripSeparator = new ToolStripSeparator(); toolStripSeparator.Name = "toolStripSeparator"; toolStripSeparator.Size = new System.Drawing.Size(185, 6); System.ComponentModel.IContainer components = new System.ComponentModel.Container(); splitButtonDropDown = new ContextMenuStrip(components); splitButtonDropDown.Name = "splitButtonDropDown"; splitButtonDropDown.Size = new System.Drawing.Size(189, 76); // // Split button // splitButton = new SplitButton(); splitButton.Enabled = sendToFix.Checked; splitButton.AutoSize = true; splitButton.AlwaysDropDown = true; splitButton.Location = new System.Drawing.Point(10, 52); splitButton.ClickedImage = "SplitButtonClickedImage.gif"; splitButton.ContextMenuStrip = splitButtonDropDown; splitButton.DisabledImage = "SplitButtonDisabledImage.gif"; splitButton.HoverImage = "SplitButtonHoverImage.gif"; splitButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; splitButton.ImageKey = "SplitButtonImage.gif"; splitButton.Name = "splitButton"; splitButton.NormalImage = "SplitButtonImage.gif"; splitButton.Size = new System.Drawing.Size(125, 26); splitButton.TabIndex = 0; splitButton.Text = "Flatten Positions"; splitButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; splitButton.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage; splitButton.UseVisualStyleBackColor = true; GroupBox statusGroupBox = new GroupBox(); statusGroupBox.Dock = DockStyle.Top; statusGroupBox.AutoSize = true; statusGroupBox.FlatStyle = FlatStyle.Standard; statusGroupBox.Text = "Dealing Status"; statusGroupBox.Controls.AddRange(new Control [] { sendToFix, splitButton }); Panel spacer1 = new Panel(); spacer1.Size = new System.Drawing.Size(125, 12); spacer1.Dock = DockStyle.Top; Panel spacer2 = new Panel(); spacer2.Size = new System.Drawing.Size(125, 12); spacer2.Dock = DockStyle.Top; this.Controls.AddRange(new Control[] { accounts, spacer1, statusGroupBox }); }
/// <summary> /// Notifies the client that a resource viewer has been opened. /// </summary> protected void ViewerOpened(int index, object value) { TabPage page = (TabPage)value; NWN2ConversationViewer viewer = page.Control as NWN2ConversationViewer; if (viewer == null) { return; } try { GlacialTreeList tree = (GlacialTreeList)viewer.Controls["panelResults"].Controls["treeListResults"]; if (tree == null) { throw new ApplicationException("Couldn't find GlacialTreeList."); } winforms.MenuItem addEditScript = new winforms.MenuItem("Add script"); winforms.MenuItem deleteScript = new winforms.MenuItem("Delete script"); winforms.MenuItem addEditCondition = new winforms.MenuItem("Add condition"); winforms.MenuItem deleteCondition = new winforms.MenuItem("Delete condition"); addEditScript.Click += delegate { if (tree.SelectedNodes.Count != 1) { MessageBox.Show("Select a single line of the conversation."); } else { try { GTLTreeNode node = (GTLTreeNode)tree.SelectedNodes[0]; NWN2ConversationConnector connector = node.Tag as NWN2ConversationConnector; if (connector != null) { addScriptToLine.Invoke(connector, viewer.Conversation); } } catch (Exception x) { MessageBox.Show("Something went wrong when adding/editing the script.\n\n" + x); } } }; addEditCondition.Click += delegate { if (tree.SelectedNodes.Count != 1) { MessageBox.Show("Select a single line of the conversation."); } else { try { GTLTreeNode node = (GTLTreeNode)tree.SelectedNodes[0]; NWN2ConversationConnector connector = node.Tag as NWN2ConversationConnector; if (connector != null) { addConditionToLine.Invoke(connector, viewer.Conversation); } } catch (Exception x) { MessageBox.Show("Something went wrong when adding/editing the script.\n\n" + x); } } }; deleteScript.Click += delegate { if (tree.SelectedNodes.Count != 1) { MessageBox.Show("Select a single line of the conversation."); } else { try { GTLTreeNode node = (GTLTreeNode)tree.SelectedNodes[0]; NWN2ConversationConnector connector = node.Tag as NWN2ConversationConnector; if (connector != null && connector.Actions.Count > 0) { MessageBoxResult result = MessageBox.Show("Delete the script on this line?", "Delete?", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { string scriptName = connector.Actions[0].Script.FullName; connector.Actions.Clear(); viewer.RefreshTreeItemForConnector(connector); Log.WriteAction(LogAction.deleted, "script", scriptName + " (was attached to line '" + connector.Line.Text.GetSafeString(OEIShared.Utils.BWLanguages.CurrentLanguage) + "')"); } } } catch (Exception x) { MessageBox.Show("Something went wrong when deleting the script.\n\n" + x); } } }; deleteCondition.Click += delegate { if (tree.SelectedNodes.Count != 1) { MessageBox.Show("Select a single line of the conversation."); } else { try { GTLTreeNode node = (GTLTreeNode)tree.SelectedNodes[0]; NWN2ConversationConnector connector = node.Tag as NWN2ConversationConnector; if (connector != null && connector.Conditions.Count > 0) { MessageBoxResult result = MessageBox.Show("Delete the condition on this line?", "Delete?", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { string scriptName = connector.Conditions[0].Script.FullName; connector.Conditions.Clear(); viewer.RefreshTreeItemForConnector(connector); Log.WriteAction(LogAction.deleted, "script", scriptName + " (was attached as condition to line '" + connector.Line.Text.GetSafeString(OEIShared.Utils.BWLanguages.CurrentLanguage) + "')"); } } } catch (Exception x) { MessageBox.Show("Something went wrong when deleting the condition.\n\n" + x); } } }; tree.ContextMenu.Popup += delegate { if (tree.SelectedNodes.Count != 1) { addEditScript.Enabled = false; addEditCondition.Enabled = false; deleteScript.Enabled = false; deleteCondition.Enabled = false; } else { GTLTreeNode node = (GTLTreeNode)tree.SelectedNodes[0]; NWN2ConversationConnector connector = node.Tag as NWN2ConversationConnector; if (connector == null) { addEditScript.Enabled = false; addEditCondition.Enabled = false; } else { addEditScript.Enabled = true; addEditCondition.Enabled = true; } if (connector != null && ScriptHelper.HasFlipScriptAttachedAsAction(connector)) { addEditScript.Text = "Edit script"; deleteScript.Enabled = true; } else { addEditScript.Text = "Add script"; deleteScript.Enabled = false; } if (connector != null && ScriptHelper.HasFlipScriptAttachedAsCondition(connector)) { addEditCondition.Text = "Edit condition"; deleteCondition.Enabled = true; } else { addEditCondition.Text = "Add condition"; deleteCondition.Enabled = false; } } }; tree.ContextMenu.MenuItems.Add("-"); tree.ContextMenu.MenuItems.Add(addEditScript); tree.ContextMenu.MenuItems.Add(deleteScript); tree.ContextMenu.MenuItems.Add("-"); tree.ContextMenu.MenuItems.Add(addEditCondition); tree.ContextMenu.MenuItems.Add(deleteCondition); } catch (Exception x) { MessageBox.Show("Error when trying to integrate Flip with conversation editor.", x.ToString()); } }