Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Baimp.PipelineController"/> class.
        /// </summary>
        /// <param name="project">Project.</param>
        /// <param name="pipelineShelf">Frame where the pipeline should be.</param>
        public PipelineController(Project project, VBox pipelineShelf)
        {
            this.pipelineShelf = pipelineShelf;

            pipelineScroller = new ScrollView();
            pipelineScroller.Content = currentPipeline;

            this.project = project;
            OnProjectDataChangged(new ProjectChangedEventArgs(null) { refresh = true });

            InitializeControllerbar();
            splitControllTab_pipelineScroller.PackEnd(pipelineScroller, true, true);

            algorithm = new AlgorithmTreeView(project.scanCollection);
            algorithm.MinWidth = 200; // TODO, save size as user property

            HPaned splitPipeline_Algorithm = new HPaned();
            splitPipeline_Algorithm.Panel1.Content = algorithm;
            splitPipeline_Algorithm.Panel1.Resize = false;
            splitPipeline_Algorithm.Panel1.Shrink = false;
            splitPipeline_Algorithm.Panel2.Content = splitControllTab_pipelineScroller;
            splitPipeline_Algorithm.Panel2.Resize = true;
            splitPipeline_Algorithm.Panel2.Shrink = false;

            pipelineShelf.PackStart(splitPipeline_Algorithm, true, true);

            InitializeEvents();
        }
Пример #2
0
 void CreateButtons(HPaned panel)
 {
     var panel2 = panel.Panel2;
     var box = new VBox ();
     panel2.Content = box;
     box.PackStart (CreateConnectButton ());
     box.PackStart (CreateListenButton ());
 }
Пример #3
0
 public NodeWindow(string name)
 {
     Title = "Node " + name;
     Width = 800;
     Height = 600;
     Content = new HPaned ();
     //this.InitialLocation = WindowLocation.CenterScreen;
 }
Пример #4
0
        public MainWindow()
        {
            SetSize ();
            CreateMenu ();

            var panel = new HPaned();
            CreateTreeView (panel);
            CreateButtons (panel);

            Content = panel;
            CloseRequested += (sender, args) =>
                Application.Exit();
        }
Пример #5
0
        public PanedViews()
        {
            Panel1.Content = CreateFrame ("Fixed panel at the left", false);

            HPaned centralPaned = new HPaned ();
            centralPaned.Panel1.Content = CreateFrame ("Should expand\nhorizontally and vertically", true);
            centralPaned.Panel1.Resize = true;

            VPaned verticalPaned = new VPaned ();
            verticalPaned.Panel1.Content = CreateFrame ("Fixed panel\nat the top", false);

            verticalPaned.Panel2.Content = CreateFrame ("Should expand vertically", true);
            verticalPaned.Panel2.Resize = true;

            centralPaned.Panel2.Content = verticalPaned;

            Panel2.Content = centralPaned;
            Panel2.Resize = true;
        }
Пример #6
0
		public PanedViews ()
		{
			Panel1.Content = CreateFrame ("Fixed panel at the left", false);
			
			HPaned centralPaned = new HPaned ();
			centralPaned.Panel1.Content = CreateFrame ("Should expand\nhorizontally and vertically", true);
			centralPaned.Panel1.Resize = true;

			VPaned verticalPaned = new VPaned ();
			verticalPaned.Panel1.Content = CreateFrame ("Fixed panel\nat the top", false);
			
			verticalPaned.Panel2.Content = CreateFrame ("Should expand vertically\n(with green background)", true);
			verticalPaned.Panel2.Content.BackgroundColor = Colors.LightGreen;
			verticalPaned.Panel2.Resize = true;

			centralPaned.Panel2.Content = verticalPaned;
			
			Panel2.Content = centralPaned;
			Panel2.Resize = true;
		}
Пример #7
0
        private void CreateComponents()
        {
            BackgroundColor = Colors.White;

            PackStart(CreateTopBar());

            var bodyBox = new HPaned();
            bodyBox.Panel1.Content = CreateDescriptionView();
            bodyBox.Panel2.Content = CreateImagesView();

            PackStart(bodyBox, true);

            PackEnd(CreateButtonsBar());
        }
Пример #8
0
        public MainWindow()
        {
            try {
                statusIcon = Application.CreateStatusIcon ();
                statusIcon.Menu = new Menu ();
                statusIcon.Menu.Items.Add (new MenuItem ("Test"));
                statusIcon.Image = Image.FromResource (GetType (), "package.png");
            } catch {
                Console.WriteLine ("Status icon could not be shown");
            }

            Menu menu = new Menu ();

            var file = new MenuItem ("File");
            file.SubMenu = new Menu ();
            file.SubMenu.Items.Add (new MenuItem ("Open"));
            file.SubMenu.Items.Add (new MenuItem ("New"));
            MenuItem mi = new MenuItem ("Close");
            mi.Clicked += delegate {
                Application.Exit();
            };
            file.SubMenu.Items.Add (mi);
            menu.Items.Add (file);

            var edit = new MenuItem ("Edit");
            edit.SubMenu = new Menu ();
            edit.SubMenu.Items.Add (new MenuItem ("Copy"));
            edit.SubMenu.Items.Add (new MenuItem ("Cut"));
            edit.SubMenu.Items.Add (new MenuItem ("Paste"));
            menu.Items.Add (edit);

            MainMenu = menu;

            HPaned box = new HPaned ();

            icon = Image.FromResource (typeof(App), "class.png");

            store = new TreeStore (nameCol, iconCol, widgetCol);
            samplesTree = new TreeView ();
            samplesTree.Columns.Add ("Name", iconCol, nameCol);

            AddSample (null, "Boxes", typeof(Boxes));
            AddSample (null, "Buttons", typeof(ButtonSample));
            AddSample (null, "CheckBox", typeof(Checkboxes));
            AddSample (null, "Clipboard", typeof(ClipboardSample));
            AddSample (null, "ColorSelector", typeof(ColorSelectorSample));
            AddSample (null, "ComboBox", typeof(ComboBoxes));
            //			AddSample (null, "Designer", typeof(Designer));
            AddSample (null, "Drag & Drop", typeof(DragDrop));

            var n = AddSample (null, "Drawing", null);
            AddSample (n, "Canvas with Widget", typeof(CanvasWithWidget));
            AddSample (n, "Chart", typeof(ChartSample));
            AddSample (n, "Colors", typeof(ColorsSample));
            AddSample (n, "Figures", typeof(DrawingFigures));
            AddSample (n, "Transformations", typeof(DrawingTransforms));
            AddSample (n, "Images and Patterns", typeof(DrawingPatternsAndImages));
            AddSample (n, "Text", typeof(DrawingText));
            AddSample (n, "Partial Images", typeof (PartialImages));

            AddSample (null, "Expander", typeof (ExpanderSample));
            AddSample (null, "Progress bars", typeof(ProgressBarSample));
            AddSample (null, "Frames", typeof(Frames));
            AddSample (null, "Images", typeof(Images));
            AddSample (null, "Labels", typeof(Labels));
            AddSample (null, "ListBox", typeof(ListBoxSample));
            AddSample (null, "ListView", typeof(ListView1));
            AddSample (null, "Menu", typeof(MenuSamples));
            AddSample (null, "Notebook", typeof(NotebookSample));
            AddSample (null, "Paneds", typeof(PanedViews));
            AddSample (null, "Scroll View", typeof(ScrollWindowSample));
            AddSample (null, "Tables", typeof(Tables));
            AddSample (null, "Text Entry", typeof(TextEntries));
            AddSample (null, "Tooltips", typeof(Tooltips));
            AddSample (null, "TreeView", typeof(TreeViews));
            AddSample (null, "WidgetEvents", typeof(WidgetEvents));
            AddSample (null, "Windows", typeof(Windows));

            samplesTree.DataSource = store;

            box.Panel1.Content = samplesTree;

            sampleBox = new VBox ();
            title = new Label ("Sample:");
            sampleBox.PackStart (title, BoxMode.None);

            box.Panel2.Content = sampleBox;
            box.Panel2.Resize = true;
            box.Position = 160;

            Content = box;

            samplesTree.SelectionChanged += HandleSamplesTreeSelectionChanged;
        }
Пример #9
0
        public MainWindow()
        {
            Title = string.Format (Catalog.GetString ("{0} Demo Application"), "Hamekoz Xwt");
            InitialLocation = WindowLocation.CenterScreen;
            Icon = Image.FromResource (Resources.Icon);
            WindowState = WindowState.Maximized;
            try {
                statusIcon = Application.CreateStatusIcon ();
                statusIcon.Menu = new Menu ();
                var about = new MenuItem {
                    Label = Catalog.GetString ("About"),
                    Image = Icons.Starred.WithSize (IconSize.Small),
                };
                var exit = new MenuItem {
                    Label = Catalog.GetString ("Exit"),
                    Image = Icons.Delete.WithSize (IconSize.Small),
                };
                statusIcon.Menu.Items.Add (about);
                statusIcon.Menu.Items.Add (exit);
                about.Clicked += AboutClicked;
                exit.Clicked += ExitClicked;
                statusIcon.Image = Icon;
            } catch {
                Console.WriteLine (Catalog.GetString ("Status icon could not be shown"));
            }

            panel = new HPaned ();

            store = new TreeStore (nameCol, iconCol, widgetCol);
            menuTree = new TreeView ();
            menuTree.Columns.Add ("", iconCol, nameCol);

            menuTree.DataSource = store;
            menuTree.SelectionChanged += HandleMenuTreeSelectionChanged;
            menuTree.MinWidth = 220;

            panel.Panel1.Content = menuTree;
            panel.Panel1.Content.MarginRight = 5;

            panel.Panel2.Resize = true;

            Content = panel;

            CloseRequested += HandleCloseRequested;

            InitialLocation = WindowLocation.CenterScreen;
        }
Пример #10
0
	  /******************************************
			THIS IS AUTO GENERATED CODE BY GLADEBUILDER
			DO NOT EDIT
			USE THE IMPLEMENTATION CLASS INSTEAD
	  *******************************************/
	  namespace GladeBuilder
Пример #11
0
        public MainWindow()
        {
            Title = "Xwt Demo Application";
            Width = 500;
            Height = 400;

            try {
                statusIcon = Application.CreateStatusIcon ();
                statusIcon.Menu = new Menu ();
                statusIcon.Menu.Items.Add (new MenuItem ("Test"));
                statusIcon.Image = Image.FromResource (GetType (), "package.png");
            } catch {
                Console.WriteLine ("Status icon could not be shown");
            }

            Menu menu = new Menu ();

            var file = new MenuItem ("_File");
            file.SubMenu = new Menu ();
            file.SubMenu.Items.Add (new MenuItem ("_Open"));
            file.SubMenu.Items.Add (new MenuItem ("_New"));
            MenuItem mi = new MenuItem ("_Close");
            mi.Clicked += delegate {
                Application.Exit();
            };
            file.SubMenu.Items.Add (mi);
            menu.Items.Add (file);

            var edit = new MenuItem ("_Edit");
            edit.SubMenu = new Menu ();
            edit.SubMenu.Items.Add (new MenuItem ("_Copy"));
            edit.SubMenu.Items.Add (new MenuItem ("Cu_t"));
            edit.SubMenu.Items.Add (new MenuItem ("_Paste"));
            menu.Items.Add (edit);

            MainMenu = menu;

            HPaned box = new HPaned ();

            icon = Image.FromResource (typeof(App), "document-generic.png");

            store = new TreeStore (nameCol, iconCol, widgetCol);
            samplesTree = new TreeView ();
            samplesTree.Columns.Add ("Name", iconCol, nameCol);

            var w = AddSample (null, "Widgets", null);
            AddSample (w, "Boxes", typeof(Boxes));
            AddSample (w, "Buttons", typeof(ButtonSample));
            AddSample (w, "CheckBox", typeof(Checkboxes));
            AddSample (w, "Clipboard", typeof(ClipboardSample));
            AddSample (w, "ColorSelector", typeof(ColorSelectorSample));
            AddSample (w, "ComboBox", typeof(ComboBoxes));
            AddSample (w, "DatePicker", typeof(DatePickerSample));
            //			AddSample (null, "Designer", typeof(Designer));
            AddSample (w, "Expander", typeof (ExpanderSample));
            AddSample (w, "Progress bars", typeof(ProgressBarSample));
            AddSample (w, "Frames", typeof(Frames));
            AddSample (w, "Images", typeof(Images));
            AddSample (w, "Labels", typeof(Labels));
            AddSample (w, "ListBox", typeof(ListBoxSample));
            AddSample (w, "LinkLabels", typeof(LinkLabels));
            var listView = AddSample (w, "ListView", typeof(ListView1));
            AddSample (listView, "Editable checkboxes", typeof(ListView2));
            AddSample (w, "Markdown", typeof (MarkDownSample));
            AddSample (w, "Menu", typeof(MenuSamples));
            var mn = AddSample (w, "Mnemonics", typeof (Mnemonics));
            AddSample (w, "Notebook", typeof(NotebookSample));
            AddSample (w, "Paneds", typeof(PanedViews));
            AddSample (w, "Popover", typeof(PopoverSample));
            AddSample (w, "RadioButton", typeof (RadioButtonSample));
            AddSample (w, "Scroll View", typeof(ScrollWindowSample));
            AddSample (w, "Scrollbar", typeof(ScrollbarSample));
            AddSample (w, "Slider", typeof (SliderSample));
            AddSample (w, "Spinners", typeof (Spinners));
            AddSample (w, "Tables", typeof (Tables));
            AddSample (w, "Text Entry", typeof (TextEntries));
            AddSample (w, "Password Entry", typeof (PasswordEntries));
            AddSample (w, "TreeView", typeof(TreeViews));

            var n = AddSample (null, "Drawing", null);
            AddSample (n, "Canvas with Widget (Linear)", typeof (CanvasWithWidget_Linear));
            AddSample (n, "Canvas with Widget (Radial)", typeof (CanvasWithWidget_Radial));
            AddSample (n, "Chart", typeof (ChartSample));
            AddSample (n, "Colors", typeof(ColorsSample));
            AddSample (n, "Figures", typeof(DrawingFigures));
            AddSample (n, "Transformations", typeof(DrawingTransforms));
            AddSample (n, "Images and Patterns", typeof(DrawingPatternsAndImages));
            AddSample (n, "Text", typeof(DrawingText));
            AddSample (n, "Partial Images", typeof (PartialImages));
            AddSample (n, "Custom Drawn Image", typeof (ImageScaling));
            AddSample (n, "Widget Rendering", typeof (WidgetRendering));

            var wf = AddSample (null, "Widget Features", null);
            AddSample (wf, "Drag & Drop", typeof(DragDrop));
            AddSample (wf, "Widget Events", typeof(WidgetEvents));
            AddSample (wf, "Opacity", typeof(OpacitySample));
            AddSample (wf, "Tooltips", typeof(Tooltips));

            AddSample (null, "Windows", typeof(Windows));

            AddSample (null, "Screens", typeof (ScreensSample));

            samplesTree.DataSource = store;

            box.Panel1.Content = samplesTree;

            sampleBox = new VBox ();
            title = new Label ("Sample:");
            sampleBox.PackStart (title);

            box.Panel2.Content = sampleBox;
            box.Panel2.Resize = true;
            box.Position = 160;

            Content = box;

            samplesTree.SelectionChanged += HandleSamplesTreeSelectionChanged;

            CloseRequested += HandleCloseRequested;
        }
Пример #12
0
        public MainWindow()
        {
            Title = "XwPlot Samples Demonstration";
            Width = 800;
            Height = 600;

            Menu menu = new Menu ();

            var file = new MenuItem ("File");
            file.SubMenu = new Menu ();
            file.SubMenu.Items.Add (new MenuItem ("Open"));
            file.SubMenu.Items.Add (new MenuItem ("New"));
            MenuItem mi = new MenuItem ("Close");
            mi.Clicked += delegate {
                Application.Exit();
            };
            file.SubMenu.Items.Add (mi);
            menu.Items.Add (file);

            var edit = new MenuItem ("Edit");
            edit.SubMenu = new Menu ();
            edit.SubMenu.Items.Add (new MenuItem ("Copy"));
            edit.SubMenu.Items.Add (new MenuItem ("Cut"));
            edit.SubMenu.Items.Add (new MenuItem ("Paste"));
            menu.Items.Add (edit);

            MainMenu = menu;

            HPaned box = new HPaned ();

            icon = Image.FromResource (typeof(App), "class.png");

            store = new TreeStore (nameCol, iconCol, sampleCol);
            samplesTree = new TreeView ();
            samplesTree.Columns.Add ("Name", iconCol, nameCol);

            plotCategory = AddSample (null, "Sample Plots", null);
            interactionCategory = AddSample (null, "Interactions", null);
            testCategory = AddSample (null, "Tests", null);

            AddSample (plotCategory, "Plot Markers", typeof (PlotMarkerSample));
            AddSample (plotCategory, "LabelPoint Plot", typeof (LabelPointPlotSample));
            AddSample (plotCategory, "Line and Point Plot", typeof (PointPlotSample));
            AddSample (plotCategory, "Waveform Step Plot", typeof (StepPlotSample));
            AddSample (plotCategory, "GradientPlot", typeof (GradientPlotSample));
            AddSample (plotCategory, "Histogram Plot", typeof (HistogramSample));
            AddSample (plotCategory, "Stacked Histogram Plot", typeof (StackedHistogram));
            AddSample (plotCategory, "Candle Plot", typeof (CandlePlotSample));
            AddSample (plotCategory, "Trading Plot", typeof (TradingSample));
            AddSample (plotCategory, "Plot Particles", typeof (PlotParticles));
            AddSample (plotCategory, "Plot Logo", typeof (PlotLogo));

            AddInteraction (interactionCategory, "AxisDrag", new AxisDrag ());
            AddInteraction (interactionCategory, "AxisScale", new AxisScale ());
            AddInteraction (interactionCategory, "PlotDrag (horizontal)", new PlotDrag (true,false));
            AddInteraction (interactionCategory, "PlotDrag (vertical)", new PlotDrag (false, true));
            AddInteraction (interactionCategory, "PlotScale", new PlotScale (true, true));
            AddInteraction (interactionCategory, "PlotZoom", new PlotZoom ());
            AddInteraction (interactionCategory, "PlotSelection", new PlotSelection ());

            AddSample (testCategory, "Linear Axis", typeof (LinearAxisTest));
            AddSample (testCategory, "Log Axis", typeof (LogAxisTest));
            AddSample (testCategory, "DateTime Axis", typeof (DateTimeAxisTest));
            AddSample (testCategory, "TradingDateTime Axis", typeof (TradingDateTimeAxisTest));
            AddSample (testCategory, "Rendering Performance", typeof (RenderingTest));
            AddSample (testCategory, "Overlay Canvas Test", typeof (OverlayTest));

            samplesTree.DataSource = store;

            box.Panel1.Content = samplesTree;

            sampleBox = new VBox ();

            box.Panel2.Content = sampleBox;
            box.Panel2.Resize = true;
            box.Position = 150;

            Content = box;

            samplesTree.SelectionChanged += HandleSamplesTreeSelectionChanged;

            CloseRequested += HandleCloseRequested;
        }
Пример #13
0
		public XwtColorSchemeEditor (HighlightingPanel panel)
		{
			this.panel = panel;

			this.Buttons.Add (new DialogButton (Command.Cancel));
			this.Buttons.Add (new DialogButton (Command.Ok));

			colorStore = new TreeStore (nameField, styleField, propertyField);

			var mainTable = new Table ();

			var headerTable = new Table ();
			headerTable.Add (new Label () { Text="Name:" }, 0, 0);
			headerTable.Add (entryName, 1, 0);
			headerTable.Add (new Label () { Text="Description:" }, 2, 0);
			headerTable.Add (entryDescription, 3, 0, 1, 1, true);
			mainTable.Add (headerTable, 0, 0, 1, 1, true, false, WidgetPlacement.Fill, WidgetPlacement.Start);

			var table = new Table ();

			var commandHBox = new HBox ();
			commandHBox.PackStart (new Button ("Undo"));
			commandHBox.PackStart (new Button ("Redo"));
			commandHBox.PackStart (new Button ("AutoSet"));
			table.Add (commandHBox, 0, 0);

			var adjustHBox = new HBox ();
			adjustHBox.PackStart (colorbuttonPrimary);
			adjustHBox.PackStart (colorbuttonSecondary);
			adjustHBox.PackStart (colorbuttonBorder);
			adjustHBox.PackStart (togglebuttonBold, false, WidgetPlacement.End);
			adjustHBox.PackStart (togglebuttonItalic, false, WidgetPlacement.End);
			adjustHBox.PackStart (buttonFormat, false, WidgetPlacement.End);
			table.Add (adjustHBox, 0, 1);

			this.colorbuttonPrimary.ColorSet += StyleChanged;
			this.colorbuttonSecondary.ColorSet += StyleChanged;
			this.colorbuttonBorder.ColorSet += StyleChanged;
			this.togglebuttonBold.Toggled += StyleChanged;
			this.togglebuttonItalic.Toggled += StyleChanged;

			this.textEditor = new TextEditor ();
			this.textEditor.Options = DefaultSourceEditorOptions.Instance;
			this.textEditor.ShowAll ();
			var toolkit = Toolkit.CurrentEngine;
			var wrappedTextEditor = toolkit.WrapWidget (textEditor);
			var scrollView = new ScrollView (wrappedTextEditor) {
				HorizontalScrollPolicy=ScrollPolicy.Always,
				VerticalScrollPolicy=ScrollPolicy.Always
			};
			table.Add (scrollView, 0, 2, 1, 1, true, true);

			this.treeviewColors = new TreeView ();
			this.treeviewColors.Columns.Add (GettextCatalog.GetString ("Name"), nameField);
			this.treeviewColors.HeadersVisible = false;
			this.treeviewColors.DataSource = colorStore;
			this.treeviewColors.SelectionChanged += HandleTreeviewColorsSelectionChanged;

			var box = new HPaned ();

			var treeBox = new VBox ();
			treeBox.PackStart (searchEntry);
			treeBox.PackStart (treeviewColors, true);
			box.Panel1.Content = treeBox;
			box.Panel2.Content = table;
			box.Panel2.Resize = true;
			box.Position = 400;
			
			mainTable.Add (box, 0, 1, 1, 1, true, true);
			this.Content = mainTable;

			this.Height = 400;

			HandleTreeviewColorsSelectionChanged (null, null);
		}
Пример #14
0
 void CreateTreeView(HPaned panel)
 {
     store = new TreeStore (nameCol);
     tree = new TreeView (store);
     tree.Columns.Add ("Name", nameCol);
     panel.Panel1.Content = tree;
     var conns = store.AddNode (null).SetValue (nameCol, "Nodes").CurrentPosition;
     vm.ConnectionAdded += (a, b) =>
         store.AddNode (conns).SetValue (nameCol, a + "-" + b.Id);
     tree.SelectionChanged +=
         HandleSelectionChanged;
 }
Пример #15
0
        public MainWindow()
        {
            Title = "NPlot.Xwt Samples Application";
            Width = 800;
            Height = 600;

            Menu menu = new Menu ();

            var file = new MenuItem ("File");
            file.SubMenu = new Menu ();
            file.SubMenu.Items.Add (new MenuItem ("Open"));
            file.SubMenu.Items.Add (new MenuItem ("New"));
            MenuItem mi = new MenuItem ("Close");
            mi.Clicked += delegate {
                Application.Exit();
            };
            file.SubMenu.Items.Add (mi);
            menu.Items.Add (file);

            var edit = new MenuItem ("Edit");
            edit.SubMenu = new Menu ();
            edit.SubMenu.Items.Add (new MenuItem ("Copy"));
            edit.SubMenu.Items.Add (new MenuItem ("Cut"));
            edit.SubMenu.Items.Add (new MenuItem ("Paste"));
            menu.Items.Add (edit);

            MainMenu = menu;

            HPaned box = new HPaned ();

            icon = Image.FromResource (typeof(App), "class.png");

            store = new TreeStore (nameCol, iconCol, widgetCol);
            samplesTree = new TreeView ();
            samplesTree.Columns.Add ("Name", iconCol, nameCol);

            var staticPlots = AddSample (null, "Static Plots", null);
            AddSample (staticPlots, "Plot Markers", typeof (PlotMarkerSample));
            AddSample (staticPlots, "Waveform Step Plot", typeof (StepPlotSample));
            AddSample (staticPlots, "Point Plot", typeof (PointPlotSample));
            AddSample (staticPlots, "Histogram Plot", typeof (HistogramSample));
            AddSample (staticPlots, "Candle Plot", typeof (CandlePlotSample));
            AddSample (staticPlots, "Trading Plot", typeof (TradingSample));

            var interactivePlots = AddSample (null, "Interactive Plots", null);
            AddSample (interactivePlots, "Waveform Plot", typeof (StepPlotSample));

            var tests = AddSample (null, "Tests", null);
            AddSample (tests, "Linear Axis", typeof (LinearAxisTest));
            AddSample (tests, "Log Axis", typeof (LogAxisTest));
            AddSample (tests, "DateTime Axis", typeof (DateTimeAxisTest));

            samplesTree.DataSource = store;

            box.Panel1.Content = samplesTree;

            sampleBox = new VBox ();

            box.Panel2.Content = sampleBox;
            box.Panel2.Resize = true;
            box.Position = 200;

            Content = box;

            samplesTree.SelectionChanged += HandleSamplesTreeSelectionChanged;

            CloseRequested += HandleCloseRequested;
        }
Пример #16
0
        /// <summary>
        /// Initializes a new instance of the Samples.MainWindow class, creating a 2-panel
        /// layout with a TreeStore for Sample selection and a VBox for the sample itself.
        /// </summary>
        public MainWindow()
        {
            // Show a status icon in taskbar if possible
            try {
                statusIcon = Application.CreateStatusIcon ();
                statusIcon.Menu = new Menu ();
                statusIcon.Menu.Items.Add (new MenuItem ("Test"));
                statusIcon.Image = Image.FromResource (GetType (), "package.png");
            } catch {
                Console.WriteLine ("Status icon could not be shown");
            }

            Menu menu = new Menu ();

            var file = new MenuItem ("File");
            file.SubMenu = new Menu ();
            file.SubMenu.Items.Add (new MenuItem ("Open"));
            file.SubMenu.Items.Add (new MenuItem ("New"));
            MenuItem mi = new MenuItem ("Close");
            mi.Clicked += delegate {
                Application.Exit();
            };
            file.SubMenu.Items.Add (mi);
            menu.Items.Add (file);

            var edit = new MenuItem ("Edit");
            edit.SubMenu = new Menu ();
            edit.SubMenu.Items.Add (new MenuItem ("Copy"));
            edit.SubMenu.Items.Add (new MenuItem ("Cut"));
            edit.SubMenu.Items.Add (new MenuItem ("Paste"));
            menu.Items.Add (edit);

            MainMenu = menu;

            HPaned box = new HPaned ();

            icon = Image.FromResource (typeof(App), "class.png");

            store = new TreeStore (nameCol, iconCol, widgetCol);
            samplesTree = new TreeView ();
            samplesTree.Columns.Add ("Name", iconCol, nameCol);

            AddSample (null, "Boxes", typeof(Boxes));

            var n = AddSample (null, "Charts", null);
            AddSample (n, "SimplePlotCanvas", typeof (SimplePlotCanvas));

            samplesTree.DataSource = store;

            box.Panel1.Content = samplesTree;

            sampleBox = new VBox ();
            title = new Label ("Sample:");
            sampleBox.PackStart (title, BoxMode.None);

            box.Panel2.Content = sampleBox;
            box.Panel2.Resize = true;
            box.Position = 160;

            Content = box;

            samplesTree.SelectionChanged += HandleSamplesTreeSelectionChanged;

            CloseRequested += HandleCloseRequested;
        }
Пример #17
0
        private void CreateComponents()
        {
            Width  = 1150;
            Height = 600;
            Icon = ResourcesManager.GetImage("icon.png");

            Version version = Assembly.GetExecutingAssembly().GetName().Version;
            Title  = string.Format("Deblocus - v{0}.{1}.{2}",
                version.Major, version.Minor, version.Build);

            var menuPanelDivision = new HPaned();
            menuPanelDivision.BackgroundColor = LightBlue;
            menuPanelDivision.Panel1.Content = MakeSidebar();
            menuPanelDivision.Panel2.Content = MakePanel();

            // Set the content
            Padding = new WidgetSpacing();
            Content = mainContent = menuPanelDivision;

            CloseRequested += WindowCloseRequested;
        }
Пример #18
0
        /// <summary>
        /// Initializes the user inferface
        /// </summary>
        private void InitializeUI()
        {
            // restore last window size and location
            Location = new Point(
                Settings.Default.WindowLocationX,
                Settings.Default.WindowLocationY
            );

            Size = new Size(
                Settings.Default.WindowSizeWidth,
                Settings.Default.WindowSizeHeight
            );

            // set window preference
            Title = "BAIMP";

            // file menu
            var fileMenu = new MenuItem("_File");
            fileMenu.SubMenu = new Menu();

            MenuItem menuNew = new MenuItem("_New...");
            menuNew.Clicked += (object sender, EventArgs e) => project.NewDialog();
            fileMenu.SubMenu.Items.Add(menuNew);

            MenuItem menuOpen = new MenuItem("_Open...");
            menuOpen.Clicked += delegate {
                if (!project.OpenDialog() && !string.IsNullOrEmpty(project.ErrorMessage)) {
                    MessageDialog.ShowMessage ("Error while opening the file", project.ErrorMessage);
                    project.ErrorMessage = null;
                }
            };
            fileMenu.SubMenu.Items.Add(menuOpen);

            if (Settings.Default.LastOpenedProjects != null) {
                MenuItem menuLastOpened = new MenuItem("Recently opened");
                menuLastOpened.SubMenu = new Menu();
                fileMenu.SubMenu.Items.Add(menuLastOpened);

                for (int i = Settings.Default.LastOpenedProjects.Count-1; i >= 0; i--) {
                    string path = Settings.Default.LastOpenedProjects[i];

                    MenuItem menuLastOpenedi = new MenuItem(path);
                    menuLastOpenedi.Clicked += delegate(object sender, EventArgs e) {
                        if (!project.Open(path) && !string.IsNullOrEmpty(project.ErrorMessage)) {
                            MessageDialog.ShowMessage ("Error while opening the file", project.ErrorMessage);
                            project.ErrorMessage = null;
                        }
                    };

                    menuLastOpened.SubMenu.Items.Add(menuLastOpenedi);
                }
            }

            fileMenu.SubMenu.Items.Add(new SeparatorMenuItem());

            MenuItem menuImport = new MenuItem("_Import...");
            menuImport.Clicked += (object sender, EventArgs e) => project.ImportDialog();
            fileMenu.SubMenu.Items.Add(menuImport);

            MenuItem menuSave = new MenuItem("_Save");
            menuSave.Clicked += (object sender, EventArgs e) => SaveAll();
            fileMenu.SubMenu.Items.Add(menuSave);

            fileMenu.SubMenu.Items.Add(new SeparatorMenuItem());

            MenuItem menuClose = new MenuItem("_Exit");
            menuClose.Clicked += (object sender, EventArgs e) => Close();
            fileMenu.SubMenu.Items.Add(menuClose);

            // View menu
            MenuItem viewMenu = new MenuItem("_View");
            viewMenu.SubMenu = new Menu();
            RadioButtonMenuItemGroup viewRadioGroup = new RadioButtonMenuItemGroup();
            RadioButtonMenuItem menuViewOverview = new RadioButtonMenuItem("Overview");
            menuViewOverview.Checked = true;
            menuViewOverview.Group = viewRadioGroup;
            viewMenu.SubMenu.Items.Add(menuViewOverview);

            RadioButtonMenuItem menuViewPipeline = new RadioButtonMenuItem("Pipeline");
            menuViewPipeline.Group = menuViewOverview.Group;
            viewMenu.SubMenu.Items.Add(menuViewPipeline);

            menuViewOverview.Clicked += delegate {
                splitMain_Status.Remove(pipelineShelf);
                splitScan_Pipeline.Panel2.Content = pipelineShelf;
                splitMain_Status.PackStart(splitScan_Pipeline, true, true);
            };
            menuViewPipeline.Clicked += delegate {
                splitScan_Pipeline.Panel2.Content = null;
                splitMain_Status.Remove(splitScan_Pipeline);
                splitMain_Status.PackStart(pipelineShelf, true, true);
            };

            // Edit menu
            MenuItem editMenu = new MenuItem("_Edit");
            editMenu.SubMenu = new Menu();
            MenuItem menuWorksheetRename = new MenuItem("_Rename worksheet...");
            editMenu.SubMenu.Items.Add(menuWorksheetRename);
            menuWorksheetRename.Clicked += (object sender, EventArgs e) => pipelineController.RenameCurrentWorksheetDialog();

            // Pipeline menu
            MenuItem pipelineMenu = new MenuItem("_Pipeline");
            pipelineMenu.SubMenu = new Menu();

            MenuItem menuExecute = new MenuItem("_Execute");
            menuExecute.Clicked += (object sender, EventArgs e) => pipelineController.CurrentPipeline.Execute(project);
            pipelineMenu.SubMenu.Items.Add(menuExecute);

            pipelineMenu.SubMenu.Items.Add(new SeparatorMenuItem());

            MenuItem menuExport = new MenuItem("Export");
            menuExport.SubMenu = new Menu();
            pipelineMenu.SubMenu.Items.Add(menuExport);

            Type exporterType = typeof(BaseExporter);
            IEnumerable<Type> exporter = AppDomain.CurrentDomain.GetAssemblies()
                .SelectMany(s => s.GetTypes())
                .Where(t => t.BaseType == exporterType);

            foreach (Type export in exporter) {
                MenuItem ni = new MenuItem(string.Format("As {0}...", export.Name));
                ni.Tag = export.Name;
                menuExport.SubMenu.Items.Add(ni);
                var lExport = export;
                ni.Clicked += delegate(object sender, EventArgs e) {
                    MenuItem s = sender as MenuItem;

                    if (s != null) {
                        if (exporterList.ContainsKey(s.Tag.ToString())) {
                            exporterList[s.Tag.ToString()].ShowDialog(pipelineController.CurrentPipeline.Nodes);
                        } else {
                            BaseExporter instance =
                                Activator.CreateInstance(lExport, pipelineController.CurrentPipeline.PipelineName) as BaseExporter;
                            if (instance != null) {
                                exporterList[s.Tag.ToString()] = instance;
                                instance.ShowDialog(pipelineController.CurrentPipeline.Nodes);
                            }
                        }
                    }
                };
            }

            // Extras menu
            MenuItem extrasMenu = new MenuItem("E_xtras");
            extrasMenu.SubMenu = new Menu();
            MenuItem menuResetAllMasks = new MenuItem("_Reset all masks");
            menuResetAllMasks.Clicked += delegate {
                foreach (BaseScan scan in project.scanCollection) {
                    scan.Mask.ResetMask();
                }
            };
            MenuItem menuExportLog = new MenuItem("Export _logs");
            menuExportLog.Clicked += delegate {
                SaveFileDialog d = new SaveFileDialog("Export logs");
                if (d.Run()) {
                    string filename = d.FileName;
                    if (!string.IsNullOrEmpty(filename)) {
                        System.IO.File.WriteAllText(filename, Log.ToText());
                    }
                }
                d.Dispose();
            };

            extrasMenu.SubMenu.Items.Add(menuResetAllMasks);
            extrasMenu.SubMenu.Items.Add(menuExportLog);

            // main menu
            Menu menu = new Menu();
            menu.Items.Add(fileMenu);
            menu.Items.Add(viewMenu);
            menu.Items.Add(editMenu);
            menu.Items.Add(pipelineMenu);
            menu.Items.Add(extrasMenu);
            MainMenu = menu;

            // initialize preview widget
            preview = new Preview();

            // load tree view with all available files
            fileTree = new FileTreeView();
            VBox splitFileTreeSearch_FileTree = new VBox();
            splitFileTreeSearch_FileTree.PackStart(new FileTreeFilter(fileTree));
            splitFileTreeSearch_FileTree.PackStart(fileTree, true);

            // load pipeline controller
            pipelineShelf = new VBox();
            pipelineController = new PipelineController(project, pipelineShelf);

            splitFiletree_Preview = new HPaned();
            splitFiletree_Preview.Panel1.Content = splitFileTreeSearch_FileTree;
            splitFiletree_Preview.Panel1.Shrink = true;
            fileTree.HorizontalScrollPolicy = ScrollPolicy.Never;
            splitFiletree_Preview.Panel2.Content = preview;
            splitFiletree_Preview.Panel2.Resize = true;

            splitController_Preview = new VBox();
            //splitController_Preview.PackStart(controllbarShelf, false, false);
            splitController_Preview.PackEnd(splitFiletree_Preview, true, true);

            splitScan_Pipeline = new VPaned();
            splitScan_Pipeline.Panel1.Content = splitController_Preview;
            splitScan_Pipeline.Panel2.Content = pipelineShelf;
            splitScan_Pipeline.Panel2.Resize = true;

            splitMain_Status = new VBox();
            splitMain_Status.PackStart(splitScan_Pipeline, true, true);
            splitMain_Status.PackEnd(new StatusBar());

            Content = splitMain_Status;
        }