Esempio n. 1
0
 /// <summary>
 /// Constructor
 /// </summary>
 public ManagerView(ViewBase owner)
     : base(owner)
 {
     notebook = new Notebook();
     _mainWidget = notebook;
     Grid = new GridView(this);
     ScriptEditor = new EditorView(this);
     notebook.AppendPage(Grid.MainWidget, new Label("Properties"));
     notebook.AppendPage(ScriptEditor.MainWidget, new Label("Script"));
 }
Esempio n. 2
0
        /// <summary>
        /// Attach model to view.
        /// </summary>
        public void Attach(object model, object view, ExplorerPresenter explorerPresenter)
        {
            Operations = model as Operations;
            View = view as EditorView;
            ExplorerPresenter = explorerPresenter;

            PopulateEditorView();
            View.ContextItemsNeeded += OnContextItemsNeeded;
            View.TextHasChangedByUser += OnTextHasChangedByUser;
            ExplorerPresenter.CommandHistory.ModelChanged += OnModelChanged;
        }
Esempio n. 3
0
        /// <summary>Constructor</summary>
        public ReportView(ViewBase owner)
            : base(owner)
        {
            Glade.XML gxml = new Glade.XML("ApsimNG.Resources.Glade.ReportView.glade", "notebook1");
            gxml.Autoconnect(this);
            _mainWidget = notebook1;

            VariableEditor = new EditorView(this);
            vbox1.PackStart(VariableEditor.MainWidget, true, true, 0);

            FrequencyEditor = new EditorView(this);
            vbox2.PackStart(FrequencyEditor.MainWidget, true, true, 0);

            dataStoreView1 = new DataStoreView(this);
            alignment1.Add(dataStoreView1.MainWidget);
        }
Esempio n. 4
0
        /// <summary>Constructor</summary>
        public ReportView(ViewBase owner) : base(owner)
        {
            Builder builder = BuilderFromResource("ApsimNG.Resources.Glade.ReportView.glade");

            notebook1  = (Notebook)builder.GetObject("notebook1");
            vbox1      = (VBox)builder.GetObject("vbox1");
            vbox2      = (VBox)builder.GetObject("vbox2");
            alignment1 = (Alignment)builder.GetObject("alignment1");
            mainWidget = notebook1;

            variableEditor = new EditorView(this);
            variableEditor.StyleChanged += OnStyleChanged;
            vbox1.PackStart(variableEditor.MainWidget, true, true, 0);

            frequencyEditor = new EditorView(this);
            frequencyEditor.StyleChanged += OnStyleChanged;
            vbox2.PackStart(frequencyEditor.MainWidget, true, true, 0);

            dataStoreView1 = new DataStoreView(this);
            alignment1.Add(dataStoreView1.MainWidget);
            mainWidget.Destroyed += _mainWidget_Destroyed;
        }
Esempio n. 5
0
 private void _mainWidget_Destroyed(object sender, System.EventArgs e)
 {
     try
     {
         panel.RemoveNotification(OnPropertyNotified);
         variableEditor.StyleChanged  -= OnStyleChanged;
         notebook1.SwitchPage         -= OnSwitchPage;
         frequencyEditor.StyleChanged -= OnStyleChanged;
         variableEditor.MainWidget.Destroy();
         variableEditor = null;
         frequencyEditor.MainWidget.Destroy();
         frequencyEditor = null;
         dataStoreView1.MainWidget.Destroy();
         dataStoreView1        = null;
         mainWidget.Destroyed -= _mainWidget_Destroyed;
         owner = null;
     }
     catch (Exception err)
     {
         ShowError(err);
     }
 }
Esempio n. 6
0
        public BubbleChartView(ViewBase owner = null) : base(owner)
        {
            vpaned1               = new VPaned();
            mainWidget            = vpaned1;
            mainWidget.Destroyed += OnDestroyed;

            graphView = new DirectedGraphView(this);
            vpaned1.Pack1(graphView.MainWidget, true, true);

            VBox vbox1 = new VBox(false, 0);

            ctxBox = new VBox(false, 0);

            // Arc selection: rules & actions
            VBox arcSelBox = new VBox();

            Label l1 = new Label("Rules");

            l1.Xalign = 0;
            arcSelBox.PackStart(l1, true, true, 0);
            RuleList = new EditorView(owner);
            RuleList.TextHasChangedByUser += OnRuleChanged;
            //RuleList.ScriptMode = false;

            ScrolledWindow rules = new ScrolledWindow();

            rules.ShadowType = ShadowType.EtchedIn;
            rules.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);

            rules.Add((RuleList as ViewBase).MainWidget);

            (RuleList as ViewBase).MainWidget.ShowAll();
            arcSelBox.PackStart(rules, true, true, 0);
            rules.Show();

            Label l2 = new Label("Actions");

            l2.Xalign = 0;
            arcSelBox.PackStart(l2, true, true, 0);
            ActionList = new EditorView(owner);
            ActionList.TextHasChangedByUser += OnActionChanged;
            //ActionList.ScriptMode = false;

            ScrolledWindow actions = new ScrolledWindow();

            actions.ShadowType = ShadowType.EtchedIn;
            actions.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);

            actions.Add((ActionList as ViewBase).MainWidget);

            (ActionList as ViewBase).MainWidget.ShowAll();
            arcSelBox.PackStart(actions, true, true, 0); actions.Show();
            arcSelWdgt = arcSelBox as Widget;
            arcSelWdgt.Hide();
            ctxBox.PackStart(arcSelWdgt, true, true, 0);

            // Node selection:

            Grid t1 = new Grid();

            Label l3 = new Label("Name");

            l3.Xalign = 0;
            t1.Attach(l3, 0, 0, 1, 1);

            Label l4 = new Label("Description");

            l4.Xalign = 0;
            t1.Attach(l4, 0, 1, 1, 1);

            Label l5 = new Label("Colour");

            l5.Xalign = 0;
            t1.Attach(l5, 0, 2, 1, 1);

            nameEntry          = new Entry();
            nameEntry.Changed += OnNameChanged;
            nameEntry.Xalign   = 0;

            // Setting the WidthRequest to 350 will effectively
            // set the minimum size, beyond which it cannot be further
            // shrunk by dragging the HPaned's splitter.
            nameEntry.WidthRequest = 350;
            t1.Attach(nameEntry, 1, 0, 1, 1);

            descEntry              = new Entry();
            descEntry.Xalign       = 0;
            descEntry.Changed     += OnDescriptionChanged;
            descEntry.WidthRequest = 350;
            t1.Attach(descEntry, 1, 1, 1, 1);
            colourChooser              = new ColorButton();
            colourChooser.Xalign       = 0;
            colourChooser.ColorSet    += OnColourChanged;
            colourChooser.WidthRequest = 350;
            t1.Attach(colourChooser, 1, 2, 1, 1);
            nodeSelWdgt = t1;
            ctxBox.PackStart(t1, true, true, 0);

            // Info
            Label l6 = new Label();

            l6.LineWrap = true;
            l6.Text     = "<left-click>: select a node or arc.\n" +
                          "<right-click>: shows a context-sensitive menu.\n\n" +
                          "Once a node/arc is selected, it can be dragged to a new position.\n\n" +
                          "Nodes are created by right-clicking on a blank area.\n\n" +
                          "Transition arcs are created by firstly selecting a source node,\n" +
                          "then right-clicking over a target node.";
            infoWdgt = l6 as Widget;
            infoWdgt.ShowAll();
            l6.Xalign = 0;
            l6.Yalign = 0;
            l6.Wrap   = false;
            Alignment infoWdgtWrapper = new Alignment(0, 0, 1, 0);

            infoWdgtWrapper.Add(infoWdgt);
            //ctxBox.PackStart(infoWdgt, true, true, 0);
            //vbox1.PackStart(ctxBox, false, false, 0);

            PropertiesView = new PropertyView(this);
            ((ScrolledWindow)((ViewBase)PropertiesView).MainWidget).HscrollbarPolicy = PolicyType.Never;
            // settingsBox = new Table(2, 2, false);
            // settingsBox.Attach(new Label("Initial State"), 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            // combobox1 = new ComboBox();
            // combobox1.PackStart(comboRender, false);
            // combobox1.AddAttribute(comboRender, "text", 0);
            // combobox1.Model = comboModel;
            // settingsBox.Attach(combobox1, 1, 2, 0, 1, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Fill, 0, 0);

            // chkVerbose = new CheckButton();
            // chkVerbose.Toggled += OnToggleVerboseMode;
            // settingsBox.Attach(new Label("Verbose Mode"), 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            // settingsBox.Attach(chkVerbose, 1, 2, 1, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Fill, 0, 0);

            hpaned1 = new HPaned();
            hpaned2 = new HPaned();
            Frame frame1 = new Frame("Rotation Settings");

            frame1.Add(((ViewBase)PropertiesView).MainWidget);
            frame1.ShadowType = ShadowType.In;
            Frame frame2 = new Frame();

            frame2.Add(hpaned2);
            frame2.ShadowType = ShadowType.In;
            ctxFrame          = new Frame();
            ctxFrame.Add(ctxBox);
            ctxFrame.ShadowType = ShadowType.In;
            Frame frame4 = new Frame("Instructions");

            frame4.Add(infoWdgtWrapper);
            frame4.ShadowType = ShadowType.In;
            hpaned1.Pack1(frame1, false, false);
            hpaned1.Pack2(frame2, true, false);
            hpaned2.Pack1(ctxFrame, true, false);
            hpaned2.Pack2(frame4, true, false);
            hpaned1.ShowAll();
            Alignment halign = new Alignment(0, 0, 1, 1);

            halign.Add(hpaned1);

            vpaned1.Pack2(halign, false, false);
            vpaned1.Show();

            graphView.OnGraphObjectSelected += OnGraphObjectSelected;
            graphView.OnGraphObjectMoved    += OnGraphObjectMoved;
            //combobox1.Changed += OnComboBox1SelectedValueChanged;

            contextMenuHelper              = new ContextMenuHelper(graphView.MainWidget);
            contextMenuHelper.ContextMenu += OnPopup;

            ContextMenu.SelectionDone += OnContextMenuDeactivated;
            ContextMenu.Mapped        += OnContextMenuRendered;

            // Ensure the menu is populated
            Select(null);
        }