public void OnEnable() { var root = this.rootVisualElement; Toolbar t = new Toolbar(); root.Add(t); ToolbarToggle tg = new ToolbarToggle() { text = "tg1" }; t.Add(tg); tg = new ToolbarToggle() { text = "tg2" }; t.Add(tg); tg.RegisterValueChangedCallback(toggleChanged); tg.RegisterCallback <ChangeEvent <bool> >(toggleListener); m_ObjectNameBinding = new TextField("Width"); m_ObjectNameBinding.bindingPath = "m_SizeDelta.x"; root.Add(m_ObjectNameBinding); m_ObjectNameBinding = new TextField("Object Name Binding"); m_ObjectNameBinding.bindingPath = "m_Name"; root.Add(m_ObjectNameBinding); OnSelectionChange(); }
// ----------------------------------------------------------------------------------------- /// <summary> /// Generate the toolbar found at the top of the graph. /// </summary> private void GenerateToolbar() { var toolbar = new Toolbar(); var buildButton = new Button(clickEvent: () => { _TranzmitGraphView.Generate(); Subscribe(); }); buildButton.text = "BUILD / REFRESH"; toolbar.Add(buildButton); var verticalButton = new Button(clickEvent: () => { _TranzmitGraphView.Arrange_Subscriber_Results(Tranzmit_Graph_View.ArrangementTypes.Vertical); _TranzmitGraphView.Arrange_Broadcaster_Results(Tranzmit_Graph_View.ArrangementTypes.Vertical); }); verticalButton.text = "Vertical"; toolbar.Add(verticalButton); var gridButton = new Button(clickEvent: () => { _TranzmitGraphView.Arrange_Subscriber_Results(Tranzmit_Graph_View.ArrangementTypes.Grid); _TranzmitGraphView.Arrange_Broadcaster_Results(Tranzmit_Graph_View.ArrangementTypes.Grid); }); gridButton.text = "Grid"; toolbar.Add(gridButton); // Adds toolbar to the graph rootVisualElement.Add(toolbar); }
// Manually create header for the tree view. void CreateTreeViewHeader(VisualElement root) { var systemTreeViewHeader = new Toolbar(); systemTreeViewHeader.AddToClassList(UssClasses.SystemScheduleWindow.TreeView.Header); var systemHeaderLabel = new Label("Systems"); systemHeaderLabel.AddToClassList(UssClasses.SystemScheduleWindow.TreeView.System); var entityHeaderLabel = new Label("Matches") { tooltip = "The number of entities that match the queries at the end of the frame." }; entityHeaderLabel.AddToClassList(UssClasses.SystemScheduleWindow.TreeView.Matches); var timeHeaderLabel = new Label("Time (ms)") { tooltip = "Average running time." }; timeHeaderLabel.AddToClassList(UssClasses.SystemScheduleWindow.TreeView.Time); systemTreeViewHeader.Add(systemHeaderLabel); systemTreeViewHeader.Add(entityHeaderLabel); systemTreeViewHeader.Add(timeHeaderLabel); root.Add(systemTreeViewHeader); }
private void CreateToolbar() { _toolbar = new Toolbar(); StyleSheetUtils.AddStyleSheets(_toolbar, "Toolbar"); _toolbar.Add(new Button(() => SaveLoadUtils.SaveGraphView(_graphView, AssetGuid)) { text = "Save" }); _toolbar.Add(new Button(() => SaveLoadUtils.LoadGraphViewAsset(_graphView)) { text = "Load" }); var toggleMiniMap = new Toggle("MiniMap"); toggleMiniMap.RegisterValueChangedCallback((change) => { _miniMap.visible = change.newValue; }); _miniMap.visible = toggleMiniMap.value; _toolbar.Add(toggleMiniMap); rootVisualElement.Add(_toolbar); }
/// <summary> /// Method responsible for creating the Toolbar on top of the window /// as well as asigning its components /// </summary> private void CreateToolbar() { //Create new instance of the Toolbar Toolbar toolbar = new Toolbar(); //Create button to instanciate a new node Button nodeCreateButton = new Button(clickEvent: () => { graphview.CreateDialogueNode(); }); //Create button to save the Dialogue Button saveButton = new Button(clickEvent: () => { svUtil.SaveDialogues(graphview, graphview.DialogueName); }); //Add text to buttons nodeCreateButton.text = "Create Node"; saveButton.text = "Save Dialogue"; //Add buttons to toolbar toolbar.Add(nodeCreateButton); toolbar.Add(saveButton); //Add toolbar to this graph rootVisualElement.Add(toolbar); }
private void GenerateToolbar() { saveButton = new Button(() => SaveGraph()) { text = "Save Graph", tooltip = "Saves the current CodeGraph file. This does not compile the CodeGraph into C# code." }; toolbar = new Toolbar(); toolbar.Add(saveButton); toolbar.Add(new Button(() => { SaveGraph(false); var code = GenerateCode(); var errors = CompileCode(code); if (errors.Count > 0) { errors.ForEach(error => Debug.LogError($"Error {error.ErrorNumber} => \"{error.ErrorText} at line number {error.Line}\"\r\n")); return; } var assetPath = WriteCodeToFile(code); AssetDatabase.ImportAsset(assetPath); }) { text = "Compile Graph", tooltip = "Compiles this CodeGraph into a C# file in the same directory as this CodeGraph file" }); rootVisualElement.Add(toolbar); }
/// <summary> /// Populate the main menu tool strip. /// We rebuild the contents from scratch /// </summary> /// <param name="menuDescriptions">Menu descriptions for each menu item.</param> public void PopulateMainToolStrip(List <MenuDescriptionArgs> menuDescriptions) { foreach (Widget child in toolStrip.Children) { toolStrip.Remove(child); } foreach (MenuDescriptionArgs description in menuDescriptions) { Gdk.Pixbuf pixbuf = new Gdk.Pixbuf(null, description.ResourceNameForImage, 20, 20); ToolButton button = new ToolButton(new Gtk.Image(pixbuf), description.Name); button.Homogeneous = false; button.LabelWidget = new Label(description.Name); Pango.FontDescription font = new Pango.FontDescription(); font.Size = (int)(8 * Pango.Scale.PangoScale); button.LabelWidget.ModifyFont(font); if (description.OnClick != null) { button.Clicked += description.OnClick; } toolStrip.Add(button); } ToolItem item = new ToolItem(); item.Expand = true; toolbarlabel = new Label(); toolbarlabel.Xalign = 1.0F; toolbarlabel.Xpad = 10; toolbarlabel.ModifyFg(StateType.Normal, new Gdk.Color(0x99, 0x99, 0x99)); item.Add(toolbarlabel); toolbarlabel.Visible = false; toolStrip.Add(item); toolStrip.ShowAll(); }
protected virtual Toolbar GenerateToolbar() { var toolbar = new Toolbar(); if (filePath == null) { filePath = new TextField(); } toolbar.Add(new Button(() => RequestDataOperation(DataOperation.Load)) { text = "Load" }); toolbar.Add(new Button(() => RequestDataOperation(DataOperation.SaveAs)) { text = "Save As..." }); toolbar.Add(new Button(() => RequestDataOperation(DataOperation.Save)) { text = "Quick Save" }); rootVisualElement.Add(toolbar); filePath.style.minWidth = new StyleLength(StyleKeyword.Auto); filePath.SetEnabled(false); toolbar.Add(filePath); return(toolbar); }
// Generate node creation toolbar private void GenerateNodeToolbar() { Toolbar toolbar = new Toolbar(); // Behaviour name field TextField behaviourNameField = new TextField(); behaviourNameField.label = "Behaviour Name: "; behaviourNameField.labelElement.style.color = Color.black; behaviourNameField.SetValueWithoutNotify(_newBehaviourName); behaviourNameField.MarkDirtyRepaint(); behaviourNameField.RegisterValueChangedCallback(evt => _newBehaviourName = evt.newValue); toolbar.Add(behaviourNameField); // Create new node menu ToolbarMenu menu = new ToolbarMenu(); menu.text = "Create New Behaviour"; menu.menu.AppendAction("New Behaviour", x => { _graphView.CreateNewNode(_newBehaviourName, NodeTypes.Action); }); menu.menu.AppendAction("New Composite", x => { _graphView.CreateNewNode(_newBehaviourName, NodeTypes.Composite); }); menu.menu.AppendAction("New Decorator", x => { _graphView.CreateNewNode(_newBehaviourName, NodeTypes.Decorator); }); toolbar.Add(menu); Button button = new Button(() => { SearchWindow.Open(new SearchWindowContext(mouseOverWindow.position.position), _graphView._addNodeSearchWindow); }); button.text = "Add existing node"; toolbar.Add(button); rootVisualElement.Add(toolbar); }
private void DrawListHeader() { Toolbar headerTitle = new Toolbar(); Add(headerTitle); Label flagHeader = new Label(); flagHeader.AddToClassList(ussClassName); flagHeader.SetWidth(40); headerTitle.Add(flagHeader); Label datetimeHeader = new Label(); datetimeHeader.text = "Datetime"; datetimeHeader.AddToClassList(ussClassName); datetimeHeader.SetWidth(220); headerTitle.Add(datetimeHeader); Label tagHeader = new Label(); tagHeader.text = "Tag"; tagHeader.AddToClassList(ussClassName); tagHeader.SetWidth(80); headerTitle.Add(tagHeader); Label messageHeader = new Label(); messageHeader.text = "Message"; messageHeader.AddToClassList(ussClassName); messageHeader.ExpandWidth(); headerTitle.Add(messageHeader); Add(headerTitle); }
void GenerateToolbar() { var toolbar = new Toolbar(); var fileNameTextField = new TextField("File Name:"); fileNameTextField.SetValueWithoutNotify(fileName); fileNameTextField.MarkDirtyRepaint(); fileNameTextField.RegisterValueChangedCallback(evt => fileName = evt.newValue); toolbar.Add(fileNameTextField); toolbar.Add(new Button(() => RequestDataOperation(true)) { text = "Save Data" }); toolbar.Add(new Button(() => RequestDataOperation(false)) { text = "Load Data" }); var createNodeButton = new Button(() => { graphView.CreateNode("Dialog Node"); }); createNodeButton.text = "Create Node"; toolbar.Add(createNodeButton); rootVisualElement.Add(toolbar); }
/// <summary> /// 构造节点面板 /// </summary> public virtual void CreateGraphView() { nodeView = new NodeBaseView { name = "NodeView" }; nodeView.StretchToParentSize(); rootVisualElement.Add(nodeView); //添加目录 var toolbar = new Toolbar(); var addButton = new Button(OnClickForToolBarAddNode); addButton.text = "添加节点"; toolbar.Add(addButton); var saveButton = new Button(OnClickForToolBarSave); saveButton.text = "保存"; toolbar.Add(saveButton); var loadButton = new Button(OnClickForToolBarLoad); loadButton.text = "读取"; toolbar.Add(loadButton); rootVisualElement.Add(toolbar); }
public VideoPlayerElement() { // Constructing Items _header = new TextElement() { text = "Using Focused Search", name = "header", }; _videoProxy = new Image() { name = "video-proxy", image = Resources.Load <Texture2D>("videoStill"), scaleMode = ScaleMode.ScaleToFit, }; _toolbar = new Toolbar(); _toolbar.Add(new ToolbarButton(Play) { text = "Play", name = "button-play" }); _toolbar.Add(new ToolbarButton(Pause) { text = "Pause", name = "button-pause" }); // Adding Items Add(_header); Add(_videoProxy); Add(_toolbar); }
private void GenerateToolbar() { var toolbar = new Toolbar(); var fileNameTextField = new TextField(label: "File Name:"); fileNameTextField.SetValueWithoutNotify(_fileName); fileNameTextField.MarkDirtyRepaint(); fileNameTextField.RegisterCallback((EventCallback <ChangeEvent <string> >)(EventType => _fileName = EventType.newValue)); toolbar.Add(fileNameTextField); toolbar.Add(child: new Button(clickEvent: () => SaveData()) { text = "Save Data" }); toolbar.Add(child: new Button(clickEvent: () => LoadData()) { text = "Load Data" }); var nodeCreateButton = new Button(clickEvent: () => { _graphView.CreateNode("Dialogue Node"); }); nodeCreateButton.text = "Creat Node"; toolbar.Add(nodeCreateButton); rootVisualElement.Add(toolbar); }
/// <summary>Populate the main menu tool strip.</summary> /// <param name="menuDescriptions">Descriptions for each item.</param> public void Populate(List <MenuDescriptionArgs> menuDescriptions) { accelerators = new AccelGroup(); foreach (Widget child in toolStrip.Children) { toolStrip.Remove(child); child.Dispose(); } foreach (MenuDescriptionArgs description in menuDescriptions) { Gtk.Image image = null; Gdk.Pixbuf pixbuf = null; ManifestResourceInfo info = Assembly.GetExecutingAssembly().GetManifestResourceInfo(description.ResourceNameForImage); if (info != null) { pixbuf = new Gdk.Pixbuf(null, description.ResourceNameForImage, 20, 20); image = new Gtk.Image(pixbuf); } ToolItem item = new ToolItem(); item.Expand = true; if (description.OnClick == null) { Label toolbarlabel = new Label(); if (description.RightAligned) { toolbarlabel.Xalign = 1.0F; } toolbarlabel.Xpad = 10; toolbarlabel.Text = description.Name; toolbarlabel.TooltipText = description.ToolTip; toolbarlabel.Visible = !String.IsNullOrEmpty(toolbarlabel.Text); item.Add(toolbarlabel); toolStrip.Add(item); toolStrip.ShowAll(); } else { ToolButton button = new ToolButton(image, description.Name); button.Homogeneous = false; button.LabelWidget = new Label(description.Name); button.Clicked += description.OnClick; if (!string.IsNullOrWhiteSpace(description.ShortcutKey)) { Gtk.Accelerator.Parse(description.ShortcutKey, out uint key, out Gdk.ModifierType modifier); button.AddAccelerator("clicked", accelerators, key, modifier, AccelFlags.Visible); } item = button; } toolStrip.Add(item); } Window mainWindow = GetMainWindow(); if (mainWindow != null) { mainWindow.AddAccelGroup(accelerators); } toolStrip.ShowAll(); }
private void GenerateToolbar() { var toolbar = new Toolbar(); var fileNameTextField = new TextField("File Name:"); fileNameTextField.SetValueWithoutNotify(_fileName); fileNameTextField.MarkDirtyRepaint(); fileNameTextField.RegisterValueChangedCallback(evt => _fileName = evt.newValue); toolbar.Add(fileNameTextField); toolbar.Add(new Button(() => RequestDataOperation(true)) { text = "Save" }); toolbar.Add(new Button(() => RequestDataOperation(false)) { text = "Load" }); toolbar.Add(new Button(() => CleaGraph()) { text = "Clear Graph" }); rootVisualElement.Add(toolbar); }
//a toolbar tat will allow us to easily create a new node using a node creation button private void CreateToolbar() { var toolbar = new Toolbar(); var fileNameTextF = new TextField("File Name: "); //set default val fileNameTextF.SetValueWithoutNotify(_fileName); //telling UI to repaint the visual element on the next frame fileNameTextF.MarkDirtyRepaint(); //change callback listener fileNameTextF.RegisterValueChangedCallback(evt => _fileName = evt.newValue); //adding this text field to toolbar toolbar.Add(fileNameTextF); //new button to save data - { text = "Save Data"} sets text of buttn toolbar.Add(new Button(() => RequestData(true)) { text = "Save Data" }); //same for load toolbar.Add(new Button(() => RequestData(false)) { text = "Load Data" }); //adding a new button to the toolbar that allows the creation of a dialogue node var nodeCreateButton = new Button(() => { _graphView.CreateNode("Dialogue Node"); }); nodeCreateButton.text = "Create Node"; toolbar.Add(nodeCreateButton); //add toolbar into editor window rootVisualElement.Add(toolbar); }
private void GenerateToolbar() { var toolbar = new Toolbar(); var fileNameTextField = new TextField(label: "File Name"); fileNameTextField.SetValueWithoutNotify(_fileName); fileNameTextField.MarkDirtyRepaint(); fileNameTextField.RegisterValueChangedCallback(evt => _fileName = evt.newValue); toolbar.Add(fileNameTextField); toolbar.Add(new Button(() => RequestDataOperation(true)) { text = "Save Data" }); toolbar.Add(new Button(() => RequestDataOperation(false)) { text = "Load Data" }); //var nodeCreateButton = new Button(clickEvent: () => //{ // _graphView.CreateNode("Dialogue Node"); //}); //nodeCreateButton.text = "Create Node"; //toolbar.Add(nodeCreateButton); rootVisualElement.Add(toolbar); }
public void ConstructToolbar() { var toolbar = new Toolbar(); var menuNameTextField = new TextField("Menu name: "); menuNameTextField.SetValueWithoutNotify(newMenuName); menuNameTextField.MarkDirtyRepaint(); menuNameTextField.RegisterValueChangedCallback(evt => newMenuName = evt.newValue); toolbar.Add(menuNameTextField); //toolbar.Add(new Button(() => DoSaveLoad(true)) { text = "Save graph" }) ; //toolbar.Add(new Button(() => DoSaveLoad(false)) { text = "Load graph" }); var rpgMenuCreateNode = new Button(() => { graph.AddRPGMenuNode(newMenuName); }); rpgMenuCreateNode.text = "Add RPGMenu"; toolbar.Add(rpgMenuCreateNode); /* * var nodeCreate = new Button(() => { graph.AddToggleUINode(); }); * nodeCreate.text = "Add UI node"; * toolbar.Add(nodeCreate); */ rootVisualElement.Add(toolbar); }
private void GenerateToolbar() { var toolbar = new Toolbar(); // var fileNameTextField = new TextField("File Name:"); fileNameTextField.SetValueWithoutNotify(_fileName); fileNameTextField.MarkDirtyRepaint(); //Put change into variable _fileName fileNameTextField.RegisterValueChangedCallback(evt => _fileName = evt.newValue); toolbar.Add(fileNameTextField); toolbar.Add(new ToolbarButton(() => RequestDataOperation(true)) { text = "Save Data" }); toolbar.Add(new ToolbarButton(() => RequestDataOperation(false)) { text = "Load Data" }); /* * var nodeCreateButton = new ToolbarButton(()=> { _graphView.CreateNode("AI Node"); }); // change * nodeCreateButton.text = "Create Node"; * toolbar.Add(nodeCreateButton); */ // rootVisualElement.Add(toolbar); }
void AddToolbar() { var toolbar = new Toolbar(); rootVisualElement.Add(toolbar); var tgl1 = new ToolbarToggle { text = "Show Labels" }; tgl1.RegisterValueChangedCallback(OnToggleValueChanged); toolbar.Add(tgl1); tgl1.style.flexGrow = 0f; m_ToggleFieldWithLabel = tgl1; var spc = new ToolbarSpacer(); toolbar.Add(spc); var tgl = new ToolbarToggle { text = "Use ScrollView" }; tgl.style.flexGrow = 0f; m_ScrollViewToggle = tgl; m_ScrollViewToggle.value = m_UseScrollViewConstruct; m_ScrollViewToggle.RegisterValueChangedCallback(evt => UpdateScrollViewUsage()); toolbar.Add(tgl); }
}//generar la barra de botones de la ventana del editor private void GenerateSecondaryToolbar() { Toolbar l_secondaryToolbar = new Toolbar(); Button l_generateRandomDungeonButton = new Button(); l_generateRandomDungeonButton.text = "Generate Random Dungeon"; l_generateRandomDungeonButton.clickable.clicked += () => GenerateRandomDungeon(); l_secondaryToolbar.Add(l_generateRandomDungeonButton); IntegerField l_maxNumberOfRoomsIntField = new IntegerField(); l_maxNumberOfRoomsIntField.tooltip = "Max Number of Rooms instantiated on the dungeon"; l_maxNumberOfRoomsIntField.label = "Max number of rooms"; l_maxNumberOfRoomsIntField.RegisterValueChangedCallback(evt => m_numberOfRoomsToGenerate = evt.newValue); l_secondaryToolbar.Add(l_maxNumberOfRoomsIntField); IntegerField l_maxNumberOfFloorsField = new IntegerField(); l_maxNumberOfFloorsField.tooltip = "Max Number of floors on the dungeon"; l_maxNumberOfFloorsField.label = "Max number of floors"; l_maxNumberOfFloorsField.RegisterValueChangedCallback(evt => m_numberOfFloorsToGenerate = evt.newValue); l_secondaryToolbar.Add(l_maxNumberOfFloorsField); Button l_clearAllNodesOnGrapButton = new Button(); l_clearAllNodesOnGrapButton.text = "Clear All"; l_clearAllNodesOnGrapButton.clickable.clicked += () => ClearAllNodesOnGraph(); l_secondaryToolbar.Add(l_clearAllNodesOnGrapButton); rootVisualElement.Add(l_secondaryToolbar); }//barra generacion aleatoria
// Generate save file toolbar private void GenerateSavetoolbar() { Toolbar toolbar = new Toolbar(); TextField fileNameField = new TextField(); fileNameField.label = "Filename: "; fileNameField.labelElement.style.color = Color.black; fileNameField.SetValueWithoutNotify(_fileName); fileNameField.MarkDirtyRepaint(); fileNameField.RegisterValueChangedCallback(evt => _fileName = evt.newValue); toolbar.Add(fileNameField); toolbar.Add(new Button(() => RequestDataOperation(true)) { text = "Save Data" }); toolbar.Add(new Button(() => RequestDataOperation(false)) { text = "Load Data" }); toolbar.Add(fileLoadField); rootVisualElement.Add(toolbar); }
void DrawToolbar() { var root = rootVisualElement; Toolbar toolbar = new Toolbar(); ToolbarButton openBtn = new ToolbarButton(() => { }); openBtn.name = "open-toolbar-button"; openBtn.text = "Open"; toolbar.Add(openBtn); ToolbarButton createBtn = new ToolbarButton(() => { }); openBtn.name = "create-toolbar-button"; openBtn.text = "Create"; toolbar.Add(openBtn); ToolbarButton saveBtn = new ToolbarButton(() => { }); saveBtn.name = "save-toolbar-button"; saveBtn.text = "Save"; toolbar.Add(saveBtn); root.Add(toolbar); }
/// <summary> /// Creates and populates a UIElements.Toolbar /// </summary> /// <returns>Returns the UIElements.Toolbar with controls.</returns> private Toolbar GenerateToolbar() { // Create the toolbar and load the stylesheet. Toolbar toolbar = new Toolbar(); toolbar.styleSheets.Add(Resources.Load <StyleSheet>("Toolbar")); // Button to save the asset toolbar.Add(new ToolbarButton(() => { dialogueGraphDataUtility.SaveGraph(dialogueContainer); }) { text = "Save Asset" }); // Flexible spacer. toolbar.Add(new ToolbarSpacer() { flex = true }); // Button to toggle the mini map visibility. ToolbarToggle toggleMiniMap = new ToolbarToggle { text = "Toggle MiniMap" }; toggleMiniMap.RegisterValueChangedCallback(evt => { _miniMapEnabled = evt.newValue; }); toolbar.Add(toggleMiniMap); return(toolbar); }
public override VisualElement CreateInspectorGUI() { StyleSheet selectedTBStyle = Resources.Load <StyleSheet>("TMEditorUi"); var ve = new VisualElement(); var tb = new Toolbar(); tb.Add(new ToolbarButton()); tb.Add(new ToolbarButton()); tb.Add(new ToolbarButton()); foreach (var visualElement in tb.Children()) { ToolbarButton child = (ToolbarButton)visualElement; if (child != null) { child.styleSheets.Add(selectedTBStyle); } } IMGUIContainer defaultInspectorIMGUI = new IMGUIContainer() { onGUIHandler = () => { DrawDefaultInspector(); } }; ve.Add(tb); ve.Add(defaultInspectorIMGUI); return(ve); }
protected virtual void OnEnable() { m_NodeList = new List <Node <T> >(); var nodeStyle = AssetDatabase.LoadAssetAtPath <StyleSheet>("Assets/StoryKit/Node/Node.uss"); var inspectorStyle = AssetDatabase.LoadAssetAtPath <StyleSheet>("Assets/InspectorElement/InspectorElement.uss"); var root = rootVisualElement; root.styleSheets.Add(nodeStyle); root.styleSheets.Add(inspectorStyle); toolbar = new Toolbar(); ToolbarButton openBtn = new ToolbarButton(); openBtn.text = "OpenAsset"; openBtn.clicked += OpenAsset; ToolbarButton saveBtn = new ToolbarButton(); saveBtn.text = "SaveAsset"; saveBtn.clicked += SaveAsset; toolbar.Add(openBtn); toolbar.Add(saveBtn); m_NodeRoot = new VisualElement(); IMGUIContainer gridDrawAndEvent = new IMGUIContainer(() => { DrawGrid(20, 0.2f, Color.gray); DrawGrid(100, 0.4f, Color.gray); ProcessEvents(UnityEngine.Event.current); }); Node <T> .onNodeDelete += (n) => { m_NodeList.Remove(n); }; IMGUIContainer drawLine = new IMGUIContainer(() => { DrawConnectLine(); }) { style = { position = Position.Absolute }, transform = { position = new Vector2(5, -15), } }; root.Add(toolbar); root.Add(gridDrawAndEvent); root.Add(m_NodeRoot); root.Add(drawLine); }
/// <summary> /// Generates the toolbar with several editing functionalities. /// </summary> private void GenerateToolbar() { var toolbar = new Toolbar(); // ==> FILE SEARCH <========================= // Add File Name Text Field toolbar.Add(ConstructFileNameField()); // Create Node Button var searchButton = new Button(() => HandleSearch()) { text = "Search", name = "searchButton" }; toolbar.Add(searchButton); // ==> DATA MANAGEMENT <========================= // Create Save Button toolbar.Add(new Button(() => RequestDataOperation(true)) { text = "Save Data" }); // Create Load Button toolbar.Add(new Button(() => RequestDataOperation(false)) { text = "Load Data" }); // ==> CREATE NEW NODE <========================= // Create Node Button var nodeCreateButton = new Button(() => _graphView.CreateNode("Dialogue Node")) { text = "Create Node", tooltip = "Creates a new dialogue node.", name = "createNode" }; toolbar.Add(nodeCreateButton); // Add style to toolbar toolbar.styleSheets.Add(Resources.Load <StyleSheet>("Toolbar")); // Register toolbar rootVisualElement.Add(toolbar); }
public ScriptGraphView(ScriptsConfiguration config, ScriptGraphState state, List <Script> scripts) { this.config = config; this.scripts = scripts; this.state = state; CustomStyleSheet = config.GraphCustomStyleSheet; styleSheets.Add(StyleSheet); if (CustomStyleSheet != null) { styleSheets.Add(CustomStyleSheet); } this.AddManipulator(new ContentDragger()); this.AddManipulator(new SelectionDragger()); this.AddManipulator(new RectangleSelector()); var grid = new GridBackground(); Insert(0, grid); grid.StretchToParentSize(); var minimap = new MiniMap(); minimap.anchored = true; minimap.SetPosition(new Rect(10, 30, 200, 140)); minimap.visible = false; Add(minimap); var toolbar = new Toolbar(); Add(toolbar); var rebuildButton = new Button(HandleRebuildButtonClicked); rebuildButton.text = "Rebuild Graph"; toolbar.Add(rebuildButton); var alignButton = new Button(AutoAlign); alignButton.text = "Auto Align"; toolbar.Add(alignButton); var minimapToggle = new Toggle(); minimapToggle.label = "Show Minimap"; minimapToggle.RegisterValueChangedCallback(evt => minimap.visible = evt.newValue); toolbar.Add(minimapToggle); var saveButton = new Button(SerializeState); saveButton.text = "Save"; toolbar.Add(saveButton); SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale); RebuildGraph(); }
public StylePropertyDebugger(VisualElement debuggerSelection) { selectedElement = debuggerSelection; m_Toolbar = new Toolbar(); Add(m_Toolbar); var searchField = new ToolbarSearchField(); searchField.AddToClassList("unity-style-debugger-search"); searchField.RegisterValueChangedCallback(e => { m_SearchFilter = e.newValue; BuildFields(); }); m_Toolbar.Add(searchField); var showAllToggle = new ToolbarToggle(); showAllToggle.AddToClassList("unity-style-debugger-toggle"); showAllToggle.text = "Show all"; showAllToggle.RegisterValueChangedCallback(e => { m_ShowAll = e.newValue; BuildFields(); }); m_Toolbar.Add(showAllToggle); var sortToggle = new ToolbarToggle(); sortToggle.AddToClassList("unity-style-debugger-toggle"); sortToggle.text = "Sort"; sortToggle.RegisterValueChangedCallback(e => { m_Sort = e.newValue; BuildFields(); }); m_Toolbar.Add(sortToggle); m_CustomPropertyFieldsContainer = new VisualElement(); Add(m_CustomPropertyFieldsContainer); m_FieldsContainer = new VisualElement(); Add(m_FieldsContainer); if (selectedElement != null) { BuildFields(); } AddToClassList("unity-style-debugger"); }
//private bool statusSplash = false; /*bool update_status () { statusSplash = splash.WaitingSplash; return true; }*/ public MainWindow(string[] arguments) : base(Gtk.WindowType.Toplevel) { this.HeightRequest = this.Screen.Height;//-50; this.WidthRequest = this.Screen.Width;//-50; bool showSplash = true; bool openFileFromArg = false; string openFileAgument = ""; for (int i = 0; i < arguments.Length; i++){ Logger.LogDebugInfo("arg->{0}",arguments[i]); string arg = arguments[i]; if (arg.StartsWith("-nosplash")){ if (arg == "-nosplash") showSplash = false; } if(!arg.EndsWith(".exe")){ // argument file msw if(File.Exists(arg)){ openFileAgument =arg; if(arg.ToLower().EndsWith(".msw")) openFileFromArg = true; } } } StringBuilder sbError = new StringBuilder(); if(!File.Exists(MainClass.Settings.FilePath)){ if(showSplash) splash = new SplashScreenForm(false); //statusSplash = true; Moscrif.IDE.Tool.Logger.LogDebugInfo(String.Format("Setting inicialize -{0}",DateTime.Now)); string file = System.IO.Path.Combine(MainClass.Paths.SettingDir, "keybinding"); if(MainClass.Platform.IsMac){ Moscrif.IDE.Iface.KeyBindings.CreateKeyBindingsMac(file); } else{ Moscrif.IDE.Iface.KeyBindings.CreateKeyBindingsWin(file); } MainClass.Settings.SaveSettings(); } else { if(showSplash) splash = new SplashScreenForm(false); } if(MainClass.Platform.IsMac){ ApplicationEvents.Quit += delegate (object sender, ApplicationQuitEventArgs e) { Application.Quit (); e.Handled = true; }; ApplicationEvents.Reopen += delegate (object sender, ApplicationEventArgs e) { MainClass.MainWindow.Deiconify (); MainClass.MainWindow.Visible = true; e.Handled = true; }; } Moscrif.IDE.Tool.Logger.LogDebugInfo(String.Format("splash.show-{0}",DateTime.Now)); Console.WriteLine(String.Format("splash.show-{0}",DateTime.Now)); if(showSplash) splash.ShowAll(); StockIconsManager.Initialize(); Moscrif.IDE.Tool.Logger.LogDebugInfo(String.Format("mainwindow.build.start-{0}",DateTime.Now)); Build(); this.Maximize(); Moscrif.IDE.Tool.Logger.LogDebugInfo(String.Format("mainwindow.build.end-{0}",DateTime.Now)); this.llcLogin = new LoginLogoutControl(); this.llcLogin.Events = ((Gdk.EventMask)(256)); this.llcLogin.Name = "llcLogin"; this.statusbar1.Add (this.llcLogin); Gtk.Box.BoxChild w14 = ((Gtk.Box.BoxChild)(this.statusbar1 [this.llcLogin])); w14.Position = 2; w14.Expand = false; w14.Fill = false; SetSettingColor(); lblMessage1.Text=""; lblMessage2.Text=""; if (String.IsNullOrEmpty(MainClass.Paths.TempDir)) { MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("cannot_create_temp"),MainClass.Paths.TempDir, Gtk.MessageType.Error,null); md.ShowDialog(); return; } string fullpath = MainClass.Paths.StylesDir; bool success = true; if (!Directory.Exists(fullpath)) try { Directory.CreateDirectory(fullpath); } catch { success = false; } if (success){ try { Mono.TextEditor.Highlighting.SyntaxModeService.LoadStylesAndModes(fullpath); } catch(Exception ex) { sbError.AppendLine("ERROR: " + ex.Message); Logger.Log(ex.Message); } } ActionUiManager.UI.AddWidget += new AddWidgetHandler(OnWidgetAdd); ActionUiManager.UI.ConnectProxy += new ConnectProxyHandler(OnProxyConnect); ActionUiManager.LoadInterface(); this.AddAccelGroup(ActionUiManager.UI.AccelGroup); WorkspaceTree = new WorkspaceTree(); FrameworkTree = new FrameworkTree(); FileExplorer = new FileExplorer(); FileNotebook.AppendPage(WorkspaceTree, new NotebookLabel("workspace-tree.png",MainClass.Languages.Translate("projects"))); FileNotebook.BorderWidth = 2; FileNotebook.AppendPage(FrameworkTree, new NotebookLabel("libs.png",MainClass.Languages.Translate("libs"))); FileNotebook.BorderWidth = 2; FileNotebook.AppendPage(FileExplorer, new NotebookLabel("workspace-tree.png",MainClass.Languages.Translate("files"))); FileNotebook.BorderWidth = 2; FileNotebook.CurrentPage = 1; hpBodyMidle.Pack1(FileNotebook, false, true); hpRight = new HPaned(); //hpRight.Fi hpRight.Pack1(EditorNotebook, true, true); hpRight.Pack2(PropertisNotebook, false, true); hpBodyMidle.Pack2(hpRight, true, true); FileNotebook.WidthRequest = 500; hpBodyMidle.ResizeMode = ResizeMode.Queue; try { ActionUiManager.SocetServerMenu(); ActionUiManager.RecentAll(MainClass.Settings.RecentFiles.GetFiles(), MainClass.Settings.RecentFiles.GetProjects(), MainClass.Settings.RecentFiles.GetWorkspace()); } catch { } ddbProject = new DropDownButton(); ddbProject.Changed+= OnChangedProject; ddbProject.WidthRequest = 175; ddbProject.SetItemSet(projectItems); ddbDevice = new DropDownButton(); ddbDevice.Changed+= OnChangedDevice; ddbDevice.WidthRequest = 175; ddbDevice.SetItemSet(deviceItems); ddbResolution = new DropDownButton(); ddbResolution.Changed+= OnChangedResolution; ddbResolution.WidthRequest = 175; ddbResolution.SetItemSet(resolutionItems); ReloadSettings(false); OpenFile("StartPage",false); PageIsChanged("StartPage"); if ((MainClass.Settings.Account != null) && (MainClass.Settings.Account.Remember)){ MainClass.User = MainClass.Settings.Account; } else { MainClass.User = null; } SetLogin(); OutputConsole = new OutputConsole(); Gtk.Menu outputMenu = new Gtk.Menu(); GetOutputMenu(ref outputMenu); BookmarkOutput = new BookmarkOutput(); OutputNotebook.AppendPage(OutputConsole, new NotebookMenuLabel("console.png",MainClass.Languages.Translate("console"),outputMenu)); OutputNotebook.AppendPage(FindReplaceControl, new NotebookLabel("find.png",MainClass.Languages.Translate("find"))); OutputNotebook.AppendPage(BookmarkOutput, new NotebookLabel("bookmark.png",MainClass.Languages.Translate("bookmarks"))); LogMonitor = new LogMonitor(); Gtk.Menu monMenu = new Gtk.Menu(); GetOutputMenu(ref monMenu, LogMonitor); OutputNotebook.AppendPage(LogMonitor, new NotebookMenuLabel("log.png",MainClass.Languages.Translate("Monitor"),monMenu)); LogGarbageCollector = new LogGarbageCollector(); Gtk.Menu gcMenu = new Gtk.Menu(); GetOutputMenu(ref gcMenu, LogGarbageCollector); garbageColectorLabel =new NotebookMenuLabel("garbage-collector.png",MainClass.Languages.Translate("garbage_collector",0),gcMenu); OutputNotebook.AppendPage(LogGarbageCollector,garbageColectorLabel ); hpOutput.Add1(OutputNotebook); ProcessOutput = new ProcessOutput(); Gtk.Menu taskMenu = new Gtk.Menu(); GetOutputMenu(ref taskMenu, ProcessOutput); TaskNotebook.AppendPage(ProcessOutput, new NotebookMenuLabel("task.png",MainClass.Languages.Translate("process"),taskMenu)); ErrorOutput = new ErrorOutput(); Gtk.Menu errorMenu = new Gtk.Menu(); GetOutputMenu(ref errorMenu, ErrorOutput); TaskNotebook.AppendPage(ErrorOutput, new NotebookMenuLabel("error.png",MainClass.Languages.Translate("errors"),errorMenu)); LogOutput = new LogOutput(); Gtk.Menu logMenu = new Gtk.Menu(); GetOutputMenu(ref logMenu, LogOutput); TaskNotebook.AppendPage(LogOutput, new NotebookMenuLabel("log.png",MainClass.Languages.Translate("logs"),logMenu)); TodoOutput = new TodoOutput(); TaskNotebook.AppendPage(TodoOutput, new NotebookLabel("task.png",MainClass.Languages.Translate("task"))); FindOutput = new FindOutput(); Gtk.Menu findMenu = new Gtk.Menu(); GetOutputMenu(ref findMenu, FindOutput); TaskNotebook.AppendPage(FindOutput, new NotebookMenuLabel("find.png",MainClass.Languages.Translate("find_result"),findMenu)); hpOutput.Add2(TaskNotebook); FirstShow(); EditorNotebook.PageIsChanged +=PageIsChanged; if (openFileFromArg){ // open workspace from argument file Workspace workspace = Workspace.OpenWorkspace(openFileAgument); Console.WriteLine("Open File From Arg"); if (workspace != null){ ReloadWorkspace(workspace, false,false); Console.WriteLine("RecentFiles"); MainClass.Settings.RecentFiles.AddWorkspace(workspace.FilePath, workspace.FilePath); ActionUiManager.RefreshRecentAll(MainClass.Settings.RecentFiles.GetFiles(), MainClass.Settings.RecentFiles.GetProjects(), MainClass.Settings.RecentFiles.GetWorkspace()); } else openFileFromArg = false; } else if((MainClass.Settings.OpenLastOpenedWorkspace) && !openFileFromArg ){ if(String.IsNullOrEmpty(MainClass.Workspace.FilePath) && (String.IsNullOrEmpty(MainClass.Settings.CurrentWorkspace) ) ){ /*MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("workspace_is_corrupted"), null, Gtk.MessageType.Error,null); md.ShowDialog();*/ MainClass.Settings.CurrentWorkspace = ""; } else{ ReloadWorkspace(MainClass.Workspace, false,false); } } else if(!MainClass.Settings.OpenLastOpenedWorkspace && (!openFileFromArg) ){ MainClass.Workspace = new Workspace(); MainClass.Settings.CurrentWorkspace = ""; } if(!String.IsNullOrEmpty(openFileAgument)){ if(!openFileAgument.ToLower().EndsWith(".msw")) OpenFile(openFileAgument,true); } EditorNotebook.Page=0; WorkspaceTree.FileIsSelected+= delegate(string fileName, int fileType,string appFileName) { if(String.IsNullOrEmpty(fileName)){ SetSensitiveMenu(false); return; } ActionUiManager.SetSensitive("propertyall",true); SetSensitiveMenu(true); if(MainClass.Settings.AutoSelectProject){ if((TypeFile)fileType == TypeFile.AppFile) SetActualProject(fileName); else if (!String.IsNullOrEmpty(appFileName)) SetActualProject(appFileName); }//PropertisNotebook PropertisNotebook.RemovePage(0); if((TypeFile)fileType == TypeFile.SourceFile || ((TypeFile)fileType == TypeFile.StartFile ) || ((TypeFile)fileType == TypeFile.ExcludetFile ) ){ string file = ""; string appfile = ""; int typ = -1; Gtk.TreeIter ti = new Gtk.TreeIter(); WorkspaceTree.GetSelectedFile(out file, out typ, out ti); if (String.IsNullOrEmpty(file)) return; appfile = WorkspaceTree.GetSelectedProjectApp(); Project p = MainClass.Workspace.FindProject_byApp(appfile, true); if (p == null) return; FilePropertisData fpd = new FilePropertisData(); fpd.Filename = MainClass.Workspace.GetRelativePath(file); fpd.Project = p; FilePropertyWidget fpw = new FilePropertyWidget( fpd); PropertisNotebook.AppendPage(fpw,new Label("Properties")); }else if ((TypeFile)fileType == TypeFile.Directory){ string file = ""; string appfile = ""; int typ = -1; Gtk.TreeIter ti = new Gtk.TreeIter(); WorkspaceTree.GetSelectedFile(out file, out typ, out ti); if (String.IsNullOrEmpty(file)) return; appfile = WorkspaceTree.GetSelectedProjectApp(); Project p = MainClass.Workspace.FindProject_byApp(appfile, true); if (p == null) return; FilePropertisData fpd = new FilePropertisData(); fpd.Filename = MainClass.Workspace.GetRelativePath(file); fpd.Project = p; DirPropertyWidget fpw = new DirPropertyWidget( fpd); PropertisNotebook.AppendPage(fpw,new Label("Properties")); }else if ((TypeFile)fileType == TypeFile.AppFile){ string file = ""; int typ = -1; Gtk.TreeIter ti = new Gtk.TreeIter(); WorkspaceTree.GetSelectedFile(out file, out typ, out ti); if (String.IsNullOrEmpty(file)) return; Project p = MainClass.Workspace.FindProject_byApp(file, true); if (p == null) return; ProjectPropertyWidget fpw = new ProjectPropertyWidget( p); PropertisNotebook.AppendPage(fpw,new Label("Properties")); } else{ } }; SetSensitiveMenu(false); string newUpdater = System.IO.Path.Combine(MainClass.Paths.AppPath,"moscrif-updater.exe.new"); if(System.IO.File.Exists(newUpdater)){ string oldUpdater = System.IO.Path.Combine(MainClass.Paths.AppPath,"moscrif-updater.exe"); try{ if(File.Exists(oldUpdater)) File.Delete(oldUpdater); File.Copy(newUpdater,oldUpdater); File.Delete(newUpdater); }catch(Exception ex){ sbError.AppendLine("WARNING: " + ex.Message); Logger.Error(ex.Message); } } Gtk.Drag.DestSet (this, 0, null, 0); this.DragDrop += delegate(object o, DragDropArgs args) { Gdk.DragContext dc=args.Context; foreach (object k in dc.Data.Keys){ Console.WriteLine(k); } foreach (object v in dc.Data.Values){ Console.WriteLine(v); } Atom [] targets = args.Context.Targets; foreach (Atom a in targets){ if(a.Name == "text/uri-list") Gtk.Drag.GetData (o as Widget, dc, a, args.Time); } }; this.DragDataReceived += delegate(object o, DragDataReceivedArgs args) { if(args.SelectionData != null){ string fullData = System.Text.Encoding.UTF8.GetString (args.SelectionData.Data); foreach (string individualFile in fullData.Split ('\n')) { string file = individualFile.Trim (); if (file.StartsWith ("file://")) { file = new Uri(file).LocalPath; try { OpenFile(file,true); } catch (Exception e) { sbError.AppendLine("ERROR: " + String.Format("unable to open file {0} exception was :\n{1}", file, e.ToString())); Logger.Error(String.Format("unable to open file {0} exception was :\n{1}", file, e.ToString())); } } } } }; //table1.Attach(ddbSocketIP,2,3,0,1,AttachOptions.Shrink,AttachOptions.Shrink,0,0); this.ShowAll(); //this.Maximize(); int x, y, w, h, d = 0; hpOutput.Parent.ParentWindow.GetGeometry(out x, out y, out w, out h, out d); hpOutput.Position = w / 2; //vpMenuRight.Parent.ParentWindow.GetGeometry(out x, out y, out w, out h, out d); tblMenuRight.Parent.ParentWindow.GetGeometry(out x, out y, out w, out h, out d); tblMenuRight.RowSpacing = 0; tblMenuRight.ColumnSpacing = 0; tblMenuRight.BorderWidth = 0; if(w<1200){ //vpMenuRight.WidthRequest =125; tblMenuRight.WidthRequest =220; } else { if(MainClass.Platform.IsMac) tblMenuRight.WidthRequest =320; else tblMenuRight.WidthRequest =300; } if (MainClass.Platform.IsMac) { try{ ActionUiManager.CreateMacMenu(mainMenu); } catch (Exception ex){ sbError.AppendLine(String.Format("ERROR: Mac IGE Main Menu failed."+ex.Message)); Logger.Error("Mac IGE Main Menu failed."+ex.Message,null); } } ReloadPanel(); Moscrif.IDE.Tool.Logger.LogDebugInfo(String.Format("splash.hide-{0}",DateTime.Now)); // Send message to close splash screen on win Console.WriteLine(String.Format("splash.hide-{0}",DateTime.Now)); if(showSplash) splash.HideAll(); EditorNotebook.OnLoadFinish = true; OutputConsole.WriteError(sbError.ToString()); Moscrif.IDE.Iface.SocketServer.OutputClientChanged+= delegate(object sndr, string message) { Gtk.Application.Invoke(delegate{ this.OutputConsole.WriteText(message); Console.WriteLine(message); }); }; Thread ExecEditorThreads = new Thread(new ThreadStart(ExecEditorThreadLoop)); ExecEditorThreads.Name = "ExecEditorThread"; ExecEditorThreads.IsBackground = true; ExecEditorThreads.Start(); //LoadDefaultBanner(); toolbarBanner = new Toolbar (); toolbarBanner.WidthRequest = 220; tblMenuRight.Attach(toolbarBanner,0,1,0,2,AttachOptions.Fill,AttachOptions.Expand|AttachOptions.Fill,0,0); bannerImage.WidthRequest = 200; bannerImage.HeightRequest = 40; toolbarBanner.Add(bannerImage);//(bannerButton); toolbarBanner.ShowAll(); LoadDefaultBanner(); //bannerImage.GdkWindow.Cursor = new Gdk.Cursor(Gdk.CursorType.Hand2); Thread BannerThread = new Thread(new ThreadStart(BannerThreadLoop)); BannerThread.Name = "BannerThread"; BannerThread.IsBackground = true; BannerThread.Start(); }