⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nxsunclock.cxx

📁 PIXIL is a small footprint operating environment, complete with PDA PIM applications, a browser and
💻 CXX
📖 第 1 页 / 共 4 页
字号:
	t_x += (w - (2 * BUTTON_WIDTH));    }				// end of Home Time Zone information output widget    {	// TR Button	NxButton *o =	    new NxButton(t_x, t_y, BUTTON_WIDTH, (3 * BUTTON_HEIGHT));	o->when(FL_WHEN_RELEASE_ALWAYS);	o->box(FL_BORDER_BOX);	o->label("Set Date/Time");	o->callback(set_dt_tm_cb, (void *) this);    }				// end of Set Date/Time button widget    t_y += (3 * BUTTON_HEIGHT);    {	// Main button (NxImage())	int dynsz;	Fl_Button *o = _sunbutton = new Fl_Button(0, t_y,						  gimp_image.width,						  gimp_image.height);	o->box(FL_FLAT_BOX);	o->down_box(o->box());	o->align(FL_ALIGN_INSIDE);	o->when(FL_WHEN_RELEASE);	o->callback(map_click_cb, (void *) this);	dynsz =	    gimp_image.height * gimp_image.width * gimp_image.bytes_per_pixel;	_sun_array = new unsigned char[dynsz];	memcpy(_sun_array, gimp_image.pixel_data, dynsz);	_sunmap = new Fl_Image(_sun_array, gimp_image.width, gimp_image.height, 4);	//gimp_image.bytes_per_pixel);//              _sunmap->setvdata(1);	_sunmap->label(o);    }    {	// Citylist popup menu	NxMenuButton *o = _selcity = new NxMenuButton(0, t_y, 0, 0);	o->when(FL_WHEN_RELEASE);	o->callback(sel_city_cb, (void *) this);	o->textsize(DEFAULT_TEXT_SIZE);	o->textfont(DEFAULT_TEXT_FONT);	o->type(Fl_Menu_Button::POPUP3);//              o->hide();    }				// end of the city select browser    b_y = t_y + gimp_image.height;    {	// BL Button	NxButton *o =	    new NxButton(b_x, b_y, BUTTON_WIDTH, (3 * BUTTON_HEIGHT),			 "Save");	o->when(FL_WHEN_RELEASE_ALWAYS);	o->callback(save_exit_cb, (void *) this);	o->box(FL_BORDER_BOX);	b_x += BUTTON_WIDTH;    }				// end of Set Visiting TimeZone button widget    {	// B Text	NxButton *o = _tzbtns[(int) tzVISIT] =	    new NxButton(b_x, b_y, (w - (2 * BUTTON_WIDTH)),			 (3 * BUTTON_HEIGHT));	NxBox *p = new NxBox(b_x, b_y + o->h(),			     (w - (2 * BUTTON_WIDTH)), BUTTON_HEIGHT);	o->box(FL_BORDER_BOX);	p->box(FL_FLAT_BOX);	o->when(FL_WHEN_RELEASE_ALWAYS);	p->when(FL_WHEN_NEVER);	o->callback(Toggle_tz_cb);	//if (_eCurTzMode != tzVISIT)	//o->labelcolor(NxApp::Instance()->getGlobalColor(APP_FG));	//p->color(NxApp::getGlobalColor(APP_BG));	//p->labelcolor(NxApp::getGlobalColor(APP_FG));	p->label("Visiting Location");	b_x += (w - (2 * BUTTON_WIDTH));    }				// end of Visiting Time Zone information output widget    {	// BR Button	NxButton *o =	    new NxButton(b_x, b_y, BUTTON_WIDTH, (3 * BUTTON_HEIGHT),			 "Reset");	o->when(FL_WHEN_RELEASE_ALWAYS);	o->callback(save_exit_cb);	o->box(FL_BORDER_BOX);    }				// end of Set timeout    _sunwin->end();    return;}				// end of nxSunclock::MakeSunwin(int, int)#endif/*******************************************************************************\****	Function:	void SetAppPrefs()**	Desc:		Stores the changed (i.e. dirty) prefences into the PAR**	Accepts:	Nothing (void)**	Returns:	Nothing (void)**\*******************************************************************************/voidnxSunclock::SetAppPrefs(void){#ifdef NOTUSED    char par_data[512];		// string data#endif    char *pardb;		// Ptr to the default db name    db_handle *parH;		// Handle to the db    // Get the default name    if ((pardb = db_getDefaultDB()) == NULL) {	// Error accessing db	printf("Unable to find PAR!");	printf("Ignoring %s changes!", UTILITY_NAME);	return;    }				// end of if    // Open the database    if ((parH = db_openDB(pardb, PAR_DB_MODE_RW)) == NULL) {	// Error opening db	printf("Unable to open %s.", pardb);	printf("Ignoring %s changes!", UTILITY_NAME);	return;    }				// end of if#ifdef NOTUSED    // Begin updating database    if (_app_settings.dirty_flgs & APP_DFLGS_HOME) {	sprintf(par_data, "%s,%s,%s", _app_settings.cities[(int) tzHOME].name,		_app_settings.cities[(int) tzHOME].reg,		_app_settings.cities[(int) tzHOME].tz);	if (par_setGlobalPref(parH, "timezone", "home_tz", PAR_TEXT,			      par_data, strlen(par_data)) == -1) {	    // Unable to update the *changed* home tz	    printf("Unable to update timezone.home_tz");	    printf("HTZ=%s will be lost!", par_data);	}			// end of if    }				// end of if    if (_app_settings.dirty_flgs & APP_DFLGS_VISIT) {	sprintf(par_data, "%s,%s,%s",		_app_settings.cities[(int) tzVISIT].name,		_app_settings.cities[(int) tzVISIT].reg,		_app_settings.cities[(int) tzVISIT].tz);	if (par_setGlobalPref	    (parH, "timezone", "visit_tz", PAR_TEXT, par_data,	     sizeof(par_data)) == -1) {	    // Unable to update the *changed* visiting tz	    printf("Unable to update timezone.visit_tz");	    printf("VTZ=%s will be lost!", par_data);	}			// end of if    }				// end of if    if ((_app_settings.dirty_flgs & APP_DFLGS_CUR) &&	par_setGlobalPref(parH, "timezone", "home_active", PAR_BOOL,			  (char *) &_app_settings.home_current,			  sizeof(_app_settings.home_current)) == -1) {	// Unable to update the *changed* active flag	printf("Unable to update timezone.home_active");	printf("home_active=%s, not saved!",	       _app_settings.home_current == true ? "true" : "false");    }				// end of if#endif#ifdef PROMPT_FOR_DST    if (_app_settings.dirty_flgs & APP_DFLGS_DST) {	if (par_setGlobalPref(parH, "timezone", "h_use_dst", PAR_BOOL,			      (char *) &_app_settings.use_dst[(int) tzHOME],			      sizeof(_app_settings.use_dst[(int) tzHOME])) ==	    -1) {	    // Unable to update the *changed* h_use_dst flag	    printf("Unable to update timezone.h_use_dst");	    printf("h_use_dst=%s, not saved!",		   _app_settings.use_dst[(int) tzHOME] ==		   true ? "true" : "false");	}			// end of if	if (par_setGlobalPref(parH, "timezone", "v_use_dst", PAR_BOOL,			      (char *) &_app_settings.use_dst[(int) tzVISIT],			      sizeof(_app_settings.use_dst[(int) tzVISIT])) ==	    -1) {	    // Unable to update the *changed* v_use_dst flag	    printf("Unable to update timezone.v_use_dst");	    printf("v_use_dst=%s, not saved!",		   _app_settings.use_dst[(int) tzVISIT] ==		   true ? "true" : "false");	}			// end of if    }				// end of if#endif //      PROMPT_FOR_DST    db_closeDB(parH);    // Send a colosseum broadcast message to everyone about the timezone change...    char col_msg[CL_MAX_MSG_LEN] = { '\0' };    int col_len = sprintf(col_msg, "sc_clock^SYSCON_TZ_CHANGE");    sysconf_ipc_write(CL_MSG_BROADCAST_ID, col_msg, col_len);    return;}				// end of nxSunclock::SetAppPrefs(void)/*******************************************************************************\****	Function:	void MakeTimewin()**	Desc:		Makes the time-setting window and adds the appropriate widgets**	Accepts:	int w = width of the window**				int h = height of the window**	Returns:	Nothing (void)**\*******************************************************************************/voidnxSunclock::MakeTimewin(int X, int Y, int w, int h){    int c_x,			// Clocks x value      c_y,			// Clocks y value      d_x,			// Dates x value      d_y;			// Dates y value    NxApp *instance = sysconf_get_instance();    // Make the encompassing window    _timewin = new Fl_Group(_winX, _winY, w, h);    _timewin->color(instance->getGlobalColor(APP_BG));    // Add all of the widgets    d_y = Y + BUTTON_Y - _winY;    d_x = X + BUTTON_X;    {	// Add the "OK" button	NxButton *o;		// Button widget	d_x = X + BUTTON_X;	d_y = Y + BUTTON_Y - _winY;	o = new NxButton(d_x, d_y, BUTTON_WIDTH, BUTTON_HEIGHT, "Save");	o->when(FL_WHEN_RELEASE);	o->callback(show_sc_win_cb, (void *) this);	d_x += 63;    }				// end of OK Button    {	// Add the "Cancel Button"	NxButton *o;	o = new NxButton(d_x, d_y, BUTTON_WIDTH, BUTTON_HEIGHT, "Reset");	o->when(FL_WHEN_RELEASE);	o->callback(show_sc_win_cb);	c_y += BUTTON_HEIGHT + 2;    }				// end of cancel button    c_x = d_x = X + 2;    d_y = Y + h / 3 + 10;    c_y = Y;    {	NxButton *o;		// Label button	o = new NxButton(c_x, c_y, _timewin->w(), BUTTON_HEIGHT);	o->box(FL_BORDER_BOX);	o->align(FL_ALIGN_INSIDE | FL_ALIGN_CENTER);	o->label("Current Time");	c_y = Y + o->h() + 2;    }				// end of if    {	// Fl Clock widget....	Fl_Clock_Output *o;	// Clock widget	_tclock = o = new Fl_Clock_Output(c_x, c_y, w / 3,					  (h - (3 * BUTTON_HEIGHT)) / 3);	o->box(FL_FLAT_BOX);	o->color(instance->getGlobalColor(APP_BG));	o->type(FL_SQUARE_CLOCK);	c_x += (w / 3) + 5;	c_y = Y + o->h() / 3;	d_y = c_y + o->h();    }				// end of Fl_Clock widget    {	NxTmInput *o;		// Time input widget	_timeui = o =	    new NxTmInput(c_x, c_y, (int) (2 * BUTTON_WIDTH), BUTTON_HEIGHT,			  0, 3);	o->color(instance->getGlobalColor(APP_BG));	for (int i = 0; i < o->GetUnits(); i++) {	    o->Units[i]->box(FL_FLAT_BOX);	    o->Units[i]->when(FL_WHEN_CHANGED);	    o->Units[i]->callback(upd_tm_cb, (void *) this);	    o->Units[i]->color(instance->getGlobalColor(APP_BG));	    o->Units[i]->selection_color(instance->getGlobalColor(APP_SEL));	    instance->def_font(o);	}	c_x += o->w();    }				// end of Time input widget    {	// Time Inc/Dec buttons	NxButton *dn,		// Down button	 *up;			// Up button	dn = new NxButton(c_x, c_y + (BUTTON_HEIGHT / 2), BUTTON_WIDTH / 3,			  ((BUTTON_HEIGHT / 3) * 2), "-");	up = new NxButton(c_x, c_y - (BUTTON_HEIGHT / 2), BUTTON_WIDTH / 3,			  ((BUTTON_HEIGHT / 3) * 2), "+");//              dn = new NxButton(c_x, c_y + (BUTTON_HEIGHT / 2), BUTTON_WIDTH / 4,//                                                      BUTTON_HEIGHT / 2, "-");//              up = new NxButton(c_x, c_y, BUTTON_WIDTH / 4, BUTTON_HEIGHT / 2, "+");//              dn->color(DEF_BG);//              up->color(DEF_BG);//              dn->box(FL_BORDER_BOX);//              up->box(FL_BORDER_BOX);	// Set the call backs	dn->when(FL_WHEN_RELEASE);	up->when(FL_WHEN_RELEASE);	dn->callback(adj_tm_cb, (void *) this);	up->callback(adj_tm_cb, (void *) this);	c_y += BUTTON_HEIGHT;    }				// end of Time inc/dec buttons#ifdef PROMPT_FOR_DST    {	Fl_Check_Button *o;	// Check Button	c_x = w / 3 + 5;	_dstbtn = o =	    new Fl_Check_Button(c_x, c_y, BUTTON_WIDTH, 2 * BUTTON_HEIGHT,				"Use Daylight Savings");	o->value(0);	if ((_eCurTzMode == tzHOME	     && _app_settings.use_dst[(int) tzHOME] == true)	    || (_eCurTzMode == tzVISIT		&& _app_settings.use_dst[(int) tzVISIT] == true))	    o->value(1);    }				// end of DST Check box#endif // PROMPT_FOR_DST    {	NxButton *o;		// Calendar section label	o = new NxButton(0, d_y, _timewin->w(), BUTTON_HEIGHT,			 "Current Date");	o->box(FL_BORDER_BOX);	o->align(FL_ALIGN_INSIDE | FL_ALIGN_CENTER);	d_y += BUTTON_HEIGHT + 5;    }				// end of Calendar label    {	// Fl_Calendar widget	Fl_Calendar *o;		// Calendar widget	d_x = X + 5;	_cal = o = new Fl_Calendar(d_x, d_y, (w - (2 * d_x)), (h - (d_y)));	//                                 (h - (d_y + (2 * BUTTON_HEIGHT))));    }				// end of Calendar        _timewin->end();    _timewin->hide();    return;}				// end of nxSunclock::MakeTimewin(int, int)#ifdef NOTUSED/*******************************************************************************\****	Function:	void SetSunclock()**	Desc:		Calculates the position of the sun, and darkens the current pixel**				values where the sun isnt -- thus creating the sun clock....**	Accepts:	Nothing (void)**	Returns:	Nothing (void)**\*******************************************************************************/voidnxSunclock::SetSunclock(void){    static int cnt = 0;#ifdef NANOX    int isize =	gimp_image.height * gimp_image.width * gimp_image.bytes_per_pixel;    printf("We are allocating %d bytes for the image\n", isize);    // Put the original data back into the array, before twiddling with it

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -