コード例 #1
0
void
Printer_abort_doc( Handle self)
{
	if ( !is_opt( optInDraw)) return;
	inherited end_paint( self);
	apc_prn_abort_doc( self);
}
コード例 #2
0
Bool
Printer_end_doc( Handle self)
{
	Bool ret;
	if ( !is_opt( optInDraw)) return false;
	ret = apc_prn_end_doc( self);
	inherited end_paint( self);
	if ( !ret) perl_error();
	return ret;
}
コード例 #3
0
Bool
Printer_begin_doc( Handle self, char * docName)
{
	Bool ok;
	char buf[ 256];
	if ( is_opt( optInDraw)) return false;
	if ( !docName || *docName == '\0') {
		snprintf( buf, 256, "APC: %s", (( PComponent) application)-> name);
		docName = buf;
	}
	if ( is_opt( optInDrawInfo))
		my-> end_paint_info( self);
	if ( !inherited begin_paint( self))
		return false;
	if ( !( ok = apc_prn_begin_doc( self, docName))) {
		inherited end_paint( self);
		perl_error();
	}
	return ok;
}
コード例 #4
0
ファイル: hsi_window.c プロジェクト: kotuku-aero/diy-efis
result_t widget_wndproc(handle_t hwnd, const canmsg_t *msg)
  {
  bool changed = false;
  hsi_window_t *wnd;
  get_wnddata(hwnd, (void **)&wnd);

  switch (msg->id)
    {
    case id_magnetic_heading:
    {
    int16_t direction;
    get_param_int16(msg, 0, &direction);

    while (direction < 0)
      direction += 360;
    while (direction > 359)
      direction -= 360;

    changed = wnd->direction != direction;
    wnd->direction = direction;
    }
    break;
    case id_heading:
    {
    int16_t value;
    get_param_int16(msg, 0, &value);
    changed = wnd->heading_bug != value;
    wnd->heading_bug = value;
    }
    break;
    case id_heading_angle:
    {
    int16_t value;
    get_param_int16(msg, 0, &value);
    changed = wnd->heading != value;
    wnd->heading = value;
    }
    break;
    case id_deviation:
    {
    int16_t value;
    get_param_int16(msg, 0, &value);
    changed = wnd->deviation != value;
    wnd->deviation = value;
    // the deviation is +/- * 10
    }
    break;
    case id_selected_course:
    {
    int16_t value;
    get_param_int16(msg, 0, &value);
    changed = wnd->course != value;
    wnd->course = value;
    }
    break;
    case id_track:
    {
    int16_t value;
    get_param_int16(msg, 0, &value);
    changed = wnd->track != value;
    wnd->track = value;
    }
    break;
    case id_wind_speed:
    {
    float v;
    get_param_float(msg, &v);
    int16_t value = (int16_t)meters_per_second_to_knots(v);
    changed = wnd->wind_speed != value;
    wnd->wind_speed = value;
    }
    break;
    case id_wind_direction:
    {
    float v;
    get_param_float(msg, &v);
    int16_t value = (int16_t)radians_to_degrees(v);
    changed = wnd->wind_direction != value;
    wnd->wind_direction != value;
    }
    break;
    case id_distance_to_next:
    {
    float v;
    get_param_float(msg, &v);
    int16_t value = (int16_t)meters_to_nm(v);
    changed = wnd->distance_to_waypoint != value;
    wnd->distance_to_waypoint = value;
    }
    break;
    case id_magnetic_variation:
    {
    float v;
    get_param_float(msg, &v);
    int16_t value = (int16_t)radians_to_degrees(v);
    changed = wnd->magnetic_variation != value;
    wnd->magnetic_variation = value;
    }
    break;
    case id_estimated_time_to_next:
    {
    int16_t value;
    get_param_int16(msg, 0, &value);
    changed = wnd->time_to_waypoint != value;
    wnd->time_to_waypoint = value;
    }
    break;
    case id_paint:
      begin_paint(hwnd);
      update_window(hwnd, wnd);
      end_paint(hwnd);
      break;
    default:
      return defwndproc(hwnd, msg);
    }

  if (changed)
    invalidate_rect(hwnd, 0);

  return s_ok;
  }