add portable sleep_ms() function
This commit is contained in:
parent
391a744302
commit
52e36cc46b
|
|
@ -2147,77 +2147,32 @@ int rstate; /* (reduced state, without ShiftMask) */
|
||||||
static int x = 0;
|
static int x = 0;
|
||||||
|
|
||||||
if(x == 0) {
|
if(x == 0) {
|
||||||
XFillRectangle(display, xctx->window, xctx->gctiled,
|
|
||||||
xctx->xrect[0].x, xctx->xrect[0].y, xctx->xrect[0].width, xctx->xrect[0].height);
|
|
||||||
} else if(x == 1) {
|
|
||||||
int i;
|
|
||||||
for(i = xctx->xrect[0].y; i < xctx->xrect[0].height; i++) {
|
|
||||||
XDrawLine(display, xctx->window, xctx->gctiled,
|
|
||||||
xctx->xrect[0].x, i, xctx->xrect[0].width, i);
|
|
||||||
}
|
|
||||||
} else if(x == 2) {
|
|
||||||
int i;
|
int i;
|
||||||
|
XFillRectangle(display, xctx->window, xctx->gc[BACKLAYER], xctx->areax1, xctx->areay1,
|
||||||
|
xctx->areaw, xctx->areah);
|
||||||
|
XFlush(display);
|
||||||
|
sleep_ms(400);
|
||||||
for(i = xctx->xrect[0].x; i < xctx->xrect[0].width; i++) {
|
for(i = xctx->xrect[0].x; i < xctx->xrect[0].width; i++) {
|
||||||
XDrawLine(display, xctx->window, xctx->gctiled,
|
XDrawLine(display, xctx->window, xctx->gctiled,
|
||||||
i, xctx->xrect[0].y, i, xctx->xrect[0].height);
|
i, xctx->xrect[0].y, i, xctx->xrect[0].height);
|
||||||
|
XFlush(display);
|
||||||
|
sleep_ms(4);
|
||||||
}
|
}
|
||||||
} else if(x == 3) {
|
} else if(x == 1) {
|
||||||
int i, j;
|
int i;
|
||||||
for(i = 0; i < xctx->xrect[0].width; i+=1) {
|
XFillRectangle(display, xctx->window, xctx->gc[BACKLAYER], xctx->areax1, xctx->areay1,
|
||||||
for(j = 0; j < xctx->xrect[0].height; j+=1) {
|
xctx->areaw, xctx->areah);
|
||||||
|
XFlush(display);
|
||||||
|
sleep_ms(400);
|
||||||
|
for(i = xctx->xrect[0].x; i < xctx->xrect[0].width; i++) {
|
||||||
XDrawLine(display, xctx->window, xctx->gctiled,
|
XDrawLine(display, xctx->window, xctx->gctiled,
|
||||||
i, xctx->xrect[0].y, xctx->xrect[0].width - i, j);
|
i, xctx->xrect[0].y, i+1, xctx->xrect[0].height);
|
||||||
|
XFlush(display);
|
||||||
XDrawLine(display, xctx->window, xctx->gctiled,
|
sleep_ms(4);
|
||||||
xctx->xrect[0].width - i, xctx->xrect[0].y, i, j);
|
|
||||||
|
|
||||||
XDrawLine(display, xctx->window, xctx->gctiled,
|
|
||||||
i, xctx->xrect[0].height, xctx->xrect[0].width - i, j);
|
|
||||||
|
|
||||||
XDrawLine(display, xctx->window, xctx->gctiled,
|
|
||||||
xctx->xrect[0].width - i, xctx->xrect[0].height, i, j);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if(x == 4) {
|
|
||||||
int i, j;
|
|
||||||
XPoint p[2];
|
|
||||||
for(i = 0; i < xctx->xrect[0].width; i+=1) {
|
|
||||||
for(j = 0; j < xctx->xrect[0].height; j+=1) {
|
|
||||||
p[0].x = (short int)i;
|
|
||||||
p[0].y = (short int)(xctx->xrect[0].y);
|
|
||||||
p[1].x = (short int)(xctx->xrect[0].width - i);
|
|
||||||
p[1].y = (short int)j;
|
|
||||||
XDrawLines(display, xctx->window, xctx->gctiled,
|
|
||||||
p, 2, CoordModeOrigin);
|
|
||||||
|
|
||||||
p[0].x = (short int)(xctx->xrect[0].width - i);
|
|
||||||
p[0].y = (short int)xctx->xrect[0].y;
|
|
||||||
p[1].x = (short int)i;
|
|
||||||
p[1].y = (short int)j;
|
|
||||||
XDrawLines(display, xctx->window, xctx->gctiled,
|
|
||||||
p, 2, CoordModeOrigin);
|
|
||||||
|
|
||||||
p[0].x = (short int)i;
|
|
||||||
p[0].y = (short int)xctx->xrect[0].height;
|
|
||||||
p[1].x = (short int)(xctx->xrect[0].width - i);
|
|
||||||
p[1].y = (short int)j;
|
|
||||||
XDrawLines(display, xctx->window, xctx->gctiled,
|
|
||||||
p, 2, CoordModeOrigin);
|
|
||||||
|
|
||||||
p[0].x = (short int)(xctx->xrect[0].width - i);
|
|
||||||
p[0].y = (short int)xctx->xrect[0].height;
|
|
||||||
p[1].x = (short int)i;
|
|
||||||
p[1].y = (short int)j;
|
|
||||||
XDrawLines(display, xctx->window, xctx->gctiled,
|
|
||||||
p, 2, CoordModeOrigin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
here(x);
|
|
||||||
x++;
|
x++;
|
||||||
x %= 5;
|
x %= 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(key=='u' && rstate==0) /* undo */
|
if(key=='u' && rstate==0) /* undo */
|
||||||
|
|
|
||||||
14
src/check.c
14
src/check.c
|
|
@ -21,7 +21,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "xschem.h"
|
#include "xschem.h"
|
||||||
|
#include <sys/select.h> /* select() */
|
||||||
static int check_includes(double x1a, double y1a, double x2a, double y2a,
|
static int check_includes(double x1a, double y1a, double x2a, double y2a,
|
||||||
double x1b, double y1b, double x2b, double y2b)
|
double x1b, double y1b, double x2b, double y2b)
|
||||||
{
|
{
|
||||||
|
|
@ -116,6 +116,18 @@ void update_conn_cues(int layer, int draw_cues, int dr_win)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sleep_ms(int milliseconds)
|
||||||
|
{
|
||||||
|
#ifdef __unix__
|
||||||
|
struct timeval tv;
|
||||||
|
tv.tv_sec = milliseconds / 1000;
|
||||||
|
tv.tv_usec = milliseconds % 1000 * 1000;
|
||||||
|
select(0, NULL, NULL, NULL, &tv);
|
||||||
|
#else
|
||||||
|
Sleep(milliseconds);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/* start = 0: initialize timer
|
/* start = 0: initialize timer
|
||||||
* start = 1: return elapsed time since previous call
|
* start = 1: return elapsed time since previous call
|
||||||
* start = 2: return total time from initialize */
|
* start = 2: return total time from initialize */
|
||||||
|
|
|
||||||
|
|
@ -1224,6 +1224,7 @@ extern int find_closest_wave(int i, Graph_ctx *gr);
|
||||||
extern void setup_graph_data(int i, int skip, Graph_ctx *gr);
|
extern void setup_graph_data(int i, int skip, Graph_ctx *gr);
|
||||||
extern int graph_fullyzoom(xRect *r, Graph_ctx *gr, int graph_dataset);
|
extern int graph_fullyzoom(xRect *r, Graph_ctx *gr, int graph_dataset);
|
||||||
extern int graph_fullxzoom(int i, Graph_ctx *gr, int dataset);
|
extern int graph_fullxzoom(int i, Graph_ctx *gr, int dataset);
|
||||||
|
extern void sleep_ms(int milliseconds);
|
||||||
extern double timer(int start);
|
extern double timer(int start);
|
||||||
extern void enable_layers(void);
|
extern void enable_layers(void);
|
||||||
extern void set_snap(double);
|
extern void set_snap(double);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue