Code Search for Developers
 
 
  

emview_gui.h from EmStar at Krugle


Show emview_gui.h syntax highlighted

/*
 *
 * Copyright (c) 2003 The Regents of the University of California.  All 
 * rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * - Redistributions of source code must retain the above copyright
 *   notice, this list of conditions and the following disclaimer.
 *
 * - Neither the name of the University nor the names of its
 *   contributors may be used to endorse or promote products derived
 *   from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS''
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 * PARTICULAR  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 */

#ifndef __EMVIEW_GUI_H__
#define __EMVIEW_GUI_H__


struct colorspec {
  char *name;
  GdkColor color;
  GdkColor light_color;
  uint32_t hexcode;
  int index;
};


typedef struct gui {

  /* the global graphics context */
  GdkGC *gc;
  struct colorspec colors[EMVIEW_MAX_COLORS];
  
  /* global widgets */
  GtkWidget *window;         /* the main window */
  GtkWidget *drawing_area;   /* drawing area */
  GtkWidget *menu_bar;       /* the top menu bar */

  /* the backing pixmap */
  GdkPixmap *fg_pixmap;

  /* global size vars, etc */
  int width;
  int height;
  int frame_rate;            /* redraw interval in ms */

  /* layout mode */
  link_source_t *layout_link_source;
  int do_grid;    /* grid is turned on for "real" position layouts */
  
  /* reserved regions (for keys, margin, etc) */
  int top_reserved;
  int bot_reserved;
  int left_reserved;
  int right_reserved;

  /* virtual canvas extent */
  float extent_x_min, extent_x_max;
  float extent_y_min, extent_y_max;
  float view_x, view_y;  /* viewport top */
  float zoom_factor;     /* zoom */
  int zoomed;            /* false when sized to fit */

  /* zoom UI */
  int zoom_sel;
  int startx, starty;
  int lastx, lasty;
  
  /* partial display */
  GTimer *timer;
  int incomplete;
  int next_full;
  g_event_t *timer_event;

  /* screenshot variables */
  char *type;
  char *attribute;
  char *value;
  
} gui_t;


#define EMVIEW_DEFAULT_WIDTH             400
#define EMVIEW_DEFAULT_HEIGHT            200
#define EMVIEW_DEFAULT_REDRAW_INTERVAL   500
#define EMVIEW_DEFAULT_REDRAW_SLICE       50
#define EMVIEW_EXCESS_WIDTH              0
#define EMVIEW_EXCESS_HEIGHT             0
#define EMVIEW_EXTENT_MARGIN             0.1

/* default padding */
#define EMVIEW_DEFAULT_MARGIN            5

/* component size constants */
#define EMVIEW_NODE_WIDTH   20
#define EMVIEW_NODE_HEIGHT  20

#define EMVIEW_BOX_WIDTH   20
#define EMVIEW_BOX_HEIGHT  20

/* various display constants */
#define TEXT_BG_PAD      1
#define NODE_FLAG_WIDTH  2
#define BOX_FLAG_WIDTH   4
#define BOX_FLAG_SEP     2

/* 
 * links and arrows 
 */

/* arrow constants */
#define ARROW_FRAC      0.25
#define ARROW_LEN        10
#define ARROW_ANGLE     (M_PI/8.0)

/* annoation constants */
#define NOTE_FRAC       0.10
#define TEXT_NOTE_PAD      2

/* link offset constant */
#define LINK_OFFSET       4

/* this is a hack because we should measure whichever font 
 * we are actually using.  however i could not find a call
 * that would tell the nominal line spacing, only one that
 * measured the spacing of the given string */
#define STD_TEXT_HEIGHT  12

/* maximum graphic file format type size for screenshots.  This is the 
 * size of the keyword defining the file format, *not* the size of the 
 * output file.  Currently, there are only two file format supported:
 * "jpeg" and "png" */
#define MAX_TYPE_SIZE             5  // jpeg
#define EMVIEW_DEFAULT_TYPE   "png"

#endif




See more files for this project here

EmStar

EmStar is a software system for developing and deploying wireless sensor networks involving Linux-based platforms. As the wireless sensor network community has attempted to deploy more complex designs---large-scale, long-lived systems that need self-organization and adaptivity---a number of difficult software design issues have arisen. Advances in software design have not kept pace with the capabilities of hardware. This is because designing for an adaptive, efficient, and useful sensor network has turned out to be surprisingly complex and difficult. EmStar is a Linux-based software framework, whose goal is to dramatically reduce this complexity, enabling work to be shared and reused, and simplifying and speeding the design of new sensor network applications.

Project homepage: http://cvs.cens.ucla.edu/emstar/
Programming language(s): C,Shell Script
License: other

  emview_analysis.c
  emview_analysis.h
  emview_box_component.c
  emview_component.c
  emview_component.h
  emview_config.c
  emview_config.h
  emview_device.c
  emview_device.h
  emview_gui.c
  emview_gui.h
  emview_gui_menu.c
  emview_i.h
  emview_main.c
  emview_node.c
  emview_node.h
  emview_node_component.c
  emview_slots.c
  emview_source.c
  emview_source.h