/// <summary> /// Required designer variable. /// </summary> // private Container components = null; internal StateBrowser(DisplayLocationDel loc_del, IThreadView t_viz, Formatter f, GuiController controller) { tviz = t_viz; formatter = f; converter = f.GetIndexConverter(); display_location = loc_del; table = new List <List <TaskVarOp> >(); max_tid = new Dictionary <int, int>(); focus = -1; replay = false; current_column = -1; current_row = -1; mouse_x = mouse_y = -1; col_sz = 20; row_sz = 20; row_max = 0; prev_col = -1; prev_row = -1; ResizeRedraw = true; SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.DoubleBuffer, true); OnResize(System.EventArgs.Empty); AutoScroll = true; line = new Pen(Color.Black); white_pen = new Pen(Color.White, 2); this.controller = controller; // InitializeComponent(); }
// this is the entry point for the gui thread private void RunGuiThread() { threadviz = (!oldDisplayStyle) ? (new MultiThreadView(formatter, controller) as IThreadView) : (new ThreadViz(formatter, controller) as IThreadView); // be notified of form closing (threadviz as Form).FormClosing += new FormClosingEventHandler(HandleFormClosing); // need timer callback to process updates timer = new System.Windows.Forms.Timer(); timer.Interval = TimerInterval; timer.Tick += new System.EventHandler(HandleTimerTick); timer.Start(); // register as observer for model events lock (model) { model.Complete += new CompleteHandler(HandleComplete); model.EntryUpdate += new EntryUpdateHandler(HandleUpdate); model.NewEntry += new NewEntryHandler(HandleNewEntry); model.ThreadnameUpdate += new ThreadnameUpdateHandler(HandleThreadnameUpdate); model.SelectionUpdate += new SelectionUpdateHandler(HandleSelectionUpdate); } // run form System.Windows.Forms.Application.Run((Form)threadviz); //System.Console.WriteLine("guithread done"); // unregister observers lock (model) { model.Complete -= new CompleteHandler(HandleComplete); model.EntryUpdate -= new EntryUpdateHandler(HandleUpdate); model.NewEntry -= new NewEntryHandler(HandleNewEntry); model.ThreadnameUpdate -= new ThreadnameUpdateHandler(HandleThreadnameUpdate); model.SelectionUpdate -= new SelectionUpdateHandler(HandleSelectionUpdate); } // notify controller controller.ViewHasClosed(this); }