Exemple #1
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);
        }
Exemple #2
0
        static public Handle Add(uint t, GLib.TimeoutHandler timeout_handler)
        {
            Closure c;

            c    = new Closure(timeout_handler);
            c.Id = GLib.Timeout.Add(t, new GLib.TimeoutHandler(c.Handler));
            return(c);
        }
Exemple #3
0
		public Abuse (DirectoryObject root,
			      EventTracker    tracker,
			      ICollection     hammers)
		{
			this.root = root;
			this.tracker = tracker;

			this.hammers = new IHammer [hammers.Count];
			int i = 0;
			foreach (IHammer hammer in hammers)
				this.hammers [i++] = hammer;

			idle_handler = new GLib.IdleHandler (AbuseWorker);
			timeout_handler = new GLib.TimeoutHandler (RescheduleAbuse);
			verified_handler = new Daemon.VerifiedHandler (VerifiedWorker);
		}
Exemple #4
0
        static DispatchService()
        {
            guiContext = new GuiSyncContext();
            guiThread  = Thread.CurrentThread;

            handler = new GLib.TimeoutHandler(guiDispatcher);

            thrBackground = new Thread(new ThreadStart(backgroundDispatcher))
            {
                Name         = "Background dispatcher",
                IsBackground = true,
                Priority     = ThreadPriority.Lowest,
            };
            thrBackground.Start();

            DispatchDebug = Environment.GetEnvironmentVariable("MONODEVELOP_DISPATCH_DEBUG") != null;
        }
Exemple #5
0
        // Implements: System.EventHandler
        /// <summary>Handler called when the entry has been changed.</summary>
        /// <remarks>Calls <see cref="Search" /> unless changes are currently
        ///   being ignored.</remarks>
        private void OnEntryChanged(object o, EventArgs args)
        {
            if (this.ignore_change)
            {
                return;
            }

            if (this.search_timeout_id > 0)
            {
                GLib.Source.Remove(this.search_timeout_id);
            }

            GLib.TimeoutHandler func = new GLib.TimeoutHandler(SearchFunc);

            this.search_timeout_id =
                GLib.Timeout.Add(AddWindow.search_timeout, func);
        }
        public LogView()
        {
            buffer                     = new TextBuffer(new TextTagTable());
            textEditorControl          = new LogTextView(buffer);
            textEditorControl.Editable = false;

            scrollView.ShadowType = ShadowType.None;
            scrollView.Add(textEditorControl);
            PackEnd(scrollView, true, true, 0);

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

            errorTag            = new TextTag("error");
            errorTag.Foreground = Styles.ErrorForegroundColor.ToHexString(false);
            errorTag.Weight     = Weight.Bold;
            buffer.TagTable.Add(errorTag);

            warningTag            = new TextTag("warning");
            warningTag.Foreground = Styles.WarningForegroundColor.ToHexString(false);
            buffer.TagTable.Add(warningTag);

            debugTag            = new TextTag("debug");
            debugTag.Foreground = Styles.InformationForegroundColor.ToHexString(false);
            buffer.TagTable.Add(debugTag);

            consoleLogTag            = new TextTag("consoleLog");
            consoleLogTag.Foreground = Styles.SecondaryTextColor.ToHexString(false);
            buffer.TagTable.Add(consoleLogTag);

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

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

            UpdateCustomFont();
            IdeApp.Preferences.CustomOutputPadFont.Changed += HandleCustomFontChanged;

            outputDispatcher = new GLib.TimeoutHandler(outputDispatchHandler);

            InitSearchWidget();
        }
        private void DelayedUpdate(GLib.TimeoutHandler handler)
        {
            if (event_delay_timeout_id != 0)
            {
                GLib.Source.Remove(event_delay_timeout_id);
                if (handler != timeout_func)
                {
                    timeout_func?.Invoke();
                }
            }

            timeout_func           = handler;
            event_delay_timeout_id = GLib.Timeout.Add(event_delay_millis, () => {
                event_delay_timeout_id = 0;
                timeout_func.Invoke();
                timeout_func = null;
                return(false);
            });
        }
Exemple #8
0
        public Abuse(DirectoryObject root,
                     EventTracker tracker,
                     ICollection hammers)
        {
            this.root    = root;
            this.tracker = tracker;

            this.hammers = new IHammer [hammers.Count];
            int i = 0;

            foreach (IHammer hammer in hammers)
            {
                this.hammers [i++] = hammer;
            }

            idle_handler     = new GLib.IdleHandler(AbuseWorker);
            timeout_handler  = new GLib.TimeoutHandler(RescheduleAbuse);
            verified_handler = new Daemon.VerifiedHandler(VerifiedWorker);
        }
Exemple #9
0
        public ProcessOutput()
        {
            this.ShadowType         = ShadowType.Out;
            treeView                = new TreeView();
            treeView.Selection.Mode = Gtk.SelectionMode.Single;

            treeView.Model = outputModel;

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

            treeView.ModifyFont(customFont);

            TreeViewColumn tvcName = new TreeViewColumn(MainClass.Languages.Translate("Name"), new CellRendererText(), "text", 0);

            tvcName.MinWidth = 100;
            treeView.AppendColumn(tvcName);
            TreeViewColumn tvcState = new TreeViewColumn(MainClass.Languages.Translate("Stat"), new CellRendererText(), "text", 1);

            tvcState.MinWidth = 100;
            treeView.AppendColumn(tvcState);
            TreeViewColumn tvcMessage = new TreeViewColumn(MainClass.Languages.Translate("Message"), new CellRendererText(), "text", 2);

            tvcMessage.MinWidth = 100;
            treeView.AppendColumn(tvcMessage);
            TreeViewColumn tvcPlace = new TreeViewColumn(MainClass.Languages.Translate("Place"), new CellRendererText(), "text", 3);

            tvcPlace.MinWidth = 100;
            treeView.AppendColumn(tvcPlace);

            treeView.HeadersVisible  = true;
            treeView.EnableTreeLines = true;

            treeView.RowActivated += new RowActivatedHandler(OnRowActivate);
            treeView.EnableSearch  = false;
            treeView.HasFocus      = false;

            outputDispatcher = new GLib.TimeoutHandler(OutputDispatchHandler);

            this.Add(treeView);

            this.ShowAll();
        }
Exemple #10
0
        public LogView()
        {
            buffer                     = new TextBuffer(new TextTagTable());
            textEditorControl          = new LogTextView(buffer);
            textEditorControl.Editable = false;

            scrollView.ShadowType = ShadowType.None;
            scrollView.Add(textEditorControl);
            PackEnd(scrollView, true, true, 0);

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

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

            debugTag            = new TextTag("debug");
            debugTag.Foreground = "#256ada";
            buffer.TagTable.Add(debugTag);

            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);

            InitSearchWidget();
        }
        void OnDragScroll(GLib.TimeoutHandler handler, double threshold, int total, int position)
        {
            if (position < threshold)
            {
                drag_scroll_velocity = -1.0 + (position / threshold);
            }
            else if (position > total - threshold)
            {
                drag_scroll_velocity = 1.0 - ((total - position) / threshold);
            }
            else
            {
                StopDragScroll();
                return;
            }

            if (drag_scroll_timeout_id == 0)
            {
                drag_scroll_timeout_id = GLib.Timeout.Add(drag_scroll_timeout_duration, handler);
            }
        }
		internal static void Initialize ()
		{
			if (guiContext != null)
				return;
			
			guiContext = new GuiSyncContext ();
			guiThread = Thread.CurrentThread;
			
			handler = new GLib.TimeoutHandler (guiDispatcher);
			
			thrBackground = new Thread (new ThreadStart (backgroundDispatcher)) {
				Name = "Background dispatcher",
				IsBackground = true,
				Priority = ThreadPriority.Lowest,
			};
			thrBackground.Start ();
			
			DispatchDebug = Environment.GetEnvironmentVariable ("MONODEVELOP_DISPATCH_DEBUG") != null;

			SynchronizationContext = new GtkSynchronizationContext ();
		}
Exemple #13
0
        /// <summary>
        /// Creates a new instance of scanner
        /// </summary>
        public TrafficScanner()
        {
            try
            {
                this.Build ();
                this.LC("TrafficScanner");
                this.textview2.PopulatePopup += new PopulatePopupHandler(CreateMenu_simple);
                this.timer = new GLib.TimeoutHandler(Tick);
                GLib.Timeout.Add (1000, timer);
                this.Icon = Gdk.Pixbuf.LoadFromResource("Client.Resources.pigeon_clip_art_hight.ico");
                this.DeleteEvent += new DeleteEventHandler(Unshow);
                textview2.Buffer.Text = "";
                LoadStyle();
                textview2.WrapMode = WrapMode.Char;
                scroll.Checked = ScannerEnabled;

                this.Hide ();
            } catch (Exception fail)
            {
                Core.handleException(fail);
            }
        }
Exemple #14
0
        public void ScheduleRefresh(uint time)
        {
            lock (this) {
                if (timeoutId != 0)
                {
                    return;
                }

                if (time == 0)
                {
                    GLib.IdleHandler handler;
                    handler   = new GLib.IdleHandler(HandleScheduled);
                    timeoutId = GLib.Idle.Add(handler);
                }
                else
                {
                    GLib.TimeoutHandler handler;
                    handler   = new GLib.TimeoutHandler(HandleScheduled);
                    timeoutId = GLib.Timeout.Add(time, handler);
                }
            }
        }
Exemple #15
0
        public HostWindow(HostGun hg)
            : base(Gtk.WindowType.Toplevel)
        {
            this.Build ();

            GLib.TimeoutHandler th = new GLib.TimeoutHandler(HostUpdate);
            GLib.Timeout.Add(100,th);

            this.hg = hg;

            hg.AddListener(this);

            PlayerSelector ps = playerselectionscreenMain.GetPlayerSelector();

            if (hg.IsTeamGame()) {
                ps.SetColumnLabels("Team 1", "Team 2", "Team 3");
            } else {
                ps.SetColumnLabels("","","");
            }
            playerselectionscreenMain.SubscribeEvents(this);

            RefreshPlayerList();
        }
Exemple #16
0
        public ProcessOutput()
        {
            this.ShadowType = ShadowType.Out;
            treeView = new TreeView();
            treeView.Selection.Mode = Gtk.SelectionMode.Single;

            treeView.Model = outputModel;

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

            TreeViewColumn tvcName = new TreeViewColumn (MainClass.Languages.Translate("Name"),  new CellRendererText(), "text", 0);
            tvcName.MinWidth = 100;
            treeView.AppendColumn(tvcName);
            TreeViewColumn tvcState = new TreeViewColumn (MainClass.Languages.Translate("Stat"),  new CellRendererText(), "text", 1);
            tvcState.MinWidth = 100;
            treeView.AppendColumn(tvcState);
            TreeViewColumn tvcMessage = new TreeViewColumn (MainClass.Languages.Translate("Message"),  new CellRendererText(), "text", 2);
            tvcMessage.MinWidth = 100;
            treeView.AppendColumn(tvcMessage);
            TreeViewColumn tvcPlace = new TreeViewColumn (MainClass.Languages.Translate("Place"),  new CellRendererText(), "text", 3);
            tvcPlace.MinWidth = 100;
            treeView.AppendColumn(tvcPlace);

            treeView.HeadersVisible = true;
            treeView.EnableTreeLines = true;

            treeView.RowActivated += new RowActivatedHandler(OnRowActivate);
            treeView.EnableSearch =false;
            treeView.HasFocus = false;

            outputDispatcher = new GLib.TimeoutHandler(OutputDispatchHandler);

            this.Add(treeView);

            this.ShowAll();
        }
 void DrawIndicatorSurface(uint timeout = 250)
 {
     RemoveIndicatorIdleHandler();
     GLib.TimeoutHandler timeoutHandler = delegate {
         indicatorIdleTimout = 0;
         if (!IsRealized)
         {
             return(false);
         }
         var allocation = Allocation;
         src.Cancel();
         src = new CancellationTokenSource();
         new IdleUpdater(this, src.Token).Start();
         return(false);
     };
     if (timeout == 0)
     {
         timeoutHandler();
     }
     else
     {
         indicatorIdleTimout = GLib.Timeout.Add(timeout, timeoutHandler);
     }
 }
Exemple #18
0
        internal static void Initialize()
        {
            if (guiContext != null)
            {
                return;
            }

            guiContext = new GuiSyncContext();
            guiThread  = Thread.CurrentThread;

            handler = new GLib.TimeoutHandler(guiDispatcher);

            thrBackground = new Thread(new ThreadStart(backgroundDispatcher))
            {
                Name         = "Background dispatcher",
                IsBackground = true,
                Priority     = ThreadPriority.Lowest,
            };
            thrBackground.Start();

            DispatchDebug = Environment.GetEnvironmentVariable("MONODEVELOP_DISPATCH_DEBUG") != null;

            SynchronizationContext = new GtkSynchronizationContext();
        }
Exemple #19
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();
        }
Exemple #20
0
 /// <summary>
 /// Init
 /// </summary>
 public void Init()
 {
     if (Configuration.CurrentPlatform == Core.Platform.Linuxx86 || Configuration.CurrentPlatform == Core.Platform.Linuxx64)
     {
         GLib.TimeoutHandler timer = new GLib.TimeoutHandler(Update);
         GLib.Timeout.Add(800, timer);
     }
     this.scrollback.owner = this;
     this.scrollback.Create();
     this.textbox.Init();
     this.Build();
     this.InitStyle();
     kbToolStripMenuItem.Enabled = true;
     krToolStripMenuItem.Enabled = true;
     Gtk.TreeViewColumn column1 = new TreeViewColumn();
     listView.TooltipColumn = 2;
     column1.Title = (messages.get("list", Core.SelectedLanguage));
     listView.AppendColumn(column1);
     listView.Model = UserList;
     Gtk.CellRendererText renderer = new CellRendererText();
     column1.PackStart(renderer, true);
     column1.SetCellDataFunc(renderer, UserListRendererTool);
     column1.AddAttribute(renderer, "text", 0);
 }
Exemple #21
0
 /// <summary>
 /// Creates a main form
 /// </summary>
 public Main()
 {
     try
     {
         Core.SetMain(this);
         if (Configuration.UserData.TrayIcon)
         {
             icon = new StatusIcon(global::Gdk.Pixbuf.LoadFromResource("Client.Resources.pigeon_clip_art_hight.ico"));
             icon.Visible = true;
             icon.PopupMenu += new PopupMenuHandler(TrayMenu);
         }
         this.Build();
         this.LC("MainForm");
         timer = new GLib.TimeoutHandler(updater_Tick);
         GLib.Timeout.Add(200, timer);
         this.DetachFromMicroChatAction.Activated += new EventHandler(detachFromMicroChatToolStripMenuItem_Click);
         this.AttachToMicroChatAction.Activated += new EventHandler(attachToMicroChatToolStripMenuItem_Click);
         this.SearchAction.Activated += new EventHandler(searchToolStripMenuItem_Click);
         this.ContentsAction.Activated += new EventHandler(contentsToolStripMenuItem_Click);
         this.ConfigurationFileAction.Activated += new EventHandler(configurationFileToolStripMenuItem_Click);
         this.FavoriteNetworksAction.Activated += new EventHandler(favoriteNetworksToolStripMenuItem_Click);
         this.RootAction.Activated += new EventHandler(rootToolStripMenuItem_Click);
         this.LoadMoreToScrollbackAction.Activated += new EventHandler(loadToolStripMenuItem_Click);
         this.SizeAllocated += new SizeAllocatedHandler(resize);
         this.FavoriteNetworksAction.Sensitive = false;
         _Load();
         Status("Welcome to pidgeon");
     }
     catch (Exception fail)
     {
         Core.handleException(fail);
     }
 }
Exemple #22
0
			public Closure (GLib.TimeoutHandler timeout_handler)
			{
				this.timeout_handler = timeout_handler;
				++Count;
			}
Exemple #23
0
        public ErrorOutput()
        {
            this.ShadowType = ShadowType.Out;
            treeView = new TreeView();
            treeView.Selection.Mode = Gtk.SelectionMode.Single;

            treeView.Model = outputModel;

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

            //treeView.AppendColumn("Name", new CellRendererText(), "text", 0);
            //treeView.AppendColumn("Stat", new CellRendererText(), "text", 1);
            //treeView.AppendColumn("Message", new CellRendererText(), "text", 2);
            //treeView.AppendColumn("Place", new CellRendererText(), "text", 3);

            TreeViewColumn tvcName = new TreeViewColumn (MainClass.Languages.Translate("file"),  new CellRendererText(), "text", 0);
            tvcName.MinWidth = 100;
            tvcName.Resizable = true;
            treeView.AppendColumn(tvcName);
            TreeViewColumn tvcState = new TreeViewColumn (MainClass.Languages.Translate("Line"),  new CellRendererText(), "text", 1);
            tvcState.MinWidth = 25;
            tvcState.Resizable = true;
            treeView.AppendColumn(tvcState);
            TreeViewColumn tvcMessage = new TreeViewColumn (MainClass.Languages.Translate("message"),  new CellRendererText(), "text", 2);
            tvcMessage.MinWidth = 100;
            tvcMessage.Resizable = true;
            treeView.AppendColumn(tvcMessage);
            TreeViewColumn tvcPlace = new TreeViewColumn (MainClass.Languages.Translate("location"),  new CellRendererText(), "text", 3);
            tvcPlace.MinWidth = 100;
            tvcPlace.Resizable = true;
            treeView.AppendColumn(tvcPlace);

            treeView.HeadersVisible = true;
            treeView.EnableTreeLines = true;

            treeView.RowActivated += new RowActivatedHandler(OnRowActivate);
            treeView.EnableSearch =false;
            treeView.HasFocus = false;

            treeView.ButtonReleaseEvent += delegate(object o, ButtonReleaseEventArgs args) {
                if (args.Event.Button != 3) return;

                Menu popupMenu = new Menu();

                MenuItem miClear = new MenuItem( MainClass.Languages.Translate("clear" ));
                miClear.Activated+= delegate(object sender, EventArgs e) {
                    Clear();
                };
                popupMenu.Append(miClear);

                TreeSelection ts = treeView.Selection;
                Gtk.TreePath[] selRow = ts.GetSelectedRows();

                MenuItem miCopy = new MenuItem( MainClass.Languages.Translate("copy_f2" ));
                miCopy.Activated+= delegate(object sender, EventArgs e) {

                    Gtk.TreePath tp = selRow[0];
                    TreeIter ti = new TreeIter();
                    outputModel.GetIter(out ti, tp);
                    string type = outputModel.GetValue(ti, 0).ToString();
                    string timeStamp = outputModel.GetValue(ti, 1).ToString();
                    string message = outputModel.GetValue(ti, 2).ToString();

                    Gtk.Clipboard clipboard = this.GetClipboard(Gdk.Selection.Clipboard);
                    string txt =type +"\t"+timeStamp+"\t"+message;

                    clipboard.Text=txt;

                };
                popupMenu.Append(miCopy);

                if(selRow.Length<1){
                    miCopy.Sensitive = false;
                }
                popupMenu.Popup();
                popupMenu.ShowAll();
            };

            outputDispatcher = new GLib.TimeoutHandler(OutputDispatchHandler);

            this.Add(treeView);

            this.ShowAll();
        }
Exemple #24
0
        protected override bool OnExposeEvent(Gdk.EventExpose ev)
        {
            Gdk.Window    win  = ev.Window;
            Gdk.Rectangle rect = ev.Area;
            Gdk.GC        gc   = this.Style.BaseGC(StateType.Normal);
            lock (this.drawLock){
                if (this.toDraw != null)
                {
                    //Raise events for the symbols...
                    bool gotSymbol = false;
                    //See if there's a new symbol
                    if (this.symbols != null)
                    {
                        foreach (Symbol s in this.symbols)
                        {
                            if (s.Count > 0 && this.data != s.ToString())
                            {
                                this.data = s.ToString();
                                //Don't raise it inside the expose event :)
                                GLib.IdleHandler raiser = delegate(){
                                    if (this.BarScanned != null)
                                    {
                                        this.BarScanned(this, new BarScannedArgs(s));
                                    }
                                    return(false);
                                };
                                GLib.Idle.Add(raiser);
                                gotSymbol = true;
                            }
                        }
                    }
                    //Avoid beeping more than once..
                    if (gotSymbol)
                    {
                        if (!this.Mute)
                        {
                            System.Media.SystemSounds.Beep.Play();
                        }
                        if (this.overlayingFrames == 0)
                        {
                            GLib.TimeoutHandler hdl = delegate(){
                                this.QueueDraw();
                                this.overlayingFrames -= 1;
                                return(this.overlayingFrames > 0);
                            };
                            GLib.Timeout.Add(35, hdl);
                        }
                        //Start drawing an overlay
                        this.overlayingFrames = overlayFrameCount;
                    }
                    this.symbols = null;                     //Symbols have been handled

                    //See if we want to request a resize
                    if (this.reqHeight != this.toDrawHeight ||
                        this.reqWidth != this.toDrawWidth)
                    {
                        this.reqHeight = this.toDrawHeight;
                        this.reqWidth  = this.toDrawWidth;
                        this.QueueResize();
                    }

                    //Draw the gray image
                    int w = Math.Min(rect.Size.Width, this.toDrawWidth);
                    int h = Math.Min(rect.Size.Height, this.toDrawHeight);

                    //Draw the image
                    win.DrawGrayImage(gc, 0, 0, w, h, Gdk.RgbDither.Normal, this.toDraw, this.toDrawWidth);

                    if (this.overlayingFrames > 0)
                    {
                        Pixbuf overlay_tmp = overlay;
                        if (this.overlay.Width > w * 0.8 || this.overlay.Height > h * 0.8)
                        {
                            int overlayMaxSize = Math.Min(h * 80 / 100, w * 80 / 100);
                            overlay_tmp = overlay.ScaleSimple(overlayMaxSize, overlayMaxSize, InterpType.Bilinear);
                        }

                        w = Math.Min(this.toDrawWidth, (int)overlay_tmp.Width);
                        h = Math.Min(this.toDrawHeight, (int)overlay_tmp.Height);
                        using (Gdk.Pixbuf pix = new Pixbuf(Colorspace.Rgb, true, 8, w, h)){
                            pix.Fill(0x00000000);                             //Fill with invisibility :)
                            overlay_tmp.Composite(pix, 0, 0, w, h, 0, 0, 1, 1, InterpType.Bilinear, 255 / 35 * this.overlayingFrames);
                            win.DrawPixbuf(gc, pix, 0, 0,
                                           (this.toDrawWidth - w) / 2,
                                           (this.toDrawHeight - h) / 2, w, h, RgbDither.Normal, 0, 0);
                        }
                    }
                }
                else
                {
                    win.DrawRectangle(gc, true, rect);

                    int w = Math.Min(this.toDrawWidth, (int)this.sourceMissing.Width);
                    int h = Math.Min(this.toDrawHeight, (int)this.sourceMissing.Height);

                    Rectangle img = new Rectangle((this.toDrawWidth - w) / 2,
                                                  (this.toDrawHeight - h) / 2,
                                                  w, h);
                    Rectangle target = Rectangle.Intersect(img, rect);
                    if (target != Rectangle.Zero)
                    {
                        win.DrawPixbuf(gc, this.sourceMissing,
                                       Math.Max(target.X - img.X, 0),
                                       Math.Max(target.Y - img.Y, 0),
                                       target.X,
                                       target.Y,
                                       target.Width,
                                       target.Height,
                                       RgbDither.Normal, 0, 0);
                    }
                }
            }
            return(true);
        }
Exemple #25
0
 public Closure(GLib.TimeoutHandler timeout_handler)
 {
     this.timeout_handler = timeout_handler;
     ++Count;
 }
Exemple #26
0
 private void Build()
 {
     global::Stetic.Gui.Initialize(this);
     global::Stetic.BinContainer.Attach(this);
     this.Name = "Client.Graphics.PidgeonList";
     this.GtkScrolledWindow = new global::Gtk.ScrolledWindow();
     this.GtkScrolledWindow.Name = "GtkScrolledWindow";
     this.GtkScrolledWindow.ShadowType = ((global::Gtk.ShadowType)(1));
     this.tv = new global::Gtk.TreeView();
     this.tv.CanFocus = true;
     this.tv.Name = "treeview1";
     Gtk.TreeViewColumn Column = new TreeViewColumn();
     Gtk.TreeViewColumn pict = new Gtk.TreeViewColumn();
     Gtk.CellRendererText Item = new Gtk.CellRendererText();
     Gtk.CellRendererPixbuf icon = new CellRendererPixbuf();
     Column.Title = messages.get("list-active-conn", Core.SelectedLanguage);
     Column.PackStart(Item, true);
     pict.PackStart(icon, true);
     Column.SetCellDataFunc(Item, UserListRendererTool);
     pict.AddAttribute(icon, "pixbuf", 5);
     tv.AppendColumn(pict);
     tv.AppendColumn(Column);
     tv.PopupMenu += Menu;
     tv.TooltipColumn = 4;
     tv.ButtonPressEvent += new ButtonPressEventHandler(Menu2);
     Column.AddAttribute(Item, "text", 0);
     this.tv.Model = Values;
     this.GtkScrolledWindow.Add(this.tv);
     timer = new GLib.TimeoutHandler(timer01_Tick);
     GLib.Timeout.Add(200, timer);
     this.tv.RowActivated += new RowActivatedHandler(items_AfterSelect);
     this.Add(this.GtkScrolledWindow);
     this.tv.CursorChanged += new EventHandler(items_AfterSelect2);
     partToolStripMenuItem.Enabled = true;
     disconnectToolStripMenuItem.Enabled = true;
     closeToolStripMenuItem.Enabled = true;
     soundsToolStripMenuItem.Visible = true;
     highlightToolStripMenuItem.Visible = true;
     Pango.FontDescription font = new Pango.FontDescription();
     font.Size = Configuration.CurrentSkin.ChannelListFontSize;
     tv.ModifyFont(font);
     this.tv.ModifyFg(StateType.Normal, Core.FromColor(Configuration.CurrentSkin.FontColor));
     if ((this.Child != null))
     {
         this.Child.ShowAll();
     }
     this.Hide();
 }
Exemple #27
0
			public GTimeoutProxy (Gtk.Function function)
			{
				this.function = function;
				handler = new GLib.TimeoutHandler (Invoke);
			}
Exemple #28
0
        public LogMonitor()
        {
            this.ShadowType         = ShadowType.Out;
            treeView                = new TreeView();
            treeView.Selection.Mode = Gtk.SelectionMode.Single;

            treeView.Model = outputModel;

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

            treeView.ModifyFont(customFont);

            Gtk.CellRendererText fileNameRenderer = new Gtk.CellRendererText();

            TreeViewColumn tvcName = new TreeViewColumn("Category", fileNameRenderer, "text", 0);

            tvcName.MinWidth  = 100;
            tvcName.Resizable = true;
            treeView.AppendColumn(tvcName);
            TreeViewColumn tvcMessage = new TreeViewColumn("Message", fileNameRenderer, "text", 1);

            tvcMessage.MinWidth  = 100;
            tvcMessage.Resizable = true;
            treeView.AppendColumn(tvcMessage);

            treeView.HeadersVisible  = true;
            treeView.EnableTreeLines = true;

            treeView.ButtonReleaseEvent += delegate(object o, ButtonReleaseEventArgs args) {
                if (args.Event.Button != 3)
                {
                    return;
                }

                Menu popupMenu = new Menu();

                MenuItem miClear = new MenuItem(MainClass.Languages.Translate("clear"));
                miClear.Activated += delegate(object sender, EventArgs e) {
                    Clear();
                };
                popupMenu.Append(miClear);

                TreeSelection  ts     = treeView.Selection;
                Gtk.TreePath[] selRow = ts.GetSelectedRows();

                MenuItem miCopy = new MenuItem(MainClass.Languages.Translate("copy_f2"));
                miCopy.Activated += delegate(object sender, EventArgs e) {
                    Gtk.TreePath tp = selRow[0];
                    TreeIter     ti = new TreeIter();
                    outputModel.GetIter(out ti, tp);
                    string category = outputModel.GetValue(ti, 0).ToString();
                    string message  = outputModel.GetValue(ti, 1).ToString();

                    Gtk.Clipboard clipboard = this.GetClipboard(Gdk.Selection.Clipboard);
                    string        txt       = category + "\t" + message;

                    clipboard.Text = txt;
                };
                popupMenu.Append(miCopy);

                if (selRow.Length < 1)
                {
                    miCopy.Sensitive = false;
                }
                popupMenu.Popup();
                popupMenu.ShowAll();
            };

            treeView.RowActivated += new RowActivatedHandler(OnRowActivate);
            treeView.EnableSearch  = false;
            treeView.HasFocus      = false;

            outputDispatcher = new GLib.TimeoutHandler(OutputDispatchHandler);

            this.Add(treeView);

            this.ShowAll();
        }
Exemple #29
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.CustomOutputPadFont);
			IdeApp.Preferences.CustomOutputPadFontChanged += HandleCustomFontChanged;
			
			outputDispatcher = new GLib.TimeoutHandler (outputDispatchHandler);
		}
 public GTimeoutProxy(Gtk.Function function)
 {
     this.function = function;
     handler       = new GLib.TimeoutHandler(Invoke);
 }
		public LogView ()
		{
			buffer = new TextBuffer (new TextTagTable ());
			textEditorControl = new LogTextView (buffer);
			textEditorControl.Editable = false;
			
			scrollView.ShadowType = ShadowType.None;
			scrollView.Add (textEditorControl);
			PackEnd (scrollView, true, true, 0);

			bold = new TextTag ("bold");
			bold.Weight = Weight.Bold;
			buffer.TagTable.Add (bold);
			
			errorTag = new TextTag ("error");
			errorTag.Foreground = "#dc3122";
			errorTag.Weight = Weight.Bold;
			buffer.TagTable.Add (errorTag);

			debugTag = new TextTag ("debug");
			debugTag.Foreground = "#256ada";
			buffer.TagTable.Add (debugTag);

			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.Changed += HandleCustomFontChanged;
			
			outputDispatcher = new GLib.TimeoutHandler (outputDispatchHandler);

			InitSearchWidget ();
		}
Exemple #32
0
 private void login()
 {
     try
     {
         // disable all controls so that user can't change them while logging in
         EnableControls (false);
         this.button2.Label = Languages.Get("cancel");
         LoggingIn = true;
         Config.UseSsl = checkbutton1.Active;
         Config.Project = combobox1.ActiveText;
         this.progressbar1.Adjustment.Value = 0;
         // FIXME
         //if (Config.Languages.Contains(cmLanguage.Text)) { Config.Language = cmLanguage.Text; } // set language (if needed)
         Config.Username = entry1.Text; // set username
         Config.Password = entry2.Text; // set password
         Login.LoggingOn = true; // set loggin in
         Login.phase = Login.LoginState.LoggingIn; // set phase
         LoginRequest lr = new LoginRequest(); // start a new login request
         //lr.Login_Form = this;
         progress(Languages.Get("login-progress-start"));
         lr.Start();
         timer = new GLib.TimeoutHandler(login_Tick);
         GLib.Timeout.Add(200, timer);
     }
     catch (Exception fail)
     {
         Core.ExceptionHandler(fail);
         EnableControls (true);
     }
 }
Exemple #33
0
 private void Build()
 {
     global::Stetic.Gui.Initialize(this);
     global::Stetic.BinContainer.Attach(this);
     this.Name = "Client.ScrollbackWidget";
     this.GtkScrolledWindow = new global::Gtk.ScrolledWindow();
     this.GtkScrolledWindow.Name = "GtkScrolledWindow";
     this.GtkScrolledWindow.ShadowType = ((global::Gtk.ShadowType)(1));
     this.simpleview = new global::Gtk.TextView();
     this.simpleview.CanFocus = true;
     this.simpleview.WrapMode = Gtk.WrapMode.Word;
     this.Visible = true;
     this.simpleview.Name = "simpleview";
     this.simpleview.SizeAllocated += new Gtk.SizeAllocatedHandler(Scroll2);
     this.simpleview.Editable = false;
     this.simpleview.ModifyFont(Font);
     this.simpleview.ScrollEvent += new Gtk.ScrollEventHandler(Scroll);
     this.simpleview.DoubleBuffered = true;
     this.GtkScrolledWindow.Add(this.simpleview);
     this.RT = new RichTBox();
     if (!isMicro)
     {
         this.simpleview.PopulatePopup += new Gtk.PopulatePopupHandler(CreateMenu_simple);
         this.RT.textView.PopulatePopup += new Gtk.PopulatePopupHandler(CreateMenu_rt);
         this.RT.textView.ButtonPressEvent += new Gtk.ButtonPressEventHandler(Click);
         this.RT.textView.KeyPressEvent += new Gtk.KeyPressEventHandler(PressEvent);
     }
     timer2 = new GLib.TimeoutHandler(timer2_Tick);
     simpleview.ModifyBase(Gtk.StateType.Normal, Core.FromColor(Configuration.CurrentSkin.BackgroundColor));
     simpleview.ModifyText(Gtk.StateType.Normal, Core.FromColor(Configuration.CurrentSkin.ColorDefault));
     simpleview.KeyPressEvent += new Gtk.KeyPressEventHandler(PressEvent);
     GLib.Timeout.Add(200, timer2);
     this.Add(this.GtkScrolledWindow);
     if ((this.Child != null))
     {
         this.Child.ShowAll();
     }
 }
Exemple #34
0
		public void ScheduleRefresh (uint time)
		{
			lock (this) {
				if (timeoutId != 0)
					return;
			
				if (time == 0) {
					GLib.IdleHandler handler;
					handler = new GLib.IdleHandler (HandleScheduled);
					timeoutId = GLib.Idle.Add (handler);
				} else {
					GLib.TimeoutHandler handler;
					handler = new GLib.TimeoutHandler (HandleScheduled);
					timeoutId = GLib.Timeout.Add (time, handler);
				}
			}
		}
Exemple #35
0
 public MainWindow()
     : base(Gtk.WindowType.Toplevel)
 {
     Build();
     handler = new GLib.TimeoutHandler(Timer_Tick);
 }
Exemple #36
0
 /// <summary>
 /// Load conf
 /// </summary>
 /// <param name="id"></param>
 public void LC(string id)
 {
     ID = id;
     if (Configuration.Window.RememberPosition)
     {
         lock (WindowInfo)
         {
             if (!WindowInfo.ContainsKey(id))
             {
                 Info info = new Info();
                 WindowInfo.Add(id, info);
                 info.X = this.Left;
                 info.Y = this.Top;
                 info.Width = this.Width;
                 info.Height = this.Height;
             }
             else
             {
                 this.Move(WindowInfo[id].X, WindowInfo[id].Y);
                 this.Resize(WindowInfo[id].Width, WindowInfo[id].Height);
             }
         }
         // **FIXME**
         this.ChangeTimer = new GLib.TimeoutHandler(ResizeHandler);
         this.ConfigureEvent += new Gtk.ConfigureEventHandler(OnResize);
         GLib.Timeout.Add(8000, this.ChangeTimer);
     }
 }
Exemple #37
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();
        }