"Fossies" - the Fresh Open Source Software Archive

Member "xosview-1.23/xosview.h" (11 Jul 2020, 2034 Bytes) of package /linux/misc/xosview-1.23.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "xosview.h" see the Fossies "Dox" file reference documentation.

    1 //
    2 //  Copyright (c) 1994, 1995, 2006 by Mike Romberg ( mike.romberg@noaa.gov )
    3 //
    4 //  This file may be distributed under terms of the GPL
    5 //
    6 
    7 #ifndef _XOSVIEW_H_
    8 #define _XOSVIEW_H_
    9 
   10 #include "xwin.h"
   11 #include "Xrm.h"  //  For Xrm resource manager class.
   12 #include <stdio.h>
   13 
   14 /*  Take at most n samples per second (default of 10)  */
   15 extern double MAX_SAMPLES_PER_SECOND;
   16 
   17 class Meter;
   18 
   19 class XOSView : public XWin {
   20 public:
   21   XOSView( const char* instName, int argc, char *argv[] );
   22   ~XOSView( void );
   23 
   24   void figureSize ( void );
   25   void resize( void );
   26   void draw ( void );
   27   void run( void );
   28   const char *winname( void );
   29 
   30   // used by meter makers
   31   int xoff(void) const { return xoff_; }
   32   int newypos( void );
   33 
   34   enum windowVisibilityState { FULLY_VISIBLE, PARTIALLY_VISIBILE, OBSCURED };
   35   enum windowVisibilityState getWindowVisibilityState(void) { return windowVisibility; }
   36 
   37 protected:
   38 
   39   Xrm xrm;
   40   void checkArgs (int argc, char** argv) const;
   41   class MeterNode {
   42   public:
   43     MeterNode( Meter *fm ) { meter_ = fm;  next_ = NULL; }
   44 
   45     Meter *meter_;
   46     MeterNode *next_;
   47   };
   48 
   49   MeterNode *meters_;
   50 
   51   int caption_, legend_, xoff_, yoff_, nummeters_, usedlabels_;
   52   int hmargin_, vmargin_, vspacing_;
   53   unsigned long sleeptime_, usleeptime_;
   54 
   55   void usleep_via_select( unsigned long usec );
   56   void addmeter( Meter *fm );
   57   void checkMeterResources( void );
   58 
   59   int findx( void );
   60   int findy( void );
   61   void dolegends( void );
   62 
   63   void checkOverallResources();
   64   void resizeEvent( XConfigureEvent &event );
   65   void exposeEvent( XExposeEvent &event );
   66   void keyPressEvent( XKeyEvent &event );
   67   void visibilityEvent( XVisibilityEvent &event );
   68   void unmapEvent( XUnmapEvent &event);
   69   void checkVersion(int argc, char *argv[]) const;
   70 
   71 private:
   72 
   73   bool _deferred_resize;
   74   bool _deferred_redraw;
   75   enum windowVisibilityState windowVisibility;
   76 };
   77 
   78 #ifdef DEBUG
   79 #define XOSDEBUG(...) { \
   80   fprintf(stderr, "%s:%d: ", __func__, __LINE__); \
   81   fprintf(stderr, __VA_ARGS__); \
   82 }
   83 #else
   84 #define XOSDEBUG(...)
   85 #endif
   86 
   87 #endif