Exemplo n.º 1
0
 public ELabelTextArea(string title, float width_title, float width_input, float height) : base(width_title + width_input, height)
 {
     title_lab = new ELabel(title, DEFAULT_HEIGHT);
     textarea  = new ETextArea(width_input, height);
     AddComponent(title_lab, 0, 0);
     AddComponentRight(textarea, title_lab);
     show_box = false;
 }
Exemplo n.º 2
0
 public ELabelIntInput(string title, float width_title, int input_lab, float width_input, float height = DEFAULT_HEIGHT) : base(width_title + width_input, height)
 {
     title_lab = new ELabel(title, width_title);
     input     = new EIntInput(input_lab, width_input);
     AddComponent(title_lab, 0, 0);
     AddComponentRight(input, title_lab);
     show_box = false;
 }
Exemplo n.º 3
0
        void ExposeHandler(object obj, ExposeEventArgs args)
        {
            int max_steps = 25;
            int displ;

            Gdk.Window    win  = args.Event.Window;
            Gdk.Rectangle area = args.Event.Area;

            win.DrawRectangle(Style.BaseGC(StateType.Normal), true, area);

            for (int y = 0, row = top_displayed; y < area.Y + area.Height; y += line_height, row++)
            {
                Gdk.GC        gc;
                Gdk.Rectangle region_area = new Gdk.Rectangle(0, y, Allocation.Width, line_height);
                StateType     state       = StateType.Normal;

                if (sel_rows.Contains(row))
                {
                    if (HasFocus)
                    {
                        state = StateType.Selected;
                    }
                    else
                    {
                        state = StateType.Active;
                    }

                    win.DrawRectangle(Style.BaseGC(state), true, region_area);
                }

                //FIXME: we have a ghost row at the end of the list!

                if (row >= provider.Rows)
                {
                    return;
                }

                string text = "";

                if (ellipses[row] == null)
                {
                    text = provider.GetValue(row);
                }
                else
                {
                    text = (string)ellipses[row];
                }
                displ = (int)((max_steps / HAdjustment.Upper) * HAdjustment.Value);
                text  = ELabel.Ellipsize(layout, text, Allocation.Width - 2 * 2, ellipsis_width, en_width, displ);

                layout.SetText(text);

                gc = Style.TextGC(state);
                win.DrawLayout(gc, 2, y, layout);
            }

            args.RetVal = true;
        }
Exemplo n.º 4
0
	public Browser (string basedir, IEnumerable<string> sources, string engine)
	{
#if MACOS
		try {
			InitMacAppHandlers();
		} catch (Exception ex) {
			Console.Error.WriteLine ("Installing Mac AppleEvent handlers failed. Skipping.\n" + ex);
		}
#endif
	
		this.engine = engine;		
		ui = new Glade.XML (null, "browser.glade", "window1", null);
		ui.Autoconnect (this);

		MainWindow = (Gtk.Window) ui["window1"];
		MainWindow.DeleteEvent += new DeleteEventHandler (delete_event_cb);
                
		MainWindow.KeyPressEvent += new KeyPressEventHandler (keypress_event_cb);
		MainWindow.KeyReleaseEvent += new KeyReleaseEventHandler (keyrelease_event_cb);
                
		Stream icon = GetResourceImage ("monodoc.png");

		if (icon != null) {
			monodoc_pixbuf = new Gdk.Pixbuf (icon);
			MainWindow.Icon = monodoc_pixbuf;
		}

		//ellipsizing label for the title
		title_label = new ELabel ("");
		title_label.Xalign = 0;
		Pango.FontDescription fd = new Pango.FontDescription ();
		fd.Weight = Pango.Weight.Bold;
		title_label.ModifyFont (fd);
		title_label.Layout.FontDescription = fd;
		title_label_box.Add (title_label);
		title_label.Show ();
		
		//colour the bar according to the current style
		bar_style = bar_eb.Style.Copy ();
		bar_eb.Style = bar_style;
		MainWindow.StyleSet += new StyleSetHandler (BarStyleSet);
		BarStyleSet (null, null);

		help_tree = Driver.LoadTree (basedir, sources);
		tree_browser = new TreeBrowser (help_tree, reference_tree, this);
		
		// Bookmark Manager init;
		bookmark_manager = new BookmarkManager(this);
		
		//
		// Tab Notebook and first tab
		//
		tabs_nb = new Notebook(); //the Notebook that holds tabs
		tabs_nb.Scrollable = true;
		tabs_nb.SwitchPage += new SwitchPageHandler(ChangeTab);
		help_container.Add(tabs_nb);

		AddTab();
			
			
		if ((capabilities & Capabilities.Fonts) != 0) {
			// Add Menu entries for changing the font
			Menu aux = (Menu) view1.Submenu;
			MenuItem sep = new SeparatorMenuItem ();
			sep.Show ();
			aux.Append (sep);
			AccelGroup accel = new AccelGroup ();
			MainWindow.AddAccelGroup (accel);

			textLarger = new MenuItem ("_Larger text");
			textLarger.Activated += new EventHandler (TextLarger);
			textLarger.Show ();
			aux.Append (textLarger);
			AccelKey ak = new AccelKey (Gdk.Key.plus, Gdk.ModifierType.ControlMask, AccelFlags.Visible);
			textLarger.AddAccelerator ("activate", accel, ak);
		
			textSmaller = new MenuItem ("_Smaller text");
			textSmaller.Activated += new EventHandler (TextSmaller);
			textSmaller.Show ();
			aux.Append (textSmaller);
			ak = new AccelKey (Gdk.Key.minus, Gdk.ModifierType.ControlMask, AccelFlags.Visible);
			textSmaller.AddAccelerator ("activate", accel, ak);
	
			textNormal = new MenuItem ("_Original size");
			textNormal.Activated += new EventHandler (TextNormal);
			textNormal.Show ();
			aux.Append (textNormal);
			ak = new AccelKey (Gdk.Key.Key_0, Gdk.ModifierType.ControlMask, AccelFlags.Visible);
			textNormal.AddAccelerator ("activate", accel, ak);
		}

		// restore the editing setting
		editing1.Active = SettingsHandler.Settings.EnableEditing;

		comments1.Active = SettingsHandler.Settings.ShowComments;

		cut1.Sensitive = false;
		paste1.Sensitive = false;

		//
		// Other bits
		//
		search_index = help_tree.GetSearchIndex();
		if (search_index == null) {
			ppanel = new ProgressPanel ("<b>No Search index found</b>", "Generate", RootTree.MakeSearchIndex, CreateSearchPanel); 
			search_vbox.Add (ppanel);
			search_vbox.Show ();
		} else {
			CreateSearchPanel ();
		}
		bookList = new ArrayList ();

		index_browser = IndexBrowser.MakeIndexBrowser (this);
		MainWindow.ShowAll();
		
#if MACOS
		try {
			InstallMacMainMenu ();
			((MenuBar)ui["menubar1"]).Hide ();
		} catch (Exception ex) {
			Console.Error.WriteLine ("Installing Mac IGE Main Menu failed. Skipping.\n" + ex);
		}
#endif
	}
        public MetroForListItem(
            System.Windows.Forms.Control fatherControl,
            bool isTitleDesc,
            bool isCanEdit,
            bool isButton,
            bool isImage,
            bool isTable,
            System.Drawing.Color foreColor,
            System.Drawing.Color backColor,
            string fontFamily,
            object listItemDescTxt,
            object listItemDescTip,
            System.Windows.Forms.MouseEventHandler listItemMouseClick
            )
        {
            #region MetroForListItem
            ForeColor = foreColor;
            BackColor = backColor;
            IsTitleDesc = isTitleDesc;
            IsCanEdit = isCanEdit;
            IsButton = isButton;
            IsImage = isImage;
            IsTable = isTable;
            FontFamily = fontFamily;

            var descTxt = listItemDescTxt.ToString();
            if (descTxt.Contains("Button"))
            {
                IsButton = true;
                descTxt = descTxt.Replace("Button", "");
            }
            if (descTxt.Contains("Select"))
            {
                IsSelect = true;
                descTxt = descTxt.Replace("Select", "");
            }
            if (descTxt.Contains("Large"))
            {
                IsLarge = true;
                descTxt = descTxt.Replace("Large", "");
            }
            if (descTxt.Contains("Image"))
            {
                IsImage = true;
                descTxt = descTxt.Replace("Image", "");
            }
            if (descTxt.Contains("TI") && descTxt.Contains("-P"))
            {
                listItemDescTip = StringRegexHelper.GetSingle(descTxt,"TI", "-P");
                descTxt = descTxt.Replace("TI" + listItemDescTip + "-P", "");
            }
            descTxt = descTxt.Replace(",", "");
            if (IsImage)
            {
                Controls.Add(new EPicBox
                {
                    Image = LoadLocalImage(descTxt),
                    SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage,
                    Dock = System.Windows.Forms.DockStyle.Fill
                });
            }
            if (descTxt == "Empty")
            {
                IsEmpty = true;
            }
            else
            {
                ListItemTxt = new ELabel
                {
                    Text = descTxt,
                    Dock = System.Windows.Forms.DockStyle.Fill,
                    Font =
                        isTitleDesc
                            ? new System.Drawing.Font(fontFamily, 15F)
                            : new System.Drawing.Font(fontFamily, 12.5F),
                    TextAlign = AlignMiddleCenter,
                    ForeColor = IsSelect ? backColor : foreColor,
                    Cursor = isTitleDesc ? System.Windows.Forms.Cursors.Default : System.Windows.Forms.Cursors.Hand,
                    BackColor = IsSelect ? foreColor : backColor
                };
                Controls.Add(ListItemTxt);
                if (IsTable)
                {
                    ListItemTxt.Tag = listItemDescTip;
                }
                ListItemTxt.MouseClick += listItemMouseClick;

                if (!IsTable && listItemDescTip != null)
                {
                    if (!isButton)
                    {
                        ListItemTxt.Controls.Add(new ELabel
                        {
                            Text = listItemDescTip.ToString(),
                            Size = new System.Drawing.Size(21, 13),
                            Location = new System.Drawing.Point(Width - 21, ListItemTxt.Height - 13),
                            Anchor = AnchorBottomRight,
                            TextAlign = AlignTopCenter,
                            BackColor = foreColor,
                            ForeColor = backColor,
                            Font = new System.Drawing.Font(fontFamily, 6.5F)
                        });
                    }
                }
                else
                {
                    ListItemTxt.MouseDown += ListItemTxt_MouseDown;
                    if (IsButton)
                    {
                        ListItemTxt.MouseUp += ListItemTxt_MouseUp;
                    }
                }
                if (IsCanEdit)
                {
                    ListItemTxt.DoubleClick += ListItemTxt_DoubleClick;
                }
            }
            fatherControl.Controls.Add(this);
            #endregion
        }
Exemplo n.º 6
0
    void ParseLabelsInfo(TextAsset text_asset)
    {
        //StreamReader reader = new StreamReader("path");
        //reader.ReadToEnd();
        //reader.Close();
        string       text     = text_asset.text;
        StringReader reader   = new StringReader(text);
        string       nextline = "";

        while (nextline != null)
        {
            nextline = reader.ReadLine();
            if (nextline != null && nextline.Length > 0)
            {
                // Format: double double string
                // both doubles are the same value (Audacity exported)
                // string formats: name, name=integer
                string[] elements = nextline.Split(new Char[] { ' ', '\t' });
                //Debug.Log("How many elements = " + elements.Length.ToString());
                Assert.IsTrue(elements.Length >= 3);
                if (elements.Length < 3)
                {
                    continue;
                }
                double   time  = double.Parse(elements[0]);
                string[] tag   = elements[2].Split('=');
                string   tag0  = tag[0];
                int      value = 0;
                if (tag.Length > 1)
                {
                    value = int.Parse(tag[1]);
                }
                ELabel type = ELabel.None;
                switch (tag0)
                {
                case "tempo":
                    type = ELabel.Tempo;
                    break;

                case "pause":
                    type = ELabel.Pause;
                    break;

                case "pattern":
                    type = ELabel.Pattern;
                    break;

                default:
                    type = ELabel.None;
                    break;
                }
                if (type == ELabel.Tempo || type == ELabel.Pause)
                {
                    SSyncEntry se = new SSyncEntry();
                    se.type  = type;
                    se.time  = time;
                    se.tag   = tag0;
                    se.value = value;
                    //Debug.Log("Parsed Entry @ " + se.time.ToString() + " seconds: " + se.tag + "(" + se.value + ")");
                    m_syncInfo.Add(se);
                }
                else
                {
                    SPatternEntry pe = new SPatternEntry();
                    pe.time    = time;
                    pe.pattern = value;
                    m_patternList.Add(pe);
                }
            }
        }
        //Debug.Log("DONE! number of entries = " + m_syncInfo.Count);
    }
Exemplo n.º 7
0
 public void _init()
 {
     _left_btn  = new EButton("<", 20);
     _rigth_btn = new EButton(">", 20);
     _page_lab  = new ELabel("0/0", 40);
 }