Commit a5f9c58c authored by Claes's avatar Claes

Merge branch 'master' of 62.20.65.89:/data1/git/pwr

parents fd52a6be 152eaa00
......@@ -34,6 +34,11 @@ void usage()
{
printf("\
co_merge_methods\n\
\n\
Options:\n\
-k Keep c file.\n\
-v Verbose.\n\
\n\
Arguments : \n\
1. Method utility (io_base, wb_base, xtt_base) \n\
2. Methods files, e.g. $pwr_inc/io_base_*.meth\n\
......@@ -73,6 +78,7 @@ int main( int argc, char *argv[])
char mtab[1000][32];
int mtabcnt = 0;
int i;
int idx;
pwr_tCmd cmd;
pwr_tFileName incdir;
pwr_tFileName cfile;
......@@ -81,6 +87,8 @@ int main( int argc, char *argv[])
char pwre_cxx[80];
char pwre_ar[80];
char *s;
int arg_keep = 0;
int arg_verbose = 0;
int in_if = 0;
#if defined OS_LINUX
char dos[] = "OS_LINUX";
......@@ -89,7 +97,7 @@ int main( int argc, char *argv[])
#elif defined OS_FREEBSD
char dos[] = "OS_FREEBSD";
#endif
if ( argc != 4) {
if ( argc < 4) {
usage();
exit(1);
}
......@@ -108,19 +116,38 @@ int main( int argc, char *argv[])
strcpy( pwre_ar, "ar");
if ( strcmp( argv[1], "io_base") == 0)
idx = 0;
for ( i = 1; i < argc; i++) {
if ( strcmp( argv[i], "-k") == 0)
arg_keep = 1;
else if ( strcmp( argv[i], "-v") == 0)
arg_verbose = 1;
else {
switch ( idx) {
case 0:
if ( strcmp( argv[i], "io_base") == 0)
mtype = merge_eMtype_IoBase;
else if ( strcmp( argv[1], "wb_base") == 0)
else if ( strcmp( argv[i], "wb_base") == 0)
mtype = merge_eMtype_WbBase;
else if ( strcmp( argv[1], "xtt_base") == 0)
else if ( strcmp( argv[i], "xtt_base") == 0)
mtype = merge_eMtype_XttBase;
else {
usage();
exit(1);
}
strcpy( filespec, argv[2]);
strcpy( outfile, argv[3]);
idx++;
break;
case 1:
strcpy( filespec, argv[i]);
idx++;
break;
case 2:
strcpy( outfile, argv[i]);
idx++;
break;
}
}
}
sts = dcli_search_file( filespec, found_file, DCLI_DIR_SEARCH_INIT);
while ( ODD(sts)) {
fp = fopen( found_file, "r");
......@@ -235,14 +262,18 @@ int main( int argc, char *argv[])
default:
sprintf( cmd, "%s -c -I%s -D%s -o %s %s", pwre_cc, incdir, dos, ofile, cfile);
}
// printf( "co_merge: %s\n", cmd);
if ( arg_verbose)
printf( "co_merge: %s\n", cmd);
system( cmd);
sprintf( cmd, "%s r %s %s", pwre_ar, outfile, ofile);
// printf( "co_merge: %s\n", cmd);
if ( arg_verbose)
printf( "co_merge: %s\n", cmd);
system(cmd);
sprintf( cmd, "rm %s", ofile);
system(cmd);
if ( !arg_keep) {
sprintf( cmd, "rm %s", cfile);
system(cmd);
}
return 1;
}
......@@ -179,8 +179,8 @@ static GdkEvent last_event;
static GdkColor glow_allocate_named_color( GlowDrawGtk *draw_ctx, const char *named_color);
static GdkColor glow_allocate_color( GlowDrawGtk *draw_ctx, int rgb_red,
int rgb_green, int rgb_blue);
static void event_timer( GlowCtx *ctx, int time_ms);
static void cancel_event_timer(GlowCtx *ctx);
static void event_timer( GlowDrawGtk *ctx, int time_ms);
static void cancel_event_timer( GlowDrawGtk *ctx);
static gboolean event_timer_cb( void *ctx);
static int glow_read_color_file( const char *filename, draw_sColor **color_array,
int *size);
......@@ -731,13 +731,13 @@ int GlowDrawGtk::event_handler( GdkEvent event)
if ( button_clicked) {
/* Wait for release */
button_clicked_and_pressed = 1;
cancel_event_timer( ctx);
cancel_event_timer( this);
button_clicked = 0;
memcpy( &last_event, &event, sizeof(event));
button_pressed = event.button.button;
last_press_x = (int)event.button.x;
last_press_y = (int)event.button.y;
event_timer(ctx, 200);
event_timer( this, 200);
return 1;
}
if ( !button_pressed ) {
......@@ -745,7 +745,7 @@ int GlowDrawGtk::event_handler( GdkEvent event)
button_pressed = event.button.button;
last_press_x = (int)event.button.x;
last_press_y = (int)event.button.y;
event_timer(ctx, 200);
event_timer( this, 200);
return 1;
}
else {
......@@ -907,20 +907,20 @@ int GlowDrawGtk::event_handler( GdkEvent event)
}
else {
/* Button click */
cancel_event_timer( ctx);
cancel_event_timer( this);
if ( ! button_clicked_and_pressed) {
// cout << "Button first click detected" << endl;
/* wait for button double click */
memcpy( &last_event, &event, sizeof(event));
button_clicked = 1;
event_timer( ctx, 200);
event_timer( this, 200);
button_pressed = 0;
return 1;
}
else {
/* Button double click */
// cout << "Button double click detected" << endl;
cancel_event_timer( ctx);
cancel_event_timer( this);
button_clicked = 0;
button_pressed = 0;
button_clicked_and_pressed = 0;
......@@ -1030,7 +1030,7 @@ int GlowDrawGtk::event_handler( GdkEvent event)
event.button.y = last_press_y;
/* Button press */
cancel_event_timer( ctx);
cancel_event_timer( this);
switch ( button_pressed) {
case 1: // Button1
button1_pressed = 1;
......@@ -1887,16 +1887,15 @@ static gboolean draw_timer_cb( void *data)
static gboolean event_timer_cb( void *ctx)
{
// printf( "Timer callback\n");
GlowDrawGtk *draw_ctx = (GlowDrawGtk *) ((GlowCtx *)ctx)->gdraw;
GlowDrawGtk *draw_ctx = (GlowDrawGtk *)ctx;
draw_ctx->timer_id = 0;
draw_ctx->event_handler( last_event);
return FALSE;
}
static void cancel_event_timer( GlowCtx *ctx)
static void cancel_event_timer( GlowDrawGtk *draw_ctx)
{
GlowDrawGtk *draw_ctx = (GlowDrawGtk *) ctx->gdraw;
if ( draw_ctx->timer_id) {
g_source_remove( draw_ctx->timer_id);
draw_ctx->timer_id = 0;
......@@ -1904,12 +1903,10 @@ static void cancel_event_timer( GlowCtx *ctx)
// printf( "Timer removed\n");
}
static void event_timer( GlowCtx *ctx, int time_ms)
static void event_timer( GlowDrawGtk *draw_ctx, int time_ms)
{
GlowDrawGtk *draw_ctx = (GlowDrawGtk *) ctx->gdraw;
// printf( "Add timer\n");
draw_ctx->timer_id = g_timeout_add( time_ms, event_timer_cb, ctx);
draw_ctx->timer_id = g_timeout_add( time_ms, event_timer_cb, draw_ctx);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment