示例#1
1
		// Inserts a piece of text into the buffer, giving it the usual
		// appearance of a hyperlink in a web browser: blue and underlined.
		// Additionally, attaches some data on the tag, to make it recognizable
		// as a link.
		void InsertLink (TextBuffer buffer, ref TextIter iter, string text, int page)
		{
			TextTag tag = new TextTag (null);
			tag.Foreground = "blue";
			tag.Underline = Pango.Underline.Single;
			tag_pages [tag] = page;
			buffer.TagTable.Add (tag);
			buffer.InsertWithTags (ref iter, text, tag);
		}
示例#2
0
        public static bool ReplaceSelection(this Gtk.TextBuffer buffer, string newText, bool keepSelection = true)
        {
            bool     retval = false;
            TextIter start;
            TextIter end;

            if (buffer.GetSelectionBounds(out start, out end))
            {
                TextMark startMark = buffer.CreateMark("start", start, false);
                TextMark endMark   = buffer.CreateMark("end", end, true);

                buffer.DeleteSelection(true, true);

                TextIter start2 = buffer.GetIterAtMark(startMark);
                buffer.Insert(ref start2, newText);

                if (keepSelection)
                {
                    TextIter start3 = buffer.GetIterAtMark(startMark);
                    TextIter end3   = buffer.GetIterAtMark(endMark);

                    buffer.SelectRange(start3, end3);
                }
                retval = true;
            }
            return(retval);
        }
示例#3
0
        public static string GetSelectedText(this Gtk.TextBuffer buffer)
        {
            TextIter start;
            TextIter end;

            return(GetSelectedText(buffer, out start, out end));
        }
示例#4
0
    public NoteWindow(NoteData note_data, Window parent) : base("Note")
    {
        this.data         = note_data;
        TransientFor      = parent;
        DestroyWithParent = true;
        SetSizeRequest(250, 210);
        Resizable = false;
        Move(this.data.get_pos_x(), this.data.get_pos_y());
        Decorated       = false;
        SkipPagerHint   = true;
        SkipTaskbarHint = true;
        BorderWidth     = 12;
        ConfigureEvent += window_position_changed;

        Gdk.Color note_color = new Gdk.Color();
        Gdk.Color.Parse(note_data.get_color(), ref note_color);

        ModifyBg(StateType.Normal, note_color);

        this.view          = new Gtk.TextView();
        this.view.WrapMode = Gtk.WrapMode.WordChar;
        this.view.ModifyBase(StateType.Normal, note_color);

        this.view.KeyReleaseEvent += new KeyReleaseEventHandler(this.check_deletion);

        this.buffer          = this.view.Buffer;
        this.buffer.Text     = this.data.get_text();
        this.buffer.Changed += this.text_change;
        this.font_size       = "14";
        this.max_lines       = 8;
        this.resize_font();

        //image = new Gdk.Pixbuf( "noise.png" );
        Add(view);
    }
示例#5
0
        public MainView(Controller app)
        {
            this.app = app;
            Glade.XML gxml;
            gxml = new Glade.XML("./data/main.glade", "main", null);
            gxml.Autoconnect(this);
            System.Console.WriteLine("Vista creada");
            counter = 0;
            buffer  = lista_proy.Buffer;

            if (main == null)
            {
                print("Ventana principal [NULL]");
            }
            if (btnOK == null)
            {
                print("btnOK [NULL]");
            }


            app.timer += new EventHandler(OnTimer);


            main.DeleteEvent += new DeleteEventHandler(deleteEventCb);
            btnOK.Clicked    += new EventHandler(OKButtonCb);
            btnLoad.Clicked  += new EventHandler(LoadButtonCb);
        }
示例#6
0
        public LogView()
        {
            buffer                     = new Gtk.TextBuffer(new Gtk.TextTagTable());
            textEditorControl          = new LogTextView(buffer);
            textEditorControl.Editable = false;

            ShadowType = ShadowType.None;
            Add(textEditorControl);

            bold        = new TextTag("bold");
            bold.Weight = Pango.Weight.Bold;
            buffer.TagTable.Add(bold);

            errorTag            = new TextTag("error");
            errorTag.Foreground = "red";
            errorTag.Weight     = Pango.Weight.Bold;
            buffer.TagTable.Add(errorTag);

            consoleLogTag            = new TextTag("consoleLog");
            consoleLogTag.Foreground = "darkgrey";
            buffer.TagTable.Add(consoleLogTag);

            tag            = new TextTag("0");
            tag.LeftMargin = 10;
            buffer.TagTable.Add(tag);
            tags.Add(tag);

            endMark = buffer.CreateMark("end-mark", buffer.EndIter, false);

            UpdateCustomFont();
            IdeApp.Preferences.CustomOutputPadFontChanged += HandleCustomFontChanged;

            outputDispatcher = new GLib.TimeoutHandler(outputDispatchHandler);
        }
示例#7
0
		// Fills the buffer with text and interspersed links. In any real
		// hypertext app, this method would parse a file to identify the links.
		void ShowPage (TextBuffer buffer, int page)
		{
			buffer.Text = "";
			TextIter iter = buffer.StartIter;

			if (page == 1) {
				buffer.Insert (ref iter, "Some text to show that simple ");
				InsertLink (buffer, ref iter, "hypertext", 3);
				buffer.Insert (ref iter, " can easily be realized with ");
				InsertLink (buffer, ref iter, "tags", 2);
				buffer.Insert (ref iter, ".");
			} else if (page == 2) {
				buffer.Insert (ref iter,
					       "A tag is an attribute that can be applied to some range of text. " +
					       "For example, a tag might be called \"bold\" and make the text inside " +
					       "the tag bold. However, the tag concept is more general than that; " +
					       "tags don't have to affect appearance. They can instead affect the " +
					       "behavior of mouse and key presses, \"lock\" a range of text so the " +
					       "user can't edit it, or countless other things.\n");
      				InsertLink (buffer, ref iter, "Go back", 1);
			} else if (page == 3) {
				TextTag tag = buffer.TagTable.Lookup ("bold");
				if (tag == null) {
					tag = new TextTag ("bold");
					tag.Weight = Pango.Weight.Bold;
					buffer.TagTable.Add (tag);
				}
				buffer.InsertWithTags (ref iter, "hypertext:\n", tag);
				buffer.Insert (ref iter,
					       "machine-readable text that is not sequential but is organized " +
					       "so that related items of information are connected.\n");
				InsertLink (buffer, ref iter, "Go back", 1);
			}
		}
示例#8
0
 public NotesWidget()
 {
     this.Build ();
     this.buf = textview1.Buffer;
     buf.Changed += new EventHandler (OnEdition);
     App.Current.EventsBroker.Subscribe<EventLoadedEvent> (HandlePlayLoaded);
 }
示例#9
0
		public ConsoleGtk ()
		{
			Window win = new Window ("MonoLOGO");
			win.DeleteEvent += new EventHandler (Window_Delete);
			win.BorderWidth = 4;
			win.DefaultSize = new Size (450, 300);
			
			VBox vbox = new VBox (false, 4);
			win.EmitAdd (vbox);
			
			ScrolledWindow swin = new ScrolledWindow (new Adjustment (0.0, 0.0, 0.0, 0.0, 0.0, 0.0), new Adjustment (0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
			swin.HscrollbarPolicy = Gtk.PolicyType.Automatic;
			swin.VscrollbarPolicy = Gtk.PolicyType.Automatic;
			swin.ShadowType = Gtk.ShadowType.In;
			vbox.PackStart (swin, true, true, 0);
			
			TextBuffer buf = new TextBuffer (new TextTagTable ());
			Out = new TextWriterGtk (buf);
			TextView text = new TextView (buf);
			text.Editable = false;
			swin.EmitAdd (text);

			Entry entry = new Entry ();
			entry.Activate += new EventHandler (Entry_Activate);
			vbox.PackStart (entry, false, false, 0);
			
			win.ShowAll ();
		}
示例#10
0
        protected virtual void OnExpander(object sender, System.EventArgs e)
        {
            if (!ContentFilled)
            {
                int    lines = 15;
                byte[] data;

                // Fill Content View with data...
                Gtk.TextBuffer buffer = ContentView.Buffer;
                try {
                    data = Ct.Read(0, lines * 16);

                    for (int l = 0; l < lines; l++)
                    {
                        StringBuilder sb = new StringBuilder(80);

                        sb.AppendFormat("{0:x4}: ", l * 16);
                        for (int i = 0; i < 16; i++)
                        {
                            sb.AppendFormat("{0:x2} ", data[l * 16 + i]);
                        }

                        sb.Append("\n");
                        buffer.Insert(buffer.EndIter, sb.ToString());
                    }

                    ContentFilled = true;
                } catch (CTException ex) {
                    System.Console.Error.WriteLine(ex);
                }
            }
        }
示例#11
0
        public ProgressDialog(MonoDevelop.Components.Window parent, bool allowCancel, bool showDetails)
        {
            MonoDevelop.Components.IdeTheme.ApplyTheme(this);
            this.Build();
            this.Title   = BrandingService.ApplicationName;
            HasSeparator = false;
            ActionArea.Hide();
            DefaultHeight = 5;

            TransientFor = parent;

            btnCancel.Visible = allowCancel;

            expander.Visible = showDetails;

            buffer = detailsTextView.Buffer;
            detailsTextView.Editable = false;

            bold        = new TextTag("bold");
            bold.Weight = Pango.Weight.Bold;
            buffer.TagTable.Add(bold);

            tag        = new TextTag("0");
            tag.Indent = 10;
            buffer.TagTable.Add(tag);
            tags.Add(tag);
        }
示例#12
0
    public void on_search_button_find_activate(object o, EventArgs ea)
    {
        Gtk.TextView   tv       = (Gtk.TextView)gxml["search_simple_keywords_view"];
        Gtk.TextBuffer tb       = tv.Buffer;
        string         kwstring = tb.GetText(tb.StartIter, tb.EndIter, false).Trim();

//        Console.WriteLine("kwstring: " + kwstring);

        if (kwstring == "")
        {
            return;
        }

        string[] kws = kwstring.Split(',', '\n', '\r');

        if (kws.Length <= 0)
        {
            return;
        }

        for (int i = 0; i < kws.Length; i++)
        {
            kws[i] = kws[i].Trim();
            Console.WriteLine("kw " + i + ": " + kws[i]);
        }
        IIconListAdapter search_adapter = new SimpleSearchIconListAdapter
                                              (repo, kws);

        icon_list.Adapter = search_adapter;
    }
示例#13
0
 public NotesWidget()
 {
     this.Build ();
     this.buf = textview1.Buffer;
     buf.Changed += new EventHandler (OnEdition);
     Config.EventsBroker.EventLoadedEvent += HandlePlayLoaded;
 }
示例#14
0
  /** ChatIM constructor. 
   *  @param core the main application
   *  @param r_add the recipient address
   */
  public BrunetChatIM(User u, Buddy bud, BrunetChatMain bcm)
  {
    _user = u;
    _recipient_buddy = bud;
    _bcm = bcm;
    
    string fname = "BrunetChat.glade";
    string root = "windowBrunetChatIM";

    Glade.XML gxml = new Glade.XML (fname, root, null);
    //Glade.XML gxml = new Glade.XML (null,fname, root, null);
    gxml.Autoconnect(this);
    
    _text_buf_display = textviewDisplay.Buffer;
    _text_buf_input = textviewInput.Buffer;
    _text_buf_recipient = textviewRecipient.Buffer;
    _text_buf_recipient.Text = _recipient_buddy.Alias;
    Gdk.Color red_color = new Gdk.Color (0xff, 0, 0);
    Gdk.Color blue_color = new Gdk.Color (0, 0, 0xff);
    
    TextTag sendercolor = new TextTag("Sender Color");
    sendercolor.ForegroundGdk = blue_color;
    
    TextTag recipientcolor = new TextTag("Recipient Color");
    recipientcolor.ForegroundGdk = red_color;
    _text_buf_display.TagTable.Add(sendercolor);
    _text_buf_display.TagTable.Add(recipientcolor);
    
  }
		public LogView ()
		{
			buffer = new Gtk.TextBuffer (new Gtk.TextTagTable ());
			textEditorControl = new Gtk.TextView (buffer);
			textEditorControl.Editable = false;
			
			ShadowType = ShadowType.None;
			Add (textEditorControl);

			bold = new TextTag ("bold");
			bold.Weight = Pango.Weight.Bold;
			buffer.TagTable.Add (bold);
			
			errorTag = new TextTag ("error");
			errorTag.Foreground = "red";
			errorTag.Weight = Pango.Weight.Bold;
			buffer.TagTable.Add (errorTag);
			
			consoleLogTag = new TextTag ("consoleLog");
			consoleLogTag.Foreground = "darkgrey";
			buffer.TagTable.Add (consoleLogTag);
			
			tag = new TextTag ("0");
			tag.LeftMargin = 10;
			buffer.TagTable.Add (tag);
			tags.Add (tag);
			
			endMark = buffer.CreateMark ("end-mark", buffer.EndIter, false);

			UpdateCustomFont (IdeApp.Preferences.CustomOutputPadFont);
			IdeApp.Preferences.CustomOutputPadFontChanged += HandleCustomFontChanged;
			
			outputDispatcher = new GLib.TimeoutHandler (outputDispatchHandler);
		}
		public ProgressDialog (MonoDevelop.Components.Window parent, bool allowCancel, bool showDetails)
		{
			MonoDevelop.Components.IdeTheme.ApplyTheme (this);
			this.Build ();
			this.Title = BrandingService.ApplicationName;
			HasSeparator = false;
			ActionArea.Hide ();
			DefaultHeight = 5;
			
			TransientFor = parent;
			
			btnCancel.Visible = allowCancel;

			expander.Visible = showDetails;
			
			buffer = detailsTextView.Buffer;
			detailsTextView.Editable = false;
			
			bold = new TextTag ("bold");
			bold.Weight = Pango.Weight.Bold;
			buffer.TagTable.Add (bold);
			
			tag = new TextTag ("0");
			tag.Indent = 10;
			buffer.TagTable.Add (tag);
			tags.Add (tag);
		}
示例#17
0
	public override void Redo (TextBuffer buffer)
	{
		TextIter insertIter = buffer.GetIterAtOffset (index);
		buffer.InsertRange (ref insertIter, chop.Start, chop.End);
		buffer.MoveMark (buffer.SelectionBound, buffer.GetIterAtOffset (index));
		buffer.MoveMark (buffer.InsertMark, buffer.GetIterAtOffset (index + chop.Length));
	}
示例#18
0
        public ILFormatter(Gtk.TextBuffer Out)
        {
            this.Out     = Out;
            this.endIter = Out.EndIter;

            CreateTags(Out);
        }
		public ProgressDialog (Window parent, bool allowCancel, bool showDetails)
		{
			this.Build ();
			HasSeparator = false;
			ActionArea.Hide ();
			DefaultHeight = 5;
			
			TransientFor = parent;
			
			btnCancel.Visible = allowCancel;

			expander.Visible = showDetails;
			
			buffer = detailsTextView.Buffer;
			detailsTextView.Editable = false;
			
			bold = new TextTag ("bold");
			bold.Weight = Pango.Weight.Bold;
			buffer.TagTable.Add (bold);
			
			tag = new TextTag ("0");
			tag.Indent = 10;
			buffer.TagTable.Add (tag);
			tags.Add (tag);
		}
示例#20
0
        private ScrolledWindow CreateText(TextBuffer buffer, bool IsSource)
        {
            ScrolledWindow scrolledWindow = new ScrolledWindow ();
            scrolledWindow.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
            scrolledWindow.ShadowType = ShadowType.In;

            TextView textView = new TextView (buffer);
            textView.Editable = false;
            textView.CursorVisible = false;

            scrolledWindow.Add (textView);

            if (IsSource) {
                FontDescription fontDescription = FontDescription.FromString ("monospace");
                textView.OverrideFont (fontDescription);
                textView.WrapMode = Gtk.WrapMode.None;
            } else {
                // Make it a bit nicer for text
                textView.WrapMode = Gtk.WrapMode.Word;
                textView.PixelsAboveLines = 2;
                textView.PixelsBelowLines = 2;
            }

            return scrolledWindow;
        }
示例#21
0
	public static int AddPaddingEmpty (TextBuffer buffer, int offset,  string suffix)
	{
		TextIter insertAt = buffer.GetIterAtOffset (offset);
		AddPaddingEmpty (buffer, ref insertAt, suffix);
		
		return insertAt.Offset;
	}
示例#22
0
        public ProgressDialog(Window parent, bool allowCancel, bool showDetails)
        {
            this.Build();
            HasSeparator = false;
            ActionArea.Hide();
            DefaultHeight = 5;

            TransientFor = parent;

            btnCancel.Visible = allowCancel;

            expander.Visible = showDetails;

            buffer = detailsTextView.Buffer;
            detailsTextView.Editable = false;

            bold        = new TextTag("bold");
            bold.Weight = Pango.Weight.Bold;
            buffer.TagTable.Add(bold);

            tag        = new TextTag("0");
            tag.Indent = 10;
            buffer.TagTable.Add(tag);
            tags.Add(tag);
        }
示例#23
0
文件: Indexing.cs 项目: GNOME/nemo
        public Indexing()
        {
            this.Build();
            this.Hide(); // not show the on creation, since we can add text before we show the screen

            buffer = new Gtk.TextBuffer(new TextTagTable());
            log_text_view.Buffer = buffer;
        }
示例#24
0
	public static void AddPaddingEmpty (TextBuffer buffer, ref TextIter insertAt, string suffix)
	{
		DocumentTagTable tagTable = (DocumentTagTable) buffer.TagTable;
		TextTag tag = tagTable.Lookup ("padding-empty" + suffix);
		
		if (tag == null)
			tag = tagTable.CreateDynamicTag ("padding-empty" + suffix);
		buffer.InsertWithTags (ref insertAt, " ", tag);
	}
示例#25
0
        private void gsIO(String mess, int len)
        {
            Gtk.TextBuffer buffer = m_gsoutput.m_textView.Buffer;
            Gtk.TextIter   ti     = buffer.EndIter;

            var part = mess.Substring(0, len);

            buffer.Insert(ref ti, part);
        }
示例#26
0
        public StyleWindow()
            : base(Gtk.WindowType.Toplevel)
        {
            SetSizeRequest(800, 800);

            var box = new VBox();
            Add(box);

            var tab = new TextTagTable();
            buf = new TextBuffer(tab);
            buf.Text = System.IO.File.ReadAllText("res/theme/gtk.css");
            var en = new TextView(buf);
            sv = new ScrolledWindow();
            sv.Add(en);
            box.PackStart(sv, true, true, 0);

            var cssProvider = new CssProvider();
            StyleContext.AddProviderForScreen(Gdk.Screen.Default, cssProvider, uint.MaxValue - 10);

            var isDefault = true;

            var but = new Button();
            but.Label = "Save";
            but.HeightRequest = 30;
            box.PackEnd(but, false, false, 0);
            but.Clicked += (s, e) => {
                System.IO.File.WriteAllText("res/theme/gtk.css", buf.Text);
            };

            buf.Changed += (s, e) => {
                bool error = false;
                try {
                    //StyleContext.RemoveProviderForScreen(Gdk.Screen.Default, cssProvider);
                    cssProvider.LoadFromData(buf.Text);
                    //StyleContext.AddProviderForScreen(Gdk.Screen.Default, cssProvider, uint.MaxValue - 10);
                } catch (Exception ex) {
                    error = true;
                }
                if (error) {
                    if (!isDefault) {
                        StyleContext.RemoveProviderForScreen(Gdk.Screen.Default, cssProvider);
                        StyleContext.AddProviderForScreen(Gdk.Screen.Default, AppLib.GlobalCssProvider, uint.MaxValue);
                        isDefault = true;
                    }

                } else {
                    if (isDefault) {
                        StyleContext.RemoveProviderForScreen(Gdk.Screen.Default, AppLib.GlobalCssProvider);
                        StyleContext.AddProviderForScreen(Gdk.Screen.Default, cssProvider, uint.MaxValue);
                        isDefault = false;
                    }
                }

            };

            ShowAll();
        }
示例#27
0
        public static string GetSelectedText(this Gtk.TextBuffer buffer, out TextIter start, out TextIter end)
        {
            string retval = string.Empty;

            if (buffer.GetSelectionBounds(out start, out end))
            {
                retval = buffer.GetText(start, end, true);
            }
            return(retval);
        }
示例#28
0
        public CheckDependenciesDialog(Project project)
            : base("CheckDependenciesDialog.ui", "dependencies")
        {
            text_buffer = new Gtk.TextBuffer (new Gtk.TextTagTable ());
            capabilitiesview.Buffer = text_buffer;

            Gtk.TextBuffer buffer_intro = new Gtk.TextBuffer (new Gtk.TextTagTable ());
            textview_intro.Buffer = buffer_intro;
            buffer_intro.Text = Catalog.GetString ("Mistelix uses a set of external components. Their availability determines Mistelix's capabilities. The following list shows the level of support of your system for Mistelix and if there are actions required.");
        }
示例#29
0
		public TextView (TextBuffer buffer) : base (IntPtr.Zero)
		{
			if (GetType() != typeof (TextView)) {
				CreateNativeObject (new string [0], new GLib.Value [0]);
				Buffer = buffer;
				return;
			}

			Raw = gtk_text_view_new_with_buffer (buffer.Handle);
		}
示例#30
0
 static ErrorDialog()
 {
     XML gxml = new Glade.XML (null,
                   WorkbenchSingleton.GLADEFILE,
                   "ErrorDialog",
                   null);
     dialog = (Dialog) gxml["ErrorDialog"];
     Gtk.TextView errorTextView = (TextView) gxml["errorTextView"];
     errorBuffer = errorTextView.Buffer;
 }
示例#31
0
 private void LoadPointers()
 {
     window = (Gtk.Window)ui["window1"];
     window.SetDefaultSize(450, 450);
     subject_entry = (Gtk.Entry)ui["subject_entry"];
     textbuffer    = ((Gtk.TextView)ui["textview1"]).Buffer;
     contrib_entry = (Gtk.Entry)ui["contrib_entry"];
     server_entry  = (Gtk.Entry)ui["server_entry"];
     statusbar     = (Gtk.Statusbar)ui["statusbar1"];
 }
示例#32
0
	private void LoadPointers ()
	{
		window = (Gtk.Window) ui["window1"];
		window.SetDefaultSize (450, 450);
		subject_entry = (Gtk.Entry) ui["subject_entry"];
		textbuffer = ((Gtk.TextView) ui["textview1"]).Buffer;
		contrib_entry = (Gtk.Entry) ui["contrib_entry"];
		server_entry = (Gtk.Entry) ui["server_entry"];
		statusbar = (Gtk.Statusbar) ui["statusbar1"];
	}
示例#33
0
        /// <summary>Crea el editor para el código en ensamblador.</summary>
        /// <returns>Un widget que contiene el campo de texto para
        /// editar código ensamblador.</returns>

        private Gtk.Widget CrearEditorEnsamblador()
        {
            textoCodigo =
                new Gtk.TextBuffer((Gtk.TextTagTable)null);
            Gtk.TextView       view = new Gtk.TextView(textoCodigo);
            Gtk.ScrolledWindow sw   = new Gtk.ScrolledWindow();
            sw.Add(view);
            textoCodigo.MarkSet +=
                new Gtk.MarkSetHandler(ActualizadaPosicionCursor);
            return(sw);
        }
        public static void RegisterCommandLineElements(TextView output, Entry entry, Button send_button)
        {
            // Register UI elements with the controller
            CommandLineOutput = output;
            OutputBuffer = output.Buffer;
            CommandLineEntry = entry;
            CommandLineSendButton = send_button;

            CommandLineEntry.Text = ""; //Clear the entry box
            OutputBuffer.Text = ""; //Clear the output box
        }
        private void CreateTextTags(Gtk.TextBuffer tb)
        {
            table_text_tag = new Gtk.TextTagTable();

            // Tag per text block - not style
            tag          = new Gtk.TextTag("DemoTextSelection");
            tag.WrapMode = Gtk.WrapMode.Char;
            tb.TagTable.Add(tag);

            return;
        }
示例#36
0
        private TextView textView; // Textview to hold landmark information.

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="SLAM.MapWindow"/> class.
        /// </summary>
        /// <param name="mapView">Map view contained in this window.</param>
        public MapWindow(MapView mapView)
            : base("Map")
        {
            robot = mapView.RobotView.Robot;

            this.mapView = mapView;

            // Subscribe to events.
            mapView.MapModel.MapUpdated += new EventHandler<MapUpdateEventArgs> (Map_Update);
            mapView.RobotView.Robot.RobotUpdated += new EventHandler<RobotUpdateEventArgs> (Robot_Update);

            SetPosition (WindowPosition.Center);
            Resizable = false;

            DeleteEvent += delegate
            {
                Application.Quit ();
            };

            TextBuffer textBuffer = new TextBuffer (new TextTagTable ());

            textView = new TextView ();
            textView.Indent = 10;
            textView.Editable = false;
            textView.Buffer = textBuffer;
            textView.CursorVisible = false;
            textView.SetSizeRequest (mapView.ViewWidth, 150);

            foreach (Landmark landmark in mapView.MapModel.Landmarks)
            {
                this.textView.Buffer.Text += landmark.ToString ();
            }

            ScrolledWindow scrolledWindow = new ScrolledWindow ();
            scrolledWindow.Add (textView);

            commandEntry = new Entry ();
            commandEntry.Activated += CommandEntry_OnActivated;

            sendButton = new Button ("Send");
            sendButton.Clicked += SendButton_OnClick;

            HBox hbox = new HBox (false, 0);
            hbox.Add (commandEntry);
            hbox.Add (sendButton);

            VBox vbox = new VBox (false, 0);
            vbox.Add (this.mapView);
            vbox.Add (scrolledWindow);
            vbox.Add (hbox);

            Add (vbox);
            Shown += OnShown;
        }
	public static string Serialize (TextBuffer buffer, TextIter start, TextIter end)
	{
		StringWriter stream = new StringWriter ();
		XmlTextWriter xmlWriter = new XmlTextWriter (stream);
		xmlWriter.Formatting = Formatting.Indented;
		
		Serialize (buffer, start, end, xmlWriter);
		
		xmlWriter.Close ();
		return stream.ToString ();
	}
示例#38
0
        /// <summary>Crea el editor para mostrar los errores producidos
        /// al ensamblar el código en ensamblador.</summary>
        /// <returns>Un widget con el campo de texto para mostrar
        /// los errores y advertencias del ensamblador.</returns>

        private Gtk.Widget CrearErroresEnsamblador()
        {
            textoErrores =
                new Gtk.TextBuffer((Gtk.TextTagTable)null);
            Gtk.TextView view = new Gtk.TextView(textoErrores);
            view.Editable = false;

            Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow();
            sw.Add(view);
            return(sw);
        }
示例#39
0
	public override void Undo (TextBuffer buffer)
	{
		#if DEBUG
		Console.WriteLine ("DEBUG: Chop Text: {0} Length: {1}", chop.Text, chop.Length);
		#endif
		
		TextIter startIter = buffer.GetIterAtOffset (index);
		TextIter endIter = buffer.GetIterAtOffset (index + chop.Length);
		buffer.Delete (ref startIter, ref endIter);
		buffer.MoveMark (buffer.InsertMark, buffer.GetIterAtOffset (index));
		buffer.MoveMark (buffer.SelectionBound, buffer.GetIterAtOffset (index));
	}
示例#40
0
 void ListAll(Gtk.TextBuffer t, System.Uri path)
 {
     GLib.File f = FileFactory.NewForUri(path);
     foreach (GLib.FileInfo info in f.EnumerateChildren("*", FileQueryInfoFlags.None, null))
     {
         t.Text += new System.Uri(path, info.Name).ToString() + Environment.NewLine;
         if (info.FileType == FileType.Directory)
         {
             ListAll(t, new System.Uri(path, info.Name + "/"));
         }
     }
 }
示例#41
0
文件: Data.cs 项目: JGunning/OpenAIM
 private void DrawLineToBuffer(Line line, TextBuffer tb)
 {
     Gtk.TextIter iter = tb.EndIter;
     lock (line.text)
     {
         foreach (ContentText _text in line.text)
         {
             DrawPart(_text, tb);
         }
     }
     iter = tb.EndIter;
     tb.Insert(ref iter, Environment.NewLine);
 }
示例#42
0
        public BuildProjectDialog(Project project)
            : base("BuildProjectDialog.ui", "buildproject")
        {
            Gtk.TextBuffer buffer_intro;
            this.project = project;
            buffer = new Gtk.TextBuffer (new Gtk.TextTagTable ());
            status_text.Buffer = buffer;

            color = totalprogress_label.Style.Background (StateType.Normal);
            buffer_intro = new Gtk.TextBuffer (new Gtk.TextTagTable ());
            textview_intro.Buffer = buffer_intro;
            textview_intro.ModifyBase (Gtk.StateType.Normal, color);
            buffer_intro.Text = Catalog.GetString ("Welcome to the project building process. Press the 'Generate' button to start this process.");
        }
示例#43
0
 public LinkTextView(string linkText)
     : base()
 {
     currentCursor = -1;
        handCursor = new Gdk.Cursor (Gdk.CursorType.Hand2);
        hoveringOverLink = false;
        string xmlLinkText = "<message>" + linkText + "</message>";
        XmlDocument linkTextDom = new XmlDocument();
        linkTextDom.LoadXml(xmlLinkText);
        TextTagTable textTagTable = CreateTextTagTable(linkTextDom);
        TextBuffer textBuffer = new TextBuffer(textTagTable);
        FormatTextBuffer(textBuffer, linkTextDom.DocumentElement);
        this.Buffer = textBuffer;
 }
        public StringWindow(string data)
        {
            Glade.XML ui;

            buffer = new Gtk.TextBuffer (null);

            ui = Glade.XML.FromAssembly ("stringvis.glade", "string_dialog", null);
            ui.Autoconnect (this);

            string_dialog.SetDefaultSize (400, 300);

            string_textview.Buffer = buffer;
            buffer.Text = data;
        }
示例#45
0
        public SettingsScreen()
        {
            try
            {
                m_xXML = new Glade.XML(null, MediaNET.GladeCommonFilename, "SettingsScreenWindow", null);
                m_xXML.BindFields(this);
                m_xXML.Autoconnect(this);

                /** Init handlers **/
                pluginStore               = new TreeStore(typeof(string), typeof(string), typeof(string), typeof(string));
                pluginList.Model          = pluginStore;
                pluginList.HeadersVisible = true;
                pluginList.AppendColumn(new TreeViewColumn("Type", new CellRendererText(), "text", 0));
                pluginList.AppendColumn(new TreeViewColumn("Identifier", new CellRendererText(), "text", 1));
                pluginList.AppendColumn(new TreeViewColumn("Player", new CellRendererText(), "text", 2));

                // Hidden column
                TreeViewColumn col          = new TreeViewColumn();
                CellRenderer   NameRenderer = new CellRendererText();
                col.Title   = "Path";
                col.Visible = false;
                col.PackStart(NameRenderer, true);
                col.AddAttribute(NameRenderer, "text", 3);
                pluginList.AppendColumn(col);

                PopulatePluginList();
                pluginList.Show();

                /** Bindings from the UI **/
                ((Gtk.Entry)m_xXML["pathEntry"]).Changed         += new EventHandler(OnChanged);
                ((Gtk.Entry)m_xXML["pathDbLocation"]).Changed    += new EventHandler(OnChanged);
                ((Gtk.Entry)m_xXML["pluginFile"]).Changed        += new EventHandler(OnChanged);
                ((Gtk.Entry)m_xXML["announcerSentence"]).Changed += new EventHandler(OnChanged);
                pluginList.RowActivated += new RowActivatedHandler(OnPluginSelectedChanged);
                buffer = pluginInfo.Buffer;

                /** Populate GUI **/
                string   list  = (string)MediaNET.Config["Interface/currentLang"];
                Menu     m     = new Menu();
                MenuItem miOne = new MenuItem(list);
                m.Append(miOne);
                langBox.Menu = m;
                LoadSettings();
            }
            catch (Exception e)
            {
                throw new Exception("SettingsScreen raised an error: " + e.Message);
            }
        }
示例#46
0
		public TextVisualizerView ()
		{
			vbox = new VBox (false, 6);
			vbox.BorderWidth = 6;
			
			TextTagTable tagTable = new TextTagTable ();
			TextBuffer buffer = new TextBuffer (tagTable);
			textView = new TextView (buffer);

			scrolledWindow = new ScrolledWindow ();
			scrolledWindow.AddWithViewport (textView);
			
			vbox.PackStart (scrolledWindow, true, true, 0);
			
			vbox.ShowAll ();
		}
示例#47
0
        public LogWindow()
            : base(Gtk.WindowType.Toplevel)
        {
            Current = this;
            SetSizeRequest(800, 800);
            var tab = new TextTagTable();
            buf = new TextBuffer(tab);
            var en = new TextView(buf);
            sv = new ScrolledWindow();
            sv.Add(en);
            Add(sv);

            CoreLib.OnLog += (txt) => AppendText(txt);

            ShowAll();
        }
        public DefaultMonitorPad(string title, string icon)
        {
            buffer = new Gtk.TextBuffer (new Gtk.TextTagTable ());
            textEditorControl = new Gtk.TextView (buffer);
            textEditorControl.Editable = false;
            scroller = new Gtk.ScrolledWindow ();
            scroller.ShadowType = ShadowType.In;
            scroller.Add (textEditorControl);

            Toolbar toolbar = new Toolbar ();
            toolbar.IconSize = IconSize.SmallToolbar;
            toolbar.Orientation = Orientation.Vertical;
            toolbar.ToolbarStyle = ToolbarStyle.Icons;

            buttonStop = new ToolButton ("gtk-stop");
            buttonStop.Clicked += new EventHandler (OnButtonStopClick);
            buttonStop.SetTooltip (tips, "Stop", "Stop");
            toolbar.Insert (buttonStop, -1);

            ToolButton buttonClear = new ToolButton ("gtk-clear");
            buttonClear.Clicked += new EventHandler (OnButtonClearClick);
            buttonClear.SetTooltip (tips, "Clear console", "Clear console");
            toolbar.Insert (buttonClear, -1);

            hbox = new HBox (false, 5);
            hbox.PackStart (scroller, true, true, 0);
            hbox.PackEnd (toolbar, false, false, 0);

            bold = new TextTag ("bold");
            bold.Weight = Pango.Weight.Bold;
            buffer.TagTable.Add (bold);

            tag = new TextTag ("0");
            tag.Indent = 10;
            buffer.TagTable.Add (tag);
            tags.Add (tag);

            Runtime.ProjectService.CombineOpened += (CombineEventHandler) Runtime.DispatchService.GuiDispatch (new CombineEventHandler (OnCombineOpen));
            Runtime.ProjectService.CombineClosed += (CombineEventHandler) Runtime.DispatchService.GuiDispatch (new CombineEventHandler (OnCombineClosed));

            this.title = title;
            this.icon = icon;
            this.markupTitle = title;

            Control.ShowAll ();
        }
示例#49
0
 private void ShowSource(object o, EventArgs args)
 {
     Gtk.Window win = new Gtk.Window("Source");
     win.SetDefaultSize(800, 500);
     Gtk.ScrolledWindow sw = new ScrolledWindow();
     sw.HscrollbarPolicy = Gtk.PolicyType.Automatic;
     sw.VscrollbarPolicy = Gtk.PolicyType.Automatic;
     Gtk.TextView view = new Gtk.TextView();
     view.CursorVisible = false;
     view.Editable      = false;
     Gtk.TextBuffer buffer = view.Buffer;
     buffer.Text = canvas.Source;
     view.Buffer = buffer;
     sw.Add(view);
     win.Add(sw);
     win.ShowAll();
 }
示例#50
0
    public void OpenFile(string filename)
    {
        string text;

        TextReader reader = File.OpenText(filename);

        try {
            statusBar.Push(0, "Opening file " + filename);
            text = reader.ReadToEnd();
        } finally {
            if (reader != null)
            {
                ((IDisposable)reader).Dispose();
            }
        }

        statusBar.Push(0, filename);
        textBuffer      = textView.Buffer;
        textBuffer.Text = text;

        //endWordIter = textBuffer.StartIter;
        endWordIter      = Gtk.TextIter.Zero;
        startWordIter    = Gtk.TextIter.Zero;
        endHilightIter   = Gtk.TextIter.Zero;
        startHilightIter = Gtk.TextIter.Zero;
        curWord          = "";
        slider.SetRange(0, textBuffer.CharCount);
        MakeHilightTag();

        if (endWordIter.Equal(Gtk.TextIter.Zero))
        {
            endWordIter = textBuffer.StartIter;
        }
        startWordIter = endWordIter;
        curWord       = GetNextWord();
        ShowWord(curWord);
        HilightWord();

        fileLoaded            = true;
        startButton.Sensitive = true;
        prevButton.Sensitive  = true;
        nextButton.Sensitive  = true;
    }
示例#51
0
 public LogTextView(Gtk.TextBuffer buf) : base(buf)
 {
 }
示例#52
0
        private void build()
        {
            this.Title = "New Battlelords Character";
            {
                // page 1 - intro
                Gtk.TextView   tv = new Gtk.TextView();
                Gtk.TextBuffer tb;
                tb = tv.Buffer;
                //tb.Text = MediaManager.GetHtml("intro.html");
                tb.Text = "Welcome to the Battlelords Character Asistant.\n" +
                          "\nThis will guide you thru the initial player character generation. " +
                          "You will be presented with some initial options that can not change " +
                          "once the character is created. " +
                          "\nStep 1" +
                          "\nStep 2" +
                          "\nStep 3" +
                          "\nStep 4" +
                          "\nConculsion";
                tv.WrapMode = WrapMode.Word;
                tv.Editable = false;

                this.AppendPage(tv);
                this.SetPageTitle(tv, "Introduction");
                this.SetPageType(tv, AssistantPageType.Intro);
                this.SetPageComplete(tv, true);
            }
            {
                // page 2 - rolling method
                string method1 = "Percentile dice are rolled and marked down in order of the given visual statistics. " +
                                 "Eight rolls are initially made. The player then makes three additional dice rolls. " +
                                 "He has the option of replacing any three previously rolled statistics with one of these number. " +
                                 "Players may not move rolls around! First roll is Strength, second roll is Manual Dexterity, etc.";
                Gtk.VBox     vb      = new Gtk.VBox();
                Gtk.HBox     hb1     = new Gtk.HBox();
                Gtk.Label    lb1     = new Gtk.Label("Rolling Method");
                string[]     entries = { "Method 1", "Method 2", "Method 3", "Fill In" };
                Gtk.ComboBox cb1     = new Gtk.ComboBox(entries);
                hb1.PackStart(lb1, true, false, 0);
                hb1.PackEnd(cb1, true, false, 0);
                cb1.Active = 0;
                Gtk.HBox        hb2 = new Gtk.HBox();
                Gtk.CheckButton b1  = new Gtk.CheckButton("Max Body Points");
                Gtk.CheckButton b2  = new Gtk.CheckButton("Max Starting Money");
                b1.Active = true;
                b2.Active = true;
                hb2.PackStart(b1, true, false, 1);
                hb2.PackEnd(b2, true, false, 1);
                Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow();
                Gtk.TextView       tv = new Gtk.TextView();
                tv.WrapMode = WrapMode.Word;
                tv.Editable = false;
                Gtk.TextBuffer tb = tv.Buffer;
                tb.Text = method1;
                sw.Add(tv);
                //vb.PackStart(hb1, false, false, 0);
                vb.PackStart(hb2, false, false, 0);
                //vb.PackEnd(sw, true, true, 0);

                this.AppendPage(vb);
                this.SetPageTitle(vb, "Rolling Options");
                this.SetPageType(vb, AssistantPageType.Content);
                this.SetPageComplete(vb, true);
            }
            {
                // page 3 - race
                TreeStore ts = new TreeStore(typeof(string), typeof(string));
                foreach (BattlelordsRace r in this.session.Races)
                {
                    ts.AppendValues(r.Name, r.Name);
                }
                TreeView tv = new TreeView(ts);
                tv.HeadersVisible = true;
                tv.AppendColumn("Battlelords Race", new CellRendererText(), "text", 0);

                this.AppendPage(tv);
                this.SetPageTitle(tv, "Select Race");
                this.SetPageType(tv, AssistantPageType.Content);
                this.SetPageComplete(tv, true);
            }
            {
                // page 4 - Basics page

                /*
                 * 1 char name
                 * 2 player name
                 * 3 height
                 * 4 weight
                 * 5 body pts
                 * 6 start money
                 */
                Gtk.VBox vb2 = new Gtk.VBox();

                Gtk.HBox  hb1 = new Gtk.HBox();
                Gtk.Label lb1 = new Gtk.Label("Player's Name:");
                Gtk.Entry en1 = new Gtk.Entry();
                hb1.PackStart(lb1, false, false, 0);
                hb1.PackStart(new Gtk.HSeparator(), true, false, 0);
                hb1.PackEnd(en1, true, true, 0);

                Gtk.HBox  hb2 = new Gtk.HBox();
                Gtk.Label lb2 = new Gtk.Label("Character's Name:");
                Gtk.Entry en2 = new Gtk.Entry();
                hb2.PackStart(lb2, false, false, 0);
                hb2.PackStart(new Gtk.HSeparator(), true, false, 0);
                hb2.PackEnd(en2, true, true, 0);

                Gtk.HBox  hb3 = new Gtk.HBox();
                Gtk.Label lb3 = new Gtk.Label("Height (ft):");
                Gtk.Entry en3 = new Gtk.Entry();
                en3.Sensitive = false;
                Gtk.Button b3 = new Gtk.Button();
                //b3.Label = "roll";
                b3.TooltipText = "Click here to roll height.";
                b3.Image       = MediaManager.GetImageFromBaseFile("dice.png");
                hb3.PackStart(lb3, false, false, 0);
                hb3.PackStart(new Gtk.HSeparator(), true, false, 0);
                hb3.PackStart(en3, true, true, 0);
                hb3.PackEnd(b3, false, false, 0);

                Gtk.HBox  hb4 = new Gtk.HBox();
                Gtk.Label lb4 = new Gtk.Label("Weight (lbs):");
                Gtk.Entry en4 = new Gtk.Entry();
                en4.Sensitive = false;
                Gtk.Button b4 = new Gtk.Button();
                //b4.Label = "roll";
                b4.TooltipText = "Click here to roll for weight.";
                b4.Image       = MediaManager.GetImageFromBaseFile("dice.png");
                hb4.PackStart(lb4, false, false, 0);
                hb4.PackStart(new Gtk.HSeparator(), true, false, 0);
                hb4.PackStart(en4, true, true, 0);
                hb4.PackEnd(b4, false, false, 0);

                Gtk.HBox  hb5 = new Gtk.HBox();
                Gtk.Label lb5 = new Gtk.Label("Body Points:");
                Gtk.Entry en5 = new Gtk.Entry();
                en5.Sensitive = false;
                Gtk.Button b5 = new Gtk.Button();
                b5.TooltipText = "Click here to roll for body points.";
                b5.Image       = MediaManager.GetImageFromBaseFile("dice.png");
                hb5.PackStart(lb5, false, false, 0);
                hb5.PackStart(new Gtk.HSeparator(), true, false, 0);
                hb5.PackStart(en5, true, true, 0);
                hb5.PackEnd(b5, false, false, 0);

                Gtk.HBox  hb6 = new Gtk.HBox();
                Gtk.Label lb6 = new Gtk.Label("Starting Money:");
                Gtk.Entry en6 = new Gtk.Entry();
                en6.Sensitive = false;
                Gtk.Button b6 = new Gtk.Button();
                b6.TooltipText = "Click here to roll for starting money.";
                b6.Image       = MediaManager.GetImageFromBaseFile("dice.png");
                hb6.PackStart(lb6, false, false, 0);
                hb6.PackStart(new Gtk.HSeparator(), true, false, 0);
                hb6.PackStart(en6, true, true, 0);
                hb6.PackEnd(b6, false, false, 0);

                vb2.PackStart(hb1, false, false, 0);
                vb2.PackStart(hb2, false, false, 0);
                vb2.PackStart(hb3, false, false, 0);
                vb2.PackStart(hb4, false, false, 0);
                vb2.PackStart(hb5, false, false, 0);
                vb2.PackStart(hb6, false, false, 0);

                this.AppendPage(vb2);
                this.SetPageTitle(vb2, "Enter Basic Information");
                this.SetPageType(vb2, AssistantPageType.Content);
                this.SetPageComplete(vb2, true);
            }
            {
                // page 5 - vitals
                VBox         vb5 = new VBox();
                Gtk.Notebook nb  = new Gtk.Notebook();
                //Battle.Gui.VitalsControl stvc = new Battle.Gui.VitalsControl(this.session);
                //stvc.Sensitive = false;
                VitalsControl m1vitals   = new VitalsControl(this.session);
                VitalsControl m2vitals   = new VitalsControl(this.session);
                VitalsControl m3vitals   = new VitalsControl(this.session);
                VitalsControl fillvitals = new VitalsControl(this.session);

                m1vitals.Enabled = false;
                m2vitals.Enabled = false;
                m3vitals.Enabled = false;

                nb.AppendPage(m1vitals, new Gtk.Label("Method 1"));
                nb.AppendPage(m2vitals, new Gtk.Label("Method 2"));
                nb.AppendPage(m3vitals, new Gtk.Label("Method 3"));
                nb.AppendPage(fillvitals, new Gtk.Label("Fill In"));

                HButtonBox bb5     = new HButtonBox();
                Button     rollBtn = new Button(Stock.Execute);
                rollBtn.Clicked += delegate(object sender, EventArgs e) {
                    Console.WriteLine("{0}", sender.GetType().ToString());
                };
                rollBtn.Label = "Roll";
                Button saveBtn = new Button(Stock.Save);
                saveBtn.Label = "Save";
                bb5.PackStart(rollBtn);
                bb5.PackEnd(saveBtn);
                nb.SwitchPage += delegate(object o, SwitchPageArgs args) {
                    if (args.PageNum == 3)
                    {
                        rollBtn.Sensitive = false;
                    }
                    else
                    {
                        rollBtn.Sensitive = true;
                    }
                };

                vb5.Add(nb);
                vb5.Add(bb5);

                this.AppendPage(vb5);
                this.SetPageTitle(vb5, "Enter Vitals");
                this.SetPageType(vb5, AssistantPageType.Content);
                this.SetPageComplete(vb5, true);
            }
            {
                // page 6 - secondaries
                Gtk.Label             not_completed_label = new Gtk.Label("not completed");
                Pango.FontDescription d = new Pango.FontDescription();
                d.Style = Pango.Style.Italic;
                not_completed_label.ModifyFont(d);

                this.AppendPage(not_completed_label);
                this.SetPageTitle(not_completed_label, "Enter Secondary Attributes");
                this.SetPageType(not_completed_label, AssistantPageType.Content);
                this.SetPageComplete(not_completed_label, true);
            }
            {
                // page 7 - fate
                Gtk.Label             not_completed_label = new Gtk.Label("not completed");
                Pango.FontDescription d = new Pango.FontDescription();
                d.Style = Pango.Style.Italic;
                not_completed_label.ModifyFont(d);

                this.AppendPage(not_completed_label);
                this.SetPageTitle(not_completed_label, "Determine Fate");
                this.SetPageType(not_completed_label, AssistantPageType.Content);
                this.SetPageComplete(not_completed_label, true);
            }
            {
                // page 8 - social
                Gtk.Label             not_completed_label = new Gtk.Label("not completed");
                Pango.FontDescription d = new Pango.FontDescription();
                d.Style = Pango.Style.Italic;
                not_completed_label.ModifyFont(d);

                this.AppendPage(not_completed_label);
                this.SetPageTitle(not_completed_label, "Social Status");
                this.SetPageType(not_completed_label, AssistantPageType.Content);
                this.SetPageComplete(not_completed_label, true);
            }
            {
                // page 9 - skills
                Gtk.Label             not_completed_label = new Gtk.Label("not completed");
                Pango.FontDescription d = new Pango.FontDescription();
                d.Style = Pango.Style.Italic;
                not_completed_label.ModifyFont(d);

                this.AppendPage(not_completed_label);
                this.SetPageTitle(not_completed_label, "Choose Initial Skills");
                this.SetPageType(not_completed_label, AssistantPageType.Content);
                this.SetPageComplete(not_completed_label, true);
            }
            {
                // page 10 - matrixes
                Gtk.Label             not_completed_label = new Gtk.Label("not completed");
                Pango.FontDescription d = new Pango.FontDescription();
                d.Style = Pango.Style.Italic;
                not_completed_label.ModifyFont(d);

                this.AppendPage(not_completed_label);
                this.SetPageTitle(not_completed_label, "Choose Initial Matrixes");
                this.SetPageType(not_completed_label, AssistantPageType.Content);
                this.SetPageComplete(not_completed_label, true);
            }
            {
                // page 11 - confirm
                TextView   tv11 = new TextView();
                TextBuffer b11  = tv11.Buffer;
                b11.Text      = "Confirm this new character.";
                tv11.Editable = false;
                this.AppendPage(tv11);
                this.SetPageTitle(tv11, "Confirm New Character");
                this.SetPageType(tv11, AssistantPageType.Confirm);
                this.SetPageComplete(tv11, true);
            }
            this.Close  += HandleHandleClose;
            this.Cancel += HandleHandleCancel;
            this.ShowAll();
        }
示例#53
0
 public CallbackMonitor(Solver s, ProgressBar bar, TextBuffer buf, SolutionCollector best) : base(s)
 {
     progress = bar;
     buffer   = buf;
     bestSol  = best;
 }
        private void ApplyTextTags(Gtk.TextBuffer tb, string tagname)
        {
            int cN = tb.Text.Length - 1;

            Gtk.TextIter start = tb.GetIterAtOffset(0);
            Gtk.TextIter stop  = tb.GetIterAtOffset(cN);

            string[] delimiters    = new string[] { ":" };
            string[] tagname_parts = tagname.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);
            string   key           = tagname_parts[0];
            string   value         = null;

            if (tagname_parts.Length > 1)
            {
                value = tagname_parts[1];
            }

            Gtk.TextTag tag_lookup = tb.TagTable.Lookup("DemoTextSelection");
            Gtk.TextTag tag_local  = null;
            // should be the same?!?!
            //tag_local = tag;		// class variable?? sometines null?
            tag_local = tag_lookup;


            Console.WriteLine("key [{0}] value[{1}] tagname [{2}]", key, value, tagname);
            switch (key)
            {
            case "font":
                tag_local.Font = value;
                break;

            case "fontsize":
                tag_local.Size = Convert.ToInt32(value);                         // events?!?!?
                break;

            case "fontweight":
                switch (value)
                {
                case "normal":
                    tag_local.Weight = Pango.Weight.Normal;
                    break;

                case "bold":
                    // tag_local.Weight = Pango.Weight.Bold; // no visible diff
                    tag_local.Weight = Pango.Weight.Ultrabold;
                    break;

                case "heavy":
                    tag_local.Weight = Pango.Weight.Heavy;
                    break;

                case "light":
                    tag_local.Weight = Pango.Weight.Light;
                    break;

                case "semibold":
                    tag_local.Weight = Pango.Weight.Semibold;
                    break;

                case "ultrabold":
                    tag_local.Weight = Pango.Weight.Ultrabold;
                    break;

                case "ultralight":
                    tag_local.Weight = Pango.Weight.Ultralight;
                    break;

                default:
                    tag_local.Weight = Pango.Weight.Normal;
                    break;
                }
                break;

            case "style":
                switch (value)
                {
                case "normal":
                    tag_local.Style = Pango.Style.Normal;
                    break;

                case "italic":
                    tag_local.Style = Pango.Style.Italic;
                    break;

                case "oblique":
                    tag_local.Style = Pango.Style.Oblique;
                    break;

                default:
                    tag_local.Style = Pango.Style.Normal;
                    break;
                }
                break;

            case "strikethrough":
                tag_local.Strikethrough = Convert.ToBoolean(value);
                break;

            case "doublestrikethrough":
                tag_local.Strikethrough = Convert.ToBoolean(value);
                break;

            case "superscript":
                if (Convert.ToBoolean(value))
                {
                    tag_local.Rise = 50;
                }
                else
                {
                    tag_local.Rise = 0;
                }
                break;

            case "subscript":
                if (Convert.ToBoolean(value))
                {
                    tag_local.Rise = -50;
                }
                else
                {
                    tag_local.Rise = 0;
                }
                break;

            case "smallcaps":
                if (Convert.ToBoolean(value))
                {
                    tag_local.Variant = Pango.Variant.SmallCaps;
                }
                else
                {
                    tag_local.Variant = Pango.Variant.Normal;
                }
                break;

            case "allcaps":
                // no all caps?
                // tamp replacement
                if (Convert.ToBoolean(value))
                {
                    tb.Text           = tb.Text.ToUpper();
                    tag_local.Variant = Pango.Variant.Normal;
                }
                else
                {
                    tb.Text           = this.demo_text;
                    tag_local.Variant = Pango.Variant.Normal;
                }
                break;

            case "hidden":
                if (Convert.ToBoolean(value))
                {
                    tag_local.Variant = Pango.Variant.Normal;
                }
                else
                {
                    tag_local.Rise = 0;
                }
                break;

            case "underlinestyle":
                switch (value)
                {
                case "none":
                    tag_local.Underline = Pango.Underline.None;
                    break;

                case "double":
                    tag_local.Underline = Pango.Underline.Double;
                    break;

                case "single":
                    tag_local.Underline = Pango.Underline.Single;
                    break;

                case "error":
                    tag_local.Underline = Pango.Underline.Error;
                    break;

                case "low":
                    tag_local.Underline = Pango.Underline.Low;
                    break;

                default:
                    tag_local.Underline = Pango.Underline.None;
                    break;
                }
                break;

            case "underlinecolor":
                // cannot change color of the underline!
                // tag_local.Underline
                // trying font until custom dialog is over
                string rgb = tagname_parts[2];                                          // obtained as "rgb:HHHH/HHHH/HHHH"

                //--------------------------------------------------------------------
                // Attempt 1
                tag_local.Foreground    = "";
                tag_local.ForegroundGdk = new Gdk.Color(60, 60, 60);
                //--------------------------------------------------------------------

                //--------------------------------------------------------------------
                // Attempt 2
                //textviewDemoText.ModifyFg(StateType.Normal, underline_color_selected);	// color not applied?!?!
                //textviewDemoText.ModifyBg(StateType.Normal, underline_color_selected);	// color not applied?!?!
                // return;		// to skip tb.ApplyTag later does not change color

                break;

            default:
                tag_local = tb.TagTable.Lookup(tagname);
                break;
            }

            tb.ApplyTag(tag_local, start, stop);

            return;
        }
示例#55
0
        public TServers(CInterfaceGateway in_krnGateway, Glade.XML gxml, Gtk.TextView log)

        /*public TServers (Gtk.TreeView tv, Gtk.TextView log, CInterfaceGateway in_krnGateway,
         *                                      Gtk.Button btn1,Gtk.Button btn2,Gtk.Entry txt1,Gtk.Entry txt2,Gtk.Entry txt3)*/
        {
            krnGateway = in_krnGateway;
            krnGateway.OnLogMessage += new LogEvent(m_Log);
            krnGateway.OnNewServer  += new ServerEvent(OnNewServer);
            //btnAddServer = btn1;
            btnAddServer = (gxml.GetWidget("btnAddServer") as Button);
            //btnDownloadServers = btn2;
            btnDownloadServers = (gxml.GetWidget("btnDownloadServers") as Button);
            //txtDownloadServers = txt1;
            txtDownloadServers = (gxml.GetWidget("txtDownloadServers") as Entry);
            //txtServerIp = txt2;
            txtServerIp = (gxml.GetWidget("txtServerIp") as Entry);
            //txtServerPort = txt3;
            txtServerPort = (gxml.GetWidget("txtServerPort") as Entry);
            txtServerLog  = log;            //I don't use gxml due to problems with buffer
            buffer        = txtServerLog.Buffer;
            /*tvServers = tv;*/
            tvServers = (gxml.GetWidget("tvServers") as TreeView);

            stServers = new TreeStore(typeof(string), typeof(string), typeof(string),
                                      typeof(string), typeof(string), typeof(string));
            tvServers.Model = stServers;

            Gtk.TreeViewColumn tvc = new TreeViewColumn("Server Name", new CellRendererText(), "text", 0);
            tvServers.AppendColumn(tvc);
            tvc.SortColumnId = 0;
            tvc.Resizable    = true;

            tvc = new TreeViewColumn("Address", new CellRendererText(), "text", 1);
            tvServers.AppendColumn(tvc);
            tvc.SortColumnId = 1;
            tvc.Resizable    = true;

            tvc = new TreeViewColumn("Failed", new CellRendererText(), "text", 2);
            tvServers.AppendColumn(tvc);
            tvc.SortColumnId = 2;
            tvc.Resizable    = true;

            tvc = new TreeViewColumn("Files", new CellRendererText(), "text", 3);
            tvServers.AppendColumn(tvc);
            tvc.SortColumnId = 3;
            tvc.Resizable    = true;

            tvc = new TreeViewColumn("Users", new CellRendererText(), "text", 4);
            tvServers.AppendColumn(tvc);
            tvc.SortColumnId = 4;
            tvc.Resizable    = true;

            tvc = new TreeViewColumn("Priority", new CellRendererText(), "text", 5);
            tvServers.AppendColumn(tvc);
            tvc.SortColumnId = 5;
            tvc.Resizable    = true;

            menu = new Gtk.Menu();
            MenuItem it_Connect = new MenuItem("Connect");

            it_Connect.Activated += new EventHandler(ConnectTo);
            MenuItem it_Copy = new MenuItem("Copy to clipboard");

            it_Copy.Activated += new EventHandler(CopyLink);
            MenuItem it_Delete = new MenuItem("Delete");

            it_Delete.Activated += new EventHandler(Delete);

            menu.Append(it_Connect);
            menu.Append(it_Copy);
            menu.Append(it_Delete);

            tvServers.ButtonPressEvent += new ButtonPressEventHandler(ButtonPressEvent);
            // tvServers.PopupMenu += new PopupMenuHandler(PopupMenuEvent);
            loadServers();
        }
示例#56
0
        public OutputConsole()
        {
            buffer                     = new Gtk.TextBuffer(new Gtk.TextTagTable());
            textEditorControl          = new Gtk.TextView(buffer);
            textEditorControl.Editable = true;

            sw = new ScrolledWindow();

            sw.ShadowType = ShadowType.Out;
            sw.Add(textEditorControl);

            this.PackStart(sw, true, true, 0);

            vbt = new VBox();

            Gdk.Pixbuf clear_pixbuf = MainClass.Tools.GetIconFromStock("file-new.png", IconSize.SmallToolbar);
            Button     btnClear     = new Button(new Gtk.Image(clear_pixbuf));

            btnClear.TooltipText  = MainClass.Languages.Translate("clear");
            btnClear.Relief       = ReliefStyle.None;
            btnClear.CanFocus     = false;
            btnClear.WidthRequest = btnClear.HeightRequest = 24;
            btnClear.Clicked     += delegate(object sender, EventArgs e) {
                Clear();
            };

            Gdk.Pixbuf save_pixbuf = MainClass.Tools.GetIconFromStock("save.png", IconSize.SmallToolbar);
            Button     btnSave     = new Button(new Gtk.Image(save_pixbuf));

            btnSave.TooltipText  = MainClass.Languages.Translate("save");
            btnSave.Relief       = ReliefStyle.None;
            btnSave.CanFocus     = false;
            btnSave.WidthRequest = btnSave.HeightRequest = 24;
            btnSave.Clicked     += delegate(object sender, EventArgs e) {
                Save();
            };

            vbt.WidthRequest = 24;
            vbt.PackStart(btnClear, false, false, 0);
            vbt.PackStart(btnSave, false, false, 0);

            this.PackEnd(vbt, false, false, 0);

            bold        = new TextTag("bold");
            bold.Weight = Pango.Weight.Bold;
            buffer.TagTable.Add(bold);

            errorTag            = new TextTag("error");
            errorTag.Foreground = "red";
            buffer.TagTable.Add(errorTag);

            consoleLogTag            = new TextTag("consoleLog");
            consoleLogTag.Foreground = "darkgrey";
            buffer.TagTable.Add(consoleLogTag);

            tag            = new TextTag("0");
            tag.LeftMargin = 10;
            buffer.TagTable.Add(tag);
            tags.Add(tag);

            endMark = buffer.CreateMark("end-mark", buffer.EndIter, false);

            outputDispatcher = new GLib.TimeoutHandler(OutputDispatchHandler);

            customFont = Pango.FontDescription.FromString(MainClass.Settings.ConsoleTaskFont);
            textEditorControl.ModifyFont(customFont);

            textEditorControl.KeyPressEvent += HandleTextEditorControlKeyPressEvent;
            this.ShowAll();
        }