int normal_draw(dxO& dxo)override{
				try{
					try{
						IsDataModeMUIBut.set(Pint(70, 20), "Data");
						dxo.draw(Pint(5, 5), IsDataModeMUIBut);
					}
					catch(const hmLib::inquiries::unconnected_exception&){
						dxo.draw(Pint(5, 5), dxoStrP(Pint(70, 20), "Data", getClr(error, strobj)));
					}

					try{
						dxo.draw(Pint(80, 5), dxoBUITimeStr(this, Pint(70, 20), (boost::format("%.1f��") % Value).str(), Time));
					}
					catch(const hmLib::inquiries::unconnected_exception&){
						dxo.draw(Pint(80, 5), dxoStrP(Pint(70, 20), "NoCnct", getClr(error, strobj)));
					}


				}
				catch(const hmLib::exceptions::exception& Excp){
					dxo.draw(Pint(5, 5), dxoButIO(getSize(), std::string("=ERR=") + Excp.what(), getClr(error, butobj), true, CLR::White, ALI::left));
				}

				return 0;
			}
				int normal_draw(dxO& dxo)override{
					try{
						try{
							DataModeMUIBut.set(Pint(70, 20), "Data");
							dxo.draw(Pint(5, 5), DataModeMUIBut);
						}
						catch(const hmLib::inquiries::unconnected_exception&){
							dxo.draw(Pint(5, 5), dxoStrP(Pint(70, 20), "CO2", getClr(error, strobj)));
						}

						try{
							dxo.draw(Pint(80, 5), dxoBUITimeStr(this, Pint(70, 20), (boost::format("%.1fppm") % Data.value()).str(), Data.time()));
							dxo.draw(Pint(155, 5), dxoBUITimeStr(this, Pint(70, 20), (boost::format("0x%04x") % Data.raw_value()).str(), Data.time()));
						}
						catch(const hmLib::inquiries::unconnected_exception&){
							dxo.draw(Pint(80, 5), dxoStrP(Pint(70, 20), "NoCnct", getClr(error, strobj)));
						}
					}
					catch(const hmLib::exceptions::exception& Excp){
						dxo.draw(Pint(5, 5), dxoButIO(getSize(), std::string("=ERR=") + Excp.what(), getClr(error, butobj), true, CLR::White, ALI::left));
					}

					try{
						SensorPWMUIBut.set(Pint(70, 20), "SensorPW");
						dxo.draw(Pint(80, 30), SensorPWMUIBut);
					}
					catch(const hmLib::inquiries::unconnected_exception&){
						dxo.draw(Pint(80, 30), dxoStrP(Pint(70, 20), "NoCnct", getClr(error, strobj)));
					}

					try{
						PumpPWMUIBut.set(Pint(70, 20), "PumpPW");
						dxo.draw(Pint(155, 30), PumpPWMUIBut);
					}
					catch(const hmLib::inquiries::unconnected_exception&){
						dxo.draw(Pint(155, 30), dxoStrP(Pint(70, 20), "NoCnct", getClr(error, strobj)));
					}

					return 0;
				}
Exemple #3
0
	virtual int drawIn(dxO& _dxo,DrawFuncType* _pDrawFunc){
		if(MoveAreaSize.x<=0 || MoveAreaSize.y<=0)return 0;
		_dxo.movePos(-viewpos);
		int ans=(*_pDrawFunc)(_dxo);
		Rint rect=_dxo.getArea();
		adjDrawArea(rect);
		_dxo.movePos(viewpos);

		if(rect.pos2.x-rect.pos1.x>MoveAreaSize.x){
			Pint tabpos;
			Pint tabsize;
			tabsize.x=MoveAreaSize.x*(MoveAreaSize.x-10)/(rect.pos2.x-rect.pos1.x);
			if(tabsize.x<5)tabsize.x=5;
			tabsize.y=10;
			tabpos.x=viewpos.x-rect.pos1.x;
			tabpos.y=0;
			_dxo.draw(Pint(0,MoveAreaSize.y-10),dxoSlider(Pint(MoveAreaSize.x-10,10),tabsize,tabpos,Pint(rect.pos2.x-rect.pos1.x-MoveAreaSize.x,0),MoveAreaClr),true,196);
//			dxo::Draw(dxoTab(pos+Pint(0,MoveAreaSize.y-10),Pint(MoveAreaSize.x-10,10),tabsize,tabpos,Pint(rect.pos2.x-rect.pos1.x-MoveAreaSize.x,0),Color,128,FrameTabBlend*AreaBlend/255));
			viewpos.x=tabpos.x+rect.pos1.x;
		}

		if(rect.pos2.y-rect.pos1.y>MoveAreaSize.y){
			Pint tabpos;
			Pint tabsize;
			tabsize.y=MoveAreaSize.y*(MoveAreaSize.y-10)/(rect.pos2.y-rect.pos1.y);
			if(tabsize.y<5)tabsize.y=5;
			tabsize.x=10;
			tabpos.y=viewpos.y-rect.pos1.y;
			tabpos.x=0;
			_dxo.draw(Pint(MoveAreaSize.x-10,0),dxoSlider(Pint(10,MoveAreaSize.y-10),tabsize,tabpos,Pint(0,rect.pos2.y-rect.pos1.y-MoveAreaSize.y),MoveAreaClr),true,196);
//			dxo::Draw(dxoTab(pos+Pint(MoveAreaSize.x-10,0),Pint(10,MoveAreaSize.y-10),tabsize,tabpos,Pint(0,rect.pos2.y-rect.pos1.y-MoveAreaSize.y),Color,128,FrameTabBlend*AreaBlend/255));
			viewpos.y=tabpos.y+rect.pos1.y;
		}

		if(!(rect.pos2-rect.pos1<=MoveAreaSize)){
			_dxo.draw(MoveAreaSize-Pint(10,10),dxoButIO(Pint(10,10),"",MoveAreaClr,false),true,196);
//			dxo::Draw(dxoButIO(pos+MoveAreaSize-Pint(10,10),Pint(10,10),Color,1,"",0,POS::center,FrameTabBlend*AreaBlend/255,0));
		}
		return 0;
	}
				//virtual int fndraw(dxO& dxf);
				int normal_draw(dxO& dxo)override{

					// FILE 書き込みボタン
					if(dxo.draw(Pint(5, 5), dxoButIO(Pint(105, 20), "FILE 接続", getClr(normal, butobj), isActive), true) == 1){
						if(!isActive){

							// Open signal 
							signal_require_activate("");
						} else{
							// Close signal
							signal_require_inactivate();
						}
					}

					// 状態表示
					if(isActive){
						dxo.draw(Pint(115, 5), dxoStrP(Pint(105, 20), "Opened", getClr(normal, strobj)));
					} else{
						dxo.draw(Pint(115, 5), dxoStrP(Pint(105, 20), "Closed", getClr(invalid, strobj)));
					}

					return 0;
				}
				int normal_draw(dxO& dxo)override{
					try{
						try{
							IsDataModeMUIBut.set(Pint(70, 20), "Data");
							dxo.draw(Pint(5, 5), IsDataModeMUIBut);
						}
						catch(const hmLib::inquiries::unconnected_exception&){
							dxo.draw(Pint(5, 5), dxoStrP(Pint(70, 20), "Data", getClr(error, strobj)));
						}

						try{
							int gpsCh;
							dxRGB clr;
							if(inq_getPic_GPSCh() == inq_getRequest_GPSCh()){ clr = getClr(normal, butobj); } else{ clr = getClr(active, butobj); }

							if(inq_getRequest_GPSCh()){ gpsCh = 1; } else{ gpsCh = 0; }

							SetGPSNumBut.set(Pint(70, 20), (boost::format("GPS#:%d") % (int)gpsCh).str(), clr);
							auto ans = dxo.draw(Pint(80, 5), SetGPSNumBut);
							if(ans == -1){
								signal_changeGPSCh();
							}

						}
						catch(const hmLib::inquiries::unconnected_exception&){
							dxo.draw(Pint(80, 5), dxoStrP(Pint(70, 20), "NoCnct", getClr(error, strobj)));
						}

						try{
							auto Data = GPSData;//inquiry_getGPSData();
							auto Time = Data.getTime();
							dxo.draw(Pint(155, 5), dxoStrP(Pint(70, 20), (boost::format("Fail:%d") % static_cast<int>(Data.getFail())).str(), getTimeStrClr(Time)));
						}
						catch(const hmLib::inquiries::unconnected_exception&){
							dxo.draw(Pint(155, 5), dxoStrP(Pint(70, 20), "NoCnct", getClr(error, strobj)));
						}

					}
					catch(const hmLib::exceptions::exception& Excp){
						dxo.draw(Pint(0, 0), dxoButIO(getSize(), std::string("=ERR=") + Excp.what(), getClr(error, butobj), true, CLR::White, ALI::left));
					}

					return 0;
				}
				int extend_draw(dxO& dxo)override{
					normal_draw(dxo);
					try{
						auto Data = GPSData;//inquiry_getGPSData();
						auto Time = Data.getTime();
						dxo.draw(Pint(80, 30), dxoStrP(Pint(145, 20), (boost::format("N:%.4f") % Data.getPos().y).str(), getTimeStrClr(Time)));
						dxo.draw(Pint(80, 55), dxoStrP(Pint(145, 20), (boost::format("E:%.4f") % Data.getPos().x).str(), getTimeStrClr(Time)));
						dxo.draw(Pint(80, 80), dxoStrP(Pint(145, 20), (boost::format("H:%.4f") % Data.getHeight()).str(), getTimeStrClr(Time)));
						dxo.draw(Pint(5, 55), dxoStrP(Pint(70, 20), (boost::format("GPS#:%d") % Data.getUseGPS()).str(), getTimeStrClr(Time)));
						//dxo.draw(Pint(5,80),dxoStrP(Pint(70,20),(boost::format("Fail:%d")%static_cast<int>(Data.getFail())).str(),getTimeStrClr(Time)));
					}
					catch(const hmLib::inquiries::unconnected_exception&){
						dxo.draw(Pint(80, 30), dxoStrP(Pint(145, 20), "NoCnct", getClr(error, strobj)));
						dxo.draw(Pint(80, 55), dxoStrP(Pint(145, 20), "NoCnct", getClr(error, strobj)));
						dxo.draw(Pint(80, 80), dxoStrP(Pint(145, 20), "NoCnct", getClr(error, strobj)));
						dxo.draw(Pint(5, 55), dxoStrP(Pint(70, 20), "NoCnct", getClr(error, strobj)));
						//dxo.draw(Pint(5,80),dxoStrP(Pint(70,20),"NoCnct",getClr(error,strobj)));
					}
					return 0;
				}
				//240-360
				int redraw(dxO& dxo)override{
					dxo.draw(Pint(5, 5), GPSKashmirBut);
					dxo.draw(Pint(90, 5), PadStatusBut);
					dxo.draw(Pint(5, 45), Battery0);
					dxo.draw(Pint(5, 80), Battery1);
					dxo.draw(Pint(5, 115), Battery2);

					dxRGB Clr = CLR::Gray;
					if(std::chrono::duration_cast<std::chrono::seconds>(clock::now() - Data.Time).count() < 10){
						Clr = CLR::White;
					}
					dxo.draw(Pint(5, 165), dxoStrP(Pint(70, 20), (boost::format("0:%5d") % Data.Data[0]).str(), Clr));
					dxo.draw(Pint(125, 165), dxoStrP(Pint(70, 20), (boost::format("1:%5d") % Data.Data[1]).str(), Clr));
					dxo.draw(Pint(5, 190), dxoStrP(Pint(70, 20), (boost::format("2:%5d") % Data.Data[2]).str(), Clr));
					dxo.draw(Pint(125, 190), dxoStrP(Pint(70, 20), (boost::format("3:%5d") % Data.Data[3]).str(), Clr));
					dxo.draw(Pint(5, 215), dxoStrP(Pint(70, 20), (boost::format("4:%5d") % Data.Data[4]).str(), Clr));
					dxo.draw(Pint(125, 215), dxoStrP(Pint(70, 20), (boost::format("5:%5d") % Data.Data[5]).str(), Clr));
					dxo.draw(Pint(5, 240), dxoStrP(Pint(70, 20), (boost::format("6:%5d") % Data.Data[6]).str(), Clr));
					dxo.draw(Pint(125, 240), dxoStrP(Pint(70, 20), (boost::format("7:%5d") % Data.Data[7]).str(), Clr));

					return 0;
				}
Exemple #8
0
	virtual int drawIn(dxO& _dxo,DrawFuncType* _pDrawFunc){
		_dxo.movePos(-viewpos);
		int ans=(*_pDrawFunc)(_dxo);
		Rint rect=_dxo.getArea();
		adjDrawArea(rect);
		_dxo.movePos(viewpos);

		if(rect.pos1.x<viewpos.x){
			dxoBox tmpbox(Pint(10,MoveAreaSize.y),MoveAreaClr);
			if(tmpbox.pIn(Pint(0,0),_dxo.GtoD(dx::getMosPos())) && _dxo.checkActive()){
				_dxo.draw(Pint(0,0),tmpbox,true,196);
				_dxo.draw(Pint(0,MoveAreaSize.y/2),dxoTriangle(Pint(10,-7),Pint(10,7),MoveAreaClr),true,196);
				if(dx::getMosL()>0)viewpos.x-=10;
				else if(dx::getMosR()>0)viewpos.x=rect.pos1.x;
				else viewpos.x-=2;
			}else{
				_dxo.draw(Pint(0,0),tmpbox,true,128);
				_dxo.draw(Pint(0,MoveAreaSize.y/2),dxoTriangle(Pint(10,-7),Pint(10,7),MoveAreaClr),true,128);
			}
		}
		if(rect.pos1.y<viewpos.y){
			dxoBox tmpbox(Pint(MoveAreaSize.x,10),MoveAreaClr);
			if(tmpbox.pIn(Pint(0,0),_dxo.GtoD(dx::getMosPos())) && _dxo.checkActive()){
				_dxo.draw(Pint(0,0),tmpbox,true,196);
				_dxo.draw(Pint(MoveAreaSize.x/2,0),dxoTriangle(Pint(-7,10),Pint(7,10),MoveAreaClr),true,196);
				if(dx::getMosL()>0)viewpos.y-=10;
				else if(dx::getMosR()>0)viewpos.y=rect.pos1.y;
				else viewpos.y-=2;
			}else{
				_dxo.draw(Pint(0,0),tmpbox,true,128);
				_dxo.draw(Pint(MoveAreaSize.x/2,0),dxoTriangle(Pint(-7,10),Pint(7,10),MoveAreaClr),true,128);
			}
		}
		if(rect.pos2.x>viewpos.x+MoveAreaSize.x){
			dxoBox tmpbox(Pint(10,MoveAreaSize.y),MoveAreaClr);
			if(tmpbox.pIn(Pint(MoveAreaSize.x-10,0),_dxo.GtoD(dx::getMosPos())) && _dxo.checkActive()){
				_dxo.draw(Pint(MoveAreaSize.x-10,0),tmpbox,true,196);
				_dxo.draw(Pint(MoveAreaSize.x,MoveAreaSize.y/2),dxoTriangle(Pint(-10,-7),Pint(-10,7),MoveAreaClr),true,196);
				if(dx::getMosL()>0)viewpos.x+=10;
				else if(dx::getMosR()>0)viewpos.x=rect.pos2.x-MoveAreaSize.x;
				else viewpos.x+=2;
			}else{
				_dxo.draw(Pint(MoveAreaSize.x-10,0),tmpbox,true,128);
				_dxo.draw(Pint(MoveAreaSize.x,MoveAreaSize.y/2),dxoTriangle(Pint(-10,-7),Pint(-10,7),MoveAreaClr),true,128);
			}
		}
		if(rect.pos2.y>viewpos.y+MoveAreaSize.y){
			dxoBox tmpbox(Pint(MoveAreaSize.x,10),MoveAreaClr);
			if(tmpbox.pIn(Pint(0,MoveAreaSize.y-10),_dxo.GtoD(dx::getMosPos())) && _dxo.checkActive()){
				_dxo.draw(Pint(0,MoveAreaSize.y-10),tmpbox,true,196);
				_dxo.draw(Pint(MoveAreaSize.x/2,MoveAreaSize.y),dxoTriangle(Pint(-7,-10),Pint(7,-10),MoveAreaClr),true,196);
				if(dx::getMosL()>0)viewpos.y+=10;
				else if(dx::getMosR()>0)viewpos.y=rect.pos2.y-MoveAreaSize.y;
				else viewpos.y+=2;
			}else{
				_dxo.draw(Pint(0,MoveAreaSize.y-10),tmpbox,true,128);
				_dxo.draw(Pint(MoveAreaSize.x/2,MoveAreaSize.y),dxoTriangle(Pint(-7,-10),Pint(7,-10),MoveAreaClr),true,128);
			}
		}

		return 0;
	}
				//virtual int fndraw(dxO& dxf);
				virtual int redraw(dxO& dxo){
					int ans;

					// RS系列についての制御系UI
					// 接続ボタン
					if(dxo.draw(Pint(10, 10), dxoButIO(Pint(220, 40), "RS接続", Clr, IsRSOpen), !IsFOMAOpen) == 1){

						if(!IsRSOpen){
							// Open signal 
							signal_require_openRS(RS_BaudRate, RS_PortCh);
							if(PortFileLinkFlag) signal_require_openFile();


						} else{
							// Close signal
							signal_require_closeRS();
							if(PortFileLinkFlag) signal_require_closeFile();
						}
					}

					// チャンネル選択
					ans = dxo.draw(Pint(30, 60), dxoButLR(Pint(200, 20), hmstd::fStr("%2dch", RS_PortCh), hm::sel((!IsRSOpen && !IsFOMAOpen), Clr, SubClr)), (!IsRSOpen && !IsFOMAOpen));
					if(!IsRSOpen && !IsFOMAOpen){
						if(ans == 1)RS_PortCh = (RS_PortCh + 1) % 13;
						if(ans == 10)RS_PortCh = (RS_PortCh + 12) % 13;
					}

					// ボーレート
					ans = dxo.draw(Pint(30, 90), dxoButLR(Pint(200, 20), hmstd::fStr("%5dbps", RS_BaudRate), hm::sel((!IsRSOpen && !IsFOMAOpen), Clr, SubClr)), (!IsRSOpen && !IsFOMAOpen));
					if(!IsRSOpen && !IsFOMAOpen){
						if(ans == 1)RS_BaudRate *= 2;
						if(ans == 10)RS_BaudRate /= 2;
						if(RS_BaudRate > 38400)RS_BaudRate = 2400;
						if(RS_BaudRate < 2400)RS_BaudRate = 38400;
					}

					// FOMA系についての制御系UI
					// 接続ボタン
					if(dxo.draw(Pint(10, 130), dxoButIO(Pint(220, 40), "FOMA接続", Clr, IsFOMAOpen), !IsRSOpen) == 1){
						if(!IsFOMAOpen){
							// Open signal 
							signal_require_openFOMA(FOMA_BaudRate, FOMA_PortCh);
							if(PortFileLinkFlag) signal_require_openFile();
						} else{
							// Close siganal
							signal_require_closeFOMA();
							if(PortFileLinkFlag) signal_require_closeFile();
						}
					}

					//チャンネル選択
					ans = dxo.draw(Pint(30, 180), dxoButLR(Pint(200, 20), hmstd::fStr("%2dch", FOMA_PortCh), hm::sel((!IsRSOpen && !IsFOMAOpen), Clr, SubClr)), (!IsRSOpen && !IsFOMAOpen));
					if(!IsRSOpen && !IsFOMAOpen){
						if(ans == 1)FOMA_PortCh = (FOMA_PortCh + 1) % 13;
						if(ans == 10)FOMA_PortCh = (FOMA_PortCh + 12) % 13;
					}

					//ボーレート
					ans = dxo.draw(Pint(30, 210), dxoButLR(Pint(200, 20), hmstd::fStr("%5dbps", FOMA_BaudRate), hm::sel((!IsRSOpen && !IsFOMAOpen), Clr, SubClr)), (!IsRSOpen && !IsFOMAOpen));
					if((!IsRSOpen && !IsFOMAOpen)){
						if(ans == 1)FOMA_BaudRate *= 2;
						if(ans == 10)FOMA_BaudRate /= 2;
						if(FOMA_BaudRate > 38400)FOMA_BaudRate = 2400;
						if(FOMA_BaudRate < 2400)FOMA_BaudRate = 38400;
					}

					//保存のリンクフラグ
					if(dxo.draw(Pint(10, 250), dxoCheck(Pint(200, 20), "接続と保存をリンクする", 20, Clr, PortFileLinkFlag)) == 1){
						if(!IsRSOpen && !IsFOMAOpen){
							PortFileLinkFlag = !PortFileLinkFlag;
						}
					}
					return 0;

				}