Exemple #1
0
void
DeviceBitmap_init( Handle self, HV * profile)
{
   dPROFILE;
   inherited init( self, profile);
   var-> w = pget_i( width);
   var-> h = pget_i( height);
   var-> monochrome = pget_B( monochrome);
   if ( !apc_dbm_create( self, var-> monochrome))
      croak("RTC0110: Cannot create device bitmap");
   inherited begin_paint( self);
   opt_set( optInDraw);
   CORE_INIT_TRANSIENT(DeviceBitmap);
}
Exemple #2
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;
}
Exemple #3
0
  LRESULT seq_tab_dialog::window_proc(HWND hwnd,uint32_t message, WPARAM wParam, LPARAM lParam)
  {
    switch(message)
    {
    case WM_INITDIALOG:
      create_device();
      break;
    case WM_SIZE:
      //resize();
      break;
    case WM_CTLCOLORDLG:
    case WM_CTLCOLORSTATIC:
    case WM_CTLCOLOREDIT:
    case WM_CTLCOLORLISTBOX:
    case WM_CTLCOLORBTN:
      SetBkMode((HDC)wParam,TRANSPARENT);
      return  (LRESULT)GetStockObject( NULL_BRUSH ); ;
    case WM_ERASEBKGND:
      return FALSE;
    case WM_PAINT:
      {

        { 
          paint_struct begin_paint(hwnd);
          //CloseHandle(cb);
          // 描画コードの呼び出し
          render();

        }
      }
      break;
    case WM_CLOSE:
      discard_device();
      return FALSE;
    }
    return FALSE;

  };
Exemple #4
0
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;
  }