grouping X11 specific global declarations
This commit is contained in:
parent
f0f1f9c2f0
commit
aa2a47c5b9
185
src/globals.c
185
src/globals.c
|
|
@ -22,79 +22,12 @@
|
|||
|
||||
#include "xschem.h"
|
||||
|
||||
int help=0; /* help option set to global scope, printing help is deferred */
|
||||
/* when configuration ~/.schem has been read 20140406 */
|
||||
int fullscreen=0;
|
||||
int semaphore=0; /* needed at global scope as it is set by tcl */
|
||||
int unzoom_nodrift=1;
|
||||
int a3page=-1;
|
||||
int has_x=1;
|
||||
int no_draw=0;
|
||||
int sym_txt=1;
|
||||
int event_reporting=0;
|
||||
int rainbow_colors=0;
|
||||
int manhattan_lines=0;
|
||||
FILE *errfp;
|
||||
char *filename=NULL; /* filename given on cmdline */
|
||||
char user_conf_dir[PATH_MAX];
|
||||
char home_dir[PATH_MAX]; /* home dir obtained via getpwuid */
|
||||
char pwd_dir[PATH_MAX]; /* obtained via getcwd() */
|
||||
#ifndef __unix__
|
||||
char win_temp_dir[PATH_MAX]="";
|
||||
const char fopen_read_mode[] = "rb";
|
||||
#else
|
||||
const char fopen_read_mode[] = "r";
|
||||
#endif
|
||||
int load_initfile=1;
|
||||
char plotfile[PATH_MAX] = {'\0'};
|
||||
char rcfile[PATH_MAX] = {'\0'};
|
||||
char *tcl_command = NULL;
|
||||
char tcl_script[PATH_MAX] = {'\0'};
|
||||
int persistent_command=0; /* remember last command 20181022 */
|
||||
int dis_uniq_names=0; /* if set allow instances with duplicate names */
|
||||
int quit=0; /* set from process_options (ex netlist from cmdline and quit) */
|
||||
int debug_var=-10; /* will be set to 0 in xinit.c */
|
||||
int tcp_port = 0;
|
||||
int do_print=0;
|
||||
int no_readline=0;
|
||||
Colormap colormap;
|
||||
int lw=0; /* line width */
|
||||
int bus_width = BUS_WIDTH;
|
||||
double lw_double=0.0; /* line width */
|
||||
int fill=1; /* filled rectangles */
|
||||
int draw_pixmap=1; /* use pixmap for double buffer */
|
||||
int draw_window=0;
|
||||
int draw_grid=1;
|
||||
double cadgrid = CADGRID;
|
||||
double cadhalfdotsize = CADHALFDOTSIZE;
|
||||
int change_lw=0; /* allow change linewidth */
|
||||
int incr_hilight=1;
|
||||
int auto_hilight=0;
|
||||
unsigned int color_index[256]; /* layer color lookup table */
|
||||
unsigned int rectcolor ; /* this is the currently used layer */
|
||||
unsigned long ui_state = 0; /* this signals that we are doing a net place,panning etc. */
|
||||
/* used to prevent nesting of some commands */
|
||||
|
||||
char *undo_dirname = NULL;
|
||||
int cur_undo_ptr=0;
|
||||
int tail_undo_ptr=0;
|
||||
int head_undo_ptr=0;
|
||||
int max_undo=MAX_UNDO;
|
||||
int draw_dots=1;
|
||||
int draw_single_layer=-1;
|
||||
int check_version = 0; /* if set ensures 'v' version header line is present before loading file */
|
||||
int yyparse_error = 0;
|
||||
unsigned short enable_stretch=0;
|
||||
int cadlayers=0;
|
||||
int *enable_layer;
|
||||
int n_active_layers=0;
|
||||
int *active_layer;
|
||||
int need_rebuild_selected_array=1;
|
||||
/* X11 specific globals */
|
||||
Colormap colormap;
|
||||
Window window; /* window is the drawing area, topwindow is the root win */
|
||||
Window pre_window; /* preview when opening files */
|
||||
Window parent_of_topwindow;
|
||||
int depth;
|
||||
int *fill_type; /*20171117 for every layer: 0: no fill, 1, solid fill, 2: stipple fill */
|
||||
unsigned char **pixdata;
|
||||
unsigned char pixdata_init[22][32]={ /* fill patterns... indexed by laynumb. */
|
||||
{0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,/*0 */
|
||||
|
|
@ -163,29 +96,108 @@ unsigned char pixdata_init[22][32]={ /* fill patterns... indexed by laynumb.
|
|||
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},/*20 */
|
||||
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}/*21 */
|
||||
};
|
||||
|
||||
char **color_array;
|
||||
|
||||
char *xschem_executable=NULL;
|
||||
Pixmap cad_icon_pixmap=0, *pixmap,save_pixmap; /* save_pixmap used to restore window */
|
||||
int areax1,areay1,areax2,areay2,areaw,areah; /* window corners / size */
|
||||
GC *gcstipple,*gc, gctiled;
|
||||
Display *display;
|
||||
XRectangle xrect[1] = {{0,0,0,0}};
|
||||
Pixmap cad_icon_pixmap=0, *pixmap,save_pixmap; /* save_pixmap used to restore window */
|
||||
XPoint *gridpoint; /* pointer to array of gridpoints, used in draw() */
|
||||
XColor xcolor_array[256];
|
||||
Visual *visual;
|
||||
#ifdef HAS_CAIRO
|
||||
cairo_surface_t *sfc, *save_sfc;
|
||||
cairo_t *cairo_ctx, *cairo_save_ctx;
|
||||
XRenderPictFormat *format;
|
||||
|
||||
#if HAS_XCB==1
|
||||
xcb_connection_t *xcbconn;
|
||||
xcb_render_pictforminfo_t format_rgb, format_rgba;
|
||||
xcb_screen_t *screen_xcb;
|
||||
xcb_visualtype_t *visual_xcb;
|
||||
#endif /*HAS_XCB */
|
||||
#endif /*HAS_CAIRO */
|
||||
|
||||
|
||||
int help=0; /* help option set to global scope, printing help is deferred */
|
||||
/* when configuration ~/.schem has been read 20140406 */
|
||||
int fullscreen=0;
|
||||
int semaphore=0; /* needed at global scope as it is set by tcl */
|
||||
int unzoom_nodrift=1;
|
||||
int a3page=-1;
|
||||
int has_x=1;
|
||||
int no_draw=0;
|
||||
int sym_txt=1;
|
||||
int event_reporting=0;
|
||||
int rainbow_colors=0;
|
||||
int manhattan_lines=0;
|
||||
FILE *errfp;
|
||||
char *filename=NULL; /* filename given on cmdline */
|
||||
char user_conf_dir[PATH_MAX];
|
||||
char home_dir[PATH_MAX]; /* home dir obtained via getpwuid */
|
||||
char pwd_dir[PATH_MAX]; /* obtained via getcwd() */
|
||||
#ifndef __unix__
|
||||
char win_temp_dir[PATH_MAX]="";
|
||||
const char fopen_read_mode[] = "rb";
|
||||
#else
|
||||
const char fopen_read_mode[] = "r";
|
||||
#endif
|
||||
int load_initfile=1;
|
||||
char plotfile[PATH_MAX] = {'\0'};
|
||||
char rcfile[PATH_MAX] = {'\0'};
|
||||
char *tcl_command = NULL;
|
||||
char tcl_script[PATH_MAX] = {'\0'};
|
||||
int persistent_command=0; /* remember last command 20181022 */
|
||||
int dis_uniq_names=0; /* if set allow instances with duplicate names */
|
||||
int quit=0; /* set from process_options (ex netlist from cmdline and quit) */
|
||||
int debug_var=-10; /* will be set to 0 in xinit.c */
|
||||
int tcp_port = 0;
|
||||
int do_print=0;
|
||||
int no_readline=0;
|
||||
int lw=0; /* line width */
|
||||
int bus_width = BUS_WIDTH;
|
||||
double lw_double=0.0; /* line width */
|
||||
int fill=1; /* filled rectangles */
|
||||
int draw_pixmap=1; /* use pixmap for double buffer */
|
||||
int draw_window=0;
|
||||
int draw_grid=1;
|
||||
double cadgrid = CADGRID;
|
||||
double cadhalfdotsize = CADHALFDOTSIZE;
|
||||
int change_lw=0; /* allow change linewidth */
|
||||
int incr_hilight=1;
|
||||
int auto_hilight=0;
|
||||
unsigned int color_index[256]; /* layer color lookup table */
|
||||
unsigned int rectcolor ; /* this is the currently used layer */
|
||||
unsigned long ui_state = 0; /* this signals that we are doing a net place,panning etc. */
|
||||
/* used to prevent nesting of some commands */
|
||||
char *undo_dirname = NULL;
|
||||
int cur_undo_ptr=0;
|
||||
int tail_undo_ptr=0;
|
||||
int head_undo_ptr=0;
|
||||
int max_undo=MAX_UNDO;
|
||||
int draw_dots=1;
|
||||
int draw_single_layer=-1;
|
||||
int check_version = 0; /* if set ensures 'v' version header line is present before loading file */
|
||||
int yyparse_error = 0;
|
||||
unsigned short enable_stretch=0;
|
||||
int cadlayers=0;
|
||||
int *enable_layer;
|
||||
int n_active_layers=0;
|
||||
int *active_layer;
|
||||
int need_rebuild_selected_array=1;
|
||||
int depth;
|
||||
int *fill_type; /*20171117 for every layer: 0: no fill, 1, solid fill, 2: stipple fill */
|
||||
char **color_array;
|
||||
int areax1,areay1,areax2,areay2,areaw,areah; /* window corners / size */
|
||||
int xschem_h, xschem_w; /* 20171130 window size */
|
||||
double mousex,mousey; /* mouse coord. */
|
||||
double mousex_snap,mousey_snap; /* mouse coord. snapped to grid */
|
||||
double mx_double_save, my_double_save;
|
||||
|
||||
char *xschem_executable=NULL;
|
||||
double cadsnap = CADSNAP;
|
||||
double *character[256]; /* array or per-char coordinates of xschem internal vector font */
|
||||
int lastselected = 0;
|
||||
int max_selected;
|
||||
Selected *selectedgroup; /* array of selected objects to be */
|
||||
/* drawn while moving if < MAXGROUP selected */
|
||||
XPoint *gridpoint; /* pointer to array of gridpoints, used in draw() */
|
||||
Tcl_Interp *interp;
|
||||
|
||||
int do_netlist=0; /* set by process_options if user wants netllist from cmdline */
|
||||
int do_simulation=0;
|
||||
int do_waves=0;
|
||||
|
|
@ -210,8 +222,6 @@ int pending_fullzoom=0;
|
|||
int split_files=0; /* split netlist files 20081202 */
|
||||
char *netlist_dir=NULL; /* user set netlist directory via cmd-option or menu or xschemrc */
|
||||
char user_top_netl_name[PATH_MAX] = ""; /* user set netlist name via cmd option -N <name> */
|
||||
XColor xcolor_array[256];
|
||||
Visual *visual;
|
||||
int dark_colorscheme=1;
|
||||
double color_dim=0.0;
|
||||
int no_undo=0;
|
||||
|
|
@ -225,19 +235,6 @@ int batch_mode = 0; /* no tcl console if set; batch mode */
|
|||
int hide_symbols = 0; /* draw only a bounding box for component instances and @symname, @name texts */
|
||||
int show_pin_net_names = 0;
|
||||
|
||||
#ifdef HAS_CAIRO
|
||||
cairo_surface_t *sfc, *save_sfc;
|
||||
cairo_t *cairo_ctx, *cairo_save_ctx;
|
||||
XRenderPictFormat *format;
|
||||
|
||||
#if HAS_XCB==1
|
||||
xcb_connection_t *xcbconn;
|
||||
xcb_render_pictforminfo_t format_rgb, format_rgba;
|
||||
xcb_screen_t *screen_xcb;
|
||||
xcb_visualtype_t *visual_xcb;
|
||||
#endif /*HAS_XCB */
|
||||
|
||||
#endif /*HAS_CAIRO */
|
||||
char cairo_font_name[1024]="Monospace";
|
||||
int cairo_longest_line;
|
||||
int cairo_lines;
|
||||
|
|
|
|||
48
src/xinit.c
48
src/xinit.c
|
|
@ -162,33 +162,33 @@ void windowid()
|
|||
unsigned int framewindow_nchildren;
|
||||
|
||||
framewindow_nchildren =0;
|
||||
mainwindow=Tk_MainWindow(interp);
|
||||
display = Tk_Display(mainwindow);
|
||||
tcleval( "winfo id .");
|
||||
sscanf(tclresult(), "0x%x", (unsigned int *) &ww);
|
||||
framewin = ww;
|
||||
XQueryTree(display, framewin, &rootwindow, &parent_of_topwindow, &framewin_child_ptr, &framewindow_nchildren);
|
||||
dbg(1,"framewinID=%x\n", (unsigned int) framewin);
|
||||
dbg(1,"framewin nchilds=%d\n", (unsigned int)framewindow_nchildren);
|
||||
dbg(1,"framewin parentID=%x\n", (unsigned int) parent_of_topwindow);
|
||||
if (debug_var>=1) {
|
||||
if (framewindow_nchildren==0) fprintf(errfp, "no framewin child\n");
|
||||
else fprintf(errfp, "framewin child 0=%x\n", (unsigned int)framewin_child_ptr[0]);
|
||||
}
|
||||
mainwindow=Tk_MainWindow(interp);
|
||||
display = Tk_Display(mainwindow);
|
||||
tcleval( "winfo id .");
|
||||
sscanf(tclresult(), "0x%x", (unsigned int *) &ww);
|
||||
framewin = ww;
|
||||
XQueryTree(display, framewin, &rootwindow, &parent_of_topwindow, &framewin_child_ptr, &framewindow_nchildren);
|
||||
dbg(1,"framewinID=%x\n", (unsigned int) framewin);
|
||||
dbg(1,"framewin nchilds=%d\n", (unsigned int)framewindow_nchildren);
|
||||
dbg(1,"framewin parentID=%x\n", (unsigned int) parent_of_topwindow);
|
||||
if (debug_var>=1) {
|
||||
if (framewindow_nchildren==0) fprintf(errfp, "no framewin child\n");
|
||||
else fprintf(errfp, "framewin child 0=%x\n", (unsigned int)framewin_child_ptr[0]);
|
||||
}
|
||||
|
||||
/* here I create the icon pixmap,to be used when iconified, */
|
||||
/* here I create the icon pixmap,to be used when iconified, */
|
||||
#ifdef __unix__
|
||||
if(!cad_icon_pixmap) {
|
||||
i=XpmCreatePixmapFromData(display,framewin, cad_icon,&cad_icon_pixmap, NULL, NULL);
|
||||
dbg(1, "Tcl_AppInit(): creating icon pixmap returned: %d\n",i);
|
||||
hints_ptr = XAllocWMHints();
|
||||
hints_ptr->icon_pixmap = cad_icon_pixmap ;
|
||||
hints_ptr->flags = IconPixmapHint ;
|
||||
XSetWMHints(display, parent_of_topwindow, hints_ptr);
|
||||
XFree(hints_ptr);
|
||||
}
|
||||
if(!cad_icon_pixmap) {
|
||||
i=XpmCreatePixmapFromData(display,framewin, cad_icon,&cad_icon_pixmap, NULL, NULL);
|
||||
dbg(1, "Tcl_AppInit(): creating icon pixmap returned: %d\n",i);
|
||||
hints_ptr = XAllocWMHints();
|
||||
hints_ptr->icon_pixmap = cad_icon_pixmap ;
|
||||
hints_ptr->flags = IconPixmapHint ;
|
||||
XSetWMHints(display, parent_of_topwindow, hints_ptr);
|
||||
XFree(hints_ptr);
|
||||
}
|
||||
#endif
|
||||
Tcl_SetResult(interp,"",TCL_STATIC);
|
||||
Tcl_SetResult(interp,"",TCL_STATIC);
|
||||
}
|
||||
|
||||
int err(Display *display, XErrorEvent *xev)
|
||||
|
|
|
|||
100
src/xschem.h
100
src/xschem.h
|
|
@ -101,6 +101,16 @@ extern char win_temp_dir[PATH_MAX];
|
|||
#define xftell _ftelli64
|
||||
#endif
|
||||
|
||||
#ifdef HAS_CAIRO
|
||||
#include <cairo.h>
|
||||
#include <cairo-xlib.h>
|
||||
#include "cairo-xlib-xrender.h"
|
||||
#if HAS_XCB==1
|
||||
#include <X11/Xlib-xcb.h>
|
||||
#include <cairo-xcb.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <tcl.h>
|
||||
#include <tk.h>
|
||||
|
||||
|
|
@ -188,7 +198,6 @@ extern char win_temp_dir[PATH_MAX];
|
|||
#define SELECTED3 8
|
||||
#define SELECTED4 16
|
||||
|
||||
|
||||
#define WIRE 1 /* types of defined objects */
|
||||
#define xRECT 2
|
||||
#define LINE 4
|
||||
|
|
@ -299,7 +308,7 @@ extern char win_temp_dir[PATH_MAX];
|
|||
#define Y_TO_XSCHEM(y) ((y)*xctx->zoom -xctx->yorigin)
|
||||
|
||||
/* given a dest_string of size 'size', allocate space to make sure it can
|
||||
* hold additional 'add' characters starting at position 'pos' */
|
||||
* hold 'add' characters */
|
||||
#define STR_ALLOC(dest_string, add, size) \
|
||||
do { \
|
||||
register int __str_alloc_tmp__ = add; \
|
||||
|
|
@ -606,7 +615,6 @@ extern int dis_uniq_names;
|
|||
extern int tcp_port;
|
||||
extern int debug_var;
|
||||
extern char **color_array;
|
||||
extern Colormap colormap;
|
||||
extern unsigned int color_index[];
|
||||
extern int lw; /* line width */
|
||||
extern int bus_width; /* line width */
|
||||
|
|
@ -628,8 +636,6 @@ extern KeySym key;
|
|||
extern unsigned short enable_stretch;
|
||||
extern unsigned int button;
|
||||
extern unsigned int state; /* status of shift,ctrl etc.. */
|
||||
extern XPoint *gridpoint;
|
||||
extern XRectangle *rectangle;
|
||||
extern Selected *selectedgroup; /* array of selected objs to draw while moving */
|
||||
extern int lastselected;
|
||||
extern int currentsch;
|
||||
|
|
@ -652,18 +658,10 @@ extern int draw_dots;
|
|||
extern int draw_single_layer;
|
||||
extern int check_version;
|
||||
extern int yyparse_error;
|
||||
extern Window window;
|
||||
extern Window pre_window;
|
||||
extern Window parent_of_topwindow;
|
||||
extern char *xschem_executable;
|
||||
extern Pixmap cad_icon_pixmap, *pixmap,save_pixmap;
|
||||
extern int depth;
|
||||
extern int *fill_type; /* 20171117 for every layer: 0: no fill, 1, solid fill, 2: stipple fill */
|
||||
extern unsigned char **pixdata;
|
||||
extern unsigned char pixdata_init[22][32];
|
||||
extern int areax1,areay1,areax2,areay2,areaw,areah;
|
||||
extern GC *gc, *gcstipple, gctiled;
|
||||
extern Display *display;
|
||||
extern Tcl_Interp *interp;
|
||||
extern XRectangle xrect[];
|
||||
extern int xschem_h, xschem_w; /* 20171130 window size */
|
||||
|
|
@ -691,8 +689,6 @@ extern int only_probes;
|
|||
extern int pending_fullzoom;
|
||||
extern int fullscreen;
|
||||
extern int unzoom_nodrift;
|
||||
extern XColor xcolor_array[];
|
||||
extern Visual *visual;
|
||||
extern int dark_colorscheme;
|
||||
extern double color_dim;
|
||||
extern int no_undo;
|
||||
|
|
@ -706,6 +702,43 @@ extern size_t get_tok_size;
|
|||
extern int batch_mode; /* no TCL console */
|
||||
extern int hide_symbols; /* draw only a bounding box for component instances and @symname, @name texts */
|
||||
extern int show_pin_net_names;
|
||||
/* CAIRO specific global variables */
|
||||
extern char cairo_font_name[1024]; /* should be monospaced */
|
||||
extern int cairo_longest_line;
|
||||
extern int cairo_lines;
|
||||
extern double cairo_font_scale; /* default: 1.0, allows to adjust font size */
|
||||
extern double nocairo_font_xscale;
|
||||
extern double nocairo_font_yscale;
|
||||
extern double cairo_font_line_spacing; /* allows to change line spacing: default: 1.0 */
|
||||
extern double cairo_vert_correct;
|
||||
extern double nocairo_vert_correct;
|
||||
extern const char fopen_read_mode[];
|
||||
|
||||
/* X11 specific globals */
|
||||
extern Colormap colormap;
|
||||
extern Window window;
|
||||
extern Window pre_window;
|
||||
extern Window parent_of_topwindow;
|
||||
extern unsigned char **pixdata;
|
||||
extern unsigned char pixdata_init[22][32];
|
||||
extern GC *gc, *gcstipple, gctiled;
|
||||
extern Display *display;
|
||||
extern XRectangle *rectangle;
|
||||
extern XPoint *gridpoint;
|
||||
extern Pixmap cad_icon_pixmap, *pixmap,save_pixmap;
|
||||
extern XColor xcolor_array[];
|
||||
extern Visual *visual;
|
||||
#ifdef HAS_CAIRO
|
||||
extern cairo_surface_t *sfc, *save_sfc;
|
||||
extern cairo_t *cairo_ctx, *cairo_save_ctx;
|
||||
extern XRenderPictFormat *format;
|
||||
#if HAS_XCB==1
|
||||
extern xcb_connection_t *xcbconn;
|
||||
extern xcb_screen_t *screen_xcb;
|
||||
extern xcb_render_pictforminfo_t format_rgb, format_rgba;
|
||||
extern xcb_visualtype_t *visual_xcb;
|
||||
#endif /* HAS_XCB */
|
||||
#endif /* HAS_CAIRO */
|
||||
|
||||
/* FUNCTIONS */
|
||||
extern void enable_layers(void);
|
||||
|
|
@ -1039,39 +1072,4 @@ extern const char *create_tmpdir(char *prefix);
|
|||
extern FILE *open_tmpfile(char *prefix, char **filename);
|
||||
extern void child_handler(int signum);
|
||||
|
||||
/* CAIRO specific global variables */
|
||||
extern char cairo_font_name[1024]; /* should be monospaced */
|
||||
extern int cairo_longest_line;
|
||||
extern int cairo_lines;
|
||||
extern double cairo_font_scale; /* default: 1.0, allows to adjust font size */
|
||||
extern double nocairo_font_xscale;
|
||||
extern double nocairo_font_yscale;
|
||||
|
||||
extern double cairo_font_line_spacing; /* allows to change line spacing: default: 1.0 */
|
||||
extern double cairo_vert_correct;
|
||||
extern double nocairo_vert_correct;
|
||||
extern const char fopen_read_mode[];
|
||||
#ifdef HAS_CAIRO
|
||||
#include <cairo.h>
|
||||
#include <cairo-xlib.h>
|
||||
#include "cairo-xlib-xrender.h"
|
||||
|
||||
# if HAS_XCB==1
|
||||
# include <X11/Xlib-xcb.h>
|
||||
# include <cairo-xcb.h>
|
||||
extern xcb_connection_t *xcbconn;
|
||||
extern xcb_screen_t *screen_xcb;
|
||||
extern xcb_render_pictforminfo_t format_rgb, format_rgba;
|
||||
extern xcb_visualtype_t *visual_xcb;
|
||||
# endif /* HAS_XCB */
|
||||
|
||||
extern cairo_surface_t *sfc, *save_sfc;
|
||||
extern cairo_t *cairo_ctx, *cairo_save_ctx;
|
||||
extern XRenderPictFormat *format;
|
||||
|
||||
|
||||
#endif /* HAS_CAIRO */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif /*CADGLOBALS */
|
||||
|
|
|
|||
Loading…
Reference in New Issue