VPR-7.0
|
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <string>
#include <iostream>
#include "graphics.h"
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>
#include <X11/Xatom.h>
Go to the source code of this file.
Data Structures | |
struct | t_button |
struct | t_gl_state |
Macros | |
#define | TRUE 1 |
#define | FALSE 0 |
#define | XPOST(worldx) (((worldx)-xleft)*ps_xmult + ps_left) |
#define | YPOST(worldy) (((worldy)-ybot)*ps_ymult + ps_bot) |
#define | XTOWORLD(x) (((float) x)*xdiv + xleft) |
#define | YTOWORLD(y) (((float) y)*ydiv + ytop) |
#define | max(a, b) (((a) > (b))? (a) : (b)) |
#define | min(a, b) ((a) > (b)? (b) : (a)) |
#define | MWIDTH 104 /* width of menu window */ |
#define | T_AREA_HEIGHT 24 /* Height of text window */ |
#define | MAX_FONT_SIZE 24 /* Largest point size of text. */ |
#define | PI 3.141592654 |
#define | BUTTON_TEXT_LEN 100 |
#define | BUFSIZE 1000 |
#define | MAXPIXEL 15000 |
#define | MINPIXEL -15000 |
#define | OFF 1 |
#define | ON 0 |
#define | NUM_FONT_TYPES 3 |
Enumerations | |
enum | t_display_type { SCREEN = 0, POSTSCRIPT = 1 } |
enum | t_button_type { BUTTON_TEXT = 0, BUTTON_POLY, BUTTON_SEPARATOR } |
Functions | |
static void * | my_malloc (int ibytes) |
static void * | my_realloc (void *memblk, int ibytes) |
static int | xcoord (float worldx) |
static int | ycoord (float worldy) |
static void | force_setcolor (int cindex) |
static void | force_setlinestyle (int linestyle) |
static void | force_setlinewidth (int linewidth) |
static void | force_setfontsize (int pointsize) |
static void | load_font (int pointsize) |
static void | reset_common_state () |
static void | build_default_menu (void) |
static void | translate_up (void(*drawscreen)(void)) |
static void | translate_left (void(*drawscreen)(void)) |
static void | translate_right (void(*drawscreen)(void)) |
static void | translate_down (void(*drawscreen)(void)) |
static void | zoom_in (void(*drawscreen)(void)) |
static void | zoom_out (void(*drawscreen)(void)) |
static void | zoom_fit (void(*drawscreen)(void)) |
static void | adjustwin (void(*drawscreen)(void)) |
static void | postscript (void(*drawscreen)(void)) |
static void | proceed (void(*drawscreen)(void)) |
static void | quit (void(*drawscreen)(void)) |
static void | map_button (int bnum) |
static void | unmap_button (int bnum) |
static Bool | test_if_exposed (Display *disp, XEvent *event_ptr, XPointer dummy) |
static void | build_textarea (void) |
static void | drawbut (int bnum) |
static int | which_button (Window win) |
static void | turn_on_off (int pressed) |
static void | drawmenu (void) |
void | setcolor (int cindex) |
void | setcolor (string cname) |
int | getcolor () |
void | setlinestyle (int linestyle) |
void | setlinewidth (int linewidth) |
void | setfontsize (int pointsize) |
static void | setpoly (int bnum, int xc, int yc, int r, float theta) |
void | create_button (const char *prev_button_text, const char *button_text, void(*button_func)(void(*drawscreen)(void))) |
void | destroy_button (const char *button_text) |
void | init_graphics (const char *window_name, int cindex) |
static void | update_transform (void) |
static void | update_ps_transform (void) |
void | event_loop (void(*act_on_mousebutton)(float x, float y), void(*act_on_mousemove)(float x, float y), void(*act_on_keypress)(char key_pressed), void(*drawscreen)(void)) |
void | clearscreen (void) |
static int | rect_off_screen (float x1, float y1, float x2, float y2) |
void | drawline (float x1, float y1, float x2, float y2) |
void | drawrect (float x1, float y1, float x2, float y2) |
void | fillrect (float x1, float y1, float x2, float y2) |
static float | angnorm (float ang) |
void | drawellipticarc (float xc, float yc, float radx, float rady, float startang, float angextent) |
void | drawarc (float xc, float yc, float rad, float startang, float angextent) |
void | fillellipticarc (float xc, float yc, float radx, float rady, float startang, float angextent) |
void | fillarc (float xc, float yc, float rad, float startang, float angextent) |
void | fillpoly (t_point *points, int npoints) |
void | drawtext (float xc, float yc, const char *text, float boundx) |
void | flushinput (void) |
void | init_world (float x1, float y1, float x2, float y2) |
void | draw_message (void) |
void | update_message (const char *msg) |
static void | update_win (int x[2], int y[2], void(*drawscreen)(void)) |
void | close_graphics (void) |
int | init_postscript (const char *fname) |
void | close_postscript (void) |
void | report_structure (t_report *report) |
void | set_mouse_move_input (bool enable) |
void | set_keypress_input (bool enable) |
void | enable_or_disable_button (int ibutton, bool enabled) |
void | set_draw_mode (enum e_draw_mode draw_mode) |
void | change_button_text (const char *button_name, const char *new_button_text) |
static void | menutext (Window win, int xc, int yc, const char *text) |
Variables | |
static t_gl_state | gl_state = {false, SCREEN, 0} |
static const int | menu_font_size = 12 |
static t_button * | button = NULL |
static int | num_buttons = 0 |
static int | display_width |
static int | display_height |
static int | top_width |
static int | top_height |
static float | xleft |
static float | xright |
static float | ytop |
static float | ybot |
static float | saved_xleft |
static float | saved_xright |
static float | saved_ytop |
static float | saved_ybot |
static float | ps_left |
static float | ps_right |
static float | ps_top |
static float | ps_bot |
static float | ps_xmult |
static float | ps_ymult |
static float | xmult |
static float | ymult |
static float | xdiv |
static float | ydiv |
static int | currentcolor |
static int | currentlinestyle |
static int | currentlinewidth |
static int | currentfontsize |
static e_draw_mode | current_draw_mode |
static FILE * | ps |
static int | ProceedPressed |
static char | statusMessage [BUFSIZE] = "" |
static bool | font_is_loaded [MAX_FONT_SIZE+1] |
static bool | get_keypress_input |
static bool | get_mouse_move_input |
static const char * | ps_cnames [NUM_COLOR] |
static Display * | display |
static int | screen_num |
static GC | gc |
static GC | gcxor |
static GC | gc_menus |
static GC | current_gc |
static XFontStruct * | font_info [MAX_FONT_SIZE+1] |
static Window | toplevel |
static Window | menu |
static Window | textarea |
static Colormap | private_cmap |
static int | colors [NUM_COLOR] |
#define BUFSIZE 1000 |
Definition at line 184 of file graphics.c.
#define BUTTON_TEXT_LEN 100 |
Definition at line 183 of file graphics.c.
#define FALSE 0 |
Definition at line 146 of file graphics.c.
#define max | ( | a, | |
b | |||
) | (((a) > (b))? (a) : (b)) |
Definition at line 171 of file graphics.c.
#define MAX_FONT_SIZE 24 /* Largest point size of text. */ |
Definition at line 179 of file graphics.c.
#define MAXPIXEL 15000 |
Definition at line 202 of file graphics.c.
#define min | ( | a, | |
b | |||
) | ((a) > (b)? (b) : (a)) |
Definition at line 174 of file graphics.c.
#define MINPIXEL -15000 |
Definition at line 203 of file graphics.c.
#define MWIDTH 104 /* width of menu window */ |
Definition at line 177 of file graphics.c.
#define NUM_FONT_TYPES 3 |
#define OFF 1 |
#define ON 0 |
#define PI 3.141592654 |
Definition at line 181 of file graphics.c.
#define T_AREA_HEIGHT 24 /* Height of text window */ |
Definition at line 178 of file graphics.c.
#define TRUE 1 |
Definition at line 145 of file graphics.c.
Definition at line 161 of file graphics.c.
Definition at line 167 of file graphics.c.
Definition at line 162 of file graphics.c.
Definition at line 168 of file graphics.c.
enum t_button_type |
Enumerator | |
---|---|
BUTTON_TEXT | |
BUTTON_POLY | |
BUTTON_SEPARATOR |
Definition at line 248 of file graphics.c.
enum t_display_type |
Enumerator | |
---|---|
SCREEN | |
POSTSCRIPT |
Definition at line 240 of file graphics.c.
|
static |
Definition at line 2262 of file graphics.c.
|
static |
|
static |
Definition at line 2628 of file graphics.c.
|
static |
Definition at line 2942 of file graphics.c.
void change_button_text | ( | const char * | button_name, |
const char * | new_button_text | ||
) |
Definition at line 2906 of file graphics.c.
void clearscreen | ( | void | ) |
Definition at line 1483 of file graphics.c.
void close_graphics | ( | void | ) |
void close_postscript | ( | void | ) |
Definition at line 2602 of file graphics.c.
void create_button | ( | const char * | prev_button_text, |
const char * | button_text, | ||
void(*)(void(*drawscreen)(void)) | button_func | ||
) |
Definition at line 881 of file graphics.c.
void destroy_button | ( | const char * | button_text | ) |
Definition at line 954 of file graphics.c.
void draw_message | ( | void | ) |
Definition at line 2063 of file graphics.c.
void drawarc | ( | float | xc, |
float | yc, | ||
float | rad, | ||
float | startang, | ||
float | angextent | ||
) |
Definition at line 1787 of file graphics.c.
|
static |
Definition at line 2992 of file graphics.c.
void drawellipticarc | ( | float | xc, |
float | yc, | ||
float | radx, | ||
float | rady, | ||
float | startang, | ||
float | angextent | ||
) |
Definition at line 1719 of file graphics.c.
void drawline | ( | float | x1, |
float | y1, | ||
float | x2, | ||
float | y2 | ||
) |
Definition at line 1539 of file graphics.c.
|
static |
Definition at line 3126 of file graphics.c.
void drawrect | ( | float | x1, |
float | y1, | ||
float | x2, | ||
float | y2 | ||
) |
Definition at line 1581 of file graphics.c.
void drawtext | ( | float | xc, |
float | yc, | ||
const char * | text, | ||
float | boundx | ||
) |
Definition at line 1952 of file graphics.c.
void enable_or_disable_button | ( | int | ibutton, |
bool | enabled | ||
) |
Definition at line 2867 of file graphics.c.
void event_loop | ( | void(*)(float x, float y) | act_on_mousebutton, |
void(*)(float x, float y) | act_on_mousemove, | ||
void(*)(char key_pressed) | act_on_keypress, | ||
void(*)(void) | drawscreen | ||
) |
Definition at line 1352 of file graphics.c.
void fillarc | ( | float | xc, |
float | yc, | ||
float | rad, | ||
float | startang, | ||
float | angextent | ||
) |
Definition at line 1876 of file graphics.c.
void fillellipticarc | ( | float | xc, |
float | yc, | ||
float | radx, | ||
float | rady, | ||
float | startang, | ||
float | angextent | ||
) |
Definition at line 1798 of file graphics.c.
void fillpoly | ( | t_point * | points, |
int | npoints | ||
) |
Definition at line 1881 of file graphics.c.
void fillrect | ( | float | x1, |
float | y1, | ||
float | x2, | ||
float | y2 | ||
) |
Definition at line 1643 of file graphics.c.
void flushinput | ( | void | ) |
Definition at line 2027 of file graphics.c.
|
static |
Definition at line 581 of file graphics.c.
|
static |
Definition at line 755 of file graphics.c.
|
static |
Definition at line 654 of file graphics.c.
|
static |
Definition at line 707 of file graphics.c.
int getcolor | ( | void | ) |
void init_graphics | ( | const char * | window_name, |
int | cindex | ||
) |
Definition at line 1003 of file graphics.c.
int init_postscript | ( | const char * | fname | ) |
Definition at line 2477 of file graphics.c.
void init_world | ( | float | x1, |
float | y1, | ||
float | x2, | ||
float | y2 | ||
) |
Definition at line 2038 of file graphics.c.
|
static |
Definition at line 2768 of file graphics.c.
|
static |
Definition at line 824 of file graphics.c.
|
static |
|
static |
Definition at line 499 of file graphics.c.
|
static |
|
static |
Definition at line 2371 of file graphics.c.
|
static |
|
static |
Definition at line 2407 of file graphics.c.
|
static |
void report_structure | ( | t_report * | report | ) |
Definition at line 2843 of file graphics.c.
|
static |
Definition at line 1256 of file graphics.c.
void set_draw_mode | ( | enum e_draw_mode | draw_mode | ) |
Definition at line 2881 of file graphics.c.
void set_keypress_input | ( | bool | enable | ) |
Definition at line 2862 of file graphics.c.
void set_mouse_move_input | ( | bool | enable | ) |
Definition at line 2857 of file graphics.c.
void setcolor | ( | int | cindex | ) |
Definition at line 619 of file graphics.c.
void setcolor | ( | string | cname | ) |
Definition at line 631 of file graphics.c.
void setfontsize | ( | int | pointsize | ) |
Definition at line 796 of file graphics.c.
void setlinestyle | ( | int | linestyle | ) |
Definition at line 697 of file graphics.c.
void setlinewidth | ( | int | linewidth | ) |
Definition at line 743 of file graphics.c.
|
static |
Definition at line 809 of file graphics.c.
|
static |
|
static |
Definition at line 2191 of file graphics.c.
|
static |
Definition at line 2205 of file graphics.c.
|
static |
Definition at line 2220 of file graphics.c.
|
static |
Definition at line 2177 of file graphics.c.
|
static |
Definition at line 3113 of file graphics.c.
|
static |
Definition at line 860 of file graphics.c.
void update_message | ( | const char * | msg | ) |
Definition at line 2113 of file graphics.c.
|
static |
|
static |
|
static |
Definition at line 2233 of file graphics.c.
|
static |
|
static |
|
static |
|
static |
Definition at line 2163 of file graphics.c.
|
static |
Definition at line 2126 of file graphics.c.
|
static |
Definition at line 2144 of file graphics.c.
|
static |
Definition at line 313 of file graphics.c.
|
static |
Definition at line 393 of file graphics.c.
|
static |
Definition at line 331 of file graphics.c.
|
static |
Definition at line 387 of file graphics.c.
|
static |
Definition at line 327 of file graphics.c.
|
static |
Definition at line 330 of file graphics.c.
|
static |
Definition at line 328 of file graphics.c.
|
static |
Definition at line 329 of file graphics.c.
|
static |
Definition at line 385 of file graphics.c.
|
static |
Definition at line 316 of file graphics.c.
|
static |
Definition at line 316 of file graphics.c.
|
static |
Definition at line 388 of file graphics.c.
|
static |
Definition at line 340 of file graphics.c.
|
static |
Definition at line 387 of file graphics.c.
|
static |
Definition at line 387 of file graphics.c.
|
static |
Definition at line 387 of file graphics.c.
|
static |
Definition at line 341 of file graphics.c.
|
static |
Definition at line 341 of file graphics.c.
|
static |
Definition at line 309 of file graphics.c.
|
static |
Definition at line 389 of file graphics.c.
|
static |
Definition at line 311 of file graphics.c.
|
static |
Definition at line 314 of file graphics.c.
|
static |
Definition at line 390 of file graphics.c.
|
static |
Definition at line 336 of file graphics.c.
|
static |
Definition at line 334 of file graphics.c.
|
static |
Definition at line 321 of file graphics.c.
|
static |
Definition at line 342 of file graphics.c.
|
static |
Definition at line 321 of file graphics.c.
|
static |
Definition at line 321 of file graphics.c.
|
static |
Definition at line 321 of file graphics.c.
|
static |
Definition at line 323 of file graphics.c.
|
static |
Definition at line 323 of file graphics.c.
|
static |
Definition at line 319 of file graphics.c.
|
static |
Definition at line 319 of file graphics.c.
|
static |
Definition at line 319 of file graphics.c.
|
static |
Definition at line 319 of file graphics.c.
|
static |
Definition at line 386 of file graphics.c.
|
static |
Definition at line 338 of file graphics.c.
|
static |
Definition at line 389 of file graphics.c.
|
static |
Definition at line 317 of file graphics.c.
|
static |
Definition at line 317 of file graphics.c.
|
static |
Definition at line 389 of file graphics.c.
|
static |
Definition at line 325 of file graphics.c.
|
static |
Definition at line 318 of file graphics.c.
|
static |
Definition at line 324 of file graphics.c.
|
static |
Definition at line 318 of file graphics.c.
|
static |
Definition at line 318 of file graphics.c.
|
static |
Definition at line 325 of file graphics.c.
|
static |
Definition at line 324 of file graphics.c.
|
static |
Definition at line 318 of file graphics.c.