Exemple #1
0
    public MainWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        Application.Init ();

            this.Resize(640,480);
            //menu bar very top
            MenuBar mb = new MenuBar ();
            Menu fileMenu = new Menu ();
            MenuItem menuItem = new MenuItem ("_File");
            menuItem.Submenu = fileMenu;
            mb.Append(menuItem);
            MenuItem menuFileQuit = new MenuItem("Quit");
            fileMenu.Append(menuFileQuit);
            vboxMain.PackStart(mb,false,false,0);

            //toolbar
            Toolbar tbTop = new Toolbar ();
            //toolbutton Staff
            ToolButton tbStaff = new ToolButton (Gtk.Stock.OrientationPortrait);
            tbStaff.Label="Staff";
            tbStaff.IsImportant=true;
            tbStaff.Clicked += HandleTbStaffClicked;
            tbTop.Insert(tbStaff,0);
            //toolbutton Clients
            ToolButton tbClients = new ToolButton (Gtk.Stock.About);
            tbClients.Label="Clients";
            tbClients.IsImportant=true;
            tbClients.Clicked+= HandleTbClientsClicked;
            tbTop.Insert(tbClients,1);
            //media bar
            Label lbMediaTemp = new Label ();
            lbMediaTemp.Text="Media holder";
            lbMediaTemp.Show();
            //pack the toolbar and media bar in the top hbox//
            hbTop.PackStart(tbTop);
            hbTop.PackStart(lbMediaTemp);
            //pack the top hbox in the main vbox
            vboxMain.PackStart(hbTop,false,false,1);
            // horizontal pane
            verticalPane.Position=200;
            verticalPane.Pack1(scrollWindowLeft,false,false);
            verticalPane.Pack2(scrollWindowRight,false,false);
            vboxMain.PackStart(verticalPane);
            scrollWindowLeft.Add(viewPortLeft);

            scrollWindowRight.Add(viewPortRight);
            Label lbMain = new Label ();
            lbMain.Text= "main";
            viewPortRight.Add(lbMain);
            verticalPane.ShowAll();
            //status bar very bottom
            Statusbar sb = new Statusbar ();
            vboxMain.PackStart(sb,false,false,1);

            this.Add(vboxMain);
            //hb1.Add(tbTop);
            this.ShowAll ();
        Build ();
    }
    public static MenuBar MyMenuBarFunc()
    {
        MenuBar item0 = new MenuBar();

        Menu item1 = new Menu();
        item1.Append( (int)MenuIDs.wxID_ABOUT, "&About...", "Helptext for About" );
        item1.AppendSeparator();

        Menu item2 = new Menu();
        item2.Append( ID_TEST1, "Test 1\tF1", "", ItemKind.wxITEM_CHECK );
        item2.Append( ID_TEST2, "Test 2\tF2", "", ItemKind.wxITEM_CHECK );
        item2.Append( ID_TEST3, "Test 3\tF3", "", ItemKind.wxITEM_CHECK );
        item1.Append( ID_MENU, "Submenu", item2, "" );

        Menu item3 = new Menu();
        item3.Append( ID_RADIO, "Radio 1", "", ItemKind.wxITEM_RADIO );
        item3.Append( ID_RADIO, "Radio 2", "", ItemKind.wxITEM_RADIO );
        item1.Append( ID_MENU, "Radio submenu", item3, "" );

        item1.AppendSeparator();
        item1.Append( (int)MenuIDs.wxID_EXIT, "&Quit\tAlt-Q", "Helptext for Quit" );
        item0.Append( item1, "&File" );

        return item0;
    }
Exemple #3
0
 public static void Localize(MenuBar menuBar)
 {
     foreach (MenuBarItem item in menuBar.Items)
     {
         Localizer.Localize(item);
     }
 }
	static Gtk.MenuBar Create_Menu ()
	{
		MenuBar mb = new MenuBar ();
		Menu file_menu = new Menu ();

		ImageMenuItem scramble_item = new ImageMenuItem ("_Scramble");
		scramble_item.Image = new Gtk.Image (Gtk.Stock.Refresh, IconSize.Menu);
		scramble_item.Activated += new EventHandler (Scramble);
		
		ImageMenuItem quit_item = new ImageMenuItem ("_Quit");
		quit_item.Image = new Gtk.Image (Gtk.Stock.Quit, IconSize.Menu);
		quit_item.Activated += new EventHandler (Quit);

		file_menu.Append (scramble_item);
		file_menu.Append (new SeparatorMenuItem ());
		file_menu.Append (quit_item);
	
		MenuItem file_item = new MenuItem ("_File");
		file_item.Submenu = file_menu;
		mb.Append (file_item);

		Menu help_menu = new Menu ();
		MenuItem help_item = new MenuItem ("_Help");
		help_item.Submenu = help_menu;

		ImageMenuItem about = new ImageMenuItem (Gnome.Stock.About, new AccelGroup ());
		about.Activated += new EventHandler (About_Box);
		help_menu.Append (about);
		mb.Append (help_item);

		return mb;
	}
 private static int GetPasteItemIndex(MenuBar contextMenu)
 {
     IMenuControl pasteItem = contextMenu.FindByCommandName("Edit.Paste");
     if (pasteItem != null)
         return pasteItem.Index;
     else
         return -1;
 }
 private void RefreshToolbar()
 {
     if (mMenuBar != null)
     {
         mMenuBar.Delete();
         mMenuBar = null;
     }
     mMenuBar = CodeRush.Menus.Bars.Add("SizeBar");
     AddScreensToDropDown(DefaultResolutions());
 }
Exemple #7
0
        private void InitMenuBar()
        {
            MenuBar menuBar = new MenuBar();
            Menu fileMenu = new Menu();

            fileMenu.Append(ID_FileExit, "E&xit\tAlt+F4", "Exit this app");
            EvtMenu(ID_FileExit, (s, e) => Close());

            menuBar.Append(fileMenu, "&File");
            MenuBar = menuBar;
        }
    // WDR: methods for MyFrame
    public void CreateMyMenuBar()
    {
        Menu file_menu = new Menu();
        file_menu.Append( (int)MenuIDs.wxID_ABOUT, "About...", "Program info" );
        file_menu.Append( (int)MenuIDs.wxID_EXIT, "Quit...", "Quit program" );

        MenuBar menu_bar = new MenuBar();
        menu_bar.Append( file_menu, "File" );

        MenuBar = menu_bar;
    }
    public static MenuBar MyMenuBarFunc()
    {
        MenuBar item0 = new MenuBar();

        Menu item1 = new Menu();
        item1.Append( (int)MenuIDs.wxID_ABOUT, "About\tAlt-A", "" );
        item1.Append( (int)MenuIDs.wxID_SAVE, "Save\tAlt-S", "" );
        item1.Append( (int)MenuIDs.wxID_EXIT, "Quit\tAlt-Q", "" );
        item0.Append( item1, "File" );

        return item0;
    }
Exemple #10
0
    public SharpApp()
        : base("Calculator")
    {
        SetDefaultSize(250, 230);
        SetPosition(WindowPosition.Center);
        DeleteEvent += delegate { Application.Quit(); } ;

        VBox vbox = new VBox(false, 2);

        MenuBar mb = new MenuBar();
        Menu filemenu = new Menu();
        MenuItem file = new MenuItem("File");
        file.Submenu = filemenu;
        mb.Append(file);

        vbox.PackStart(mb, false, false, 0);

        Table table = new Table(5,4,true);

        table.Attach(new Button("Cls"), 0,1,0,1);
        table.Attach(new Button("Bck"), 1,2,0,1);
        table.Attach(new Label(), 2,3,0,1);
        table.Attach(new Button("Close"),3,4,0,1);

        table.Attach(new Button("7"), 0,1,1,2);
        table.Attach(new Button("8"), 1,2,1,2);
        table.Attach(new Button("9"), 2,3,1,2);
        table.Attach(new Button("/"), 3,4,1,2);

        table.Attach(new Button("4"), 0,1,2,3);
        table.Attach(new Button("5"), 1,2,2,3);
        table.Attach(new Button("6"), 2,3,2,3);
        table.Attach(new Button("*"), 3,4,2,3);

        table.Attach(new Button("1"), 0,1,3,4);
        table.Attach(new Button("2"), 1,2,3,4);
        table.Attach(new Button("3"), 2,3,3,4);
        table.Attach(new Button("-"), 3,4,3,4);

        table.Attach(new Button("0"), 0,1,4,5);
        table.Attach(new Button("."), 1,2,4,5);
        table.Attach(new Button("="), 2,3,4,5);
        table.Attach(new Button("+"), 3,4,4,5);

        vbox.PackStart(new Entry(), false, false, 0);
        vbox.PackEnd(table, true, true,0);

        Add(vbox);
        ShowAll();
    }
    public static void Main()
    {
        Application.Init ();
        window = new Window ("Top level test");
        VBox box = new VBox (true, 0);
        MenuBar mb = new MenuBar ();

                item = new MenuItem ("_Test");
        mb.Append (item);
        box.PackStart (mb, true, true, 0);
        label = new Label ("Text");
        box.PackStart (label, true, true, 0);
        window.Add (box);
        window.ShowAll ();
        window.DeleteEvent += new DeleteEventHandler (OnDelete);
        Application.Run ();
    }
    public MainWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        _regexes = new Dictionary<string, string>();

        _regexes.Add("Possible Email Addresses",@"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}");
        _regexes.Add("Possible Environment Variables", @"^[A-Za-z]{3,}=[A-Za-z]+");
        _regexes.Add("Possible File Paths", @"[A-Za-z]:\\");
        _regexes.Add("Possible URLS", @"/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)/");
        _regexes.Add("Custom", string.Empty);

        Build ();
        this.Title = "VolatileMinds Pagefile Analyzer";
        SetPosition (Gtk.WindowPosition.Center);
        DeleteEvent += delegate(object o, DeleteEventArgs args) {
            Application.Quit ();
        };

        MenuBar bar = new MenuBar ();

        Menu fileMenu = new Menu ();
        MenuItem fileMenuItem = new MenuItem ("File");
        fileMenuItem.Submenu = fileMenu;

        MenuItem exit = new MenuItem ("Exit");
        exit.Activated += delegate(object sender, EventArgs e) {
            Application.Quit ();
        };

        MenuItem openFile = new MenuItem ("Open file...");

        openFile.Activated += OpenFile;

        fileMenu.Append (openFile);
        fileMenu.Append (exit);

        bar.Append (fileMenuItem);

        _vbox = new VBox (false, 2);
        _vbox.PackStart (bar, false, false, 0);

        this.Add (_vbox);
        this.ShowAll ();
    }
Exemple #13
0
    public SharpApp()
        : base("Simple menu")
    {
        SetDefaultSize(250,200);
        SetPosition(WindowPosition.Center);
        DeleteEvent+= delegate { Application.Quit();};

        MenuBar mb = new MenuBar();
        Menu filemenu = new Menu();
        MenuItem file = new MenuItem("File");
        file.Submenu = filemenu;

        MenuItem exit = new MenuItem("Exit");
        exit.Activated += OnActivated;
        filemenu.Append(exit);

        mb.Append(file);

        VBox vbox = new VBox(false, 2);
        vbox.PackStart(mb, false, false, 0);
        Add(vbox);
        ShowAll();
    }
    public MainWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        Build ();
        this.Title = "VolatileMinds Registry Reader";
        SetPosition (Gtk.WindowPosition.Center);
        DeleteEvent += delegate(object o, DeleteEventArgs args) {
            Application.Quit ();
        };

        MenuBar bar = new MenuBar ();

        Menu fileMenu = new Menu ();
        MenuItem fileMenuItem = new MenuItem ("File");
        fileMenuItem.Submenu = fileMenu;

        MenuItem exit = new MenuItem ("Exit");
        exit.Activated += delegate(object sender, EventArgs e) {
            Application.Quit ();
        };

        MenuItem openFile = new MenuItem ("Open file...");

        openFile.Activated += OpenFile;

        fileMenu.Append (openFile);
        fileMenu.Append (exit);

        bar.Append (fileMenuItem);

        _vbox = new VBox (false, 2);
        _vbox.PackStart (bar, false, false, 0);

        this.Add (_vbox);
        this.ShowAll ();
    }
        public override void Setup()
        {
            Win.Title  = this.GetName();
            Win.Y      = 1;           // menu
            Win.Height = Dim.Fill(1); // status bar
            Top.LayoutSubviews();

            var menu = new MenuBar(new MenuBarItem [] {
                new MenuBarItem("_File", new MenuItem [] {
                    new MenuItem("_Quit", "", () => Quit()),
                }),
                new MenuBarItem("_View", new MenuItem [] {
                    miShowLines = new MenuItem("_ShowLines", "", () => ShowLines())
                    {
                        Checked = true, CheckType = MenuItemCheckStyle.Checked
                    },
                    null /*separator*/,
                    miPlusMinus = new MenuItem("_PlusMinusSymbols", "", () => SetExpandableSymbols('+', '-'))
                    {
                        Checked = true, CheckType = MenuItemCheckStyle.Radio
                    },
                    miArrowSymbols = new MenuItem("_ArrowSymbols", "", () => SetExpandableSymbols('>', 'v'))
                    {
                        Checked = false, CheckType = MenuItemCheckStyle.Radio
                    },
                    miNoSymbols = new MenuItem("_NoSymbols", "", () => SetExpandableSymbols(null, null))
                    {
                        Checked = false, CheckType = MenuItemCheckStyle.Radio
                    },
                    miUnicodeSymbols = new MenuItem("_Unicode", "", () => SetExpandableSymbols('ஹ', '﷽'))
                    {
                        Checked = false, CheckType = MenuItemCheckStyle.Radio
                    },
                    null /*separator*/,
                    miColoredSymbols = new MenuItem("_ColoredSymbols", "", () => ShowColoredExpandableSymbols())
                    {
                        Checked = false, CheckType = MenuItemCheckStyle.Checked
                    },
                    miInvertSymbols = new MenuItem("_InvertSymbols", "", () => InvertExpandableSymbols())
                    {
                        Checked = false, CheckType = MenuItemCheckStyle.Checked
                    },
                    miFullPaths = new MenuItem("_FullPaths", "", () => SetFullName())
                    {
                        Checked = false, CheckType = MenuItemCheckStyle.Checked
                    },
                    miLeaveLastRow = new MenuItem("_LeaveLastRow", "", () => SetLeaveLastRow())
                    {
                        Checked = true, CheckType = MenuItemCheckStyle.Checked
                    },
                }),
            });

            Top.Add(menu);

            var statusBar = new StatusBar(new StatusItem [] {
                new StatusItem(Key.CtrlMask | Key.Q, "~^Q~ Quit", () => Quit()),
            });

            Top.Add(statusBar);

            var lblFiles = new Label("File Tree:")
            {
                X = 0,
                Y = 1
            };

            Win.Add(lblFiles);

            treeViewFiles = new TreeView <FileSystemInfo> ()
            {
                X      = 0,
                Y      = Pos.Bottom(lblFiles),
                Width  = Dim.Fill(),
                Height = Dim.Fill(),
            };

            treeViewFiles.ObjectActivated += TreeViewFiles_ObjectActivated;

            SetupFileTree();

            Win.Add(treeViewFiles);

            SetupScrollBar();

            green = Application.Driver.MakeAttribute(Color.Green, Color.Blue);
            red   = Application.Driver.MakeAttribute(Color.Red, Color.Blue);
        }
        public void Start(ApplicationData applicationData)
        {
            Application.Init();
            var top = Application.Top;

            _applicationData = applicationData;

            // If we have PassThru, then we want to make them selectable. If we make them selectable,
            // they have a 8 character addition of a checkbox ("     [ ]") that we have to factor in.
            _listViewOffset = _applicationData.PassThru ? 8 : 4;

            // Creates the top-level window to show
            var win = new Window(_applicationData.Title)
            {
                X = 0,
                Y = 1, // Leave one row for the toplevel menu
                // By using Dim.Fill(), it will automatically resize without manual intervention
                Width  = Dim.Fill(),
                Height = Dim.Fill()
            };

            top.Add(win);

            // Creates a menubar, the item "New" has a help menu.
            var menu = new MenuBar(new MenuBarItem []
            {
                new MenuBarItem("_Actions (F9)",
                                _applicationData.PassThru
                    ? new MenuItem []
                {
                    new MenuItem("_Accept", string.Empty, () => { if (Quit("Accept", ACCEPT_TEXT))
                                                                  {
                                                                      Application.RequestStop();
                                                                  }
                                 }),
                    new MenuItem("_Cancel", string.Empty, () => { if (Quit("Cancel", CANCEL_TEXT))
                                                                  {
                                                                      _cancelled = true;
                                                                  }
                                                                  Application.RequestStop(); })
                }
                    : new MenuItem []
                {
                    new MenuItem("_Close", string.Empty, () => { if (Quit("Close", CLOSE_TEXT))
                                                                 {
                                                                     Application.RequestStop();
                                                                 }
                                 })
                })
            });

            top.Add(menu);

            var gridHeaders = _applicationData.DataTable.DataColumns.Select((c) => c.Label).ToList();

            _listViewColumnWidths = new int[gridHeaders.Count];
            for (int i = 0; i < gridHeaders.Count; i++)
            {
                _listViewColumnWidths[i] = gridHeaders[i].Length;
            }

            // calculate the width of each column based on longest string in each column for each row
            foreach (var row in _applicationData.DataTable.Data)
            {
                int index = 0;

                // use half of the visible buffer height for the number of objects to inspect to calculate widths
                foreach (var col in row.Values.Take(top.Frame.Height / 2))
                {
                    var len = col.Value.DisplayValue.Length;
                    if (len > _listViewColumnWidths[index])
                    {
                        _listViewColumnWidths[index] = len;
                    }

                    index++;
                }
            }

            // if the total width is wider than the usable width, remove 1 from widest column until it fits
            // the gui loses 3 chars on the left and 2 chars on the right
            int usableWidth     = top.Frame.Width - 3 - _listViewColumnWidths.Length - _listViewOffset - 2;
            int columnWidthsSum = _listViewColumnWidths.Sum();

            while (columnWidthsSum >= usableWidth)
            {
                int maxWidth = 0;
                int maxIndex = 0;
                for (int i = 0; i < _listViewColumnWidths.Length; i++)
                {
                    if (_listViewColumnWidths[i] > maxWidth)
                    {
                        maxWidth = _listViewColumnWidths[i];
                        maxIndex = i;
                    }
                }

                _listViewColumnWidths[maxIndex]--;
                columnWidthsSum--;
            }

            var filterLabel = new Label(FILTER_LABEL)
            {
                X = 2
            };

            // 2 is for the square brackets added to buttons
            var filterFieldWidth = usableWidth - filterLabel.Text.Length - APPLY_LABEL.Length - 2;
            var filterField      = new TextField(string.Empty)
            {
                X        = Pos.Right(filterLabel) + 1,
                Y        = Pos.Top(filterLabel),
                CanFocus = true,
                Width    = filterFieldWidth
            };

            filterField.Changed += FilterField_Changed;

            _filterErrorLabel = new Label(string.Empty)
            {
                X           = Pos.Right(filterLabel) + 1,
                Y           = Pos.Top(filterLabel) + 1,
                ColorScheme = Colors.Base,
                Width       = filterFieldWidth
            };

            var filterApplyButton = new Button(APPLY_LABEL)
            {
                // Pos.Right(filterField) returns 0
                X       = Pos.Right(filterLabel) + filterFieldWidth + 2,
                Y       = Pos.Top(filterLabel),
                Clicked = () =>
                {
                    FilterField_Changed(null, filterField.Text);
                }
            };

            var header = new Label(GridViewHelpers.GetPaddedString(
                                       gridHeaders,
                                       _listViewOffset + _listViewOffset - 1,
                                       _listViewColumnWidths))
            {
                X = 0,
                Y = 2
            };

            win.Add(filterLabel, filterField, _filterErrorLabel, filterApplyButton, header);

            // This renders dashes under the header to make it more clear what is header and what is data
            var headerLineText = new StringBuilder();

            foreach (char c in header.Text)
            {
                if (c.Equals(' '))
                {
                    headerLineText.Append(' ');
                }
                else
                {
                    // When gui.cs supports text decorations, should replace this with just underlining the header
                    headerLineText.Append('-');
                }
            }

            var headerLine = new Label(headerLineText.ToString())
            {
                X = 0,
                Y = 3
            };

            win.Add(headerLine);

            LoadData();

            _listView = new ListView(_itemSource)
            {
                X             = 3,
                Y             = 4,
                Width         = Dim.Fill(2),
                Height        = Dim.Fill(2),
                AllowsMarking = _applicationData.PassThru
            };

            win.Add(_listView);
            Application.Run();

            if (_cancelled)
            {
                return;
            }

            foreach (GridViewRow gvr in _itemSource.GridViewRowList)
            {
                if (gvr.IsMarked)
                {
                    SelectedIndexes.Add(gvr.OriginalIndex);
                }
            }
        }
Exemple #17
0
        public void UpdateInput()
        {
            if (MouseInfoGetter != null)
            {
                var mouseInfo = MouseInfoGetter();
                MousePosition = mouseInfo.Position;

                if (SpriteBatchBeginParams.TransformMatrix != null)
                {
                    // Apply transform
                    var t = Vector2.Transform(
                        new Vector2(MousePosition.X, MousePosition.Y),
                        SpriteBatchBeginParams.InverseTransform);

                    MousePosition = new Point((int)t.X, (int)t.Y);
                }

                if (MousePosition.X != LastMousePosition.X ||
                    MousePosition.Y != LastMousePosition.Y)
                {
                    var ev = MouseMoved;
                    if (ev != null)
                    {
                        ev(this, EventArgs.Empty);
                    }

                    ChildrenCopy.HandleMouseMovement();
                }

                HandleButton(mouseInfo.IsLeftButtonDown, _lastMouseInfo.IsLeftButtonDown, MouseButtons.Left);
                HandleButton(mouseInfo.IsMiddleButtonDown, _lastMouseInfo.IsMiddleButtonDown, MouseButtons.Middle);
                HandleButton(mouseInfo.IsRightButtonDown, _lastMouseInfo.IsRightButtonDown, MouseButtons.Right);

#if XENKO
                var handleWheel = mouseInfo.Wheel != 0;
#else
                var handleWheel = mouseInfo.Wheel != _lastMouseInfo.Wheel;
#endif

                if (handleWheel)
                {
                    var delta = mouseInfo.Wheel;
#if !XENKO
                    delta -= _lastMouseInfo.Wheel;
#endif

                    var ev = MouseWheelChanged;
                    if (ev != null)
                    {
                        ev(null, new GenericEventArgs <float>(delta));
                    }

                    if (_focusedWidget != null)
                    {
                        _focusedWidget.IterateFocusable(w => w.OnMouseWheel(delta));
                    }
                }

                _lastMouseInfo = mouseInfo;
            }

            if (DownKeysGetter != null)
            {
                var pressedKeys = DownKeysGetter();

                if (pressedKeys != null)
                {
                    MyraEnvironment.ShowUnderscores = (MenuBar != null && MenuBar.OpenMenuItem != null) ||
                                                      pressedKeys.Contains(Keys.LeftAlt) ||
                                                      pressedKeys.Contains(Keys.RightAlt);

                    if (_lastDownKeys != null)
                    {
                        foreach (var key in pressedKeys)
                        {
                            if (!_lastDownKeys.Contains(key))
                            {
                                var ev = KeyDown;
                                if (ev != null)
                                {
                                    ev(this, new GenericEventArgs <Keys>(key));
                                }

                                if (MenuBar != null && MyraEnvironment.ShowUnderscores)
                                {
                                    MenuBar.OnKeyDown(key);
                                }
                                else
                                {
                                    if (_focusedWidget != null)
                                    {
                                        _focusedWidget.IterateFocusable(w => w.OnKeyDown(key));

#if XENKO
                                        var ch = key.ToChar(pressedKeys.Contains(Keys.LeftShift) ||
                                                            pressedKeys.Contains(Keys.RightShift));
                                        if (ch != null)
                                        {
                                            _focusedWidget.IterateFocusable(w => w.OnChar(ch.Value));
                                        }
#endif
                                    }
                                }

                                if (key == Keys.Escape && ContextMenu != null)
                                {
                                    HideContextMenu();
                                }
                            }
                        }

                        foreach (var key in _lastDownKeys)
                        {
                            if (!pressedKeys.Contains(key))
                            {
                                // Key had been released
                                var ev = KeyUp;
                                if (ev != null)
                                {
                                    ev(this, new GenericEventArgs <Keys>(key));
                                }

                                if (_focusedWidget != null)
                                {
                                    _focusedWidget.IterateFocusable(w => w.OnKeyUp(key));
                                }
                            }
                        }
                    }
                }

                _lastDownKeys = pressedKeys.ToArray();
            }
        }
Exemple #18
0
 public ResetPasswordPage(IWebDriver webDriver, Uri baseUri)
     : base(webDriver, baseUri, PageTitles.RESET_PASSWORD)
 {
     MenuBar = new MenuBar(webDriver, baseUri);
 }
    private void buildMenu()
    {
        //MenuItem - represents an item in a menu
        //Menu	   - collects items into a menu
        //Menus can be submenus of menu items
        //MenuBar - collects items into a widget allowing users to navigate its items
        MenuBar menu = new MenuBar ();

        MenuItem fileItem = new MenuItem ("File");

        Menu fileItems = new Menu ();

        MenuItem quit = new MenuItem ("Quit");
        quit.ButtonReleaseEvent += new ButtonReleaseEventHandler(ExitApplication);

        MenuItem save = new MenuItem ("Save");

        MenuItem loadFile = new MenuItem ("Load File");
        loadFile.ButtonReleaseEvent += new ButtonReleaseEventHandler (LoadNewFile);

        fileItems.Add (quit);
        fileItems.Add (save);
        fileItems.Add (loadFile);

        fileItem.Submenu = fileItems;

        menu.Add (fileItem);

        VBox v = new VBox ();
        v.PackStart (menu, false, false, 0);
        masterContainer.PackStart (v, false, false, 0);
    }
Exemple #20
0
        void InitializeComponent()
        {
            #region Commands

            openFileCommand = new Command {
                MenuText = "Open", Shortcut = OpenHotKey
            };
            openFileWithCommand = new Command {
                MenuText = "Open with Plugin", Shortcut = OpenWithHotKey
            };
            saveAllFileCommand = new Command {
                MenuText = "Save All", Shortcut = SaveAllHotKey, Image = MenuSaveResource
            };

            openTextSequenceSearcherCommand = new Command {
                MenuText = "Text Sequence Searcher"
            };
            openBatchExtractorCommand = new Command {
                MenuText = "Batch Extractor"
            };
            openBatchInjectorCommand = new Command {
                MenuText = "Batch Injector"
            };

            openHashcommand = new Command {
                MenuText = "Hashes"
            };

            openEncryptionCommand = new Command {
                MenuText = "Encrypt"
            };
            openDecryptionCommand = new Command {
                MenuText = "Decrypt"
            };

            openDecompressionCommand = new Command {
                MenuText = "Decompress"
            };
            openCompressionCommand = new Command {
                MenuText = "Compress"
            };

            openRawImageViewerCommand = new Command {
                MenuText = "Raw Image Viewer"
            };

            openImageTranscoderCommand = new Command {
                MenuText = "Image Trascoder"
            };

            includeDevBuildCommand = new Command();

            openAboutCommand = new Command {
                MenuText = "About..."
            };

            #endregion

            Title      = "Kuriimu2";
            ClientSize = new Size(1116, 643);
            Padding    = new Padding(3);
            Icon       = Icon.FromResource("Kuriimu2.EtoForms.Images.kuriimu2winforms.ico");

            #region Menu

            Menu = new MenuBar
            {
                Items =
                {
                    new ButtonMenuItem {
                        Text = "File", Items ={ openFileCommand,           openFileWithCommand,      new SeparatorMenuItem(), saveAllFileCommand }
                    },
                    new ButtonMenuItem {
                        Text = "Tools", Items ={ openBatchExtractorCommand, openBatchInjectorCommand, openTextSequenceSearcherCommand }
                    },
                    new ButtonMenuItem(openHashcommand),
                    new ButtonMenuItem {
                        Text = "Ciphers", Items ={ openEncryptionCommand,     openDecryptionCommand }
                    },
                    new ButtonMenuItem {
                        Text = "Compressions", Items ={ openDecompressionCommand,  openCompressionCommand }
                    },
                    new ButtonMenuItem(openRawImageViewerCommand),
                    //new ButtonMenuItem(openImageTranscoderCommand),
                    new ButtonMenuItem {
                        Text = "Settings", Items ={ new CheckMenuItem {
                                             Text = "Include Developer Builds", Checked = Settings.Default.IncludeDevBuilds, Command = includeDevBuildCommand
                                         } }
                    }
                },
                AboutItem = openAboutCommand
            };

            #endregion

            #region Content

            tabControl     = new TabControl();
            _progressBarEx = new ProgressBarEx();
            statusMessage  = new Label();

            var progressLayout = new TableLayout
            {
                Spacing = new Size(3, 3),

                Rows =
                {
                    new TableRow
                    {
                        Cells =
                        {
                            new TableCell(_progressBarEx)
                            {
                                ScaleWidth = true
                            },
                            new TableCell(statusMessage)
                            {
                                ScaleWidth = true
                            },
                        }
                    }
                }
            };

            Content = new TableLayout
            {
                AllowDrop = true,
                Spacing   = new Size(3, 3),

                Rows =
                {
                    new TableRow(tabControl)
                    {
                        ScaleHeight = true
                    },
                    progressLayout
                }
            };

            #endregion
        }
    protected void Populate()
    {
        this.SetDefaultSize(1024,768);
        Window pingpong = new Window(Gtk.WindowType.Toplevel);
        pingpong.SetDefaultSize(500,50);
        pingpong.SetPosition(Gtk.WindowPosition.CenterOnParent);
        pingpong.Title = "Loading...";
        _pulseBar = new ProgressBar();
        pingpong.Add(_pulseBar);
        pingpong.ShowAll();
        pingpong.Show();

        while (_currentStrs == null)
        {
            Application.Invoke( delegate {
                _pulseBar.Pulse();
            });

            Thread.Sleep(100);
        }

        Application.Invoke( delegate {
            pingpong.Destroy();

            this.Remove(_vbox);
            _vbox = new VBox(false, 10);

            MenuBar bar = new MenuBar ();

            Menu fileMenu = new Menu ();
            MenuItem fileMenuItem = new MenuItem ("File");
            fileMenuItem.Submenu = fileMenu;

            MenuItem exit = new MenuItem ("Exit");
            exit.Activated += delegate(object sender, EventArgs e) {
                Application.Quit ();
            };

            MenuItem openFile = new MenuItem ("Open file...");

            openFile.Activated += OpenFile;

            fileMenu.Append (openFile);
            fileMenu.Append (exit);

            bar.Append (fileMenuItem);

            _vbox.PackStart(bar, false, false, 0);

            _regxTitle = ComboBox.NewText();
            _regxTitle.Changed += HandleChanged;

            foreach (KeyValuePair<string, string> pair in _regexes)
                _regxTitle.AppendText(pair.Key);

            _regx = new Entry();
            _regx.IsEditable = false;
            _regx.CanFocus = false;

            HBox comboRegexBox = new HBox(true, 10);
            comboRegexBox.SetSizeRequest(768, 50);

            comboRegexBox.PackStart(_regxTitle, false,false, 0);
            comboRegexBox.PackStart(_regx, true, true, 0);

            Button search = new Button("Search!");
            search.Clicked += HandleClicked;
            comboRegexBox.PackStart(search, false, false, 20);

            _vbox.PackStart(comboRegexBox, true, true, 10);
            ScrolledWindow sw = new ScrolledWindow();
            _tv = new TreeView();
            sw.Add(_tv);

            CellRendererText tsText  = new CellRendererText();
            TreeViewColumn match = new TreeViewColumn();
            match.Title = "Match";
            match.PackStart(tsText, true);
            match.AddAttribute(tsText, "text", 0);

            _tv.AppendColumn(match);

            TreeStore store = new TreeStore(typeof(string));

            foreach (string str in _currentStrs)
                store.AppendValues(str);

            _tv.Model = store;
            sw.SetSizeRequest(768,600);
            _vbox.PackStart(sw, false, false, 0);
            this.Add(_vbox);
            this.ShowAll();
        });
    }
Exemple #22
0
    public static void Main(string[] args)
    {
        Application.Init();

        Gtk.Window w = new Gtk.Window("Encodroyd");
        HBox mainHBox = new HBox();
        HBox dropHBox = new HBox();
        HBox spinVideoHBox = new HBox();
        HBox spinAudioHBox = new HBox();
        HBox statusButtonHBox = new HBox();
        VBox mainVBox = new VBox();
        VBox leftVBox = new VBox();
        VBox rightVBox = new VBox();
        VBox prefVBox = new VBox();
        VBox statusVBox = new VBox();
        MenuBar mb = new MenuBar ();
        //Gtk.Frame dndFrame = new Gtk.Frame();
        Gtk.Frame prefFrame = new Gtk.Frame("Preferences");
        Gtk.Frame statusFrame = new Gtk.Frame("Status");
        icon = new Pixbuf(null, "encodroyd.png");
        Gtk.EventBox image = new Gtk.EventBox();
        Gtk.Label dropLabel = new Gtk.Label("Drop videos here\nto convert");

        highQualityRadio = new RadioButton(null, "High Quality (H.264)");
        prefVBox.PackStart(highQualityRadio, true, true, 0);
        lowQualityRadio = new RadioButton(highQualityRadio, "Low Quality (MPEG4)");
        lowQualityRadio.Active = true;
        prefVBox.PackStart(lowQualityRadio, true, true, 0);

        statusLabel = new Gtk.Label("Idle");
        pBar = new ProgressBar();
        skipCurrentButton = new Gtk.Button();

        Gtk.ScrolledWindow scrollWin = new Gtk.ScrolledWindow();
        Gtk.TreeView tree = new TreeView();
        listStore = new ListStore(typeof (String));

        // set properties
        w.Icon = icon;

        // transparence
        //if (w.Screen.RgbaColormap != null)
        //  Gtk.Widget.DefaultColormap = w.Screen.RgbaColormap;

        mainHBox.BorderWidth = 6;
        mainHBox.Spacing = 6;
        dropHBox.BorderWidth = 6;
        dropHBox.Spacing = 6;
        spinVideoHBox.BorderWidth = 6;
        spinVideoHBox.Spacing = 6;
        spinAudioHBox.BorderWidth = 6;
        spinAudioHBox.Spacing = 6;
        statusButtonHBox.BorderWidth = 0;
        statusButtonHBox.Spacing = 6;
        leftVBox.BorderWidth = 6;
        leftVBox.Spacing = 6;
        rightVBox.BorderWidth = 6;
        rightVBox.Spacing = 6;
        prefVBox.BorderWidth = 6;
        prefVBox.Spacing = 6;
        statusVBox.BorderWidth = 6;
        statusVBox.Spacing = 6;
        statusLabel.Ellipsize = Pango.EllipsizeMode.Middle;
        scrollWin.ShadowType = ShadowType.In;
        statusLabel.SetSizeRequest(120,-1);
        skipCurrentButton.Sensitive = false;
        skipCurrentButton.Label = "Skip";

        // first hbox
        image.Add(new Gtk.Image(icon));
        dropHBox.Add(image);
        dropHBox.Add(dropLabel);

        // preferences frame
        prefFrame.Add(prefVBox);
        prefVBox.Add(spinVideoHBox);
        prefVBox.Add(spinAudioHBox);

        // status frame
        statusFrame.Add(statusVBox);
        statusVBox.Add(statusButtonHBox);
        statusVBox.Add(pBar);
        statusButtonHBox.Add(statusLabel);
        statusButtonHBox.Add(skipCurrentButton);

        // leftvbox
        leftVBox.Add(dropHBox);
        leftVBox.Add(prefFrame);
        leftVBox.Add(statusFrame);

        // right
        tree.Model = listStore;
        tree.HeadersVisible = true;
        tree.AppendColumn ("Queue", new CellRendererText (), "text", 0);

        // scrolledwindow
        scrollWin.Add(tree);

        // rightvbox
        rightVBox.Add(scrollWin);
        rightVBox.SetSizeRequest(200,-1);

        // menubar
        Menu fileMenu = new Menu ();
        MenuItem exitItem = new MenuItem("Exit");
        exitItem.Activated += new EventHandler (OnExitItemActivate);
        fileMenu.Append (exitItem);
        MenuItem fileItem = new MenuItem("File");
        fileItem.Submenu = fileMenu;
        mb.Append (fileItem);
        Menu helpMenu = new Menu ();
        MenuItem aboutItem = new MenuItem("About");
        aboutItem.Activated += new EventHandler (OnAboutItemActivate);
        helpMenu.Append (aboutItem);
        MenuItem helpItem = new MenuItem("Help");
        helpItem.Submenu = helpMenu;
        mb.Append (helpItem);

        // mainHBox
        mainVBox.Add(mb);
        mainVBox.Add(mainHBox);
        mainHBox.Add(leftVBox);
        mainHBox.Add(rightVBox);

        // window
        w.Add(mainVBox);
        w.ShowAll();

        // events
        Gtk.Drag.DestSet(dropHBox, DestDefaults.All, targetTable, Gdk.DragAction.Copy);
        dropHBox.DragDataReceived += DataReceived;
        skipCurrentButton.Clicked += new EventHandler(OnSkipOneButtonClicked);
        w.DeleteEvent += OnWindowDelete;

        Application.Run();
    }
Exemple #23
0
  public static void Main(string [] args)
  {	
    Application.Init();

    Window win = new Window("EFL# Demo App");	
    win.Resize(640, 480);

    Application.EE.ResizeEvent += AppResizeHandler;

    /* integrate this code in the Window class */
    Edje win_bg = new Edje(Application.EE.Get());
    win_bg.FileSet(DataConfig.DATADIR + "/data/eblocks/themes/e17.edj","window");
    win_bg.Resize(640, 480);
    win_bg.Move(0, 0);
    win_bg.Lower();
    win_bg.Show();
    
    MenuItem item;    
    MenuItem entry;

    MenuBar mb = new MenuBar();
    mb.Move(0, 0);
    mb.Resize(640, 35);
    mb.Spacing = 15;

    item = new MenuItem("_File");
    Menu file_menu = new Menu();
    
    entry = new MenuItem(file_menu.Canvas, "_Open");
    file_menu.Append(entry);
    entry = new MenuItem(file_menu.Canvas, "_Close");
    file_menu.Append(entry);
    entry = new MenuItem(file_menu.Canvas, "_Save");
    file_menu.Append(entry);
    
    item.SubMenu = file_menu;
    
    mb.Append(item);

    item = new MenuItem("_Edit");
    Menu edit_menu = new Menu();
    
    entry = new MenuItem(edit_menu.Canvas, "_Copy");
    edit_menu.Append(entry);
    entry = new MenuItem(edit_menu.Canvas, "_Cut");
    edit_menu.Append(entry);
    entry = new MenuItem(edit_menu.Canvas, "_Paste");
    edit_menu.Append(entry);
    
    item.SubMenu = edit_menu;
    mb.Append(item);

    item = new MenuItem("_About");
    //item.SubMenu = about_menu;
    mb.Append(item);

    mb.Show();

    Button button;	

    HBox box_left = new HBox();
    box_left.Move(0, 37);
    box_left.Resize(70, 480 - 37);
	
    VBox box_icons = new VBox();
    box_icons.Spacing = 0;
    box_icons.Resize(64, 480 - 37);
	
    button = new Button("Tile");
    button.Resize(64, 64);
    box_icons.PackEnd(button);
    button = new Button("Stretch");
    button.Resize(64, 64);
    box_icons.PackEnd(button);	
    button = new Button("Rotate");
    button.Resize(64, 64);
    box_icons.PackEnd(button);	
    button = new Button("Flip");
    button.Resize(64, 64);
    box_icons.PackEnd(button);	
    button = new Button("Quit");
    button.MouseUpEvent += new Enlightenment.Evas.Item.EventHandler(AppQuitButtonHandler);
    button.Resize(64, 64);	
    box_icons.PackEnd(button);		
	
    box_left.PackEnd(box_icons);
	
    Enlightenment.Eblocks.Line vline = new Enlightenment.Eblocks.Line(Application.EE.Get());
    vline.Vertical = true;
    vline.Resize(6, 480 - 37);
	
    box_left.PackEnd(vline);
	
    box_left.Show();
	
    dir = args[0];	
	       	
    imageTable = new Table(Application.EE.Get(), items);
	
    HBox box_images = new HBox();
    box_images.Move(70, 37);
    box_images.Spacing = 0;
    box_images.Resize(640 - 70 - 2, 480 - 37 - 2);
    box_images.PackStart(imageTable);
	
    Application.EE.DataSet("box_images", box_images);
    Application.EE.DataSet("box_left", box_left);
    Application.EE.DataSet("box_icons", box_icons);
    Application.EE.DataSet("win_bg", win_bg);
    Application.EE.DataSet("vline", vline);
    Application.EE.DataSet("mb", mb);
	
    WaitCallback callback = new WaitCallback(Callback);
    ThreadPool.QueueUserWorkItem(callback);	

    win.ShowAll();
	
    Application.Run();
  }   
Exemple #24
0
    // pridanie menu a toolbarov do prislusnich widgetov
    private void OnWidgetAdd(object obj, AddWidgetArgs args)
    {
        if (args.Widget is Toolbar) {
            args.Widget.Show();
            if (args.Widget.Name == "toolbarLeft") {
                toolbarLeft = (Toolbar)args.Widget;

                toolbarLeft.ShowAll();
                toolbarLeft.IconSize = IconSize.LargeToolbar;

                vpMenuLeft.Pack1(toolbarLeft, false, false);

            }
            if (args.Widget.Name == "toolbarMiddle") {
                toolbarMiddle = (Toolbar)args.Widget;
                vbMenuMidle.PackEnd(toolbarMiddle,true, true, 0);//true, false,

                ToolItem tic = new ToolItem();
                ToolItem tic2 = new ToolItem();
                ToolItem tic3 = new ToolItem();
                ToolItem til1 = new ToolItem();
                ToolItem til2 = new ToolItem();
                ToolItem til3 = new ToolItem();

                /*Label lbl1 = new Label(MainClass.Languages.Translate("project"));
                Label lbl2 = new Label(MainClass.Languages.Translate("resolution"));
                Label lbl3 = new Label(MainClass.Languages.Translate("device"));*/
                Label lbl1 = new Label(MainClass.Languages.Translate(" "));
                Label lbl2 = new Label(MainClass.Languages.Translate(" "));
                Label lbl3 = new Label(MainClass.Languages.Translate(" "));
                til1.Add(lbl1);
                til2.Add(lbl2);
                til3.Add(lbl3);

                if(MainClass.Platform.IsMac){

                    VBox vboxMenu1 = new VBox();
                    vboxMenu1.PackStart(new Label(),true,false,0);
                    vboxMenu1.PackStart(ddbProject,false,false,0);
                    vboxMenu1.PackEnd(new Label(),true,false,0);

                    VBox vboxMenu2 = new VBox();
                    vboxMenu2.PackStart(new Label(),true,false,0);
                    vboxMenu2.PackStart(ddbResolution,false,false,0);
                    vboxMenu2.PackEnd(new Label(),true,false,0);

                    VBox vboxMenu3 = new VBox();
                    vboxMenu3.PackStart(new Label(),true,false,0);
                    vboxMenu3.PackStart(ddbDevice,false,false,0);
                    vboxMenu3.PackEnd(new Label(),true,false,0);

                    tic.Add(vboxMenu1);
                    tic2.Add(vboxMenu2);
                    tic3.Add(vboxMenu3);

                } else {
                    tic.Add(ddbProject);
                    tic2.Add(ddbResolution);
                    tic3.Add(ddbDevice);

                }
                toolbarMiddle.Insert(tic2, 0);
                toolbarMiddle.Insert(til2, 0);
                //toolbarMiddle.Insert(new SeparatorToolItem(), 0);
                toolbarMiddle.Insert(tic3, 0);
                toolbarMiddle.Insert(til3, 0);
                //toolbarMiddle.Insert(new SeparatorToolItem(), 0);
                toolbarMiddle.Insert(tic, 0);
                toolbarMiddle.Insert(til1, 0);

                toolbarMiddle.ShowAll();
            }
            if (args.Widget.Name == "toolbarRight1") {
                toolbarRight1 = (Toolbar)args.Widget;
                toolbarRight1.IconSize = IconSize.SmallToolbar;
                toolbarRight1.ToolbarStyle = ToolbarStyle.Icons;
                //toolbarRight.
                //hbMenuRight.PackStart(toolbarRight, true, true,0);
                //vbRight.PackStart(toolbarRight1, true, true,0);//Pack1(toolbarRight, true, true);
                tblMenuRight.Attach(toolbarRight1,1,2,0,1,AttachOptions.Expand|AttachOptions.Fill,AttachOptions.Fill,0,0);

            }
            if (args.Widget.Name == "toolbarRight2") {
                toolbarRight2 = (Toolbar)args.Widget;
                toolbarRight2.IconSize = IconSize.SmallToolbar;
                toolbarRight2.ToolbarStyle = ToolbarStyle.Icons;
                //toolbarRight2.AccelCanActivate;
                //toolbarRight.
                //hbMenuRight.PackStart(toolbarRight, true, true,0);
                tblMenuRight.Attach(toolbarRight2,1,2,1,2,AttachOptions.Expand|AttachOptions.Fill,AttachOptions.Fill,0,0);
                //vbRight.PackEnd(toolbarRight2, true, true,0);//Pack1(toolbarRight, true, true);

            }
        }
        if (args.Widget is MenuBar) {
            mainMenu =(MenuBar)args.Widget;
            mainMenu.Show();

            if(!MainClass.Platform.IsMac)
                vbMenuMidle.PackStart(mainMenu, true, true, 0);
        }
    }
Exemple #25
0
    /// <summary>
    /// Generate header bar
    /// </summary>
    private void FillMenuBar(OptionItems foOptions)
    {
        string username = "******";

        try
        {
            headerContainer.Controls.Clear();

            UserLoginData user = (UserLoginData)db_config_sessions.GetUserAuthentication();
            OptionItems userOi = null;

            db_config_master_page dcmp = new db_config_master_page(); dcmp.Open();

            List<string> userFavorites = new List<string>();

            // user not autenticated show just public pages
            if (user == null)
            {
                dcmp.SelectPublicObjectsFromDb();
            }
            else
            {
                // user autenticated show public pages and user pages
                dcmp.SelectAuthenticatedObjectsFromDb(user.UserPages);
                userOi = new OptionItems(user.User.UserOptions);

                userFavorites = userOi.GetList("favorites");

                // prepare username to be used in error exception.
                username = user.User.Name;
            }

            // set url to use when the page start
            SelectDefaultPage(foOptions.GetSingle("default_page"), user != null
                                                                        ? userOi.GetSingle("default_frontoffice_page")
                                                                        : "");

            MenuBar mb = new MenuBar();
            mb.AddHeader("Home", "frontoffice.aspx");

            // just show data if is not refresh
            if (!IsPostBack)
            {
                mb.AddHeader("Site pages", ""); // site pages
                int headerId = mb.GetHeaderPosition("Site pages");

                db_config_page dcp;

                foreach (DbConfig.MasterPage item in dcmp.AllMasterPages)
                {
                    // just show pages that admin dont want to hide from you :)
                    List<DbConfig.Page> visiblePages = (from p in dcmp.GetAllPages(item.ID)
                                                        where (new OptionItems(p.Options).GetSingle("hidden_from_frontoffice").Equals("true")) == false
                                                        select p).ToList();

                    dcp = new db_config_page(dcmp.Db, visiblePages, item.ID);

                    if (user == null)
                        dcp.SelectPublicObjectsFromDb();
                    else
                        dcp.SelectAuthenticatedObjectsFromDb(user.UserPages);

                    // will just add master page if it has visible pages to show,
                    // if the master page does not have pages will not get here.
                    if (dcp.AllPages.Count > 0)
                    {
                        // add master page to menu
                        mb.AddMenuItem(headerId, item.Title, "");
                        int menuItemId = mb.GetMenuPosition(headerId, item.Title);

                        // add pages to sub menus
                        foreach (DbConfig.Page subItem in dcp.AllPages)
                            mb.AddSubMenuItem(headerId, menuItemId, subItem.Title, "page.aspx?nm=" + subItem.Name);
                    }

                    dcp.Close();
                }

                if (userFavorites.Count > 0) // favorites
                {
                    mb.AddHeader("Favorites", "");
                    int favItemId = mb.GetHeaderPosition("Favorites");

                    dcp = new db_config_page(dcmp.Db, new List<DbConfig.Page>(), -1); dcp.Refresh();

                    foreach (string favpage in userFavorites)
                    {
                        if (!dcp.PageExists(favpage)) continue;

                        DbConfig.Page p = dcp.Get(favpage);
                        mb.AddMenuItem(favItemId, p.Title, "page.aspx?nm=" + p.Name);
                    }

                    dcp.Close();
                }
            }

            dcmp.Close();

            headerContainer.Controls.Add(mb.Get());
            Generic.JavaScriptInjector("js", mb.GetLoginJavascript());
        }
        catch (Exception ex)
        {
            throw new Exception("error: fill menu bar for user " + username + " - " + ex.Message + " ...");
        }
    }
Exemple #26
0
        public static void Main(string [] args)
        {
            Application.Init();

            menu = new MenuBar(new MenuBarItem [] {
                new MenuBarItem("_File", new MenuItem [] {
                    new MenuItem("_Close", "", () => Close()),
                    new MenuItem("_Quit", "", () => { Application.RequestStop(); })
                }),
                new MenuBarItem("_Edit", new MenuItem [] {
                    new MenuItem("_Copy", "", Copy),
                    new MenuItem("C_ut", "", Cut),
                    new MenuItem("_Paste", "", Paste)
                }),
            });

            var login = new Label("Login: "******"Password: "******"Test: ")
            {
                X = Pos.Left(login),
                Y = Pos.Bottom(password) + 1
            };

            var surface = new Surface()
            {
                X      = 0,
                Y      = 1,
                Width  = Dim.Percent(50),
                Height = Dim.Percent(50)
            };

            var loginText = new TextField("")
            {
                X           = Pos.Right(password),
                Y           = Pos.Top(login),
                Width       = Dim.Percent(90),
                ColorScheme = new ColorScheme()
                {
                    Focus     = Attribute.Make(Color.BrightYellow, Color.DarkGray),
                    Normal    = Attribute.Make(Color.Green, Color.BrightYellow),
                    HotFocus  = Attribute.Make(Color.BrightBlue, Color.Brown),
                    HotNormal = Attribute.Make(Color.Red, Color.BrightRed),
                },
            };

            loginText.MouseEnter += LoginText_MouseEnter;
            loginText.MouseLeave += LoginText_MouseLeave;
            loginText.Enter      += LoginText_Enter;
            loginText.Leave      += LoginText_Leave;

            var passText = new TextField("")
            {
                Secret = true,
                X      = Pos.Left(loginText),
                Y      = Pos.Top(password),
                Width  = Dim.Width(loginText)
            };

            var testText = new TextField("")
            {
                X     = Pos.Left(loginText),
                Y     = Pos.Top(test),
                Width = Dim.Width(loginText)
            };

            surface.Add(login, password, test, loginText, passText, testText);
            Application.Top.Add(menu, surface);
            Application.Run();
        }
Exemple #27
0
 //
 // GET: /Home/
 public ActionResult Index()
 {
     Session["Menus"] = MenuBar.GetJson(new Guid("266e2696-bf31-4a32-865e-442e315e5f00"));
     return(View());
 }
        private static void ListBoxPopup(ScreenCollection screens)
        {
            var screen = new Screen("List Box Pop Up");

            MenuBar menuBar = Menus.SetupMenuBar(screen);

            var control1 = new ListBox();

            control1.Left        = 0;
            control1.Top         = 1;
            control1.Width       = screen.Width;
            control1.Height      = screen.Height - 2;
            control1.BorderStyle = BorderStyle.Double;

            for (int i = 0; i < 150; i++)
            {
                control1.Items.Add(string.Format("Item {0} - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua", i + 1));
            }

            screen.Controls.Add(control1);

            var textBox = new TextBox();

            textBox.BorderStyle          = BorderStyle.Double;
            textBox.Width                = 8;
            textBox.Left                 = (screen.Width / 2) - (textBox.Width / 2);
            textBox.Top                  = (screen.Height / 2) - (textBox.Height / 2);
            textBox.MaxLength            = 6;
            textBox.BackgroundColor      = System.ConsoleColor.DarkGreen;
            textBox.FocusBackgroundColor = System.ConsoleColor.DarkGreen;
            textBox.Visible              = false;
            textBox.TreatEnterKeyAsTab   = false;
            textBox.HasShadow            = true;

            screen.Controls.Add(textBox);

            screen.Footer.Text = screen.Name + ". Press C to popup a text box, enter or escape.";

            screen.Controls.Add(menuBar);

            screens.Add(screen);

            control1.KeyPressed += (s, e) =>
            {
                if (e.Info.Key == System.ConsoleKey.C)
                {
                    textBox.Visible = true;
                    textBox.Focus();
                    e.Handled = true;
                }
            };

            control1.Selected += (s, e) =>
            {
                screen.Footer.Text = control1.SelectedItem;
            };

            textBox.TextChanged += (s, e) =>
            {
                screen.Footer.Text = string.Format("{0} => {1}", e.OrignalText ?? string.Empty, e.NewText);
            };

            textBox.Leave += (s, e) =>
            {
                //textBox.Visible = false;
            };

            control1.Enter += (s, e) =>
            {
                textBox.Visible = false;
            };
        }
Exemple #29
0
        public MainForm()
        {
            Title      = "My Eto Form";
            ClientSize = new Size(400, 350);

            // scrollable region as the main content
            Content = new Scrollable
            {
                // table with three rows
                Content = new TableLayout(
                    null,
                    // row with three columns
                    new TableRow(null, new Label {
                    Text = "Hello World!"
                }, null),
                    null
                    )
            };

            // create a few commands that can be used for the menu and toolbar
            var clickMe = new Command {
                MenuText = "Click Me!", ToolBarText = "Click Me!"
            };

            clickMe.Executed += (sender, e) => MessageBox.Show(this, "I was clicked!");

            var quitCommand = new Command {
                MenuText = "Quit", Shortcut = Application.Instance.CommonModifier | Keys.Q
            };

            quitCommand.Executed += (sender, e) => Application.Instance.Quit();

            var aboutCommand = new Command {
                MenuText = "About..."
            };

            aboutCommand.Executed += (sender, e) => MessageBox.Show(this, "About my app...");

            // create menu
            Menu = new MenuBar
            {
                Items =
                {
                    // File submenu
                    new ButtonMenuItem {
                        Text = "&File", Items ={ clickMe          }
                    },
                    // new ButtonMenuItem { Text = "&Edit", Items = { /* commands/items */ } },
                    // new ButtonMenuItem { Text = "&View", Items = { /* commands/items */ } },
                },
                ApplicationItems =
                {
                    // application (OS X) or file menu (others)
                    new ButtonMenuItem {
                        Text = "&Preferences..."
                    },
                },
                QuitItem  = quitCommand,
                AboutItem = aboutCommand
            };

            // create toolbar
            ToolBar = new ToolBar {
                Items = { clickMe }
            };
        }
Exemple #30
0
        public MainForm(UIManager uiManager)
        {
            Title      = "Titan";
            ClientSize = new Size(600, 230);
            Resizable  = false;
            Icon       = uiManager.SharedResources.TITAN_ICON;

            // Selected arguments for the UI
            _targetBox = new TextBox {
                PlaceholderText = "STEAM_0:0:131983088"
            };
            _matchIDBox = new TextBox {
                PlaceholderText = "CSGO-727c4-5oCG3-PurVX-sJkdn-LsXfE"
            };
            _matchIDLabel = new Label {
                Text = "Share Link (optional)"
            };

            _dropDown = new DropDown {
                Items = { "Report", "Commend" }, SelectedIndex = 0
            };
            _dropDown.SelectedIndexChanged += OnDropDownIndexChange;

            var bombBtn = new Button {
                Text = "Bomb!"
            };

            bombBtn.Click += OnBombButtonClick;

            _uiManager = uiManager;

            Content = new TableLayout
            {
                Spacing = new Size(5, 5),
                Padding = new Padding(10, 10, 10, 10),
                Rows    =
                {
                    new TableRow(
                        new TableCell(new Label {
                        Text = "Mode"
                    }, true),
                        new TableCell(_dropDown, true)
                        ),
                    new TableRow(
                        new Label               {
                        Text = "Target"
                    },
                        _targetBox
                        ),
                    new TableRow(
                        _matchIDLabel,
                        _matchIDBox
                        ),
                    new TableRow(new TableCell(), new TableCell()),
                    new TableRow(new TableCell(), new TableCell()),
                    new TableRow(new TableCell(), new TableCell()),
                    new TableRow(
                        new TableCell(),
                        bombBtn
                        ),
                    new TableRow                {
                        ScaleHeight = true
                    }
                }
            };

            Menu = new MenuBar
            {
                Items =
                {
                    new ButtonMenuItem {
                        Text = "&Links", Items =
                        {
                            new SteamIO(),
                            new JsonValidator()
                        }
                    }
                },
                AboutItem = new About(),
                QuitItem  = new Quit()
            };
        }
 public MenuCommandService()
 {
     commands         = new ArrayList();
     this.contextMenu = new Menu();
     this.menuBar     = new MenuBar();
 }
Exemple #32
0
        void InitializeComponent()
        {
            //exception handling

            var sf = s.UIScalingFactor;

            Application.Instance.UnhandledException += (sender, e) =>
            {
                new DWSIM.UI.Desktop.Editors.UnhandledExceptionView((Exception)e.ExceptionObject).ShowModalAsync();
            };

            Title = "DWSIMLauncher".Localize();

            switch (GlobalSettings.Settings.RunningPlatform())
            {
            case GlobalSettings.Settings.Platform.Windows:
                ClientSize = new Size((int)(690 * sf), (int)(420 * sf));
                break;

            case GlobalSettings.Settings.Platform.Linux:
                ClientSize = new Size((int)(690 * sf), (int)(370 * sf));
                break;

            case GlobalSettings.Settings.Platform.Mac:
                ClientSize = new Size((int)(690 * sf), (int)(350 * sf));
                break;
            }

            Icon = Eto.Drawing.Icon.FromResource(imgprefix + "DWSIM_ico.ico");

            var bgcolor = new Color(0.051f, 0.447f, 0.651f);

            if (s.DarkMode)
            {
                bgcolor = SystemColors.ControlBackground;
            }

            Eto.Style.Add <Button>("main", button =>
            {
                button.BackgroundColor = bgcolor;
                button.Font            = new Font(FontFamilies.Sans, 12f, FontStyle.None);
                button.TextColor       = Colors.White;
                button.ImagePosition   = ButtonImagePosition.Left;
                button.Width           = (int)(sf * 250);
                button.Height          = (int)(sf * 50);
            });

            Eto.Style.Add <Button>("donate", button =>
            {
                button.BackgroundColor = !s.DarkMode ? Colors.LightYellow : SystemColors.ControlBackground;
                button.Font            = new Font(FontFamilies.Sans, 12f, FontStyle.None);
                button.TextColor       = !s.DarkMode ? bgcolor : Colors.White;
                button.ImagePosition   = ButtonImagePosition.Left;
                button.Width           = (int)(sf * 250);
                button.Height          = (int)(sf * 50);
            });

            var btn1 = new Button()
            {
                Style = "main", Text = "OpenSavedFile".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "OpenFolder_100px.png"), (int)(sf * 40), (int)(sf * 40), ImageInterpolation.Default)
            };
            var btn2 = new Button()
            {
                Style = "main", Text = "NewSimulation".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "icons8-workflow.png"), (int)(sf * 40), (int)(sf * 40), ImageInterpolation.Default)
            };
            var btn3 = new Button()
            {
                Style = "main", Text = "NewCompound".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "Peptide_100px.png"), (int)(sf * 40), (int)(sf * 40), ImageInterpolation.Default)
            };
            var btn4 = new Button()
            {
                Style = "main", Text = "NewDataRegression".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "AreaChart_100px.png"), (int)(sf * 40), (int)(sf * 40), ImageInterpolation.Default)
            };
            var btn6 = new Button()
            {
                Style = "main", Text = "User Guide".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "Help_100px.png"), (int)(sf * 40), (int)(sf * 40), ImageInterpolation.Default)
            };
            var btn7 = new Button()
            {
                Style = "main", Text = "About".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "Info_100px.png"), (int)(sf * 40), (int)(sf * 40), ImageInterpolation.Default)
            };
            var btn8 = new Button()
            {
                Style = "donate", Text = "Become a Patron", Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "icons8-patreon.png"), (int)(sf * 40), (int)(sf * 40), ImageInterpolation.Default)
            };
            var btn9 = new Button()
            {
                Style = "main", Text = "Preferences".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "ReportCard_96px.png"), (int)(sf * 40), (int)(sf * 40), ImageInterpolation.Default)
            };

            btn9.Click += (sender, e) =>
            {
                new Forms.Forms.GeneralSettings().GetForm().Show();
            };

            btn6.Click += (sender, e) =>
            {
                var basepath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                Process.Start(basepath + Path.DirectorySeparatorChar + "docs" + Path.DirectorySeparatorChar + "user_guide.pdf");
            };

            btn1.Click += (sender, e) =>
            {
                var dialog = new OpenFileDialog();
                dialog.Title = "Open File".Localize();
                dialog.Filters.Add(new FileFilter("XML Simulation File".Localize(), new[] { ".dwxml", ".dwxmz" }));
                dialog.Filters.Add(new FileFilter("Mobile XML Simulation File (Android/iOS)", new[] { ".xml" }));
                dialog.MultiSelect        = false;
                dialog.CurrentFilterIndex = 0;
                if (dialog.ShowDialog(this) == DialogResult.Ok)
                {
                    LoadSimulation(dialog.FileName);
                }
            };

            btn2.Click += (sender, e) =>
            {
                var form = new Forms.Flowsheet();
                AddUserCompounds(form.FlowsheetObject);
                OpenForms   += 1;
                form.Closed += (sender2, e2) =>
                {
                    OpenForms -= 1;
                };
                form.newsim = true;
                form.Show();
            };

            btn7.Click += (sender, e) => new AboutBox().Show();
            btn8.Click += (sender, e) => Process.Start("https://patreon.com/dwsim");

            var stack = new StackLayout {
                Orientation = Orientation.Vertical, Spacing = 5
            };

            stack.Items.Add(btn1);
            stack.Items.Add(btn2);
            stack.Items.Add(btn9);
            stack.Items.Add(btn6);
            stack.Items.Add(btn7);
            stack.Items.Add(btn8);

            var tableright = new TableLayout();

            tableright.Padding = new Padding(5, 5, 5, 5);
            tableright.Spacing = new Size(10, 10);

            MostRecentList = new TreeGridView {
                Height = (int)(sf * 330)
            };
            SampleList = new ListBox {
                BackgroundColor = bgcolor, Height = (int)(sf * 330)
            };
            FoldersList = new ListBox {
                BackgroundColor = bgcolor, Height = (int)(sf * 330)
            };
            FOSSEEList = new ListBox {
                BackgroundColor = bgcolor, Height = (int)(sf * 330)
            };

            if (Application.Instance.Platform.IsGtk &&
                GlobalSettings.Settings.RunningPlatform() == GlobalSettings.Settings.Platform.Mac)
            {
                SampleList.TextColor  = bgcolor;
                FoldersList.TextColor = bgcolor;
                FOSSEEList.TextColor  = bgcolor;
            }
            else if (GlobalSettings.Settings.RunningPlatform() == GlobalSettings.Settings.Platform.Mac)
            {
                SampleList.BackgroundColor  = SystemColors.ControlBackground;
                FoldersList.BackgroundColor = SystemColors.ControlBackground;
                FOSSEEList.BackgroundColor  = SystemColors.ControlBackground;
                SampleList.TextColor        = SystemColors.ControlText;
                FoldersList.TextColor       = SystemColors.ControlText;
                FOSSEEList.TextColor        = SystemColors.ControlText;
            }
            else
            {
                SampleList.TextColor  = Colors.White;
                FoldersList.TextColor = Colors.White;
                FOSSEEList.TextColor  = Colors.White;
            }

            MostRecentList.AllowMultipleSelection = false;
            MostRecentList.ShowHeader             = true;
            MostRecentList.Columns.Clear();
            MostRecentList.Columns.Add(new GridColumn {
                DataCell = new ImageViewCell(0)
                {
                    ImageInterpolation = ImageInterpolation.High
                }
            });
            MostRecentList.Columns.Add(new GridColumn {
                DataCell = new TextBoxCell(1), HeaderText = "Name", Sortable = true
            });
            MostRecentList.Columns.Add(new GridColumn {
                DataCell = new TextBoxCell(2), HeaderText = "Date", Sortable = true
            });
            MostRecentList.Columns.Add(new GridColumn {
                DataCell = new TextBoxCell(3), HeaderText = "DWSIM Version", Sortable = true
            });
            MostRecentList.Columns.Add(new GridColumn {
                DataCell = new TextBoxCell(4), HeaderText = "Operating System", Sortable = true
            });

            var invertedlist = new List <string>(GlobalSettings.Settings.MostRecentFiles);

            invertedlist.Reverse();

            var tgc = new TreeGridItemCollection();

            foreach (var item in invertedlist)
            {
                if (File.Exists(item))
                {
                    var li   = new TreeGridItem();
                    var data = new Dictionary <string, string>();
                    if (Path.GetExtension(item).ToLower() == ".dwxmz")
                    {
                        data = SharedClasses.Utility.GetSimulationFileDetails(FlowsheetBase.FlowsheetBase.LoadZippedXMLDoc(item));
                    }
                    else
                    {
                        data = SharedClasses.Utility.GetSimulationFileDetails(XDocument.Load(item));
                    }
                    li.Tag = data;
                    data.Add("Path", item);
                    DateTime dt;
                    if (data.ContainsKey("SavedOn"))
                    {
                        dt = DateTime.Parse(data["SavedOn"]);
                    }
                    else
                    {
                        dt = File.GetLastWriteTime(item);
                    }
                    string dwsimver, osver;
                    if (data.ContainsKey("DWSIMVersion"))
                    {
                        dwsimver = data["DWSIMVersion"];
                    }
                    else
                    {
                        dwsimver = "N/A";
                    }
                    if (data.ContainsKey("OSInfo"))
                    {
                        osver = data["OSInfo"];
                    }
                    else
                    {
                        osver = "N/A";
                    }
                    li.Values = new object[] { new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "icons8-workflow.png")).WithSize(16, 16),
                                               System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(Path.GetFileNameWithoutExtension(item)),
                                               dt, dwsimver, osver };
                    tgc.Add(li);
                }
            }

            tgc = new TreeGridItemCollection(tgc.OrderByDescending(x => ((DateTime)((TreeGridItem)x).Values[2]).Ticks));

            MostRecentList.DataStore = tgc;

            var samplist = Directory.EnumerateFiles(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "samples"), "*.dwxm*");

            foreach (var item in samplist)
            {
                if (File.Exists(item))
                {
                    SampleList.Items.Add(new ListItem {
                        Text = Path.GetFileNameWithoutExtension(item), Key = item
                    });
                }
            }

            foreach (String f in invertedlist)
            {
                if (Path.GetExtension(f).ToLower() != ".dwbcs")
                {
                    if (FoldersList.Items.Where((x) => x.Text == Path.GetDirectoryName(f)).Count() == 0)
                    {
                        if (Directory.Exists(Path.GetDirectoryName(f)))
                        {
                            FoldersList.Items.Add(new ListItem {
                                Text = Path.GetDirectoryName(f), Key = Path.GetDirectoryName(f)
                            });
                        }
                    }
                }
            }

            FOSSEEList.Items.Add(new ListItem {
                Text = "Downloading flowsheet list, please wait...", Key = ""
            });

            Dictionary <string, SharedClasses.FOSSEEFlowsheet> fslist = new Dictionary <string, SharedClasses.FOSSEEFlowsheet>();

            Task.Factory.StartNew(() =>
            {
                return(SharedClasses.FOSSEEFlowsheets.GetFOSSEEFlowsheets());
            }).ContinueWith((t) =>
            {
                Application.Instance.Invoke(() =>
                {
                    FOSSEEList.Items.Clear();
                    if (t.Exception != null)
                    {
                        FOSSEEList.Items.Add(new ListItem {
                            Text = "Error loading flowsheet list. Check your internet connection.", Key = ""
                        });
                    }
                    else
                    {
                        foreach (var item in t.Result)
                        {
                            fslist.Add(item.DownloadLink, item);
                            FOSSEEList.Items.Add(new ListItem {
                                Text = item.DisplayName, Key = item.DownloadLink
                            });
                        }
                    }
                });
            });

            FoldersList.SelectedIndexChanged += (sender, e) =>
            {
                if (FoldersList.SelectedIndex >= 0)
                {
                    var dialog = new OpenFileDialog();
                    dialog.Title     = "Open File".Localize();
                    dialog.Directory = new Uri(FoldersList.SelectedKey);
                    dialog.Filters.Add(new FileFilter("XML Simulation File".Localize(), new[] { ".dwxml", ".dwxmz" }));
                    dialog.MultiSelect        = false;
                    dialog.CurrentFilterIndex = 0;
                    if (dialog.ShowDialog(this) == DialogResult.Ok)
                    {
                        LoadSimulation(dialog.FileName);
                    }
                }
            };

            MostRecentList.SelectedItemChanged += (sender, e) =>
            {
                if (MostRecentList.SelectedItem != null)
                {
                    var si   = (TreeGridItem)MostRecentList.SelectedItem;
                    var data = (Dictionary <string, string>)si.Tag;
                    LoadSimulation(data["Path"]);
                    //MostRecentList.SelectedIndex = -1;
                }
                ;
            };

            SampleList.SelectedIndexChanged += (sender, e) =>
            {
                if (SampleList.SelectedIndex >= 0)
                {
                    LoadSimulation(SampleList.SelectedKey);
                    //MostRecentList.SelectedIndex = -1;
                }
                ;
            };

            FOSSEEList.SelectedIndexChanged += (sender, e) =>
            {
                if (FOSSEEList.SelectedIndex >= 0 && FOSSEEList.SelectedKey != "")
                {
                    var item = fslist[FOSSEEList.SelectedKey];
                    var sb   = new StringBuilder();
                    sb.AppendLine("Title: " + item.Title);
                    sb.AppendLine("Author: " + item.ProposerName);
                    sb.AppendLine("Institution: " + item.Institution);
                    sb.AppendLine();
                    sb.AppendLine("Click 'Yes' to download and open this flowsheet.");

                    if (MessageBox.Show(sb.ToString(), "Open FOSSEE Flowsheet", MessageBoxButtons.YesNo, MessageBoxType.Information, MessageBoxDefaultButton.Yes) == DialogResult.Yes)
                    {
                        var loadingdialog = new LoadingData();
                        loadingdialog.loadingtext.Text = "Please wait, downloading file...\n(" + FOSSEEList.SelectedKey + ")";
                        loadingdialog.Show();
                        var address = FOSSEEList.SelectedKey;
                        Task.Factory.StartNew(() =>
                        {
                            return(SharedClasses.FOSSEEFlowsheets.DownloadFlowsheet(address, (p) =>
                            {
                                Application.Instance.Invoke(() => loadingdialog.loadingtext.Text = "Please wait, downloading file... (" + p + "%)\n(" + address + ")");
                            }));
                        }).ContinueWith((t) =>
                        {
                            Application.Instance.Invoke(() => loadingdialog.Close());
                            if (t.Exception != null)
                            {
                                MessageBox.Show(t.Exception.Message, "Error downloading file", MessageBoxButtons.OK, MessageBoxType.Error, MessageBoxDefaultButton.OK);
                            }
                            else
                            {
                                Application.Instance.Invoke(() => LoadSimulation(SharedClasses.FOSSEEFlowsheets.LoadFlowsheet(t.Result)));
                            }
                        });
                        FOSSEEList.SelectedIndex = -1;
                    }
                }
                ;
            };

            var fosseecontainer = c.GetDefaultContainer();
            var l1  = c.CreateAndAddLabelRow3(fosseecontainer, "About the Project");
            var l2  = c.CreateAndAddDescriptionRow(fosseecontainer, "FOSSEE, IIT Bombay, invites chemical engineering students, faculty and practitioners to the flowsheeting project using DWSIM. We want you to convert existing flowsheets into DWSIM and get honoraria and certificates.");
            var bu1 = c.CreateAndAddButtonRow(fosseecontainer, "Submit a Flowsheet", null, (b1, e1) => Process.Start("https://dwsim.fossee.in/flowsheeting-project"));
            var bu2 = c.CreateAndAddButtonRow(fosseecontainer, "About FOSSEE", null, (b2, e2) => Process.Start("https://fossee.in/"));
            var l3  = c.CreateAndAddLabelRow3(fosseecontainer, "Completed Flowsheets");

            if (GlobalSettings.Settings.RunningPlatform() == GlobalSettings.Settings.Platform.Mac)
            {
                fosseecontainer.BackgroundColor = SystemColors.ControlBackground;
            }
            else
            {
                fosseecontainer.BackgroundColor = bgcolor;
                l1.TextColor        = Colors.White;
                l2.TextColor        = Colors.White;
                l3.TextColor        = Colors.White;
                bu1.TextColor       = Colors.White;
                bu2.TextColor       = Colors.White;
                bu1.BackgroundColor = bgcolor;
                bu2.BackgroundColor = bgcolor;
            }
            fosseecontainer.Add(FOSSEEList);
            fosseecontainer.EndVertical();

            var tabview = new TabControl();
            var tab1    = new TabPage(MostRecentList)
            {
                Text = "Recent Files"
            };;
            var tab2 = new TabPage(SampleList)
            {
                Text = "Samples"
            };;
            var tab2a = new TabPage(fosseecontainer)
            {
                Text = "FOSSEE Flowsheets"
            };;
            var tab3 = new TabPage(FoldersList)
            {
                Text = "Recent Folders"
            };;

            tabview.Pages.Add(tab1);
            tabview.Pages.Add(tab2);
            tabview.Pages.Add(tab2a);
            tabview.Pages.Add(tab3);

            tableright.Rows.Add(new TableRow(tabview));

            var tl = new DynamicLayout();

            tl.Add(new TableRow(stack, tableright));

            TableContainer = new TableLayout
            {
                Padding = 10,
                Spacing = new Size(5, 5),
                Rows    = { new TableRow(tl) }
            };

            if (GlobalSettings.Settings.RunningPlatform() == GlobalSettings.Settings.Platform.Mac)
            {
                TableContainer.BackgroundColor = SystemColors.ControlBackground;
            }
            else
            {
                TableContainer.BackgroundColor = bgcolor;
            }


            Content = TableContainer;

            var quitCommand = new Command {
                MenuText = "Quit".Localize(), Shortcut = Application.Instance.CommonModifier | Keys.Q
            };

            quitCommand.Executed += (sender, e) =>
            {
                try
                {
                    DWSIM.GlobalSettings.Settings.SaveSettings("dwsim_newui.ini");
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this, ex.Message, "Error Saving Settings to File", MessageBoxButtons.OK, MessageBoxType.Error, MessageBoxDefaultButton.OK);
                }
                if (MessageBox.Show(this, "ConfirmAppExit".Localize(), "AppExit".Localize(), MessageBoxButtons.YesNo, MessageBoxType.Information, MessageBoxDefaultButton.No) == DialogResult.Yes)
                {
                    Application.Instance.Quit();
                }
            };

            var aboutCommand = new Command {
                MenuText = "About".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "information.png"))
            };

            aboutCommand.Executed += (sender, e) => new AboutBox().Show();

            var aitem1 = new ButtonMenuItem {
                Text = "Preferences".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "icons8-sorting_options.png"))
            };

            aitem1.Click += (sender, e) =>
            {
                new Forms.Forms.GeneralSettings().GetForm().Show();
            };

            var hitem1 = new ButtonMenuItem {
                Text = "User Guide".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "help_browser.png"))
            };

            hitem1.Click += (sender, e) =>
            {
                var basepath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                Process.Start(basepath + Path.DirectorySeparatorChar + "docs" + Path.DirectorySeparatorChar + "user_guide.pdf");
            };

            var hitem2 = new ButtonMenuItem {
                Text = "Support".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "help_browser.png"))
            };

            hitem2.Click += (sender, e) =>
            {
                Process.Start("http://dwsim.inforside.com.br/wiki/index.php?title=Support");
            };

            var hitem3 = new ButtonMenuItem {
                Text = "Report a Bug".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "help_browser.png"))
            };

            hitem3.Click += (sender, e) =>
            {
                Process.Start("https://sourceforge.net/p/dwsim/tickets/");
            };

            var hitem4 = new ButtonMenuItem {
                Text = "Go to DWSIM's Website".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "help_browser.png"))
            };

            hitem4.Click += (sender, e) =>
            {
                Process.Start("http://dwsim.inforside.com.br");
            };

            // create menu
            Menu = new MenuBar
            {
                ApplicationItems = { aitem1 },
                QuitItem         = quitCommand,
                HelpItems        = { hitem1, hitem4, hitem2, hitem3 },
                AboutItem        = aboutCommand
            };

            Shown += MainForm_Shown;

            Closing += MainForm_Closing;

            //Plugins

            LoadPlugins();
        }
Exemple #33
0
	public static void Main(string [] args)
	{
		Application.Init();

		Window w = new Window("EFL# Demo App");
		
		VBox vbx = new VBox ();
		vbx.Spacing = 4;
		
		MenuBar mb = new MenuBar();
		
		vbx.PackStart (mb, false, false, 0);
		
		MenuItem item = new MenuItem ("File");
		Menu file_menu = new Menu ();
		item.Submenu = file_menu;
		
		MenuItem file_item = new MenuItem ("Open");
		file_item.Activated += FileOpenHandler;
		file_menu.Append (file_item);
		
		file_item = new MenuItem ("Close");
		file_menu.Append (file_item);
		
		file_item = new MenuItem ("Save");
		file_menu.Append (file_item);
		
		file_item = new MenuItem ("Save As");
                file_menu.Append (file_item);
		
		file_item = new MenuItem ("Quit");
		file_item.Activated += FileQuitHandler;		
                file_menu.Append (file_item);
		
		mb.Append (item);
		
		item = new MenuItem ("Edit");
		Menu edit_menu = new Menu ();
		item.Submenu = edit_menu;
		mb.Append (item);
		
		item = new MenuItem ("About");
		Menu about_menu = new Menu ();		
		item.Submenu = about_menu;
		
		MenuItem about_item = new MenuItem ("Help");
		about_item.Activated += AboutHelpHandler;
		about_menu.Append (about_item);
		
		about_item = new MenuItem ("Authors");
		about_item.Activated += AboutAuthorsHandler;
		about_menu.Append (about_item);
		
		mb.Append (item);
				
		HBox bx = new HBox ();
		
		vbx.PackStart (bx);
		
		bx.Spacing = 0;
		Button l1 = new Button ("one");		
		Button l2 = new Button ("two");
		Button l3 = new Button ("three");
		Button l4 = new Button ("four");
		Button l5 = new Button ("five");		

		l5.Clicked +=  Button_Clicked;
		
		bx.PackStart(l1);
		bx.PackStart(l2);
		bx.PackStart(l3);
		bx.PackStart(l4);
		bx.PackStart(l5);
		
		Label input_label = new Label ("What is your name?");
		input_label.Xalign = 0.5f;
		input_label.Yalign = 1;
		vbx.PackStart (input_label);
		Entry input = new Entry ();
		vbx.PackStart (input);
		
		w.Add(vbx);
		//w.SetDefaultSize(300, 200);
		w.ShowAll();
		
		Application.Run();
	}
        void KeyDownFunction(KeyEventArgs args)
        {
            if (args.Key == Keys.Enter)
            {
                Window window = new Window(this, gui);
                window.Width  = 320;
                window.Height = 380;
                window.Close += new CloseHandler(WindowCloseFunction);

                string text = "Test Window " + windowNumber;
                window.TitleText = text;
                windowNumber++;

                ComboBox comboBox = new ComboBox(this, gui);
                comboBox.IsEditable = true;
                comboBox.ZOrder     = 1.0f;
                comboBox.X          = 20;
                comboBox.Y          = 54;

                for (int i = 0; i < 3; i++)
                {
                    comboBox.AddEntry("Test");
                }

                window.Add(comboBox);

                RadioButton radio1 = new RadioButton(this, gui);
                radio1.X    = 0;
                radio1.Y    = 0;
                radio1.Text = "Radio Test 1";

                RadioButton radio2 = new RadioButton(this, gui);
                radio2.X    = 0;
                radio2.Y    = 16;
                radio2.Text = "Radio Test 2";

                RadioButton radio3 = new RadioButton(this, gui);
                radio3.X    = 0;
                radio3.Y    = 32;
                radio3.Text = "Radio Test 3";

                RadioGroup group = new RadioGroup(this, gui);
                group.X      = 20;
                group.Y      = 89;
                group.Width  = 200;
                group.Height = 48;
                group.ZOrder = 1.0f;
                group.Add(radio1);
                group.Add(radio2);
                group.Add(radio3);

                window.Add(group);

                ListBox listBox = new ListBox(this, gui);
                listBox.X      = 20;
                listBox.Y      = 144;
                listBox.ZOrder = 1.0f;

                for (int i = 0; i < 15; i++)
                {
                    listBox.AddEntry("List Box Test " + (i + 1));
                }

                window.Add(listBox);

                MenuBar    menuBar = new MenuBar(this, gui);
                MenuButton item1   = new MenuButton(this, gui);
                item1.Text = "File";
                menuBar.Add(item1);
                MenuButton item2 = new MenuButton(this, gui);
                item2.Text      = "Edit";
                item2.IsEnabled = false;
                item2.IsEnabled = true;
                menuBar.Add(item2);

                MenuButton fileItem1 = new MenuButton(this, gui);
                fileItem1.Text       = "New";
                fileItem1.IconSource = new Rectangle(1, 189, 14, 14);
                fileItem1.IsEnabled  = false;
                item1.Add(fileItem1);
                MenuSeparator fileItem2 = new MenuSeparator(this, gui);
                item1.Add(fileItem2);
                MenuButton fileItem3 = new MenuButton(this, gui);
                fileItem3.Text       = "Close";
                fileItem3.IconSource = new Rectangle(16, 189, 15, 13);
                item1.Add(fileItem3);

                MenuButton item4 = new MenuButton(this, gui);
                item4.Text      = "Community";
                item4.IsEnabled = true;
                item2.Add(item4);
                MenuSeparator sep2 = new MenuSeparator(this, gui);
                item2.Add(sep2);
                MenuButton item5 = new MenuButton(this, gui);
                item5.Text = "Next Test";
                item4.Add(item5);
                MenuButton item6 = new MenuButton(this, gui);
                item6.Text            = "The Next Level!";
                item6.ShowMarginImage = false;
                item2.Add(item6);
                MenuButton item7 = new MenuButton(this, gui);
                item7.Text = "Booyeah ;-)";
                item6.Add(item7);
                window.Add(menuBar);

                gui.Add(window);

                MessageBox dialog = new MessageBox(this, gui, "Message box asking user a question.", "Message Box", MessageBoxButtons.Yes_No_Cancel, MessageBoxType.Question);
                dialog.Show(false);

                if (before == 1)
                {
                    gui.ApplySkin(skin, true, true);
                }

                before++;
            }
            else if (args.Key == Keys.A)
            {
                SkinnedComponent skin = new SkinnedComponent(this, gui);
            }
        }
Exemple #35
0
    MenuBar CreateMenuBar()
    {
        MenuBar mb = new MenuBar();
        AccelGroup agrp = new AccelGroup();
        AddAccelGroup(agrp);

        Menu fileMenu = new Menu();
        MenuItem item = new MenuItem("_File");
        item.Submenu = fileMenu;
        mb.Append(item);

        item = new ImageMenuItem(Stock.Quit, agrp);
        item.Activated += OnMenuQuit;
        fileMenu.Append(item);

        Menu viewMenu = new Menu();
        item = new MenuItem("_View");
        item.Submenu = viewMenu;
        mb.Append(item);

        item = new ImageMenuItem(Stock.ZoomIn, agrp);
        item.Activated += OnZoomIn;
        viewMenu.Append(item);

        item = new ImageMenuItem(Stock.ZoomOut, agrp);
        item.Activated += OnZoomOut;
        viewMenu.Append(item);

        item = new ImageMenuItem(Stock.Refresh, agrp);
        item.Activated += OnReload;
        viewMenu.Append(item);

        CheckMenuItem cmi = new CheckMenuItem("_Automatic reload");
        cmi.Active = true;
        cmi.Toggled += OnToggleAuto;
        viewMenu.Append(cmi);

        return mb;
    }
Exemple #36
0
        static void Main(string[] args)
        {
            Application.Init();
            var top = Application.Top;

            var win = new Window("MyApp")
            {
                X      = 0,
                Y      = 1,
                Width  = Dim.Fill(),
                Height = Dim.Fill(),
            };

            top.Add(win);

            var menu = new MenuBar(new MenuBarItem[] {
                new MenuBarItem("_File", new MenuItem [] {
                    new MenuItem("_New", "Creates new file", NewFile),
                    new MenuItem("_Close", "", () => Close()),
                    new MenuItem("_Quit", "", () => { if (Quit())
                                                      {
                                                          top.Running = false;
                                                      }
                                 })
                }),
                new MenuBarItem("_Edit", new MenuItem [] {
                    new MenuItem("_Copy", "", null),
                    new MenuItem("C_ut", "", null),
                    new MenuItem("_Paste", "", null)
                })
            });

            top.Add(menu);

            var login = new Label("Login: "******"Password: "******"")
            {
                X     = Pos.Right(password),
                Y     = Pos.Top(login),
                Width = 40
            };
            var passText = new TextField("")
            {
                Secret = true,
                X      = Pos.Left(loginText),
                Y      = Pos.Top(password),
                Width  = Dim.Width(loginText)
            };

            var rect = new Rect()
            {
                X      = 3,
                Y      = 6,
                Width  = 113,
                Height = 17
            };
            var display = new TextView(rect);

            display.ColorScheme = Colors.Menu;

            var inputTextField = new TextField("")
            {
                X     = 3,
                Y     = Pos.Bottom(display) + 1,
                Width = 105
            };
            var sendButton = new Button("送信")
            {
                X     = Pos.Right(inputTextField),
                Y     = Pos.Top(inputTextField),
                Width = 6
            };

            win.Add(
                login,
                password,
                loginText,
                passText,
                display,
                inputTextField,
                sendButton
                );


            Application.Run();
        }
Exemple #37
0
        /// <summary>
        /// Create all controls. This gets called once and the controls remain with their state between Sceanrio runs.
        /// </summary>
        private static void Setup()
        {
            // Set this here because not initilzied until driver is loaded
            _baseColorScheme = Colors.Base;

            StringBuilder aboutMessage = new StringBuilder();

            aboutMessage.AppendLine();
            aboutMessage.AppendLine(GetAppTitle());
            aboutMessage.AppendLine();
            aboutMessage.AppendLine("SmartThings Terminal - a terminal for the SmartThings REST API");
            aboutMessage.AppendLine();
            aboutMessage.AppendLine("SmartThings REST API: https://smartthings.developer.samsung.com/docs/api-ref/st-api.html");
            aboutMessage.AppendLine();
            aboutMessage.AppendLine($"Version: {typeof(Program).Assembly.GetName().Version}");
            aboutMessage.AppendLine($"Using Terminal.Gui Version: {typeof(Terminal.Gui.Application).Assembly.GetName().Version}");
            aboutMessage.AppendLine();

            _menu = new MenuBar(new MenuBarItem[] {
                new MenuBarItem("_File", new MenuItem [] {
                    new MenuItem("_Quit", "", () => Application.RequestStop())
                }),
                new MenuBarItem("_Color Scheme", CreateColorSchemeMenuItems()),
                //new MenuBarItem ("_Diagostics", CreateDiagnosticMenuItems()),
                new MenuBarItem("_About...", "About this app", () => MessageBox.Query("About SmartThings Terminal", aboutMessage.ToString(), "Ok")),
            });

            _leftPane = new FrameView("API")
            {
                X        = 0,
                Y        = 1, // for menu
                Width    = 40,
                Height   = Dim.Fill(1),
                CanFocus = false,
            };

            _categories       = Scenario.GetAllCategories().OrderBy(c => c).ToList();
            _categoryListView = new ListView(_categories)
            {
                X             = 0,
                Y             = 0,
                Width         = Dim.Fill(0),
                Height        = Dim.Fill(0),
                AllowsMarking = false,
                CanFocus      = true,
            };
            _categoryListView.OpenSelectedItem += (a) =>
            {
                _top.SetFocus(_rightPane);
            };
            _categoryListView.SelectedItemChanged += CategoryListView_SelectedChanged;
            _leftPane.Add(_categoryListView);

            Label appNameView = new Label()
            {
                X = 0, Y = 0, Height = Dim.Fill(), Width = Dim.Fill()
            };

            StringBuilder sbTitle = new StringBuilder();

            appNameView.Text = GetAppTitle();

            _appTitlePane = new FrameView()
            {
                X        = 25,
                Y        = 1, // for menu
                Width    = Dim.Fill(),
                Height   = 9,
                CanFocus = false
            };
            _appTitlePane.Add(appNameView);

            _rightPane = new FrameView("API Description")
            {
                X = 25,
                //Y = 1, // for menu
                Y        = Pos.Bottom(_appTitlePane),
                Width    = Dim.Fill(),
                Height   = Dim.Fill(1),
                CanFocus = true,
            };

            _nameColumnWidth  = Scenario.ScenarioMetadata.GetName(_scenarios.OrderByDescending(t => Scenario.ScenarioMetadata.GetName(t).Length).FirstOrDefault()).Length;
            _scenarioListView = new ListView()
            {
                X             = 0,
                Y             = 0,
                Width         = Dim.Fill(0),
                Height        = Dim.Fill(0),
                AllowsMarking = false,
                CanFocus      = true,
            };

            _scenarioListView.OpenSelectedItem += _scenarioListView_OpenSelectedItem;
            _rightPane.Add(_scenarioListView);

            _categoryListView.SelectedItem = 0;
            _categoryListView.OnSelectedChanged();

            _capslock   = new StatusItem(Key.CharMask, "Caps", null);
            _numlock    = new StatusItem(Key.CharMask, "Num", null);
            _scrolllock = new StatusItem(Key.CharMask, "Scroll", null);

            _statusBar = new StatusBar(new StatusItem[] {
                _capslock,
                _numlock,
                _scrolllock,
                new StatusItem(Key.ControlR, "~CTRL-R~ Refresh Data", () => {
                    _stClient.ResetData();
                }),
                new StatusItem(Key.ControlQ, "~CTRL-Q~ Back/Quit", () => {
                    if (_runningScenario is null)
                    {
                        // This causes GetScenarioToRun to return null
                        _runningScenario = null;
                        Application.RequestStop();
                    }
                    else
                    {
                        _runningScenario.RequestStop();
                    }
                }),
            });
 public RecoverPage(IWebDriver webDriver, Uri baseUri)
     : base(webDriver, baseUri, PageTitles.RECOVER)
 {
     MenuBar = new MenuBar(webDriver, baseUri);
 }
Exemple #39
0
        void SetupGUI()
        {
            var height = Application.Lines - 4;

            left   = Panel.Create(this, "left", 4);
            right  = Panel.Create(this, "right", 4);
            bar    = new ButtonBar(bar_labels);
            menu   = new MenuBar(mc_menu);
            prompt = new Label(0, Application.Lines - 2, "bash$ acción ")
            {
                Color = Application.ColorBasic
            };
            entry = new Entry(prompt.Text.Length, Application.Lines - 2, Application.Cols - prompt.Text.Length, "")
            {
                Color    = Application.ColorBasic,
                CanFocus = false,
            };

            bar.Action += delegate(int n){
                switch (n)
                {
                case 3:
                    var selected = CurrentPanel.SelectedNode;
                    if (selected is Listing.DirNode)
                    {
                        CurrentPanel.ChangeDir(selected as Listing.DirNode);
                    }
                    else
                    {
                        Stream stream;
                        try {
                            stream = File.OpenRead(CurrentPanel.SelectedPath);
                        } catch (IOException ioe) {
                            Message.Error(ioe, "Could not open file", CurrentPanel.SelectedPath);
                            return;
                        }
                        FullView.Show(stream);

                        stream.Dispose();
                    }
                    break;

                case 5:
                    CurrentPanel.Copy(OtherPanel.CurrentPath);
                    break;

                case 9:
                    menu.Activate(0);
                    break;

                case 10:
                    var r = MessageBox.Query(56, 7, "Midnight Commander NG", "Do you really want to quit?", "Yes", "No");
                    if (r == 0)
                    {
                        Running = false;
                    }
                    break;

                default:
                    break;
                }
            };

            Add(left);
            Add(right);
            Add(bar);
            Add(menu);
            Add(prompt);
            Add(entry);

            SetFocus(left);
        }
Exemple #40
0
        public override void Init(Toplevel top, ColorScheme colorScheme)
        {
            Application.Init();
            Top = top;
            if (Top == null)
            {
                Top = Application.Top;
            }

            Win = new Window(_fileName ?? "Untitled")
            {
                X           = 0,
                Y           = 1,
                Width       = Dim.Fill(),
                Height      = Dim.Fill(),
                ColorScheme = colorScheme,
            };
            Top.Add(Win);

            _textView = new TextView()
            {
                X            = 0,
                Y            = 0,
                Width        = Dim.Fill(),
                Height       = Dim.Fill(),
                BottomOffset = 1,
                RightOffset  = 1
            };

            CreateDemoFile(_fileName);

            LoadFile();

            Win.Add(_textView);

            var menu = new MenuBar(new MenuBarItem [] {
                new MenuBarItem("_File", new MenuItem [] {
                    new MenuItem("_New", "", () => New()),
                    new MenuItem("_Open", "", () => Open()),
                    new MenuItem("_Save", "", () => Save()),
                    new MenuItem("_Save As", "", () => SaveAs()),
                    new MenuItem("_Close", "", () => CloseFile()),
                    null,
                    new MenuItem("_Quit", "", () => Quit()),
                }),
                new MenuBarItem("_Edit", new MenuItem [] {
                    new MenuItem("_Copy", "", () => Copy(), null, null, Key.CtrlMask | Key.C),
                    new MenuItem("C_ut", "", () => Cut(), null, null, Key.CtrlMask | Key.W),
                    new MenuItem("_Paste", "", () => Paste(), null, null, Key.CtrlMask | Key.Y),
                    null,
                    new MenuItem("_Find", "", () => Find(), null, null, Key.CtrlMask | Key.S),
                    new MenuItem("Find _Next", "", () => FindNext(), null, null, Key.CtrlMask | Key.ShiftMask | Key.S),
                    new MenuItem("Find P_revious", "", () => FindPrevious(), null, null, Key.CtrlMask | Key.ShiftMask | Key.AltMask | Key.S),
                    new MenuItem("_Replace", "", () => Replace(), null, null, Key.CtrlMask | Key.R),
                    new MenuItem("Replace Ne_xt", "", () => ReplaceNext(), null, null, Key.CtrlMask | Key.ShiftMask | Key.R),
                    new MenuItem("Replace Pre_vious", "", () => ReplacePrevious(), null, null, Key.CtrlMask | Key.ShiftMask | Key.AltMask | Key.R),
                    new MenuItem("Replace _All", "", () => ReplaceAll(), null, null, Key.CtrlMask | Key.ShiftMask | Key.AltMask | Key.A),
                    null,
                    new MenuItem("_Select All", "", () => SelectAll(), null, null, Key.CtrlMask | Key.T)
                }),
                new MenuBarItem("_ScrollBarView", CreateKeepChecked()),
                new MenuBarItem("_Cursor", new MenuItem [] {
                    new MenuItem("_Invisible", "", () => SetCursor(CursorVisibility.Invisible)),
                    new MenuItem("_Box", "", () => SetCursor(CursorVisibility.Box)),
                    new MenuItem("_Underline", "", () => SetCursor(CursorVisibility.Underline)),
                    new MenuItem("", "", () => {}, () => { return(false); }),
                    new MenuItem("xTerm :", "", () => {}, () => { return(false); }),
                    new MenuItem("", "", () => {}, () => { return(false); }),
                    new MenuItem("  _Default", "", () => SetCursor(CursorVisibility.Default)),
                    new MenuItem("  _Vertical", "", () => SetCursor(CursorVisibility.Vertical)),
                    new MenuItem("  V_ertical Fix", "", () => SetCursor(CursorVisibility.VerticalFix)),
                    new MenuItem("  B_ox Fix", "", () => SetCursor(CursorVisibility.BoxFix)),
                    new MenuItem("  U_nderline Fix", "", () => SetCursor(CursorVisibility.UnderlineFix))
                }),
                new MenuBarItem("Forma_t", new MenuItem [] {
                    CreateWrapChecked(),
                    CreateAutocomplete(),
                    CreateAllowsTabChecked()
                }),
                new MenuBarItem("_Responder", new MenuItem [] {
                    CreateCanFocusChecked(),
                    CreateEnabledChecked(),
                    CreateVisibleChecked()
                }),
            });

            Top.Add(menu);

            var statusBar = new StatusBar(new StatusItem [] {
                new StatusItem(Key.F2, "~F2~ Open", () => Open()),
                new StatusItem(Key.F3, "~F3~ Save", () => Save()),
                new StatusItem(Key.F4, "~F4~ Save As", () => SaveAs()),
                new StatusItem(Key.CtrlMask | Key.Q, "~^Q~ Quit", () => Quit()),
                new StatusItem(Key.Null, $"OS Clipboard IsSupported : {Clipboard.IsSupported}", null)
            });

            Top.Add(statusBar);

            _scrollBar = new ScrollBarView(_textView, true);

            _scrollBar.ChangedPosition += () => {
                _textView.TopRow = _scrollBar.Position;
                if (_textView.TopRow != _scrollBar.Position)
                {
                    _scrollBar.Position = _textView.TopRow;
                }
                _textView.SetNeedsDisplay();
            };

            _scrollBar.OtherScrollBarView.ChangedPosition += () => {
                _textView.LeftColumn = _scrollBar.OtherScrollBarView.Position;
                if (_textView.LeftColumn != _scrollBar.OtherScrollBarView.Position)
                {
                    _scrollBar.OtherScrollBarView.Position = _textView.LeftColumn;
                }
                _textView.SetNeedsDisplay();
            };

            _scrollBar.VisibleChanged += () => {
                if (_scrollBar.Visible && _textView.RightOffset == 0)
                {
                    _textView.RightOffset = 1;
                }
                else if (!_scrollBar.Visible && _textView.RightOffset == 1)
                {
                    _textView.RightOffset = 0;
                }
            };

            _scrollBar.OtherScrollBarView.VisibleChanged += () => {
                if (_scrollBar.OtherScrollBarView.Visible && _textView.BottomOffset == 0)
                {
                    _textView.BottomOffset = 1;
                }
                else if (!_scrollBar.OtherScrollBarView.Visible && _textView.BottomOffset == 1)
                {
                    _textView.BottomOffset = 0;
                }
            };

            _textView.DrawContent += (e) => {
                _scrollBar.Size     = _textView.Lines;
                _scrollBar.Position = _textView.TopRow;
                if (_scrollBar.OtherScrollBarView != null)
                {
                    _scrollBar.OtherScrollBarView.Size     = _textView.Maxlength;
                    _scrollBar.OtherScrollBarView.Position = _textView.LeftColumn;
                }
                _scrollBar.LayoutSubviews();
                _scrollBar.Refresh();
            };

            Win.KeyPress += (e) => {
                if (winDialog != null && (e.KeyEvent.Key == Key.Esc ||
                                          e.KeyEvent.Key == (Key.Q | Key.CtrlMask)))
                {
                    DisposeWinDialog();
                }
                else if (e.KeyEvent.Key == (Key.Q | Key.CtrlMask))
                {
                    Quit();
                    e.Handled = true;
                }
            };
        }
Exemple #41
0
        public void DynamicallyAddedItemsShouldValidateAndDisable()
        {
            bool disabledWasClicked = false;
            int  validateWasCalled  = 0;

            void AddMenuItems(ISubmenu submenu, Window window, int initialItems = 0)
            {
                if (submenu.Items.Count > initialItems)
                {
                    return;
                }

                var commandButton = new Command {
                    MenuText = "A Command Item"
                };

                commandButton.Executed += (sender, e) => Log.Write(sender, $"{commandButton.MenuText} was clicked");

                var disabledCommandButton = new Command {
                    MenuText = "A Disabled command Item", Enabled = false
                };

                disabledCommandButton.Executed += (sender, e) => {
                    Log.Write(sender, $"{disabledCommandButton.MenuText} was clicked");
                };

                var enabledButton = new ButtonMenuItem {
                    Text = "An Enabled Button"
                };

                enabledButton.Validate += (sender, e) =>
                {
                    validateWasCalled++;
                    Log.Write(sender, "Validate was called!");
                };
                enabledButton.Click += (s2, e2) => Log.Write(s2, $"{enabledButton.Text} was clicked");

                var disabledButton = new ButtonMenuItem {
                    Text = "Disabled button", Enabled = false
                };

                disabledButton.Click += (sender, e) =>
                {
                    Log.Write(sender, $"{disabledButton.Text} was clicked");
                    disabledWasClicked = true;
                    window.Close();
                };

                var toggledButton = new ButtonMenuItem {
                    Text = "Toggled button"
                };

                toggledButton.Click += (s2, e2) => Log.Write(s2, $"{toggledButton.Text} was clicked");

                var checkButton = new CheckMenuItem {
                    Text = "toggled button enabled", Checked = true
                };

                toggledButton.Bind(c => c.Enabled, checkButton, c => c.Checked);
                checkButton.Click += (s2, e2) => Log.Write(s2, $"{checkButton.Text} was clicked");


                submenu.Items.Add(enabledButton);
                submenu.Items.Add(disabledButton);
                submenu.Items.AddSeparator();
                submenu.Items.Add(toggledButton);
                submenu.Items.Add(checkButton);
                submenu.Items.AddSeparator();
                submenu.Items.Add(commandButton);
                submenu.Items.Add(disabledCommandButton);
            }

            ManualForm("Ensure the items in the\nFile menu are correct", form =>
            {
                var sub = new SubMenuItem {
                    Text = "A Child Menu"
                };
                sub.Opening += (sender, e) => AddMenuItems((ISubmenu)sender, form);

                var file = new SubMenuItem {
                    Text = "&File"
                };
                file.Opening += (sender, e) => AddMenuItems((ISubmenu)sender, form, 3);
                file.Items.Add(sub);

                var menu = new MenuBar();
                menu.Items.Add(file);

                var showContextMenuButton = new Button {
                    Text = "Show ContextMenu"
                };
                showContextMenuButton.Click += (sender, e) => {
                    var contextMenu = new ContextMenu();

                    var subMenuItem = new SubMenuItem {
                        Text = "A Child Menu"
                    };
                    subMenuItem.Opening += (s2, e2) => AddMenuItems((ISubmenu)s2, form);
                    contextMenu.Items.Add(subMenuItem);

                    contextMenu.Opening += (s2, e2) => AddMenuItems((ISubmenu)s2, form, 3);
                    contextMenu.Show();
                };

                form.Menu = menu;
                return(new Panel {
                    Size = new Size(200, 50), Content = TableLayout.AutoSized(showContextMenuButton, centered: true)
                });
            });

            Assert.IsFalse(disabledWasClicked, "#1 - Disabled item should not be clickable");
            Assert.Greater(validateWasCalled, 0, "#2 - Validate was never called!");
        }
Exemple #42
0
 public void SetMenu(MenuBar m)
 {
     menu = m;
 }
Exemple #43
0
 public ChangeEmailAddressSuccessPage(IWebDriver webDriver, Uri baseUri)
     : base(webDriver, baseUri, PageTitles.CHANGE_EMAIL_ADDRESS_SUCCESS)
 {
     MenuBar = new MenuBar(webDriver, baseUri);
 }
Exemple #44
0
        static void Main(string[] args)
        {
            ConfigManager.LoadConfig();

            string IP;

            string port;

            Console.Write("Enter IP(or press enter or default):"); IP = Console.ReadLine();

            if (!string.IsNullOrEmpty(IP))

            {
                Console.Write("Enter port:");

                port = Console.ReadLine();

                ConfigManager.Config.IP = IP;

                if (int.TryParse(port, out var configPort))
                {
                    ConfigManager.Config.Port = configPort;
                }

                else
                {
                    Console.WriteLine($"Wrong port. Use {configPort}");
                }
            }

            Login();

            var onlineUpdaterThread = new Thread(ServerResponse.OnlineUpdater)
            {
                Name = "OnlineUpdaterThread"
            };

            onlineUpdaterThread.Start();

            var historyUpdaterThread = new Thread(ServerResponse.GetHistoryMessages)
            {
                Name = "HistoryUpdaterThread"
            };

            historyUpdaterThread.Start();

            while (true)
            {
                try
                {
                    while (true)
                    {
                        Post();
                    }
                }
                catch (Exception)

                {
                    // ignored
                }
            }

            Application.Init();
            //
            //ColorScheme colorDark = new ColorScheme();

            //colorDark.Normal = new Terminal.Gui.Attribute(Color.White, Color.DarkGray);
            //
            //	Создание верхнего меню приложения
            menu = new MenuBar(new MenuBarItem[] {
                new MenuBarItem("_App", new MenuItem[] { new MenuItem("_Quit", "Close the app", Application.RequestStop), }),
            })
            {
                X     = 0, Y = 0,
                Width = Dim.Fill(), Height = 1,
            };
            Application.Top.Add(menu);

//	Создание главного окна
            winMain = new Window()
            {
                X = 0,

                Y     = 1,
                Width = Dim.Fill(),

                Height = Dim.Fill(),

                Title = "DotChat",
            };
            //winMain.ColorScheme = colorDark;

            Application.Top.Add(winMain);

//	Создание окна с сообщениями
            winMessages = new Window()
            {
                X     = 0, Y = 0,
                Width = winMain.Width, Height = winMain.Height - 2,
            };
            winMain.Add(winMessages);

//	Создание надписи с username
            labelUsername = new Label()
            {
                X      = 0,
                Y      = Pos.Bottom(winMain) - 5, Width = 15,
                Height = 1,
                Text   = "Username:"******"Message:",

                TextAlignment = TextAlignment.Right,
            };
            winMain.Add(labelMessage);

//	Создание поля ввода username
            fieldUsername = new TextField()

            {
                X = 15,

                Y = Pos.Bottom(winMain) - 5, Width = winMain.Width - 15, Height = 1,
            };
            winMain.Add(fieldUsername);

//	Создание поля ввода message
            fieldMessage = new TextField()

            {
                X = 15,

                Y = Pos.Bottom(winMain) - 4, Width = winMain.Width - 15, Height = 1,
            };
            winMain.Add(fieldMessage);

//	Создание кнопки отправки
            btnSend = new Button()

            {
                X = Pos.Right(winMain) - 15,
                Y = Pos.Bottom(winMain) - 4,

                Width = 15,

                Height = 1,

                Text = "	SEND	",
            };

            btnSend.Clicked += OnBtnSendClick;
            winMain.Add(btnSend);

//	Создание цикла получения сообщений
            int lastMsgID = 0;

            System.Timers.Timer updateLoop = new System.Timers.Timer();
            updateLoop.Interval = 1000;

            updateLoop.Elapsed += (object sender, ElapsedEventArgs e) => {
                Message msg = GetMessage(lastMsgID);

                if (msg != null)
                {
                    messages.Add(msg); MessagesUpdate(); lastMsgID++;
                }
            };

            updateLoop.Start();

            Application.Run();
        }
Exemple #45
0
 private MenuBar MakeMenuBar()
 {
     MenuBar menuBar = new MenuBar();
     menuBar.Append(MakeFileMenu());
     menuBar.Append(MakeEditMenu());
     menuBar.Append(MakeHelpMenu());
     return menuBar;
 }
        private void InitializeComponent()
        {
            #region Controls

            imageView  = new ImageViewEx();
            widthLabel = new Label {
                Text = "Width: 0"
            };
            heightLabel = new Label {
                Text = "Height: 0"
            };

            widthText = new TextBox {
                Text = "1"
            };
            heightText = new TextBox {
                Text = "1"
            };
            offsetText = new TextBox {
                Text = "0"
            };
            encodings = new ComboBox();
            swizzles  = new ComboBox();

            encodingParameters = new GroupBox {
                Text = "Encoding Parameters"
            };
            swizzleParameters = new GroupBox {
                Text = "Swizzle Parameters"
            };

            statusLabel = new Label {
                TextColor = KnownColors.DarkRed
            };

            #endregion

            #region Commands

            openFileCommand = new Command {
                MenuText = "Open"
            };
            closeFileCommand = new Command {
                MenuText = "Close", Enabled = false
            };
            processCommand = new Command {
                Enabled = false
            };

            #endregion

            Title   = "Raw Image Viewer";
            Size    = new Size(500, 600);
            Padding = new Padding(4);

            Menu = new MenuBar
            {
                Items =
                {
                    new ButtonMenuItem {
                        Text = "File", Items ={ openFileCommand,         closeFileCommand }
                    },
                }
            };

            #region Content

            var baseParameterLayout = new StackLayout
            {
                Orientation = Orientation.Vertical,
                HorizontalContentAlignment = HorizontalAlignment.Stretch,

                Spacing = 3,

                Items =
                {
                    new TableLayout
                    {
                        Spacing = new Size(3, 3),
                        Rows    =
                        {
                            new TableRow {
                                Cells =  { new Label {
                                               Text = "Width:"
                                           }, widthText }
                            },
                            new TableRow {
                                Cells =  { new Label {
                                               Text = "Height:"
                                           }, heightText }
                            },
                            new TableRow {
                                Cells =  { new Label {
                                               Text = "Offset:"
                                           }, offsetText }
                            },
                            new TableRow {
                                Cells =  { new Label {
                                               Text = "Encodings:"
                                           }, encodings }
                            },
                            new TableRow {
                                Cells =  { new Label {
                                               Text = "Swizzles:"
                                           }, swizzles }
                            },
                        }
                    },
                    new Button           {
                        Text = "Process", Command = processCommand
                    }
                }
            };

            var encodingParameterLayout = new StackLayout
            {
                Orientation = Orientation.Vertical,

                Items =
                {
                    encodingParameters,
                    swizzleParameters
                }
            };

            Content = new TableLayout
            {
                Spacing = new Size(3, 3),

                Rows =
                {
                    new TableRow {
                        ScaleHeight = true, Cells ={ imageView                    }
                    },
                    new TableLayout
                    {
                        Rows =
                        {
                            new TableRow
                            {
                                Cells =
                                {
                                    baseParameterLayout,
                                    encodingParameterLayout
                                }
                            }
                        }
                    },
                    statusLabel
                }
            };

            #endregion
        }
Exemple #47
0
	public static void TestBoxesButtonMenus(object o, object eventargs)
	{
		Window w = new Window("Boxes, Buttons & Menus Test");
		
		VBox vbx = new VBox ();
		vbx.Spacing = 4;
		
		MenuBar mb = new MenuBar();
		
		vbx.PackStart (mb, false, false, 0);
		
		MenuItem item = new MenuItem ("File");
		Menu file_menu = new Menu ();
		item.Submenu = file_menu;
		
		MenuItem file_item = new MenuItem ("Open");
		file_item.Activated += TestButtons_FileOpenHandler;
		file_menu.Append (file_item);
								
		file_item = new MenuItem ("Close");
		file_menu.Append (file_item);
		Menu close_menu = new Menu ();
		file_item.Submenu = close_menu;
		MenuItem close_menu_item = new MenuItem ("Close This");
		close_menu.Append (close_menu_item);
		close_menu_item = new MenuItem ("Close All");
		close_menu.Append (close_menu_item);
								
		file_item = new MenuItem ("Save");
		file_menu.Append (file_item);
		
		file_item = new MenuItem ("Save As");
                file_menu.Append (file_item);
		
		file_item = new MenuItem ("Quit");
		file_item.Activated += TestButtons_FileQuitHandler;
                file_menu.Append (file_item);
		
		mb.Append (item);
		
		item = new MenuItem ("Edit");
		Menu edit_menu = new Menu ();
		item.Submenu = edit_menu;
		mb.Append (item);
		
		item = new MenuItem ("About");
		Menu about_menu = new Menu ();		
		item.Submenu = about_menu;
		
		MenuItem about_item = new MenuItem ("Help");
		about_item.Activated += TestButtons_AboutHelpHandler;
		about_menu.Append (about_item);
		
		about_item = new MenuItem ("Authors");
		about_item.Activated += TestButtons_AboutAuthorsHandler;
		about_menu.Append (about_item);
		
		mb.Append (item);
				
		HBox bx = new HBox ();
		
		vbx.PackStart (bx);
		
		bx.Spacing = 0;
		Button l1 = new Button ("one");				
		Button l2 = new Button ("two");
		Button l3 = new Button ("three");
		Button l4 = new Button ("four");
		Button l5 = new Button ("five");		

		l5.Clicked +=  TestButtons_ButtonClicked;
		
		bx.PackStart(l1);
		bx.PackStart(l2);
		bx.PackStart(l3);
		bx.PackStart(l4);
		bx.PackStart(l5);

/*		
		HBox inbox = new HBox ();
		inbox.Spacing = 5;
		inbox.BorderWidth = 2;
		vbx.PackStart (inbox);
		Label input_label = new Label ("What is your name?");
		input_label.Xalign = 0;
		inbox.PackStart (input_label, false, false, 0);
		input = new Entry ();
		inbox.PackStart (input);
		
		HBox bbox = new HBox ();
		Button get_text = new Button ("Get Text");
		get_text.Clicked += Get_Text;
		bbox.PackStart (get_text, false, false, 0);
		vbx.PackStart (bbox, false, false, 0);
*/		
		w.Add(vbx);
		w.SetDefaultSize(300, 200);
		w.ShowAll();			
	}								
Exemple #48
0
    public MainWindow() : base(WindowType.Toplevel)
    {
        Build();

        string content = File.ReadAllText("settings.json");

        settings = JsonConvert.DeserializeObject <Clonebit.Settings>(content);

        stationLog = new Dictionary <string, string>();
        usbStatus  = new Dictionary <string, string>();

        Console.WriteLine(settings.Addresses.Count);
        foreach (var address in settings.Addresses)
        {
            Console.WriteLine(address);
        }

        for (var i = 0; i < settings.Addresses.Count; i++)
        {
            stationLog.Add(settings.Addresses[i], "");
            usbStatus.Add(settings.Addresses[i], "NONE");
        }

        vBox = new VBox(false, 0);
        Add(vBox);
        vBox.ShowAll();

        menuBar = new MenuBar();
        vBox.PackStart(menuBar, false, false, 0);

        MenuItem accountItem = new MenuItem("Compte");

        logoutItem = new MenuItem("Déconnexion")
        {
            Sensitive = false
        };
        logoutItem.Activated += OnLogoutActivated;

        MenuItem quitItem = new MenuItem("Quitter");

        quitItem.Activated += OnQuitActivated;

        MenuItem settingsItem = new MenuItem("Paramètres");

        settingsItem.Activated += OnSettingsActivated;

        Menu accountMenu = new Menu();

        accountMenu.Append(logoutItem);
        accountMenu.Append(new SeparatorMenuItem());
        accountMenu.Append(quitItem);
        accountItem.Submenu = accountMenu;

        menuBar.Append(accountItem);
        menuBar.Append(settingsItem);
        Add(menuBar);
        menuBar.ShowAll();

        vBox.PackEnd(new LoginPage(), true, true, 0);
        vBox.ShowAll();
    }
    protected void SetupMenu()
    {
        menuBar = new MenuBar();
        Menu fileMenu = new Menu();

        MenuItem exitItem = new MenuItem("Exit");
        exitItem.Activated += QuitHandler;
        fileMenu.Append(exitItem);

        MenuItem fileItem = new MenuItem("File");
        fileItem.Submenu = fileMenu;
        menuBar.Append(fileItem);

        vbox.PackStart(menuBar);
    }
        void InitializeComponent()
        {
            Title      = "My Eto Form";
            ClientSize = new Size(400, 350);
            Padding    = 10;

            Content = new StackLayout
            {
                Items =
                {
                    "Hello World!",
                    // add more controls here
                }
            };

            // create a few commands that can be used for the menu and toolbar
            var clickMe = new Command {
                MenuText = "Click Me!", ToolBarText = "Click Me!"
            };

            clickMe.Executed += (sender, e) => MessageBox.Show(this, "I was clicked!");

            var quitCommand = new Command {
                MenuText = "Quit", Shortcut = Application.Instance.CommonModifier | Keys.Q
            };

            quitCommand.Executed += (sender, e) => Application.Instance.Quit();

            var aboutCommand = new Command {
                MenuText = "About..."
            };

            aboutCommand.Executed += (sender, e) => new AboutDialog().ShowDialog(this);

            // create menu
            Menu = new MenuBar
            {
                Items =
                {
                    // File submenu
                    new ButtonMenuItem {
                        Text = "&File", Items ={ clickMe          }
                    },
                    // new ButtonMenuItem { Text = "&Edit", Items = { /* commands/items */ } },
                    // new ButtonMenuItem { Text = "&View", Items = { /* commands/items */ } },
                },
                ApplicationItems =
                {
                    // application (OS X) or file menu (others)
                    new ButtonMenuItem {
                        Text = "&Preferences..."
                    },
                },
                QuitItem  = quitCommand,
                AboutItem = aboutCommand
            };

            // create toolbar
            ToolBar = new ToolBar {
                Items = { clickMe }
            };
        }
Exemple #51
0
 private void InitializeComponent()
 {
     this.components = new Container();
     this.sandDockManager = new SandDockManager();
     this.sandBarManager = new SandBarManager(this.components);
     this.leftSandBarDock = new ToolBarContainer();
     this.rightSandBarDock = new ToolBarContainer();
     this.bottomSandBarDock = new ToolBarContainer();
     this.topSandBarDock = new ToolBarContainer();
     this.menuBar = new MenuBar();
     this.menuBarItem1 = new MenuBarItem();
     this.menuItem_newMap = new MenuButtonItem();
     this.menuItem_newWilderness = new MenuButtonItem();
     this.menuItem_loadMap = new MenuButtonItem();
     this.menuItem_saveMap = new MenuButtonItem();
     this.menuItem_saveMapAs = new MenuButtonItem();
     this.menuItem_exit = new MenuButtonItem();
     this.menuBarItem3 = new MenuBarItem();
     this.menuItem_Undo = new MenuButtonItem();
     this.menuItem_Redo = new MenuButtonItem();
     this.menuBarItem2 = new MenuBarItem();
     this.menuItem_viewToolParameters = new MenuButtonItem();
     this.menuItem_viewEditorSettings = new MenuButtonItem();
     this.menuItem_viewContextHelp = new MenuButtonItem();
     this.menuBarItem4 = new MenuBarItem();
     this.menuItem_TestIngame = new MenuButtonItem();
     this.menuBarItem5 = new MenuBarItem();
     this.menuItem_OpenCodeEditor = new MenuButtonItem();
     this.menuItem_DumpMap = new MenuButtonItem();
     this.menuItem_ExtractBigFile = new MenuButtonItem();
     this.menuItem_ExportToPC = new MenuButtonItem();
     this.menuItem_ExportToConsole = new MenuButtonItem();
     this.menuItem_ResetLayout = new MenuButtonItem();
     this.menuItem_PrepareThumbnails = new MenuButtonItem();
     this.menuItem_ReloadEditor = new MenuButtonItem();
     this.menuItem_ImportWorld = new MenuButtonItem();
     this.menuItem_ObjectAdmin = new MenuButtonItem();
     this.menuBarItem6 = new MenuBarItem();
     this.menuItem_visitWebsite = new MenuButtonItem();
     this.menuItem_about = new MenuButtonItem();
     this.toolBarMain = new TD.SandBar.ToolBar();
     this.buttonItem1 = new ButtonItem();
     this.buttonItem2 = new ButtonItem();
     this.buttonItem3 = new ButtonItem();
     this.buttonItem4 = new ButtonItem();
     this.buttonItem5 = new ButtonItem();
     this.toolTip = new ToolTip(this.components);
     this.openMapDialog = new OpenFileDialog();
     this.saveMapDialog = new SaveFileDialog();
     this.timerUIUpdate = new Timer(this.components);
     this.statusBar = new StatusStrip();
     this.statusBarContextMenu = new ContextMenuStrip(this.components);
     this.whatsThisToolStripMenuItem = new ToolStripMenuItem();
     this.statusCaption = new ToolStripStatusLabel();
     this.statusBarCameraSpeed = new ToolStripDropDownButton();
     this.cameraSpeedStrip = new ContextMenuStrip(this.components);
     this.statusBarCameraPos = new ToolStripStatusLabel();
     this.statusBarCursorPos = new ToolStripStatusLabel();
     this.statusBarMemoryUsage = new ToolStripStatusLabel();
     this.statusBarObjectUsage = new ToolStripStatusLabel();
     this.statusBarFpsItem = new ToolStripStatusLabel();
     this.folderBrowserDialog = new FolderBrowserDialog();
     this.viewport = new ViewportControl();
     this.topSandBarDock.SuspendLayout();
     this.statusBar.SuspendLayout();
     this.statusBarContextMenu.SuspendLayout();
     base.SuspendLayout();
     this.sandDockManager.DockSystemContainer = this;
     this.sandDockManager.MaximumDockContainerSize = 2000;
     this.sandDockManager.OwnerForm = this;
     this.sandBarManager.OwnerForm = this;
     this.sandBarManager.Renderer = new WhidbeyRenderer();
     this.leftSandBarDock.Dock = DockStyle.Left;
     this.leftSandBarDock.Guid = new Guid("5af42533-b4bf-4ff9-b113-19c06ff822ad");
     this.leftSandBarDock.Location = new Point(0, 49);
     this.leftSandBarDock.Manager = this.sandBarManager;
     this.leftSandBarDock.Name = "leftSandBarDock";
     this.leftSandBarDock.Size = new Size(0, 592);
     this.leftSandBarDock.TabIndex = 0;
     this.rightSandBarDock.Dock = DockStyle.Right;
     this.rightSandBarDock.Guid = new Guid("dd1d865e-52de-4df1-b60b-8d95778c6a99");
     this.rightSandBarDock.Location = new Point(973, 49);
     this.rightSandBarDock.Manager = this.sandBarManager;
     this.rightSandBarDock.Name = "rightSandBarDock";
     this.rightSandBarDock.Size = new Size(0, 592);
     this.rightSandBarDock.TabIndex = 1;
     this.bottomSandBarDock.Dock = DockStyle.Bottom;
     this.bottomSandBarDock.Guid = new Guid("241b4d86-e08e-4fbd-9187-85417e2a6762");
     this.bottomSandBarDock.Location = new Point(0, 641);
     this.bottomSandBarDock.Manager = this.sandBarManager;
     this.bottomSandBarDock.Name = "bottomSandBarDock";
     this.bottomSandBarDock.Size = new Size(973, 0);
     this.bottomSandBarDock.TabIndex = 2;
     this.topSandBarDock.Controls.Add(this.menuBar);
     this.topSandBarDock.Controls.Add(this.toolBarMain);
     this.topSandBarDock.Dock = DockStyle.Top;
     this.topSandBarDock.Guid = new Guid("9d4d899c-2f1c-48a5-b6b3-c2965fee85b0");
     this.topSandBarDock.Location = new Point(0, 0);
     this.topSandBarDock.Manager = this.sandBarManager;
     this.topSandBarDock.Name = "topSandBarDock";
     this.topSandBarDock.Size = new Size(973, 49);
     this.topSandBarDock.TabIndex = 3;
     this.menuBar.Guid = new Guid("67d4f929-8914-4b23-9c2d-b9539a54dd9b");
     this.menuBar.Items.AddRange(new ToolbarItemBase[]
     {
         this.menuBarItem1,
         this.menuBarItem3,
         this.menuBarItem2,
         this.menuBarItem4,
         this.menuBarItem5,
         this.menuBarItem6
     });
     this.menuBar.Location = new Point(2, 0);
     this.menuBar.Movable = false;
     this.menuBar.Name = "menuBar";
     this.menuBar.OwnerForm = this;
     this.menuBar.Size = new Size(971, 23);
     this.menuBar.TabIndex = 0;
     this.menuBar.Text = "menuBar1";
     this.menuBarItem1.Items.AddRange(new ToolbarItemBase[]
     {
         this.menuItem_newMap,
         this.menuItem_newWilderness,
         this.menuItem_loadMap,
         this.menuItem_saveMap,
         this.menuItem_saveMapAs,
         this.menuItem_exit
     });
     this.menuBarItem1.Text = "MENU_FILE";
     this.menuItem_newMap.Shortcut = Shortcut.CtrlN;
     this.menuItem_newMap.Text = "MENUITEM_FILE_NEW_MAP";
     this.menuItem_newMap.Activate += new EventHandler(this.menuItem_newMap_Activate);
     this.menuItem_newWilderness.Text = "MENUITEM_FILE_NEW_WILDERNESS";
     this.menuItem_newWilderness.Activate += new EventHandler(this.menuItem_newWilderness_Activate);
     this.menuItem_loadMap.Shortcut = Shortcut.CtrlO;
     this.menuItem_loadMap.Text = "MENUITEM_FILE_LOAD_MAP";
     this.menuItem_loadMap.Activate += new EventHandler(this.menuItem_loadMap_Activate);
     this.menuItem_saveMap.BeginGroup = true;
     this.menuItem_saveMap.Shortcut = Shortcut.CtrlS;
     this.menuItem_saveMap.Text = "MENUITEM_FILE_SAVE_MAP";
     this.menuItem_saveMap.Activate += new EventHandler(this.menuItem_saveMap_Activate);
     this.menuItem_saveMapAs.Text = "MENUITEM_FILE_SAVE_MAP_AS";
     this.menuItem_saveMapAs.Activate += new EventHandler(this.menuItem_saveMapAs_Activate);
     this.menuItem_exit.BeginGroup = true;
     this.menuItem_exit.Text = "MENUITEM_FILE_EXIT";
     this.menuItem_exit.Activate += new EventHandler(this.menuItem_exit_Activate);
     this.menuBarItem3.Items.AddRange(new ToolbarItemBase[]
     {
         this.menuItem_Undo,
         this.menuItem_Redo
     });
     this.menuBarItem3.Text = "MENU_EDIT";
     this.menuItem_Undo.Shortcut = Shortcut.CtrlZ;
     this.menuItem_Undo.Text = "MENUITEM_EDIT_UNDO";
     this.menuItem_Undo.Activate += new EventHandler(this.menuItem_Undo_Activate);
     this.menuItem_Redo.Shortcut = Shortcut.CtrlShiftZ;
     this.menuItem_Redo.Text = "MENUITEM_EDIT_REDO";
     this.menuItem_Redo.Activate += new EventHandler(this.menuItem_Redo_Activate);
     this.menuBarItem2.Items.AddRange(new ToolbarItemBase[]
     {
         this.menuItem_viewToolParameters,
         this.menuItem_viewEditorSettings,
         this.menuItem_viewContextHelp
     });
     this.menuBarItem2.Text = "MENU_VIEW";
     this.menuItem_viewToolParameters.Text = "DOCK_TOOL_PARAMETERS";
     this.menuItem_viewToolParameters.Activate += new EventHandler(this.menuItem_viewToolParameters_Activate);
     this.menuItem_viewEditorSettings.Text = "DOCK_EDITOR_SETTINGS";
     this.menuItem_viewEditorSettings.Activate += new EventHandler(this.menuItem_viewEditorSettings_Activate);
     this.menuItem_viewContextHelp.Text = "DOCK_CONTEXT_HELP";
     this.menuItem_viewContextHelp.Activate += new EventHandler(this.menuItem_viewContextHelp_Activate);
     this.menuBarItem4.Items.AddRange(new ToolbarItemBase[]
     {
         this.menuItem_TestIngame
     });
     this.menuBarItem4.Text = "MENU_GAME";
     this.menuItem_TestIngame.Shortcut = Shortcut.CtrlG;
     this.menuItem_TestIngame.Text = "MENUITEM_GAME_TEST_INGAME";
     this.menuItem_TestIngame.Activate += new EventHandler(this.menuItem_TestIngame_Activate);
     this.menuBarItem5.Items.AddRange(new ToolbarItemBase[]
     {
         this.menuItem_OpenCodeEditor,
         this.menuItem_DumpMap,
         this.menuItem_ExtractBigFile,
         this.menuItem_ExportToPC,
         this.menuItem_ExportToConsole,
         this.menuItem_ResetLayout,
         this.menuItem_PrepareThumbnails,
         this.menuItem_ReloadEditor,
         this.menuItem_ImportWorld,
         this.menuItem_ObjectAdmin
     });
     this.menuBarItem5.Text = "MENU_ADVANCED";
     this.menuItem_OpenCodeEditor.Text = "*Code Editor";
     this.menuItem_OpenCodeEditor.Activate += new EventHandler(this.menuItem_OpenCodeEditor_Activate);
     this.menuItem_DumpMap.BeginGroup = true;
     this.menuItem_DumpMap.Text = "*Dump map";
     this.menuItem_DumpMap.Activate += new EventHandler(this.menuItem_DumpMap_Activate);
     this.menuItem_ExtractBigFile.Text = "*Extract Bigfile";
     this.menuItem_ExtractBigFile.Activate += new EventHandler(this.menuItem_ExtractBigFile_Activate);
     this.menuItem_ExportToPC.BeginGroup = true;
     this.menuItem_ExportToPC.Text = "*Export to PC";
     this.menuItem_ExportToPC.Activate += new EventHandler(this.menuItem_ExportToPC_Activate);
     this.menuItem_ExportToConsole.Text = "*Export to Console";
     this.menuItem_ExportToConsole.Activate += new EventHandler(this.menuItem_ExportToConsole_Activate);
     this.menuItem_ResetLayout.Text = "MENUITEM_ADVANCED_RESET_LAYOUT";
     this.menuItem_ResetLayout.Activate += new EventHandler(this.menuItem_ResetLayout_Activate);
     this.menuItem_PrepareThumbnails.BeginGroup = true;
     this.menuItem_PrepareThumbnails.Text = "*Prepare thumbnails";
     this.menuItem_PrepareThumbnails.Activate += new EventHandler(this.menuItem_PrepareThumbnails_Activate);
     this.menuItem_ReloadEditor.BeginGroup = true;
     this.menuItem_ReloadEditor.Text = "*Reload editor DLL";
     this.menuItem_ReloadEditor.Activate += new EventHandler(this.menuItem_ReloadEditor_Activate);
     this.menuItem_ImportWorld.BeginGroup = true;
     this.menuItem_ImportWorld.Text = "*Import world";
     this.menuItem_ImportWorld.Activate += new EventHandler(this.menuItem_ImportWorld_Activate);
     this.menuItem_ObjectAdmin.Text = "*Object admin";
     this.menuItem_ObjectAdmin.Activate += new EventHandler(this.menuItem_ObjectAdmin_Activate);
     this.menuBarItem6.Items.AddRange(new ToolbarItemBase[]
     {
         this.menuItem_visitWebsite,
         this.menuItem_about
     });
     this.menuBarItem6.Text = "MENU_HELP";
     this.menuItem_visitWebsite.Text = "MENUITEM_HELP_VISIT_WEBSITE";
     this.menuItem_visitWebsite.Activate += new EventHandler(this.menuItem_visitWebsite_Activate);
     this.menuItem_about.BeginGroup = true;
     this.menuItem_about.Text = "MENUITEM_HELP_ABOUT";
     this.menuItem_about.Activate += new EventHandler(this.menuItem_about_Activate);
     this.toolBarMain.DockLine = 1;
     this.toolBarMain.FlipLastItem = true;
     this.toolBarMain.Guid = new Guid("472238c1-4ade-4ff2-ba4f-4429ed30f50f");
     this.toolBarMain.Items.AddRange(new ToolbarItemBase[]
     {
         this.buttonItem1,
         this.buttonItem2,
         this.buttonItem3,
         this.buttonItem4,
         this.buttonItem5
     });
     this.toolBarMain.Location = new Point(2, 23);
     this.toolBarMain.Name = "toolBarMain";
     this.toolBarMain.Size = new Size(146, 26);
     this.toolBarMain.TabIndex = 1;
     this.toolBarMain.Text = "TOOLBAR_MAIN";
     this.buttonItem1.BuddyMenu = this.menuItem_newMap;
     this.buttonItem1.Image = Resources.newMap;
     this.buttonItem2.BuddyMenu = this.menuItem_loadMap;
     this.buttonItem2.Image = Resources.openMap;
     this.buttonItem3.BuddyMenu = this.menuItem_saveMap;
     this.buttonItem3.Image = Resources.save;
     this.buttonItem4.BeginGroup = true;
     this.buttonItem4.BuddyMenu = this.menuItem_Undo;
     this.buttonItem4.Image = Resources.undo;
     this.buttonItem5.BuddyMenu = this.menuItem_Redo;
     this.buttonItem5.Image = Resources.redo;
     this.openMapDialog.DefaultExt = "fc3map";
     this.openMapDialog.Filter = "Far Cry 3 maps (*.fc3map)|*.fc3map|All files (*.*)|*.*";
     this.openMapDialog.Title = "Open Far Cry 3 map";
     this.saveMapDialog.DefaultExt = "fc3map";
     this.saveMapDialog.Filter = "Far Cry 3 maps (*.fc3map)|*.fc3map|All files (*.*)|*.*";
     this.saveMapDialog.Title = "Save Far Cry 3 map";
     this.timerUIUpdate.Enabled = true;
     this.timerUIUpdate.Tick += new EventHandler(this.timerUIUpdate_Tick);
     this.statusBar.ContextMenuStrip = this.statusBarContextMenu;
     this.statusBar.Items.AddRange(new ToolStripItem[]
     {
         this.statusCaption,
         this.statusBarCameraSpeed,
         this.statusBarCameraPos,
         this.statusBarCursorPos,
         this.statusBarMemoryUsage,
         this.statusBarObjectUsage,
         this.statusBarFpsItem
     });
     this.statusBar.Location = new Point(0, 641);
     this.statusBar.Name = "statusBar";
     this.statusBar.Size = new Size(973, 22);
     this.statusBar.TabIndex = 7;
     this.statusBar.Text = "statusStrip1";
     this.statusBarContextMenu.Items.AddRange(new ToolStripItem[]
     {
         this.whatsThisToolStripMenuItem
     });
     this.statusBarContextMenu.Name = "statusBarContextMenu";
     this.statusBarContextMenu.Size = new Size(179, 26);
     this.statusBarContextMenu.Opening += new CancelEventHandler(this.statusBarContextMenu_Opening);
     this.whatsThisToolStripMenuItem.Name = "whatsThisToolStripMenuItem";
     this.whatsThisToolStripMenuItem.Size = new Size(178, 22);
     this.whatsThisToolStripMenuItem.Text = "HELP_WHATS_THIS";
     this.whatsThisToolStripMenuItem.Click += new EventHandler(this.whatsThisToolStripMenuItem_Click);
     this.statusCaption.ImageAlign = ContentAlignment.MiddleLeft;
     this.statusCaption.Name = "statusCaption";
     this.statusCaption.Size = new Size(408, 17);
     this.statusCaption.Spring = true;
     this.statusCaption.Text = "Ready";
     this.statusCaption.TextAlign = ContentAlignment.MiddleLeft;
     this.statusBarCameraSpeed.AutoSize = false;
     this.statusBarCameraSpeed.DropDown = this.cameraSpeedStrip;
     this.statusBarCameraSpeed.Image = Resources.speed;
     this.statusBarCameraSpeed.ImageAlign = ContentAlignment.MiddleLeft;
     this.statusBarCameraSpeed.ImageTransparentColor = Color.Magenta;
     this.statusBarCameraSpeed.Name = "statusBarCameraSpeed";
     this.statusBarCameraSpeed.Size = new Size(55, 20);
     this.statusBarCameraSpeed.Text = "0";
     this.statusBarCameraSpeed.TextAlign = ContentAlignment.MiddleLeft;
     this.cameraSpeedStrip.Name = "cameraSpeedStrip";
     this.cameraSpeedStrip.OwnerItem = this.statusBarCameraSpeed;
     this.cameraSpeedStrip.ShowImageMargin = false;
     this.cameraSpeedStrip.Size = new Size(36, 4);
     this.statusBarCameraPos.AutoSize = false;
     this.statusBarCameraPos.Image = Resources.camera;
     this.statusBarCameraPos.ImageAlign = ContentAlignment.MiddleLeft;
     this.statusBarCameraPos.Name = "statusBarCameraPos";
     this.statusBarCameraPos.Size = new Size(150, 17);
     this.statusBarCameraPos.Text = "(0, 0, 0)";
     this.statusBarCameraPos.TextAlign = ContentAlignment.MiddleLeft;
     this.statusBarCursorPos.AutoSize = false;
     this.statusBarCursorPos.Image = Resources.cursor;
     this.statusBarCursorPos.ImageAlign = ContentAlignment.MiddleLeft;
     this.statusBarCursorPos.Name = "statusBarCursorPos";
     this.statusBarCursorPos.Size = new Size(150, 17);
     this.statusBarCursorPos.Text = "(0, 0, 0)";
     this.statusBarCursorPos.TextAlign = ContentAlignment.MiddleLeft;
     this.statusBarMemoryUsage.AutoSize = false;
     this.statusBarMemoryUsage.Image = Resources.MemoryUsage;
     this.statusBarMemoryUsage.ImageAlign = ContentAlignment.MiddleLeft;
     this.statusBarMemoryUsage.Name = "statusBarMemoryUsage";
     this.statusBarMemoryUsage.Size = new Size(60, 17);
     this.statusBarMemoryUsage.Text = "0";
     this.statusBarMemoryUsage.TextAlign = ContentAlignment.MiddleLeft;
     this.statusBarObjectUsage.AutoSize = false;
     this.statusBarObjectUsage.Image = Resources.ObjectUsage;
     this.statusBarObjectUsage.ImageAlign = ContentAlignment.MiddleLeft;
     this.statusBarObjectUsage.Name = "statusBarObjectUsage";
     this.statusBarObjectUsage.Size = new Size(60, 17);
     this.statusBarObjectUsage.Text = "0";
     this.statusBarObjectUsage.TextAlign = ContentAlignment.MiddleLeft;
     this.statusBarFpsItem.AutoSize = false;
     this.statusBarFpsItem.Image = Resources.frametime;
     this.statusBarFpsItem.ImageAlign = ContentAlignment.MiddleLeft;
     this.statusBarFpsItem.Name = "statusBarFpsItem";
     this.statusBarFpsItem.Size = new Size(75, 17);
     this.statusBarFpsItem.Text = "0.0 fps";
     this.statusBarFpsItem.TextAlign = ContentAlignment.MiddleLeft;
     this.folderBrowserDialog.Description = "Select export folder";
     this.viewport.BackColor = SystemColors.AppWorkspace;
     this.viewport.BlockNextKeyRepeats = false;
     this.viewport.BorderStyle = BorderStyle.Fixed3D;
     this.viewport.CameraEnabled = true;
     this.viewport.CaptureMouse = false;
     this.viewport.CaptureWheel = false;
     this.viewport.Cursor = Cursors.Default;
     this.viewport.DefaultCursor = Cursors.Default;
     this.viewport.Dock = DockStyle.Fill;
     this.viewport.Location = new Point(0, 49);
     this.viewport.Name = "viewport";
     this.viewport.Size = new Size(973, 592);
     this.viewport.TabIndex = 5;
     base.AutoScaleDimensions = new SizeF(6f, 13f);
     base.AutoScaleMode = AutoScaleMode.Font;
     base.ClientSize = new Size(973, 663);
     base.Controls.Add(this.viewport);
     base.Controls.Add(this.leftSandBarDock);
     base.Controls.Add(this.rightSandBarDock);
     base.Controls.Add(this.bottomSandBarDock);
     base.Controls.Add(this.topSandBarDock);
     base.Controls.Add(this.statusBar);
     base.Name = "MainForm";
     this.Text = "Far Cry 3 Editor";
     base.Activated += new EventHandler(this.MainForm_Activated);
     base.Deactivate += new EventHandler(this.MainForm_Deactivate);
     base.FormClosing += new FormClosingEventHandler(this.MainForm_FormClosing);
     base.FormClosed += new FormClosedEventHandler(this.MainForm_FormClosed);
     base.Load += new EventHandler(this.MainForm_Load);
     base.LocationChanged += new EventHandler(this.MainForm_LocationChanged);
     base.SizeChanged += new EventHandler(this.MainForm_SizeChanged);
     this.topSandBarDock.ResumeLayout(false);
     this.statusBar.ResumeLayout(false);
     this.statusBar.PerformLayout();
     this.statusBarContextMenu.ResumeLayout(false);
     base.ResumeLayout(false);
     base.PerformLayout();
 }
 //------------------------------------------------------------------------/
 // Interface
 //------------------------------------------------------------------------/
 protected abstract void OnMultiColumnEditorEnable(MenuBar menu, GUISplitter columns);
Exemple #53
0
        /// <summary>
        /// Create all controls. This gets called once and the controls remain with their state between Sceanrio runs.
        /// </summary>
        private static void Setup()
        {
            _menu = new MenuBar(new MenuBarItem [] {
                new MenuBarItem("_File", new MenuItem [] {
                    new MenuItem("_Quit", "", () => Application.RequestStop())
                }),
                new MenuBarItem("_About...", "About this app", () => MessageBox.Query(0, 6, "About UI Catalog", "UI Catalog is a comprehensive sample library for Terminal.Gui", "Ok")),
            });

            _leftPane = new Window("Categories")
            {
                X        = 0,
                Y        = 1,          // for menu
                Width    = 25,
                Height   = Dim.Fill(),
                CanFocus = false,
            };


            _categories       = Scenario.GetAllCategories();
            _categoryListView = new ListView(_categories)
            {
                X             = 1,
                Y             = 0,
                Width         = Dim.Fill(0),
                Height        = Dim.Fill(2),
                AllowsMarking = false,
                CanFocus      = true,
            };
            _categoryListView.OpenSelectedItem += (o, a) => {
                _top.SetFocus(_rightPane);
            };
            _categoryListView.SelectedChanged += CategoryListView_SelectedChanged;
            _leftPane.Add(_categoryListView);

            _rightPane = new Window("Scenarios")
            {
                X        = 25,
                Y        = 1,          // for menu
                Width    = Dim.Fill(),
                Height   = Dim.Fill(),
                CanFocus = false,
            };

            _nameColumnWidth = Scenario.ScenarioMetadata.GetName(_scenarios.OrderByDescending(t => Scenario.ScenarioMetadata.GetName(t).Length).FirstOrDefault()).Length;

            _scenarioListView = new ListView()
            {
                X             = 0,
                Y             = 0,
                Width         = Dim.Fill(0),
                Height        = Dim.Fill(0),
                AllowsMarking = false,
                CanFocus      = true,
            };

            //_scenarioListView.OnKeyPress += (KeyEvent ke) => {
            //	if (_top.MostFocused == _scenarioListView && ke.Key == Key.Enter) {
            //		_scenarioListView_OpenSelectedItem (null, null);
            //	}
            //};

            _scenarioListView.OpenSelectedItem += _scenarioListView_OpenSelectedItem;
            _rightPane.Add(_scenarioListView);

            _categoryListView.SelectedItem = 0;
            CategoryListView_SelectedChanged();

            _statusBar = new StatusBar(new StatusItem [] {
                //new StatusItem(Key.F1, "~F1~ Help", () => Help()),
                new StatusItem(Key.ControlQ, "~CTRL-Q~ Quit", () => {
                    if (_runningScenario is null)
                    {
                        // This causes GetScenarioToRun to return null
                        _runningScenario = null;
                        Application.RequestStop();
                    }
                    else
                    {
                        _runningScenario.RequestStop();
                    }
                }),
            });
Exemple #54
0
    //
    static void Editor()
    {
        Application.Init();
        Application.HeightAsBuffer = heightAsBuffer;

        var ntop = Application.Top;

        var text = new TextView()
        {
            X = 0, Y = 0, Width = Dim.Fill(), Height = Dim.Fill()
        };

        string fname = GetFileName();

        var win = new Window(fname ?? "Untitled")
        {
            X      = 0,
            Y      = 1,
            Width  = Dim.Fill(),
            Height = Dim.Fill()
        };

        ntop.Add(win);

        if (fname != null)
        {
            text.Text = System.IO.File.ReadAllText(fname);
        }
        win.Add(text);

        void Paste()
        {
            if (text != null)
            {
                text.Paste();
            }
        }

        void Cut()
        {
            if (text != null)
            {
                text.Cut();
            }
        }

        void Copy()
        {
            if (text != null)
            {
                text.Copy();
            }
        }

        var menu = new MenuBar(new MenuBarItem [] {
            new MenuBarItem("_File", new MenuItem [] {
                new MenuItem("_Close", "", () => { if (Quit())
                                                   {
                                                       running = MainApp; Application.RequestStop();
                                                   }
                             }, null, null, Key.AltMask | Key.Q),
            }),
            new MenuBarItem("_Edit", new MenuItem [] {
                new MenuItem("_Copy", "", Copy, null, null, Key.C | Key.CtrlMask),
                new MenuItem("C_ut", "", Cut, null, null, Key.X | Key.CtrlMask),
                new MenuItem("_Paste", "", Paste, null, null, Key.Y | Key.CtrlMask)
            }),
        });

        ntop.Add(menu);

        Application.Run(ntop);
    }
    private void Populate()
    {
        this.Remove(_vbox);
        _vbox = new VBox(false, 3);
        //_vbox.
        MenuBar bar = new MenuBar ();

        Menu fileMenu = new Menu ();
        MenuItem fileMenuItem = new MenuItem ("File");
        fileMenuItem.Submenu = fileMenu;

        MenuItem exit = new MenuItem ("Exit");
        exit.Activated += delegate(object sender, EventArgs e) {
            Application.Quit ();
        };

        MenuItem openFile = new MenuItem ("Open file...");
        openFile.Activated += OpenFile;

        fileMenu.Append (openFile);
        fileMenu.Append (exit);

        bar.Append (fileMenuItem);

        VBox menu = new VBox (false, 2);
        menu.PackStart (bar, false, false, 0);
        _vbox.PackStart(menu, false, false, 0);

        _hbox = new HBox();

        ScrolledWindow sw = new ScrolledWindow();
        _tv= new TreeView();
        sw.Add(_tv);

        _tv.RowActivated += HandleRowActivated;

        CellRendererText tsText  = new CellRendererText();
        TreeViewColumn timestamp = new TreeViewColumn();
        timestamp.Title = "Filename";
        timestamp.PackStart(tsText, true);
        timestamp.AddAttribute(tsText, "text", 0);

        CellRendererText dlText = new CellRendererText();
        TreeViewColumn datalength = new TreeViewColumn();
        datalength.Title = "Hive type";
        datalength.PackStart(dlText, true);
        datalength.AddAttribute(dlText, "text", 1);

        _tv.AppendColumn(timestamp);
        _tv.AppendColumn(datalength);

        TreeStore store = new TreeStore(typeof(string), typeof(string));

        _hives = _hives.OrderBy(h => h.GetType().Name).ToList();

        foreach (RegistryHive hive in _hives)
        {
            string[] strs = hive.Filepath.Split(System.IO.Path.DirectorySeparatorChar);
            store.AppendValues(strs[strs.Length-1], hive.GetType().Name);
        }

        _tv.Model = store;

        _hbox.PackStart(sw, true, true, 0);
        _vbox.PackStart (_hbox, true, true, 0);

        this.Add(_vbox);
        this.ShowAll();
    }
Exemple #56
0
 private void InitializeComponent()
 {
     this.components = new Container();
     this.codeMapViewerDock1 = new CodeMapViewerDock();
     this.sandDockManager1 = new SandDockManager();
     this.statusStrip1 = new StatusStrip();
     this.toolStripStatusLabel1 = new ToolStripStatusLabel();
     this.lineStatusLabel = new ToolStripStatusLabel();
     this.columnStatusLabel = new ToolStripStatusLabel();
     this.sandBarManager1 = new SandBarManager(this.components);
     this.leftSandBarDock = new ToolBarContainer();
     this.rightSandBarDock = new ToolBarContainer();
     this.bottomSandBarDock = new ToolBarContainer();
     this.topSandBarDock = new ToolBarContainer();
     this.menuBar1 = new MenuBar();
     this.menuBarItem1 = new MenuBarItem();
     this.newFileMenuItem = new MenuButtonItem();
     this.openScriptMenuItem = new MenuButtonItem();
     this.saveScriptMenuItem = new MenuButtonItem();
     this.exitMenuItem = new MenuButtonItem();
     this.menuBarItem2 = new MenuBarItem();
     this.undoMenuItem = new MenuButtonItem();
     this.redoMenuItem = new MenuButtonItem();
     this.cutMenuItem = new MenuButtonItem();
     this.copyMenuItem = new MenuButtonItem();
     this.pasteMenuItem = new MenuButtonItem();
     this.menuBarItem3 = new MenuBarItem();
     this.mapViewerMenuItem = new MenuButtonItem();
     this.menuBarItem4 = new MenuBarItem();
     this.runMenuItem = new MenuButtonItem();
     this.menuBarItem5 = new MenuBarItem();
     this.toolBar1 = new TD.SandBar.ToolBar();
     this.buttonItem1 = new ButtonItem();
     this.buttonItem3 = new ButtonItem();
     this.buttonItem2 = new ButtonItem();
     this.buttonItem4 = new ButtonItem();
     this.buttonItem5 = new ButtonItem();
     this.buttonItem6 = new ButtonItem();
     this.buttonItem8 = new ButtonItem();
     this.buttonItem9 = new ButtonItem();
     this.buttonItem7 = new ButtonItem();
     this.openFileDialog = new OpenFileDialog();
     this.contextMenuStrip1 = new ContextMenuStrip(this.components);
     this.cutToolStripMenuItem = new ToolStripMenuItem();
     this.copyToolStripMenuItem = new ToolStripMenuItem();
     this.pasteToolStripMenuItem = new ToolStripMenuItem();
     this.toolStripSeparator1 = new ToolStripSeparator();
     this.insertFunctionToolStripMenuItem = new ToolStripMenuItem();
     this.insertTextureEntryIDToolStripMenuItem = new ToolStripMenuItem();
     this.insertCollectionEntryIDToolStripMenuItem = new ToolStripMenuItem();
     DockContainer dockContainer = new DockContainer();
     dockContainer.SuspendLayout();
     this.statusStrip1.SuspendLayout();
     this.topSandBarDock.SuspendLayout();
     this.contextMenuStrip1.SuspendLayout();
     base.SuspendLayout();
     dockContainer.Controls.Add(this.codeMapViewerDock1);
     dockContainer.Dock = DockStyle.Right;
     dockContainer.LayoutSystem = new SplitLayoutSystem(250, 312, Orientation.Horizontal, new LayoutSystemBase[]
     {
         new ControlLayoutSystem(250, 312, new DockControl[]
         {
             this.codeMapViewerDock1
         }, this.codeMapViewerDock1)
     });
     dockContainer.Location = new Point(274, 49);
     dockContainer.Manager = this.sandDockManager1;
     dockContainer.Name = "dockContainer1";
     dockContainer.Size = new Size(254, 312);
     dockContainer.TabIndex = 6;
     this.codeMapViewerDock1.Guid = new Guid("40b77176-f5ac-44ce-a28c-d2f296197e1d");
     this.codeMapViewerDock1.Image = null;
     this.codeMapViewerDock1.Location = new Point(4, 18);
     this.codeMapViewerDock1.Name = "codeMapViewerDock1";
     this.codeMapViewerDock1.Size = new Size(250, 270);
     this.codeMapViewerDock1.TabIndex = 0;
     this.codeMapViewerDock1.Text = "Map Viewer";
     this.sandDockManager1.DockSystemContainer = this;
     this.sandDockManager1.OwnerForm = this;
     this.sandDockManager1.ActiveTabbedDocumentChanged += new EventHandler(this.sandDockManager1_ActiveTabbedDocumentChanged);
     this.statusStrip1.Items.AddRange(new ToolStripItem[]
     {
         this.toolStripStatusLabel1,
         this.lineStatusLabel,
         this.columnStatusLabel
     });
     this.statusStrip1.Location = new Point(0, 361);
     this.statusStrip1.Name = "statusStrip1";
     this.statusStrip1.Size = new Size(528, 22);
     this.statusStrip1.TabIndex = 1;
     this.statusStrip1.Text = "statusStrip1";
     this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
     this.toolStripStatusLabel1.Size = new Size(447, 17);
     this.toolStripStatusLabel1.Spring = true;
     this.lineStatusLabel.Name = "lineStatusLabel";
     this.lineStatusLabel.Size = new Size(35, 17);
     this.lineStatusLabel.Text = "Line 0";
     this.columnStatusLabel.Name = "columnStatusLabel";
     this.columnStatusLabel.Size = new Size(31, 17);
     this.columnStatusLabel.Text = "Col 0";
     this.sandBarManager1.OwnerForm = this;
     this.leftSandBarDock.Dock = DockStyle.Left;
     this.leftSandBarDock.Guid = new Guid("f51f9d3c-d12d-4b04-b3c1-dba150a785e6");
     this.leftSandBarDock.Location = new Point(0, 49);
     this.leftSandBarDock.Manager = this.sandBarManager1;
     this.leftSandBarDock.Name = "leftSandBarDock";
     this.leftSandBarDock.Size = new Size(0, 334);
     this.leftSandBarDock.TabIndex = 2;
     this.rightSandBarDock.Dock = DockStyle.Right;
     this.rightSandBarDock.Guid = new Guid("c3e7b6e1-de74-4788-aa84-badf07d4feb3");
     this.rightSandBarDock.Location = new Point(528, 49);
     this.rightSandBarDock.Manager = this.sandBarManager1;
     this.rightSandBarDock.Name = "rightSandBarDock";
     this.rightSandBarDock.Size = new Size(0, 334);
     this.rightSandBarDock.TabIndex = 3;
     this.bottomSandBarDock.Dock = DockStyle.Bottom;
     this.bottomSandBarDock.Guid = new Guid("214365d9-c066-4c57-b2e9-f4e9b8b58fd5");
     this.bottomSandBarDock.Location = new Point(0, 383);
     this.bottomSandBarDock.Manager = this.sandBarManager1;
     this.bottomSandBarDock.Name = "bottomSandBarDock";
     this.bottomSandBarDock.Size = new Size(528, 0);
     this.bottomSandBarDock.TabIndex = 4;
     this.topSandBarDock.Controls.Add(this.menuBar1);
     this.topSandBarDock.Controls.Add(this.toolBar1);
     this.topSandBarDock.Dock = DockStyle.Top;
     this.topSandBarDock.Guid = new Guid("31bfec4a-f321-4810-8e02-c4eccad1d7f9");
     this.topSandBarDock.Location = new Point(0, 0);
     this.topSandBarDock.Manager = this.sandBarManager1;
     this.topSandBarDock.Name = "topSandBarDock";
     this.topSandBarDock.Size = new Size(528, 49);
     this.topSandBarDock.TabIndex = 5;
     this.menuBar1.Guid = new Guid("0188290c-f307-4042-a99f-b3a2a1517a38");
     this.menuBar1.Items.AddRange(new ToolbarItemBase[]
     {
         this.menuBarItem1,
         this.menuBarItem2,
         this.menuBarItem3,
         this.menuBarItem4,
         this.menuBarItem5
     });
     this.menuBar1.Location = new Point(2, 0);
     this.menuBar1.Name = "menuBar1";
     this.menuBar1.OwnerForm = this;
     this.menuBar1.Size = new Size(526, 23);
     this.menuBar1.TabIndex = 0;
     this.menuBar1.Text = "menuBar1";
     this.menuBarItem1.Items.AddRange(new ToolbarItemBase[]
     {
         this.newFileMenuItem,
         this.openScriptMenuItem,
         this.saveScriptMenuItem,
         this.exitMenuItem
     });
     this.menuBarItem1.Text = "&File";
     this.newFileMenuItem.Image = Resources.newMap;
     this.newFileMenuItem.Shortcut = Shortcut.CtrlN;
     this.newFileMenuItem.Text = "New script";
     this.newFileMenuItem.Activate += new EventHandler(this.newFileMenuItem_Activate);
     this.openScriptMenuItem.Image = Resources.openMap;
     this.openScriptMenuItem.Shortcut = Shortcut.CtrlO;
     this.openScriptMenuItem.Text = "Open script";
     this.openScriptMenuItem.Activate += new EventHandler(this.openScriptMenuItem_Activate);
     this.saveScriptMenuItem.BeginGroup = true;
     this.saveScriptMenuItem.Image = Resources.save;
     this.saveScriptMenuItem.Shortcut = Shortcut.CtrlS;
     this.saveScriptMenuItem.Text = "Save script";
     this.saveScriptMenuItem.Activate += new EventHandler(this.saveScriptMenuItem_Activate);
     this.exitMenuItem.Text = "Exit";
     this.menuBarItem2.Items.AddRange(new ToolbarItemBase[]
     {
         this.undoMenuItem,
         this.redoMenuItem,
         this.cutMenuItem,
         this.copyMenuItem,
         this.pasteMenuItem
     });
     this.menuBarItem2.Text = "&Edit";
     this.undoMenuItem.Image = Resources.undo;
     this.undoMenuItem.Shortcut = Shortcut.CtrlZ;
     this.undoMenuItem.Text = "&Undo";
     this.undoMenuItem.Activate += new EventHandler(this.undoMenuItem_Activate);
     this.redoMenuItem.Image = Resources.redo;
     this.redoMenuItem.Shortcut = Shortcut.CtrlShiftZ;
     this.redoMenuItem.Text = "&Redo";
     this.cutMenuItem.BeginGroup = true;
     this.cutMenuItem.Image = Resources.cut;
     this.cutMenuItem.Shortcut = Shortcut.CtrlX;
     this.cutMenuItem.Text = "C&ut";
     this.cutMenuItem.Activate += new EventHandler(this.cutMenuItem_Activate);
     this.copyMenuItem.Image = Resources.copy;
     this.copyMenuItem.Shortcut = Shortcut.CtrlC;
     this.copyMenuItem.Text = "&Copy";
     this.copyMenuItem.Activate += new EventHandler(this.copyMenuItem_Activate);
     this.pasteMenuItem.Image = Resources.paste;
     this.pasteMenuItem.Shortcut = Shortcut.CtrlV;
     this.pasteMenuItem.Text = "&Paste";
     this.pasteMenuItem.Activate += new EventHandler(this.pasteMenuItem_Activate);
     this.menuBarItem3.Items.AddRange(new ToolbarItemBase[]
     {
         this.mapViewerMenuItem
     });
     this.menuBarItem3.Text = "&View";
     this.mapViewerMenuItem.Text = "Map Viewer";
     this.mapViewerMenuItem.Activate += new EventHandler(this.mapViewerMenuItem_Activate);
     this.menuBarItem4.Items.AddRange(new ToolbarItemBase[]
     {
         this.runMenuItem
     });
     this.menuBarItem4.MdiWindowList = true;
     this.menuBarItem4.Text = "&Script";
     this.runMenuItem.Image = Resources.PlayHS;
     this.runMenuItem.Shortcut = Shortcut.F5;
     this.runMenuItem.Text = "&Run";
     this.runMenuItem.Activate += new EventHandler(this.runMenuItem_Activate);
     this.menuBarItem5.Text = "&Help";
     this.toolBar1.DockLine = 1;
     this.toolBar1.Guid = new Guid("46756475-373b-4e41-8b89-f8ab1b41c370");
     this.toolBar1.Items.AddRange(new ToolbarItemBase[]
     {
         this.buttonItem1,
         this.buttonItem3,
         this.buttonItem2,
         this.buttonItem4,
         this.buttonItem5,
         this.buttonItem6,
         this.buttonItem8,
         this.buttonItem9,
         this.buttonItem7
     });
     this.toolBar1.Location = new Point(2, 23);
     this.toolBar1.Name = "toolBar1";
     this.toolBar1.Size = new Size(252, 26);
     this.toolBar1.TabIndex = 1;
     this.toolBar1.Text = "toolBar1";
     this.buttonItem1.BuddyMenu = this.newFileMenuItem;
     this.buttonItem1.Image = Resources.newMap;
     this.buttonItem3.BuddyMenu = this.openScriptMenuItem;
     this.buttonItem3.Image = Resources.openMap;
     this.buttonItem2.BuddyMenu = this.saveScriptMenuItem;
     this.buttonItem2.Image = Resources.save;
     this.buttonItem4.BeginGroup = true;
     this.buttonItem4.BuddyMenu = this.cutMenuItem;
     this.buttonItem4.Image = Resources.cut;
     this.buttonItem5.BuddyMenu = this.copyMenuItem;
     this.buttonItem5.Image = Resources.copy;
     this.buttonItem6.BuddyMenu = this.pasteMenuItem;
     this.buttonItem6.Image = Resources.paste;
     this.buttonItem8.BeginGroup = true;
     this.buttonItem8.BuddyMenu = this.undoMenuItem;
     this.buttonItem8.Image = Resources.undo;
     this.buttonItem9.BuddyMenu = this.redoMenuItem;
     this.buttonItem9.Image = Resources.redo;
     this.buttonItem7.BeginGroup = true;
     this.buttonItem7.BuddyMenu = this.runMenuItem;
     this.buttonItem7.Image = Resources.PlayHS;
     this.openFileDialog.DefaultExt = "lua";
     this.openFileDialog.FileName = "openFileDialog1";
     this.openFileDialog.Filter = "Far Cry 2 script files (*.lua)|*.lua|All files (*.*)|*.*";
     this.openFileDialog.Title = "Open script";
     this.contextMenuStrip1.Items.AddRange(new ToolStripItem[]
     {
         this.cutToolStripMenuItem,
         this.copyToolStripMenuItem,
         this.pasteToolStripMenuItem,
         this.toolStripSeparator1,
         this.insertFunctionToolStripMenuItem,
         this.insertTextureEntryIDToolStripMenuItem,
         this.insertCollectionEntryIDToolStripMenuItem
     });
     this.contextMenuStrip1.Name = "contextMenuStrip1";
     this.contextMenuStrip1.Size = new Size(194, 164);
     this.cutToolStripMenuItem.Name = "cutToolStripMenuItem";
     this.cutToolStripMenuItem.Size = new Size(193, 22);
     this.cutToolStripMenuItem.Text = "Cut";
     this.cutToolStripMenuItem.Click += new EventHandler(this.cutToolStripMenuItem_Click);
     this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";
     this.copyToolStripMenuItem.Size = new Size(193, 22);
     this.copyToolStripMenuItem.Text = "Copy";
     this.copyToolStripMenuItem.Click += new EventHandler(this.copyToolStripMenuItem_Click);
     this.pasteToolStripMenuItem.Name = "pasteToolStripMenuItem";
     this.pasteToolStripMenuItem.Size = new Size(193, 22);
     this.pasteToolStripMenuItem.Text = "Paste";
     this.pasteToolStripMenuItem.Click += new EventHandler(this.pasteToolStripMenuItem_Click);
     this.toolStripSeparator1.Name = "toolStripSeparator1";
     this.toolStripSeparator1.Size = new Size(190, 6);
     this.insertFunctionToolStripMenuItem.Name = "insertFunctionToolStripMenuItem";
     this.insertFunctionToolStripMenuItem.Size = new Size(193, 22);
     this.insertFunctionToolStripMenuItem.Text = "Insert function";
     this.insertTextureEntryIDToolStripMenuItem.Name = "insertTextureEntryIDToolStripMenuItem";
     this.insertTextureEntryIDToolStripMenuItem.Size = new Size(193, 22);
     this.insertTextureEntryIDToolStripMenuItem.Text = "Insert texture entry ID";
     this.insertCollectionEntryIDToolStripMenuItem.Name = "insertCollectionEntryIDToolStripMenuItem";
     this.insertCollectionEntryIDToolStripMenuItem.Size = new Size(193, 22);
     this.insertCollectionEntryIDToolStripMenuItem.Text = "Insert collection entry ID";
     base.AutoScaleDimensions = new SizeF(6f, 13f);
     base.AutoScaleMode = AutoScaleMode.Font;
     base.ClientSize = new Size(528, 383);
     base.Controls.Add(dockContainer);
     base.Controls.Add(this.statusStrip1);
     base.Controls.Add(this.leftSandBarDock);
     base.Controls.Add(this.rightSandBarDock);
     base.Controls.Add(this.bottomSandBarDock);
     base.Controls.Add(this.topSandBarDock);
     base.Name = "CodeEditor";
     this.Text = "Far Cry 2 Script Editor";
     dockContainer.ResumeLayout(false);
     this.statusStrip1.ResumeLayout(false);
     this.statusStrip1.PerformLayout();
     this.topSandBarDock.ResumeLayout(false);
     this.contextMenuStrip1.ResumeLayout(false);
     base.ResumeLayout(false);
     base.PerformLayout();
 }
Exemple #57
0
        void InitializeComponent()
        {
            //exception handling

            Application.Instance.UnhandledException += (sender, e) =>
            {
                new DWSIM.UI.Desktop.Editors.UnhandledExceptionView((Exception)e.ExceptionObject).ShowModalAsync();
            };

            string imgprefix = "DWSIM.UI.Forms.Resources.Icons.";

            Title = "DWSIMLauncher".Localize();

            switch (GlobalSettings.Settings.RunningPlatform())
            {
            case GlobalSettings.Settings.Platform.Windows:
                ClientSize = new Size(690, 420);
                break;

            case GlobalSettings.Settings.Platform.Linux:
                ClientSize = new Size(690, 365);
                break;

            case GlobalSettings.Settings.Platform.Mac:
                ClientSize = new Size(690, 350);
                break;
            }

            Icon = Eto.Drawing.Icon.FromResource(imgprefix + "DWSIM_ico.ico");

            var bgcolor = new Color(0.051f, 0.447f, 0.651f);

            Eto.Style.Add <Button>("main", button =>
            {
                button.BackgroundColor = bgcolor;
                button.Font            = new Font(FontFamilies.Sans, 12f, FontStyle.None);
                button.TextColor       = Colors.White;
                button.ImagePosition   = ButtonImagePosition.Left;
                button.Width           = 230;
            });

            var btn1 = new Button()
            {
                Style = "main", Text = "OpenSavedFile".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "OpenFolder_100px.png"), 40, 40, ImageInterpolation.Default)
            };
            var btn2 = new Button()
            {
                Style = "main", Text = "NewSimulation".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "Workflow_100px.png"), 40, 40, ImageInterpolation.Default)
            };
            var btn3 = new Button()
            {
                Style = "main", Text = "NewCompound".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "Peptide_100px.png"), 40, 40, ImageInterpolation.Default)
            };
            var btn4 = new Button()
            {
                Style = "main", Text = "NewDataRegression".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "AreaChart_100px.png"), 40, 40, ImageInterpolation.Default)
            };
            var btn6 = new Button()
            {
                Style = "main", Text = "Help".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "Help_100px.png"), 40, 40, ImageInterpolation.Default)
            };
            var btn7 = new Button()
            {
                Style = "main", Text = "About".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "Info_100px.png"), 40, 40, ImageInterpolation.Default)
            };
            var btn8 = new Button()
            {
                Style = "main", Text = "Donate".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "PayPal_100px.png"), 40, 40, ImageInterpolation.Default)
            };
            var btn9 = new Button()
            {
                Style = "main", Text = "Preferences".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "VerticalSettingsMixer_100px.png"), 40, 40, ImageInterpolation.Default)
            };

            btn9.Click += (sender, e) =>
            {
                new Forms.Forms.GeneralSettings().GetForm().Show();
            };

            btn6.Click += (sender, e) =>
            {
                Process.Start("http://dwsim.inforside.com.br/docs/crossplatform/help/");
            };

            btn1.Click += (sender, e) =>
            {
                var dialog = new OpenFileDialog();
                dialog.Title = "Open File".Localize();
                dialog.Filters.Add(new FileFilter("XML Simulation File".Localize(), new[] { ".dwxml", ".dwxmz" }));
                dialog.MultiSelect        = false;
                dialog.CurrentFilterIndex = 0;
                if (dialog.ShowDialog(this) == DialogResult.Ok)
                {
                    LoadSimulation(dialog.FileName);
                }
            };

            btn2.Click += (sender, e) =>
            {
                var form = new Forms.Flowsheet();
                AddUserCompounds(form.FlowsheetObject);
                OpenForms   += 1;
                form.Closed += (sender2, e2) =>
                {
                    OpenForms -= 1;
                };
                form.newsim = true;
                form.Show();
            };

            btn7.Click += (sender, e) => new AboutBox().Show();
            btn8.Click += (sender, e) => Process.Start("http://sourceforge.net/p/dwsim/donate/");

            var stack = new StackLayout {
                Orientation = Orientation.Vertical, Spacing = 5
            };

            stack.Items.Add(btn1);
            stack.Items.Add(btn2);
            stack.Items.Add(btn9);
            stack.Items.Add(btn6);
            stack.Items.Add(btn7);
            stack.Items.Add(btn8);

            var tableright = new TableLayout();

            tableright.Padding = new Padding(5, 5, 5, 5);
            tableright.Spacing = new Size(10, 10);

            MostRecentList = new ListBox {
                BackgroundColor = bgcolor, Height = 330
            };
            SampleList = new ListBox {
                BackgroundColor = bgcolor, Height = 330
            };
            FoldersList = new ListBox {
                BackgroundColor = bgcolor, Height = 330
            };

            if (Application.Instance.Platform.IsGtk &&
                GlobalSettings.Settings.RunningPlatform() == GlobalSettings.Settings.Platform.Mac)
            {
                MostRecentList.TextColor = bgcolor;
                SampleList.TextColor     = bgcolor;
                FoldersList.TextColor    = bgcolor;
            }
            else
            {
                MostRecentList.TextColor = Colors.White;
                SampleList.TextColor     = Colors.White;
                FoldersList.TextColor    = Colors.White;
            }

            var invertedlist = new List <string>(GlobalSettings.Settings.MostRecentFiles);

            invertedlist.Reverse();

            foreach (var item in invertedlist)
            {
                if (File.Exists(item))
                {
                    MostRecentList.Items.Add(new ListItem {
                        Text = Path.GetFileName(item), Key = item
                    });
                }
            }

            var samplist = Directory.EnumerateFiles(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "samples"), "*.dwxm*");

            foreach (var item in samplist)
            {
                if (File.Exists(item))
                {
                    SampleList.Items.Add(new ListItem {
                        Text = Path.GetFileName(item), Key = item
                    });
                }
            }

            foreach (String f in invertedlist)
            {
                if (Path.GetExtension(f).ToLower() != ".dwbcs")
                {
                    if (FoldersList.Items.Where((x) => x.Text == Path.GetDirectoryName(f)).Count() == 0)
                    {
                        FoldersList.Items.Add(new ListItem {
                            Text = Path.GetDirectoryName(f), Key = Path.GetDirectoryName(f)
                        });
                    }
                }
            }

            FoldersList.SelectedIndexChanged += (sender, e) =>
            {
                if (FoldersList.SelectedIndex >= 0)
                {
                    var dialog = new OpenFileDialog();
                    dialog.Title     = "Open File".Localize();
                    dialog.Directory = new Uri(FoldersList.SelectedKey);
                    dialog.Filters.Add(new FileFilter("XML Simulation File".Localize(), new[] { ".dwxml", ".dwxmz" }));
                    dialog.MultiSelect        = false;
                    dialog.CurrentFilterIndex = 0;
                    if (dialog.ShowDialog(this) == DialogResult.Ok)
                    {
                        LoadSimulation(dialog.FileName);
                    }
                }
            };

            MostRecentList.SelectedIndexChanged += (sender, e) =>
            {
                if (MostRecentList.SelectedIndex >= 0)
                {
                    LoadSimulation(MostRecentList.SelectedKey);
                    MostRecentList.SelectedIndex = -1;
                }
                ;
            };

            SampleList.SelectedIndexChanged += (sender, e) =>
            {
                if (SampleList.SelectedIndex >= 0)
                {
                    LoadSimulation(SampleList.SelectedKey);
                    MostRecentList.SelectedIndex = -1;
                }
                ;
            };

            var tabview = new TabControl();
            var tab1    = new TabPage(MostRecentList)
            {
                Text = "Recent Files"
            };;
            var tab2 = new TabPage(SampleList)
            {
                Text = "Samples"
            };;
            var tab3 = new TabPage(FoldersList)
            {
                Text = "Recent Folders"
            };;

            tabview.Pages.Add(tab1);
            tabview.Pages.Add(tab2);
            tabview.Pages.Add(tab3);

            tableright.Rows.Add(new TableRow(tabview));

            var tl = new DynamicLayout();

            tl.Add(new TableRow(stack, tableright));

            TableContainer = new TableLayout
            {
                Padding         = 10,
                Spacing         = new Size(5, 5),
                Rows            = { new TableRow(tl) },
                BackgroundColor = bgcolor,
            };

            Content = TableContainer;

            var quitCommand = new Command {
                MenuText = "Quit".Localize(), Shortcut = Application.Instance.CommonModifier | Keys.Q
            };

            quitCommand.Executed += (sender, e) => Application.Instance.Quit();

            var aboutCommand = new Command {
                MenuText = "About".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "information.png"))
            };

            aboutCommand.Executed += (sender, e) => new AboutBox().Show();

            var aitem1 = new ButtonMenuItem {
                Text = "Preferences".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "icons8-sorting_options.png"))
            };

            aitem1.Click += (sender, e) =>
            {
                new Forms.Forms.GeneralSettings().GetForm().Show();
            };

            var hitem1 = new ButtonMenuItem {
                Text = "Help".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "help_browser.png"))
            };

            hitem1.Click += (sender, e) =>
            {
                Process.Start("http://dwsim.inforside.com.br/docs/crossplatform/help/");
            };

            var hitem2 = new ButtonMenuItem {
                Text = "Support".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "help_browser.png"))
            };

            hitem2.Click += (sender, e) =>
            {
                Process.Start("http://dwsim.inforside.com.br/wiki/index.php?title=Support");
            };

            var hitem3 = new ButtonMenuItem {
                Text = "Report a Bug".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "help_browser.png"))
            };

            hitem3.Click += (sender, e) =>
            {
                Process.Start("https://sourceforge.net/p/dwsim/tickets/");
            };

            var hitem4 = new ButtonMenuItem {
                Text = "Go to DWSIM's Website".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "help_browser.png"))
            };

            hitem4.Click += (sender, e) =>
            {
                Process.Start("http://dwsim.inforside.com.br");
            };

            // create menu
            Menu = new MenuBar
            {
                ApplicationItems = { aitem1 },
                QuitItem         = quitCommand,
                HelpItems        = { hitem1, hitem4, hitem2, hitem3 },
                AboutItem        = aboutCommand
            };

            Shown += MainForm_Shown;

            Closing += MainForm_Closing;

            //Plugins

            LoadPlugins();
        }
Exemple #58
0
 public MenuBarView(MenuBar menubar, GUIManager manager)
     : base(menubar, manager)
 {
 }
Exemple #59
0
 public MenuCollection(MenuBar menuBar)
 {
     _menuBar = menuBar;
 }
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.components = new System.ComponentModel.Container();
     this.menuBarItem1 = new TD.SandBar.MenuBarItem();
     this.menuBarItem2 = new TD.SandBar.MenuBarItem();
     this.menuBarItem3 = new TD.SandBar.MenuBarItem();
     this.menuBarItem4 = new TD.SandBar.MenuBarItem();
     this.menuBarItem5 = new TD.SandBar.MenuBarItem();
     this.sandDockManager = new TD.SandDock.SandDockManager();
     this.leftSandDock = new TD.SandDock.DockContainer();
     this.rightSandDock = new TD.SandDock.DockContainer();
     this.dockElementInsert = new TD.SandDock.DockableWindow();
     this.elementInsertPanel = new XEditNet.Widgets.ElementInsertPanel();
     this.dockElementChange = new TD.SandDock.DockableWindow();
     this.elementChangePanel = new XEditNet.Widgets.ElementChangePanel();
     this.dockAttributes = new TD.SandDock.DockableWindow();
     this.attributeChangePanel = new XEditNet.Widgets.AttributeChangePanel();
     this.bottomSandDock = new TD.SandDock.DockContainer();
     this.topSandDock = new TD.SandDock.DockContainer();
     this.menuBar1 = new TD.SandBar.MenuBar();
     this.menuBarItem6 = new TD.SandBar.MenuBarItem();
     this.menuFileSave = new TD.SandBar.MenuButtonItem();
     this.menuButtonItem1 = new TD.SandBar.MenuButtonItem();
     this.menuBarItem7 = new TD.SandBar.MenuBarItem();
     this.menuButtonItem2 = new TD.SandBar.MenuButtonItem();
     this.menuBarItem8 = new TD.SandBar.MenuBarItem();
     this.menuButtonItem3 = new TD.SandBar.MenuButtonItem();
     this.toolBar1 = new TD.SandBar.ToolBar();
     this.toolBar2 = new TD.SandBar.ToolBar();
     this.buttonItem1 = new TD.SandBar.ButtonItem();
     this.quickFixBar = new TD.SandBar.ContainerBar();
     this.containerBarClientPanel1 = new TD.SandBar.ContainerBarClientPanel();
     this.quickFixPanel = new XEditNet.Widgets.QuickFixPanel();
     this.quickFixImageList = new System.Windows.Forms.ImageList(this.components);
     this.quickFixPreceeding = new TD.SandBar.ButtonItem();
     this.quickFixFollowing = new TD.SandBar.ButtonItem();
     this.commandImageList = new System.Windows.Forms.ImageList(this.components);
     this.rightSandDock.SuspendLayout();
     this.dockElementInsert.SuspendLayout();
     this.dockElementChange.SuspendLayout();
     this.dockAttributes.SuspendLayout();
     this.quickFixBar.SuspendLayout();
     this.containerBarClientPanel1.SuspendLayout();
     this.SuspendLayout();
     //
     // menuBarItem1
     //
     this.menuBarItem1.Text = "&File";
     //
     // menuBarItem2
     //
     this.menuBarItem2.Text = "&Edit";
     //
     // menuBarItem3
     //
     this.menuBarItem3.Text = "&View";
     //
     // menuBarItem4
     //
     this.menuBarItem4.MdiWindowList = true;
     this.menuBarItem4.Text = "&Window";
     //
     // menuBarItem5
     //
     this.menuBarItem5.Text = "&Help";
     //
     // sandDockManager
     //
     this.sandDockManager.OwnerForm = this;
     this.sandDockManager.Renderer = new TD.SandDock.Rendering.Office2003Renderer();
     //
     // leftSandDock
     //
     this.leftSandDock.Dock = System.Windows.Forms.DockStyle.Left;
     this.leftSandDock.LayoutSystem = new TD.SandDock.SplitLayoutSystem(250, 400);
     this.leftSandDock.Location = new System.Drawing.Point(0, 22);
     this.leftSandDock.Manager = this.sandDockManager;
     this.leftSandDock.Name = "leftSandDock";
     this.leftSandDock.Size = new System.Drawing.Size(0, 480);
     this.leftSandDock.TabIndex = 0;
     //
     // rightSandDock
     //
     this.rightSandDock.Controls.Add(this.dockElementInsert);
     this.rightSandDock.Controls.Add(this.dockElementChange);
     this.rightSandDock.Controls.Add(this.dockAttributes);
     this.rightSandDock.Dock = System.Windows.Forms.DockStyle.Right;
     this.rightSandDock.LayoutSystem = new TD.SandDock.SplitLayoutSystem(250, 400, System.Windows.Forms.Orientation.Horizontal, new TD.SandDock.LayoutSystemBase[] {
                                                                                                                                                                       new TD.SandDock.ControlLayoutSystem(212, 238, new TD.SandDock.DockableWindow[] {
                                                                                                                                                                                                                                                       this.dockElementInsert,
                                                                                                                                                                                                                                                       this.dockElementChange}, this.dockElementInsert),
                                                                                                                                                                       new TD.SandDock.ControlLayoutSystem(212, 238, new TD.SandDock.DockableWindow[] {
                                                                                                                                                                                                                                                       this.dockAttributes}, this.dockAttributes)});
     this.rightSandDock.Location = new System.Drawing.Point(600, 22);
     this.rightSandDock.Manager = this.sandDockManager;
     this.rightSandDock.Name = "rightSandDock";
     this.rightSandDock.Size = new System.Drawing.Size(216, 480);
     this.rightSandDock.TabIndex = 1;
     //
     // dockElementInsert
     //
     this.dockElementInsert.Controls.Add(this.elementInsertPanel);
     this.dockElementInsert.Guid = new System.Guid("63fe64f8-5444-45cb-b17d-17f8baf0c91d");
     this.dockElementInsert.Location = new System.Drawing.Point(4, 25);
     this.dockElementInsert.Name = "dockElementInsert";
     this.dockElementInsert.Size = new System.Drawing.Size(212, 190);
     this.dockElementInsert.TabIndex = 1;
     this.dockElementInsert.Text = "Insert";
     //
     // elementInsertPanel
     //
     this.elementInsertPanel.Dock = System.Windows.Forms.DockStyle.Fill;
     this.elementInsertPanel.Location = new System.Drawing.Point(0, 0);
     this.elementInsertPanel.Name = "elementInsertPanel";
     this.elementInsertPanel.Size = new System.Drawing.Size(212, 190);
     this.elementInsertPanel.TabIndex = 0;
     //
     // dockElementChange
     //
     this.dockElementChange.Controls.Add(this.elementChangePanel);
     this.dockElementChange.Guid = new System.Guid("cb2f6fbf-41de-4588-a08b-f4f00d505fa7");
     this.dockElementChange.Location = new System.Drawing.Point(4, 25);
     this.dockElementChange.Name = "dockElementChange";
     this.dockElementChange.Size = new System.Drawing.Size(212, 190);
     this.dockElementChange.TabIndex = 1;
     this.dockElementChange.Text = "Change";
     //
     // elementChangePanel
     //
     this.elementChangePanel.Dock = System.Windows.Forms.DockStyle.Fill;
     this.elementChangePanel.Location = new System.Drawing.Point(0, 0);
     this.elementChangePanel.Name = "elementChangePanel";
     this.elementChangePanel.Size = new System.Drawing.Size(212, 190);
     this.elementChangePanel.TabIndex = 0;
     //
     // dockAttributes
     //
     this.dockAttributes.Controls.Add(this.attributeChangePanel);
     this.dockAttributes.Guid = new System.Guid("7a4f064f-d569-4ab2-8133-ca0b6b8c4151");
     this.dockAttributes.Location = new System.Drawing.Point(4, 267);
     this.dockAttributes.Name = "dockAttributes";
     this.dockAttributes.Size = new System.Drawing.Size(212, 190);
     this.dockAttributes.TabIndex = 2;
     this.dockAttributes.Text = "Attributes";
     //
     // attributeChangePanel
     //
     this.attributeChangePanel.Dock = System.Windows.Forms.DockStyle.Fill;
     this.attributeChangePanel.Location = new System.Drawing.Point(0, 0);
     this.attributeChangePanel.Name = "attributeChangePanel";
     this.attributeChangePanel.Size = new System.Drawing.Size(212, 190);
     this.attributeChangePanel.TabIndex = 0;
     //
     // bottomSandDock
     //
     this.bottomSandDock.Dock = System.Windows.Forms.DockStyle.Bottom;
     this.bottomSandDock.LayoutSystem = new TD.SandDock.SplitLayoutSystem(250, 400);
     this.bottomSandDock.Location = new System.Drawing.Point(0, 502);
     this.bottomSandDock.Manager = this.sandDockManager;
     this.bottomSandDock.Name = "bottomSandDock";
     this.bottomSandDock.Size = new System.Drawing.Size(816, 0);
     this.bottomSandDock.TabIndex = 2;
     //
     // topSandDock
     //
     this.topSandDock.Dock = System.Windows.Forms.DockStyle.Top;
     this.topSandDock.LayoutSystem = new TD.SandDock.SplitLayoutSystem(250, 400);
     this.topSandDock.Location = new System.Drawing.Point(0, 22);
     this.topSandDock.Manager = this.sandDockManager;
     this.topSandDock.Name = "topSandDock";
     this.topSandDock.Size = new System.Drawing.Size(816, 0);
     this.topSandDock.TabIndex = 3;
     //
     // menuBar1
     //
     this.menuBar1.AllowMerge = true;
     this.menuBar1.Guid = new System.Guid("dc0a091b-fb9a-4a33-8bf0-a9a24af4064c");
     this.menuBar1.Items.AddRange(new TD.SandBar.ToolbarItemBase[] {
                                                                       this.menuBarItem6,
                                                                       this.menuBarItem7,
                                                                       this.menuBarItem8});
     this.menuBar1.Location = new System.Drawing.Point(232, 22);
     this.menuBar1.Name = "menuBar1";
     this.menuBar1.OwnerForm = this;
     this.menuBar1.Size = new System.Drawing.Size(368, 22);
     this.menuBar1.TabIndex = 0;
     this.menuBar1.Text = "menuBar1";
     this.menuBar1.Visible = false;
     //
     // menuBarItem6
     //
     this.menuBarItem6.Items.AddRange(new TD.SandBar.ToolbarItemBase[] {
                                                                           this.menuFileSave,
                                                                           this.menuButtonItem1});
     this.menuBarItem6.Text = "&File";
     //
     // menuFileSave
     //
     this.menuFileSave.BeginGroup = true;
     this.menuFileSave.MergeAction = TD.SandBar.ItemMergeAction.Insert;
     this.menuFileSave.MergeIndex = 2;
     this.menuFileSave.Text = "Save";
     this.menuFileSave.Activate += new System.EventHandler(this.SaveFile);
     //
     // menuButtonItem1
     //
     this.menuButtonItem1.MergeAction = TD.SandBar.ItemMergeAction.Insert;
     this.menuButtonItem1.MergeIndex = 3;
     this.menuButtonItem1.Text = "&Close";
     this.menuButtonItem1.Activate += new System.EventHandler(this.CloseFile);
     //
     // menuBarItem7
     //
     this.menuBarItem7.Items.AddRange(new TD.SandBar.ToolbarItemBase[] {
                                                                           this.menuButtonItem2});
     this.menuBarItem7.Text = "&Edit";
     //
     // menuButtonItem2
     //
     this.menuButtonItem2.MergeAction = TD.SandBar.ItemMergeAction.Add;
     this.menuButtonItem2.MergeIndex = 0;
     this.menuButtonItem2.Text = "&Test";
     //
     // menuBarItem8
     //
     this.menuBarItem8.Items.AddRange(new TD.SandBar.ToolbarItemBase[] {
                                                                           this.menuButtonItem3});
     this.menuBarItem8.Text = "&View";
     //
     // menuButtonItem3
     //
     this.menuButtonItem3.MergeAction = TD.SandBar.ItemMergeAction.Add;
     this.menuButtonItem3.MergeIndex = 0;
     this.menuButtonItem3.Text = "&ViewTest";
     //
     // toolBar1
     //
     this.toolBar1.DockLine = 1;
     this.toolBar1.Guid = new System.Guid("88196026-7bd7-4954-85b7-34999dcd37cd");
     this.toolBar1.Location = new System.Drawing.Point(2, 24);
     this.toolBar1.Name = "toolBar1";
     this.toolBar1.Size = new System.Drawing.Size(24, 18);
     this.toolBar1.TabIndex = 1;
     this.toolBar1.Text = "toolBar1";
     //
     // toolBar2
     //
     this.toolBar2.Guid = new System.Guid("458f1dcc-720e-4fb6-b794-41d5a9f186e2");
     this.toolBar2.Items.AddRange(new TD.SandBar.ToolbarItemBase[] {
                                                                       this.buttonItem1});
     this.toolBar2.Location = new System.Drawing.Point(0, 0);
     this.toolBar2.Name = "toolBar2";
     this.toolBar2.Size = new System.Drawing.Size(816, 22);
     this.toolBar2.TabIndex = 4;
     this.toolBar2.Text = "";
     this.toolBar2.Visible = false;
     //
     // buttonItem1
     //
     this.buttonItem1.MergeAction = TD.SandBar.ItemMergeAction.Insert;
     this.buttonItem1.MergeIndex = 2;
     this.buttonItem1.Text = "xxxx";
     //
     // quickFixBar
     //
     this.quickFixBar.AddRemoveButtonsVisible = false;
     this.quickFixBar.AllowHorizontalDock = false;
     this.quickFixBar.Controls.Add(this.containerBarClientPanel1);
     this.quickFixBar.Dock = System.Windows.Forms.DockStyle.Left;
     this.quickFixBar.Flow = TD.SandBar.ToolBarLayout.Horizontal;
     this.quickFixBar.Guid = new System.Guid("0e1e9ede-d2fe-4307-a683-d2e3ea4f4e5f");
     this.quickFixBar.ImageList = this.quickFixImageList;
     this.quickFixBar.Items.AddRange(new TD.SandBar.ToolbarItemBase[] {
                                                                          this.quickFixPreceeding,
                                                                          this.quickFixFollowing});
     this.quickFixBar.Location = new System.Drawing.Point(0, 22);
     this.quickFixBar.Name = "quickFixBar";
     this.quickFixBar.Size = new System.Drawing.Size(232, 480);
     this.quickFixBar.TabIndex = 5;
     this.quickFixBar.Text = "Quick Fix";
     //
     // containerBarClientPanel1
     //
     this.containerBarClientPanel1.Controls.Add(this.quickFixPanel);
     this.containerBarClientPanel1.Location = new System.Drawing.Point(2, 45);
     this.containerBarClientPanel1.Name = "containerBarClientPanel1";
     this.containerBarClientPanel1.Size = new System.Drawing.Size(228, 433);
     this.containerBarClientPanel1.TabIndex = 0;
     //
     // quickFixPanel
     //
     this.quickFixPanel.BackColor = System.Drawing.Color.Transparent;
     this.quickFixPanel.Dock = System.Windows.Forms.DockStyle.Fill;
     this.quickFixPanel.Location = new System.Drawing.Point(0, 0);
     this.quickFixPanel.Name = "quickFixPanel";
     this.quickFixPanel.Size = new System.Drawing.Size(228, 433);
     this.quickFixPanel.TabIndex = 0;
     this.quickFixPanel.FinishUpdate += new System.EventHandler(this.QuickFixUpdated);
     //
     // quickFixImageList
     //
     this.quickFixImageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit;
     this.quickFixImageList.ImageSize = new System.Drawing.Size(16, 16);
     this.quickFixImageList.TransparentColor = System.Drawing.Color.Transparent;
     //
     // quickFixPreceeding
     //
     this.quickFixPreceeding.ImageIndex = 0;
     this.quickFixPreceeding.Activate += new System.EventHandler(this.GotoPrecedingError);
     //
     // quickFixFollowing
     //
     this.quickFixFollowing.ImageIndex = 1;
     this.quickFixFollowing.Activate += new System.EventHandler(this.GotoFollowingError);
     //
     // commandImageList
     //
     this.commandImageList.ImageSize = new System.Drawing.Size(16, 16);
     this.commandImageList.TransparentColor = System.Drawing.Color.Transparent;
     //
     // XEditNetChildForm
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.ClientSize = new System.Drawing.Size(816, 502);
     this.Controls.Add(this.menuBar1);
     this.Controls.Add(this.quickFixBar);
     this.Controls.Add(this.leftSandDock);
     this.Controls.Add(this.rightSandDock);
     this.Controls.Add(this.bottomSandDock);
     this.Controls.Add(this.topSandDock);
     this.Controls.Add(this.toolBar2);
     this.Name = "XEditNetChildForm";
     this.Text = "XEditNetChildForm";
     this.rightSandDock.ResumeLayout(false);
     this.dockElementInsert.ResumeLayout(false);
     this.dockElementChange.ResumeLayout(false);
     this.dockAttributes.ResumeLayout(false);
     this.quickFixBar.ResumeLayout(false);
     this.containerBarClientPanel1.ResumeLayout(false);
     this.ResumeLayout(false);
 }