@@ -374,6 +374,95 @@ void graph_init(void)
374374 curses_initialized = true;
375375}
376376
377+ void draw_eom_data (WINDOW * win , unsigned int * data , int count , int x_offset , int y_offset )
378+ {
379+ for (int i = 0 ; i < count ; ++ i ) {
380+ int xl = data [i ] + x_offset ;
381+ int xr = data [i ] + x_offset ;
382+ int yt = data [i ] + y_offset ;
383+ int yb = data [i ] + y_offset ;
384+
385+ // Draw points
386+ mvwaddch (win , yt , xl , 'L' ); // Left
387+ mvwaddch (win , yt , xr , 'R' ); // Right
388+ mvwaddch (win , yt , xl , 'T' ); // Top
389+ mvwaddch (win , yb , xl , 'B' ); // Bottom
390+
391+ // Draw horizontal line (left to right at eye_top)
392+ for (int x = xl ; x <= xr ; ++ x )
393+ mvwaddch (win , yt , x , '-' );
394+
395+ // Draw vertical line (top to bottom at eye_left)
396+ for (int y = yt ; y <= yb ; ++ y )
397+ mvwaddch (win , y , xl , '|' );
398+ }
399+ wrefresh (win );
400+ }
401+
402+ int graph_draw_eom_win (unsigned int * data , int count , const char * title , char * status )
403+ {
404+ WINDOW * datawin , * stwin = NULL ;
405+ const int x_off = 7 , y_off = 4 ;
406+ int s_off ;
407+ int c ;
408+ printf ("%d %d %d %d\n" , data [0 ], data [1 ], data [2 ], data [3 ]);
409+ if (!isatty (STDOUT_FILENO )) {
410+ // Fallback to text output if not a terminal
411+ return 0 ;
412+ }
413+
414+ if (!curses_initialized ) {
415+ initscr ();
416+ curses_initialized = true;
417+ }
418+
419+ noecho ();
420+ cbreak ();
421+ curs_set (0 );
422+ keypad (stdscr , true);
423+ start_color ();
424+
425+ if (status ) {
426+ s_off = 2 ;
427+ stwin = newwin (2 , 0 , LINES - 2 , 0 );
428+ if (!stwin ) {
429+ perror ("Unable to create window" );
430+ return 1 ;
431+ }
432+ } else {
433+ s_off = 0 ;
434+ }
435+
436+ datawin = newwin (LINES - y_off - s_off , COLS - x_off , y_off , x_off );
437+ if (!datawin ) {
438+ perror ("Unable to create window" );
439+ return 1 ;
440+ }
441+
442+ // Main loop
443+ while (1 ) {
444+ werase (datawin );
445+ box (datawin , 0 , 0 );
446+ draw_eom_data (datawin , data , count , 0 , 0 );
447+
448+ if (stwin ) {
449+ werase (stwin );
450+ mvwprintw (stwin , 0 , 0 , "%s" , status );
451+ wrefresh (stwin );
452+ }
453+
454+ c = getch ();
455+ if (c == 'q' || c == 'x' )
456+ break ;
457+ }
458+
459+ if (stwin )
460+ delwin (stwin );
461+ delwin (datawin );
462+ endwin ();
463+ return 0 ;
464+ }
465+
377466#else /* defined(HAVE_LIBCURSES) || defined(HAVE_LIBNCURSES) */
378467
379468int graph_draw_win (struct range * X , struct range * Y , int * data , int * shades ,
0 commit comments