Exemplo n.º 1
0
        /// <summary>
        /// Class constructor
        /// </summary>
        public WeatherDownloadDialog()
        {
            Builder builder = ViewBase.BuilderFromResource("ApsimNG.Resources.Glade.WeatherDownload.glade");

            dialog1             = (Dialog)builder.GetObject("dialog1");
            radioAus            = (RadioButton)builder.GetObject("radioAus");
            radioWorld          = (RadioButton)builder.GetObject("radioWorld");
            entryLatitude       = (Entry)builder.GetObject("entryLatitude");
            entryLongitude      = (Entry)builder.GetObject("entryLongitude");
            entryPlacename      = (Entry)builder.GetObject("entryPlacename");
            radioSiloDataDrill  = (RadioButton)builder.GetObject("radioSiloDataDrill");
            radioSiloPatchPoint = (RadioButton)builder.GetObject("radioSiloPatchPoint");
            radioNASA           = (RadioButton)builder.GetObject("radioNASA");
            btnOk                    = (Button)builder.GetObject("btnOk");
            btnCancel                = (Button)builder.GetObject("btnCancel");
            btnGetPlacename          = (Button)builder.GetObject("btnGetPlacename");
            btnGetLocation           = (Button)builder.GetObject("btnGetLocation");
            calendarStart            = (Calendar)builder.GetObject("calendarStart");
            calendarEnd              = (Calendar)builder.GetObject("calendarEnd");
            entryFilePath            = (Entry)builder.GetObject("entryFilePath");
            btnBrowse                = (Button)builder.GetObject("btnBrowse");
            entryEmail               = (Entry)builder.GetObject("entryEmail");
            calendarEnd.Date         = DateTime.Today.AddDays(-1.0);
            radioAus.Clicked        += RadioAus_Clicked;
            radioWorld.Clicked      += RadioAus_Clicked;
            btnOk.Clicked           += BtnOk_Clicked;
            btnCancel.Clicked       += BtnCancel_Clicked;
            btnGetLocation.Clicked  += BtnGetLocation_Clicked;
            btnGetPlacename.Clicked += BtnGetPlacename_Clicked;
            btnBrowse.Clicked       += BtnBrowse_Clicked;
        }
Exemplo n.º 2
0
        public FindAndReplaceForm()
        {
            Builder builder = ViewBase.BuilderFromResource("ApsimNG.Resources.Glade.FindAndReplace.glade");

            window1           = (Window)builder.GetObject("window1");
            chkMatchCase      = (CheckButton)builder.GetObject("chkMatchCase");
            chkMatchWholeWord = (CheckButton)builder.GetObject("chkMatchWholeWord");
            txtLookFor        = (Entry)builder.GetObject("txtLookFor");
            txtReplaceWith    = (Entry)builder.GetObject("txtReplaceWith");
            btnReplace        = (Button)builder.GetObject("btnReplace");
            btnReplaceAll     = (Button)builder.GetObject("btnReplaceAll");
            btnHighlightAll   = (Button)builder.GetObject("btnHighlightAll");
            btnCancel         = (Button)builder.GetObject("btnCancel");
            btnFindPrevious   = (Button)builder.GetObject("btnFindPrevious");
            btnFindNext       = (Button)builder.GetObject("btnFindNext");
            lblReplaceWith    = (Label)builder.GetObject("lblReplaceWith");

            btnFindNext.Clicked     += BtnFindNext_Click;
            btnFindPrevious.Clicked += BtnFindPrevious_Click;
            btnCancel.Clicked       += BtnCancel_Click;
            btnReplace.Clicked      += BtnReplace_Click;
            btnReplaceAll.Clicked   += BtnReplaceAll_Click;
            btnHighlightAll.Clicked += BtnHighlightAll_Click;
            window1.DeleteEvent     += Window1_DeleteEvent;
            window1.Destroyed       += Window1_Destroyed;
            AccelGroup agr = new AccelGroup();

            btnCancel.AddAccelerator("activate", agr, new AccelKey(Gdk.Key.Escape, Gdk.ModifierType.None, AccelFlags.Visible));
            window1.AddAccelGroup(agr);
        }
Exemplo n.º 3
0
        /// <summary>Show dialog box</summary>
        public static string ShowDialog(ExplorerPresenter explorerPresenter, string caption, string labelText, string defaultText)
        {
            Gtk.Window topLevelWindow = explorerPresenter.GetView().MainWidget.Toplevel as Gtk.Window;

            Builder builder      = ViewBase.BuilderFromResource("ApsimNG.Resources.Glade.StringEntryForm.glade");
            Dialog  dialog       = (Dialog)builder.GetObject("dialog");
            Label   prompt       = (Label)builder.GetObject("prompt");
            Button  okButton     = (Button)builder.GetObject("okButton");
            Button  cancelButton = (Button)builder.GetObject("cancelButton");
            Entry   entryBox     = (Entry)builder.GetObject("entryBox");

            dialog.TransientFor = topLevelWindow;
            dialog.SetDefaultSize(600, 620);
            dialog.Parent = topLevelWindow;
            dialog.Title  = caption;
            prompt.Text   = labelText;
            entryBox.Text = defaultText;
            entryBox.GrabFocus();
            dialog.ShowAll();
            int    response = dialog.Run();
            string text     = entryBox.Text;

            dialog.Destroy();

            if (response == 1)
            {
                return(text);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Constructor
        /// </summary>
        public UpgradeForm(IMainView explorerPresenter)
        {
            Builder builder = ViewBase.BuilderFromResource("ApsimNG.Resources.Glade.UpgradeForm.glade");

            window1         = (Window)builder.GetObject("window1");
            button1         = (Button)builder.GetObject("button1");
            button2         = (Button)builder.GetObject("button2");
            table1          = (Table)builder.GetObject("table1");
            table2          = (Table)builder.GetObject("table2");
            firstNameBox    = (Entry)builder.GetObject("firstNameBox");
            lastNameBox     = (Entry)builder.GetObject("lastNameBox");
            organisationBox = (Entry)builder.GetObject("organisationBox");
            emailBox        = (Entry)builder.GetObject("emailBox");
            address1Box     = (Entry)builder.GetObject("address1Box");
            address2Box     = (Entry)builder.GetObject("address2Box");
            cityBox         = (Entry)builder.GetObject("cityBox");
            stateBox        = (Entry)builder.GetObject("stateBox");
            countryBox      = (Entry)builder.GetObject("countryBox");
            postcodeBox     = (Entry)builder.GetObject("postcodeBox");
            label1          = (Label)builder.GetObject("label1");
            HTMLalign       = (Alignment)builder.GetObject("HTMLalign");
            checkbutton1    = (CheckButton)builder.GetObject("checkbutton1");
            listview1       = (TreeView)builder.GetObject("listview1");
            alignment3      = (Alignment)builder.GetObject("alignment3");
            alignment4      = (Alignment)builder.GetObject("alignment4");
            alignment5      = (Alignment)builder.GetObject("alignment5");
            alignment6      = (Alignment)builder.GetObject("alignment6");
            alignment7      = (Alignment)builder.GetObject("alignment7");

            listview1.Model = listmodel;

            CellRendererText textRender = new Gtk.CellRendererText();

            textRender.Editable = false;

            TreeViewColumn column0 = new TreeViewColumn("Version", textRender, "text", 0);

            listview1.AppendColumn(column0);
            column0.Sizing    = TreeViewColumnSizing.Autosize;
            column0.Resizable = true;

            TreeViewColumn column1 = new TreeViewColumn("Description", textRender, "text", 1);

            listview1.AppendColumn(column1);
            column1.Sizing    = TreeViewColumnSizing.Autosize;
            column1.Resizable = true;

            // Make the tab order a little more sensible than the defaults
            table1.FocusChain = new Widget[] { alignment7, button1, button2 };
            table2.FocusChain = new Widget[] { firstNameBox, lastNameBox, organisationBox, emailBox,
                                               alignment3, alignment4, cityBox, alignment5, countryBox, alignment6 };

            HTMLview = new HTMLView(new ViewBase(null));
            HTMLalign.Add(HTMLview.MainWidget);
            this.tabbedExplorerView = explorerPresenter;
            button1.Clicked        += OnUpgrade;
            button2.Clicked        += OnViewMoreDetail;
            window1.Destroyed      += OnFormClosing;
            window1.MapEvent       += OnShown;
        }
Exemplo n.º 5
0
        /// <summary>Show dialog box</summary>
        public static string ShowDialog(ExplorerPresenter explorerPresenter, string caption, string labelText, string defaultText)
        {
            Gtk.Window topLevelWindow = explorerPresenter.GetView().MainWidget.Toplevel as Gtk.Window;

            Builder builder  = ViewBase.BuilderFromResource("ApsimNG.Resources.Glade.StringEntryForm.glade");
            Dialog  dialog   = (Dialog)builder.GetObject("dialog");
            Label   prompt   = (Label)builder.GetObject("prompt");
            Entry   entryBox = (Entry)builder.GetObject("entryBox");

            dialog.TransientFor = topLevelWindow;
            dialog.Title        = caption;
            if (labelText != null)
            {
                prompt.Text = labelText;
            }
            if (defaultText != null)
            {
                entryBox.Text = defaultText;
            }
            entryBox.GrabFocus();
            dialog.ShowAll();
            int    response = dialog.Run();
            string text     = entryBox.Text;

            dialog.Cleanup();

            if (response == 1)
            {
                return(text);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 6
0
        public FindInBrowserForm()
        {
            Builder builder = ViewBase.BuilderFromResource("ApsimNG.Resources.Glade.BrowserFind.glade");

            window1         = (Window)builder.GetObject("window1");
            chkMatchCase    = (CheckButton)builder.GetObject("chkMatchCase");
            chkHighlightAll = (CheckButton)builder.GetObject("chkHighlightAll");
            txtLookFor      = (Entry)builder.GetObject("txtLookFor");
            btnCancel       = (Button)builder.GetObject("btnCancel");
            btnFindPrevious = (Button)builder.GetObject("btnFindPrevious");
            btnFindNext     = (Button)builder.GetObject("btnFindNext");

            txtLookFor.Changed       += TxtLookFor_Changed;
            btnFindNext.Clicked      += BtnFindNext_Click;
            btnFindPrevious.Clicked  += BtnFindPrevious_Click;
            btnCancel.Clicked        += BtnCancel_Click;
            chkHighlightAll.Clicked  += ChkHighlightAll_Click;
            chkHighlightAll.Visible   = false;           // Hide this for now...
            chkHighlightAll.NoShowAll = true;
            window1.DeleteEvent      += Window1_DeleteEvent;
            window1.Destroyed        += Window1_Destroyed;
            AccelGroup agr = new AccelGroup();

            btnCancel.AddAccelerator("activate", agr, new AccelKey(Gdk.Key.Escape, Gdk.ModifierType.None, AccelFlags.Visible));
            window1.AddAccelGroup(agr);
        }
Exemplo n.º 7
0
        public FindAndReplaceForm()
        {
            Builder builder = ViewBase.BuilderFromResource("ApsimNG.Resources.Glade.FindAndReplace.glade");

            window1           = (Window)builder.GetObject("window1");
            chkMatchCase      = (CheckButton)builder.GetObject("chkMatchCase");
            chkMatchWholeWord = (CheckButton)builder.GetObject("chkMatchWholeWord");
            txtLookFor        = (Entry)builder.GetObject("txtLookFor");
            txtReplaceWith    = (Entry)builder.GetObject("txtReplaceWith");
            btnReplace        = (Button)builder.GetObject("btnReplace");
            btnReplaceAll     = (Button)builder.GetObject("btnReplaceAll");
            btnHighlightAll   = (Button)builder.GetObject("btnHighlightAll");
            btnCancel         = (Button)builder.GetObject("btnCancel");
            btnFindPrevious   = (Button)builder.GetObject("btnFindPrevious");
            btnFindNext       = (Button)builder.GetObject("btnFindNext");
            lblReplaceWith    = (Label)builder.GetObject("lblReplaceWith");

            btnFindNext.Clicked     += btnFindNext_Click;
            btnFindPrevious.Clicked += btnFindPrevious_Click;
            btnCancel.Clicked       += btnCancel_Click;
            btnReplace.Clicked      += btnReplace_Click;
            btnReplaceAll.Clicked   += btnReplaceAll_Click;
            btnHighlightAll.Clicked += btnHighlightAll_Click;
            window1.DeleteEvent     += Window1_DeleteEvent;
            window1.Destroyed       += Window1_Destroyed;
        }
Exemplo n.º 8
0
        public MarkdownFindView()
        {
            Builder builder = ViewBase.BuilderFromResource("ApsimNG.Resources.Glade.FindAndReplace.glade");

            window1           = (Window)builder.GetObject("window1");
            chkMatchCase      = (CheckButton)builder.GetObject("chkMatchCase");
            chkMatchWholeWord = (CheckButton)builder.GetObject("chkMatchWholeWord");
            txtLookFor        = (Entry)builder.GetObject("txtLookFor");
            txtReplaceWith    = (Entry)builder.GetObject("txtReplaceWith");
            btnReplace        = (Button)builder.GetObject("btnReplace");
            btnReplaceAll     = (Button)builder.GetObject("btnReplaceAll");
            btnHighlightAll   = (Button)builder.GetObject("btnHighlightAll");
            btnCancel         = (Button)builder.GetObject("btnCancel");
            btnFindPrevious   = (Button)builder.GetObject("btnFindPrevious");
            btnFindNext       = (Button)builder.GetObject("btnFindNext");
            lblReplaceWith    = (Label)builder.GetObject("lblReplaceWith");

            // We use the same glade form as the FindAndReplaceForm, but we don't
            // allow for replacing text (the view is readonly). Therefore we need
            // to hide the controls related to the text replace functionality.
            btnReplace.Visible      = btnReplaceAll.Visible = false;
            lblReplaceWith.Visible  = txtReplaceWith.Visible = false;
            btnHighlightAll.Visible = false;  // !value;

            btnFindNext.Clicked     += BtnFindNext_Click;
            btnFindPrevious.Clicked += BtnFindPrevious_Click;
            btnCancel.Clicked       += BtnCancel_Click;
            btnHighlightAll.Clicked += BtnHighlightAll_Click;
            window1.DeleteEvent     += Window1_DeleteEvent;
            window1.Destroyed       += Window1_Destroyed;
            AccelGroup agr = new AccelGroup();

            // Allow the text input widget to activate the default widget and make
            // the 'find next instance' button the default widget for its toplevel.
            // This means that when the user presses return while the text input
            // has focus, it will activate the default widget (the 'find next' button).
            btnFindNext.HasDefault      = true;
            txtLookFor.ActivatesDefault = true;

            // Add some extra keyboard shortcuts for the various buttons:
            // F3                               - find next
            // Shift + F3, Shift + Return       - find previous
            // Escape                           - Close the dialog
            btnFindNext.AddAccelerator("activate", agr, new AccelKey(Gdk.Key.F3, Gdk.ModifierType.None, AccelFlags.Visible));
            btnFindPrevious.AddAccelerator("activate", agr, new AccelKey(Gdk.Key.F3, Gdk.ModifierType.ShiftMask, AccelFlags.Visible));
            btnFindPrevious.AddAccelerator("activate", agr, new AccelKey(Gdk.Key.Return, Gdk.ModifierType.ShiftMask, AccelFlags.Visible));
            btnCancel.AddAccelerator("activate", agr, new AccelKey(Gdk.Key.Escape, Gdk.ModifierType.None, AccelFlags.Visible));
            window1.AddAccelGroup(agr);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Class constructor
        /// </summary>
        public SoilDownloadDialog()
        {
            Builder builder = ViewBase.BuilderFromResource("ApsimNG.Resources.Glade.SoilDownload.glade");

            dialog1                  = (Dialog)builder.GetObject("dialog1");
            entryLatitude            = (Entry)builder.GetObject("entryLatitude");
            entryLongitude           = (Entry)builder.GetObject("entryLongitude");
            entryPlacename           = (Entry)builder.GetObject("entryPlacename");
            radioSynth               = (RadioButton)builder.GetObject("radioSynth");
            radioMatch               = (RadioButton)builder.GetObject("radioMatch");
            radioISRIC               = (RadioButton)builder.GetObject("radioISRIC");
            btnOk                    = (Button)builder.GetObject("btnOk");
            btnCancel                = (Button)builder.GetObject("btnCancel");
            btnGetPlacename          = (Button)builder.GetObject("btnGetPlacename");
            btnGetLocation           = (Button)builder.GetObject("btnGetLocation");
            btnOk.Clicked           += BtnOk_Clicked;
            btnCancel.Clicked       += BtnCancel_Clicked;
            btnGetLocation.Clicked  += BtnGetLocation_Clicked;
            btnGetPlacename.Clicked += BtnGetPlacename_Clicked;
        }
Exemplo n.º 10
0
        /// <summary>
        /// Class constructor
        /// </summary>
        public WeatherDownloadDialog()
        {
            Builder builder = ViewBase.BuilderFromResource("ApsimNG.Resources.Glade.WeatherDownload.glade");

            dialog1             = (Dialog)builder.GetObject("dialog1");
            vbox1               = (VBox)builder.GetObject("vbox1");
            dialogVBox          = (Box)builder.GetObject("dialog-vbox1");
            scroller            = (ScrolledWindow)builder.GetObject("scrolledwindow1");
            radioAus            = (RadioButton)builder.GetObject("radioAus");
            radioWorld          = (RadioButton)builder.GetObject("radioWorld");
            entryLatitude       = (Entry)builder.GetObject("entryLatitude");
            entryLongitude      = (Entry)builder.GetObject("entryLongitude");
            entryPlacename      = (Entry)builder.GetObject("entryPlacename");
            radioSiloDataDrill  = (RadioButton)builder.GetObject("radioSiloDataDrill");
            radioSiloPatchPoint = (RadioButton)builder.GetObject("radioSiloPatchPoint");
            radioNASA           = (RadioButton)builder.GetObject("radioNASA");
            btnOk               = (Button)builder.GetObject("btnOk");
            btnCancel           = (Button)builder.GetObject("btnCancel");
            btnGetPlacename     = (Button)builder.GetObject("btnGetPlacename");
            btnGetLocation      = (Button)builder.GetObject("btnGetLocation");
            calendarStart       = (Gtk.Calendar)builder.GetObject("calendarStart");
            calendarEnd         = (Gtk.Calendar)builder.GetObject("calendarEnd");
            entryFilePath       = (Entry)builder.GetObject("entryFilePath");
            btnBrowse           = (Button)builder.GetObject("btnBrowse");
            entryEmail          = (Entry)builder.GetObject("entryEmail");

            // fixme: once we move to gtk3, we can just use a scrolled
            // window with natural height/width propagation to get a
            // sensible initial size. Until then, we need to use this
            // hack in the SizeAllocated event.
            scroller.SizeAllocated += OnSizeAllocated;

            calendarEnd.Date         = DateTime.Today.AddDays(-1.0);
            radioAus.Clicked        += RadioAus_Clicked;
            radioWorld.Clicked      += RadioAus_Clicked;
            btnOk.Clicked           += BtnOk_Clicked;
            btnCancel.Clicked       += BtnCancel_Clicked;
            btnGetLocation.Clicked  += BtnGetLocation_Clicked;
            btnGetPlacename.Clicked += BtnGetPlacename_Clicked;
            btnBrowse.Clicked       += BtnBrowse_Clicked;
        }