[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linrad] users_hardware.c correction



Hi, All,

It is late but I thought I would post this so I don't forget to do so.

For 'quite a while' I have put my addon routines directly in hwaredriver.c or more recently in users_extras.c because everytime I put anything in users.c renamed to users_hwaredriver.c I got error messages and a failure to compile.

I REALLY needed to implement Leif's nice window/parameter protype routines for an extra parameter window in Linrad, and these are in users.c, so this evening I got off my lazy butt and looked for the answer to the problem instead of just working around it.

The problem is solved with just a little change of the code. It is due to a single misplaced "}", which needs to be removed from one line and added a few lines higher in the code. I hope that I have placed the bracket correctly. It compiles fine and so far the code seems to work reasonably well with the bracket placed as I have shown it. The missing bracket was added at [or about] line 335.

Immediately below is a fragment of the corrected code, and below that the original code which needed correction:

corrected code:

if(mouse_x > ug.xleft+2*text_width && mouse_x<ug.xright-2*text_width)
  {
  if(mouse_y > (ug.ytop+ug.ybottom)/2)
    {
    numinput_ypix=ug.ytop+2*text_height;
    numinput_chars=12;
    erase_numinput_txt();
    numinput_flag=FIXED_FLOAT_PARM;
    par_from_keyboard_routine=new_user_par2;
    }
  else
    {
    numinput_ypix=ug.ytop+text_height;
    numinput_chars=4;
    erase_numinput_txt();
    numinput_flag=FIXED_INT_PARM;
    par_from_keyboard_routine=new_user_par1;
    }
   } //added } <----added "}" HERE
  else
    {
// If we did not select a numeric input by setting numinput_flag
// we have to set mouse_active flag.
// Set the routine to mouse_nothing, we just want to
// set flags when the mouse button is released.
    current_mouse_activity=mouse_nothing;
    mouse_active_flag=1;
    }
// } <---- removed "}" HERE
}


old [needed correction]:

if(mouse_x > ug.xleft+2*text_width && mouse_x<ug.xright-2*text_width)
  {
  if(mouse_y > (ug.ytop+ug.ybottom)/2)
    {
    numinput_ypix=ug.ytop+2*text_height;
    numinput_chars=12;
    erase_numinput_txt();
    numinput_flag=FIXED_FLOAT_PARM;
    par_from_keyboard_routine=new_user_par2;
    }
  else
    {
    numinput_ypix=ug.ytop+text_height;
    numinput_chars=4;
    erase_numinput_txt();
    numinput_flag=FIXED_INT_PARM;
    par_from_keyboard_routine=new_user_par1;
    }
  else
    {
// If we did not select a numeric input by setting numinput_flag
// we have to set mouse_active flag.
// Set the routine to mouse_nothing, we just want to
// set flags when the mouse button is released.
    current_mouse_activity=mouse_nothing;
    mouse_active_flag=1;
    }
  }
}



Hope that helps, and

73,

Roger
W3SZ

--
Roger Rehr
W3SZ
http://www.nitehawk.com/w3sz/

#############################################################
This message is sent to you because you are subscribed to
 the mailing list <linrad@xxxxxxxxxxxxxxxxxxxxx>.
To unsubscribe, E-mail to: <linrad-off@xxxxxxxxxxxxxxxxxxxxx>
To switch to the DIGEST mode, E-mail to <linrad-digest@xxxxxxxxxxxxxxxxxxxxx>
To switch to the INDEX mode, E-mail to <linrad-index@xxxxxxxxxxxxxxxxxxxxx>
Send administrative queries to  <linrad-request@xxxxxxxxxxxxxxxxxxxxx>

LINRADDARNIL