void showWidgets(Constants.BellModes bellMode, Constants.EncoderVariablesCapture encoderMainVariable, EncoderRhythm encoderRhythm) { frame_best_and_worst.Hide(); frame_conditions.Hide(); hbox_jump_best_worst.Hide(); hbox_run_best_worst.Hide(); hbox_jump_conditions.Hide(); hbox_run_conditions.Hide(); frame_encoder_automatic_conditions.Hide(); vbox_encoder_manual.Hide(); notebook_encoder_conditions.Hide(); vbox_encoder_stuff.Hide(); notebook_main.GetNthPage(RHYTHMPAGE).Hide(); notebook_main.ShowTabs = false; if (bellMode == Constants.BellModes.JUMPS) { frame_best_and_worst.Show(); hbox_jump_best_worst.Show(); hbox_jump_conditions.Show(); frame_conditions.Show(); } else if (bellMode == Constants.BellModes.RUNS) { frame_best_and_worst.Show(); hbox_run_best_worst.Show(); hbox_run_conditions.Show(); frame_conditions.Show(); } else //encoder (grav and inertial) { vbox_encoder_stuff.Show(); frame_encoder_automatic_conditions.Show(); notebook_main.ShowTabs = true; vbox_encoder_manual.Show(); if (checkbutton_encoder_show_manual_feedback.Active) { notebook_encoder_conditions.Show(); } combo_encoder_main_variable.Active = UtilGtk.ComboMakeActive(combo_encoder_main_variable, Constants.GetEncoderVariablesCapture(encoderMainVariable)); notebook_main.GetNthPage(RHYTHMPAGE).Show(); encoder_rhythm_set_values(encoderRhythm); } label_test_sound_result.Text = ""; }
static void OnProjectReloaded(object sender, EventArgs a) { if (WidgetNotebook.Page == -1) { return; } // Get the opened components int active = WidgetNotebook.Page; ArrayList pages = new ArrayList(); while (WidgetNotebook.NPages > 0) { DesignerView view = (DesignerView)WidgetNotebook.GetNthPage(0); pages.Add(view.Component.Name); WidgetNotebook.Remove(view); view.Dispose(); } openWindows.Clear(); // Reopen the components foreach (string s in pages) { WidgetInfo w = Project.GetWidget(s); if (w != null) { OpenWindow(w); } } WidgetNotebook.Page = active; }
// Is there a better way? /// <summary> /// Helper function for dealing with clicks on the tab labels, or whatever /// widgets the tab label might control. Tests to see which tab the /// indicated objects is on. This lets us identify the tabs associated /// with click events, for example. /// </summary> /// <param name="o">The widget that we are seaching for</param> /// <returns>Page number of the tab, or -1 if not found</returns> private int GetTabOfWidget(object o, ref Notebook notebook, ref string tabName) { tabName = null; Widget widg = o as Widget; if (widg == null) return -1; notebook = IsControlOnLeft(o) ? notebook1 : notebook2; for (int i = 0; i < notebook.NPages; i++) { // First check the tab labels Widget testParent = notebook.GetTabLabel(notebook.GetNthPage(i)); if (testParent == widg || widg.IsAncestor(testParent)) { tabName = notebook.GetTabLabelText(notebook.GetNthPage(i)); return i; } // If not found, check the tab contents testParent = notebook.GetNthPage(i); if (testParent == widg || widg.IsAncestor(testParent)) { tabName = notebook.GetTabLabelText(notebook.GetNthPage(i)); return i; } } return -1; }
//string[] papersize = {"letter", "legal", "a4"}; //string[] modemType = {@"-j\Q4",@"-j\Q1",@"-j*F1",@"-j&H2&I0&R1&D3I4",@"-or"}; /* # FCINIT='-j\Q4' # AT&T (Dataport, Paradyne) # FCINIT='-j\Q1' # Motorola (Power Modem, 3400 Pro,...) # FCINIT='-j*F1' # QuickComm (Spirit II) # FCINIT='-j&H2&I0&R1&D3I4' # USR (Courier, Sportster) # FCINIT='-or' # Multi-Tech (for bit reversal) */ public GfaxPrefs() { gxml = new Glade.XML(null, "gfax.glade", "PrefsDialog", null); //GConf.PropertEditors EditorShell shell = new EditorShell(gxml); gxml.Autoconnect(this); // System Tab if (Settings.TransmitAgent == "hylafax") { HylafaxRadioButton.Active = true; CoverPageCheckButton.Visible = false; PrefsNotebook.GetNthPage(EFAX_PAGE).Hide(); } else if (Settings.TransmitAgent == "efax") { EfaxRadioButton.Active = true; EmailNotifyCheckButton.Sensitive = false; EmailAddressEntry.Sensitive = false; Settings.SendNow = SendNowCheckButton.Active; FaxLogCheckButton.Visible = false; CoverPageCheckButton.Visible = false; Settings.HiResolution = HiResCheckButton.Active; PrefsNotebook.GetNthPage(HYLAFAX_PAGE).Hide(); } // Set these regardless so they are set if we need them switch (Settings.EfaxPapersize) { case "letter": EfaxPapersizeComboBox.Active = 0; break; case "legal": EfaxPapersizeComboBox.Active = 1; break; case "a4": EfaxPapersizeComboBox.Active = 2; break; default: EfaxPapersizeComboBox.Active = 0; break; } //"-j\\Q4","-j\\Q1","-j*F1","-j&H2&I0&R1&D3I4","-or" switch (Settings.EfaxModemFcinit) { case @"-j\Q4": EfaxModemTypeComboBox.Active = 0; break; case @"-j\Q1": EfaxModemTypeComboBox.Active = 1; break; case @"-j*F1": EfaxModemTypeComboBox.Active = 2; break; case @"-j&H2&I0&R1&D3I4": EfaxModemTypeComboBox.Active = 3; break; case @"-or": EfaxModemTypeComboBox.Active = 4; break; default: EfaxModemTypeComboBox.Active = 5; break; } EfaxModemSpeakerVolumeComboBox.Active = Settings.EfaxModemSpeakerVolume; // changes that happen automagically shell.Add(SettingKeys.FaxNumber, "FaxNumberEntry"); shell.Add(SettingKeys.PhonePrefix, "DialPrefixEntry"); shell.Add(SettingKeys.FaxViewer, "FaxViewerEntry"); // Hylafax Tab shell.Add(SettingKeys.Hostname, "HylafaxHostnameEntry"); shell.Add(SettingKeys.Port, "HylafaxPortEntry"); shell.Add(SettingKeys.Username, "HylafaxUsernameEntry"); // Efax Tab shell.Add(SettingKeys.EfaxModemDevice, "EfaxModemDeviceEntry"); // User tab shell.Add(SettingKeys.EmailNotify, "EmailNotifyCheckButton"); shell.Add(SettingKeys.EmailAddress, "EmailAddressEntry"); shell.Add(SettingKeys.SendNow, "SendNowCheckButton"); shell.Add(SettingKeys.LogEnabled, "FaxLogCheckButton"); shell.Add(SettingKeys.CoverPage, "CoverPageCheckButton"); shell.Add(SettingKeys.HiResolution, "HiResCheckButton"); eventsEnabled = true; }
/// <summary> /// Sets the expressionof tab. /// </summary> /// <param name='_nb'> /// Nb. /// </param> /// <param name='_index'> /// Index. /// </param> /// <param name='_content'> /// Content. /// </param> public static void setExpressionofTab(Notebook _nb, int _index, string _content, bool _append = false) { try { if (_append == false) ((libTerminus.cRegex)_nb.GetNthPage (_nb.Page)).setExpressionBuffer (_content); else ((libTerminus.cRegex)_nb.GetNthPage (_nb.Page)).appendExpressionBuffer (_content); } catch (Exception ex) { MessageBox.Show (ex.Message, "", ButtonsType.Ok, MessageType.Error); } }
/// <summary> /// Undo the specified notebook - page /// </summary> /// <param name='nb'> /// Nb. /// </param> public static void undo(Notebook nb) { try { ((libTerminus.cRegex)nb.GetNthPage (nb.Page)).Undo (); } catch (Exception ex) { MessageBox.Show (ex.Message, cTerminus.g_programName, ButtonsType.Close, MessageType.Error); } }
/// <summary> /// Save the specified nb, Index and Filename. /// </summary> /// <param name='_nb'> /// Nb. /// </param> /// <param name='_Index'> /// Index. /// </param> /// <param name='_Filename'> /// Filename. /// </param> public static void Save(Notebook _nb, int _Index, string _Filename) { try { if (_Filename != "" && disable != true) { ((libTerminus.cRegex)_nb.GetNthPage (_nb.Page)).Save (_Filename); int current = _nb.Page; string data = ((libTerminus.cRegex)_nb.GetNthPage (_nb.Page)).GetDataSourceBuffer (); ((libTerminus.cRegex)_nb.GetNthPage (_nb.Page)).Saved = true; ((libTerminus.cRegex)_nb.GetNthPage (_nb.Page)).setDataBuffer (data); g_tmp = ((libTerminus.cRegex)_nb.GetNthPage (_nb.Page)); _nb.Remove (_nb.GetNthPage (_nb.Page)); AddTabFromFile (_nb, _Filename, current); _nb.Page = current; } } catch (Exception ex) { MessageBox.Show (ex.Message, cTerminus.g_programName, ButtonsType.Close, MessageType.Error); } }
public static void SaveCopy(Notebook _nb, int _Index) { string filename = ShowSaveDialog (null); if (filename != "") { ((libTerminus.cRegex)_nb.GetNthPage (_nb.Page)).Save (filename, false); } }
/// <summary> /// Gets the name of the current file. /// </summary> /// <returns> /// The file name. /// </returns> /// <param name='_nb'> /// The notebook /// </param> /// <param name='_index'> /// The current page index of the notebook. /// </param> public static string getFileName(Notebook _nb, int _index) { try { return ((libTerminus.cRegex)_nb.GetNthPage (_nb.Page)).g_filename; //return Files [index]; } catch (IndexOutOfRangeException ex) { MessageBox.Show (ex.Message, cTerminus.g_programName, ButtonsType.Close, MessageType.Error); return ""; } }
/// <summary> /// Gets the title. /// </summary> /// <returns> /// The title. /// </returns> /// <param name='_nb'> /// Notebook /// </param> /// <param name='_Index'> /// Index of the current page. /// </param> public static string getTitle(Notebook _nb, int _Index) { try { cRegex p_current = ((libTerminus.cRegex)_nb.GetNthPage (_nb.Page)); if (p_current.g_filename == "") return g_programName; else { if (p_current.Saved) return p_current.g_filename + " - " + g_programName; else return p_current.g_filename + "* - " + g_programName; } } catch (Exception ex) { //MessageBox.Show (ex.Message, cTerminus.g_programName, ButtonsType.Close, MessageType.Error); return g_programName + " "; } }
/// <summary> /// Gets the expression of tab. /// </summary> /// <returns> /// The buffer content of the expression of the cRegex - Tab. Or if any errors appeared - "". /// </returns> /// <param name='_nb'> /// The notebook. /// </param> /// <param name='_Index'> /// The current page index. /// </param> public static string getExpressionofTab(Notebook _nb, int _Index) { try { return ((libTerminus.cRegex)_nb.GetNthPage (_nb.Page)).GetExpressionBuffer (); } catch { return ""; } }
/// <summary> /// Closes the tab of the notebook and removes it from the <see cref="cTerminus.Files"/> List. /// </summary> /// <param name='_nb'> /// The notebook /// </param> /// <param name='_index'> /// The index of the current page, which should be deleted. /// </param> public static void CloseTab(Notebook _nb, int _index) { try { if (((libTerminus.cRegex)_nb.GetNthPage (_nb.Page)).Saved) { _nb.RemovePage (_index); g_files.RemoveAt (_index); } else if (((libTerminus.cRegex)_nb.GetNthPage (_nb.Page)).GetExpressionBuffer () == "") { _nb.RemovePage (_index); g_files.RemoveAt (_index); } else { if (AskForClosingLastTab () == ResponseType.Yes) { _nb.RemovePage (_index); g_files.RemoveAt (_index); } } } catch (Exception ex) { if (_nb.GetNthPage (_nb.Page) is cConfig) { cTerminus.isConfigTabOpen = false; cTerminus.ConfigTabIndex = -1; } else if (_nb.GetNthPage (_nb.Page) is cPool) { cTerminus.isLibTabOpen = false; LibTabIndex = -1; //Remove the tab } _nb.RemovePage (_index); _nb.ParentWindow.Title = cTerminus.getTitle (_nb, _nb.Page); } }
public static void check(Notebook nb) { try { if (nb.GetNthPage (nb.Page) is cRegex) { cTerminus.disable = false; } else { cTerminus.disable = true; } } catch { } }
Notebook CreateNewWindow(Notebook source, Widget page, int x, int y) { Helpers.ExternalWindow window; EventBox box; Notebook notebook; window = new Helpers.ExternalWindow (); if (page == timeline) { window.Title = Catalog.GetString ("Timeline"); } else if (page == dashboardhpaned) { window.Title = Catalog.GetString ("Analysis dashboard"); } else if (page == playspositionviewer1) { window.Title = Catalog.GetString ("Zonal tags viewer"); } notebook = new Notebook (); notebook.ShowTabs = false; notebook.CanFocus = false; //notebook.Group = source.Group; window.Add (notebook); window.SetDefaultSize (page.Allocation.Width, page.Allocation.Height); window.Move (x, y); window.ShowAll (); activeWindows.Add (window); window.DeleteEvent += (o, args) => { Widget pa = notebook.CurrentPageWidget; activeWindows.Remove (window); notebook.Remove (pa); Visible = true; source.AppendPage (pa, null); notebookHelper.UpdateTabs (); notebook.Destroy (); }; /* If we are remove the last visible page, hide the widget to * free the empty space for the rest of widgets */ int visiblePages = 0; for (int i = 0; i < source.NPages; i++) { if (source.GetNthPage (i).Visible) { visiblePages++; } } if (visiblePages == 1) { Visible = false; } return notebook; }
public MindFire(string[] args) { Application.Init(); Glade.XML gxml = new Glade.XML(null, "gui.glade", "mindFire", null); gxml.Autoconnect(this); playButtonPixbuf = new Gdk.Pixbuf(null, "media-play.png"); playButtonImage = new Gtk.Image(); playButtonImage.Pixbuf = playButtonPixbuf; startButton.Add(playButtonImage); startButton.Sensitive = false; startButton.Clicked += new EventHandler(StartRsvp); startButton.ShowAll(); stopButtonPixbuf = new Gdk.Pixbuf(null, "media-stop.png"); stopButtonImage = new Gtk.Image(); stopButtonImage.Pixbuf = stopButtonPixbuf; stopButton.Add(stopButtonImage); stopButton.Sensitive = false; stopButton.Clicked += new EventHandler(StopRsvp); stopButton.ShowAll(); prevButtonPixbuf = new Gdk.Pixbuf(null, "media-prev.png"); prevButtonImage = new Gtk.Image(); prevButtonImage.Pixbuf = prevButtonPixbuf; prevButton.Add(prevButtonImage); prevButton.Sensitive = false; prevButton.Clicked += new EventHandler(PreviousWord); prevButton.ShowAll(); nextButtonPixbuf = new Gdk.Pixbuf(null, "media-next.png"); nextButtonImage = new Gtk.Image(); nextButtonImage.Pixbuf = nextButtonPixbuf; nextButton.Add(nextButtonImage); nextButton.Sensitive = false; nextButton.Clicked += new EventHandler(NextWord); nextButton.ShowAll(); speedUp.Clicked += new EventHandler(SpeedUp); speedDown.Clicked += new EventHandler(SpeedDown); startMenuItem.Sensitive = false; stopMenuItem.Sensitive = false; slider.ValueChanged += new EventHandler(SliderMoved); noteBook.SwitchPage += new SwitchPageHandler(NoteBookChanged); icon = new Gdk.Pixbuf(null, "mindFireMonkey.png"); mindFire.Icon = icon; dateTime = System.DateTime.Now; config = new Config(); noteBook.SetTabLabelPacking(noteBook.GetNthPage(0), true, true, Gtk.PackType.Start); ftLabel.ModifyFg(Gtk.StateType.Active, new Gdk.Color(127, 127, 127)); riLabel.ModifyFg(Gtk.StateType.Active, new Gdk.Color(127, 127, 127)); sgLabel.ModifyFg(Gtk.StateType.Active, new Gdk.Color(127, 127, 127)); mlLabel.ModifyFg(Gtk.StateType.Active, new Gdk.Color(127, 127, 127)); statusBar.Push(0, "Ready"); ShowWord(curWord); Application.Run(); }