Exemple #1
0
void TEventWindow::set_background(float r, float g, float b)
//-----------------------------------------
{
    COLORREF rgb = RGBF(r,g,b);
    m_bkgnd_brush = CreateSolidBrush(rgb);
    get_dc()->get(this);
    SetBkColor(get_dc()->get_hdc(),rgb);
    get_dc()->select(m_bkgnd_brush);
    m_bk_color = rgb;
    get_dc()->release(this);
    invalidate();
}
Exemple #2
0
static void get_cylinderindex(char *buffer, void *_i)
{
	int *i = _i;
	*i = atoi(buffer);
	if (lastcylinderindex != *i) {
		add_gas_switch_event(cur_dive, get_dc(), cur_sample->time.seconds, *i);
		lastcylinderindex = *i;
	}
}
Exemple #3
0
//----TEventWindow class member definitions---------------------
TEventWindow::TEventWindow(pchar caption, TWin *parent, dword style)
//-----------------------------------------------------------------
{
  set_defaults();
  if (style) m_style |= style;
  create_window(caption, parent);
  get_dc()->set_text_align(TA_TOP | TA_LEFT);
  enable_resize(true);
}
Exemple #4
0
static void uddf_gasswitch(char *buffer, void *_sample)
{
	struct sample *sample = _sample;
	int idx = atoi(buffer);
	int seconds = sample->time.seconds;
	struct dive *dive = cur_dive;
	struct divecomputer *dc = get_dc();

	add_gas_switch_event(dive, dc, seconds, idx);
}
Exemple #5
0
static void sample_start(void)
{
	cur_sample = prepare_sample(get_dc());
	cur_sample->ndl.seconds = lastndl;
	cur_sample->in_deco = lastindeco;
	cur_sample->stoptime.seconds = laststoptime;
	cur_sample->stopdepth.mm = laststopdepth;
	cur_sample->cns = lastcns;
	cur_sample->po2 = lastpo2;
	cur_sample->sensor = lastsensor;
}
Exemple #6
0
static void event_end(void)
{
	struct divecomputer *dc = get_dc();
	if (cur_event.name) {
		if (strcmp(cur_event.name, "surface") != 0)
			add_event(dc, cur_event.time.seconds,
				cur_event.type, cur_event.flags,
				cur_event.value, cur_event.name);
		free((void *)cur_event.name);
	}
	cur_event.active = 0;
}
Exemple #7
0
static void sample_end(void)
{
	if (!cur_dive)
		return;

	finish_sample(get_dc());
	lastndl = cur_sample->ndl.seconds;
	lastindeco = cur_sample->in_deco;
	laststoptime = cur_sample->stoptime.seconds;
	laststopdepth = cur_sample->stopdepth.mm;
	lastcns = cur_sample->cns;
	lastpo2 = cur_sample->po2;
	cur_sample = NULL;
}
Exemple #8
0
int TEventWindow::metrics(int ntype)
//----------------------------------
// Encapsulates what we need from GetSystemMetrics() and GetTextMetrics()
{
    if (ntype < TM_CAPTION_HEIGHT) { // text metrics
       TEXTMETRIC tm;
       GetTextMetrics(get_dc()->get_hdc(),&tm);
       if (ntype == TM_CHAR_HEIGHT) return tm.tmHeight; else
       if (ntype == TM_CHAR_WIDTH)  return tm.tmMaxCharWidth;
    } else {
        switch(ntype) { 
        case TM_CAPTION_HEIGHT: return GetSystemMetrics(SM_CYMINIMIZED);
        case TM_MENU_HEIGHT: return GetSystemMetrics(SM_CYMENU);
        case TM_CLIENT_EXTRA:
            return metrics(TM_CAPTION_HEIGHT) + (m_hmenu != NULL) ? metrics(TM_MENU_HEIGHT) : 0; 
        case TM_SCREEN_WIDTH:  return GetSystemMetrics(SM_CXMAXIMIZED); 
        case TM_SCREEN_HEIGHT: return GetSystemMetrics(SM_CYMAXIMIZED);
        default: return 0;
        }       
    }
    return 0;
}
void calculate_sky_patches (int dc_direct_resolution, int dif_pts, int dir_pts, int *number_direct_coefficients)
{
	int 	i,j;
	double alt, azi;
	FILE *DIFFUSE_POINTS_FILE;
	FILE *DIRECT_POINTS_FILE;
	get_dc(dc_direct_resolution,number_direct_coefficients);	/* calculate daylight coefficients depending on site */

	if (dir_pts) {/* print direct daylight coefficients */
		DIRECT_POINTS_FILE=open_output(direct_points_file);
		for(i=0; i< *number_direct_coefficients ; i++){fprintf(DIRECT_POINTS_FILE," %f %f %f \n",direct_pts[i][0],direct_pts[i][1],direct_pts[i][2]);}
		i=close_file(DIRECT_POINTS_FILE);
	}
	if (dif_pts) {/* print diffuse daylight coefficients */
		DIFFUSE_POINTS_FILE=open_output(diffuse_points_file);
		for(i=0; i<= 144; i++){fprintf(DIFFUSE_POINTS_FILE," %f %f 0.0 \n",diffuse_pts[i][0],diffuse_pts[i][1]);}
		i=close_file(DIFFUSE_POINTS_FILE);

	}

	/* print radiance file for direct suns */
	if(dc_coupling_mode ==2){
		if(!strcmp(direct_radiance_file,"")){
			error(USER, "shadow testing turned on but no direct radiance file specified in header!");
		}else{
			DIFFUSE_POINTS_FILE=open_output(direct_radiance_file);
			for(j=0; j< *number_direct_coefficients; j++){
				fprintf(DIFFUSE_POINTS_FILE,"void light solar%d\n0 \n0 \n3 1000 1000 1000\n\n",j+1);
				fprintf(DIFFUSE_POINTS_FILE,"solar%d source sun\n0\n0\n",j+1);
				alt = radians(90 - direct_pts[j][1]);
				azi = -radians(direct_pts[j][2] + 90);
				fprintf(DIFFUSE_POINTS_FILE,"4 %f %f %f 0.533\n\n",sin(alt)*cos(azi),sin(alt)*sin(azi),cos(alt));
			}
			i=close_file(DIFFUSE_POINTS_FILE);
		}
	}


}
Exemple #10
0
 void paint(TDC& dc) {
   get_dc()->set_colour(0,0,0);
 }
Exemple #11
0
 unique_hdc(HWND hwnd) : m_hwnd(hwnd), m_hdc(get_dc(hwnd)) {}