Beispiel #1
0
void  OGL2DBase::AxesDrawSetup()
{
    SetDrawColor(plot2Dbase.defaultPenSet->GetColor(plot2Dbase.plotAnnotation.axesDataPen));
    SetLine(plot2Dbase.plotAnnotation.axesLineWidth);
    SetLineSolid();
    SetGridHigh();
}
Beispiel #2
0
sPalCv::sPalCv(const RGBA *palette, int ncolors, PaletteCv& cv_pal)
:	cv_pal(cv_pal), palette(palette), ncolors(ncolors)
{
	byte ender[256];
	for(int b = 0; b < RASTER_MAP_B; b++) {
		ZeroArray(ender);
		for(int r = 0; r < RASTER_MAP_R; r++) {
			SetLine(r, b);
			int g = 0;
			while(g < RASTER_MAP_G) {
				int ii = Get(g);
				int eg = max<int>(g, ender[ii]);
				if(Get(eg) == ii)
					while(eg < RASTER_MAP_G - 1 && Get(eg + 1) == ii)
						eg++;
				else
					while(Get(eg) != ii)
						eg--;
				ender[ii] = eg;
				g++;
				while(g <= eg - 1) {
					gline[g] = ii;
					done[g] = true;
					g++;
				}
			}
		}
	}
}
Beispiel #3
0
luna::Function * RandomFunction()
{
    auto f = g_gc.NewFunction();

    auto s = RandomString();
    f->SetModuleName(s);
    f->SetLine(RandomNum(1000));

    int instruction_count = RandomRange(10, 1000);
    for (int i = 0; i < instruction_count; ++i)
    {
        unsigned int op_min = luna::OpType_LoadNil;
        unsigned int op_max = luna::OpType_GetGlobal;
        luna::OpType op = static_cast<luna::OpType>(RandomRange(op_min, op_max));
        luna::Instruction instruction(op, RandomNum(128), RandomNum(128), RandomNum(128));
        f->AddInstruction(instruction, i);
    }

    int const_num = RandomNum(5);
    for (int i = 0; i < const_num; ++i)
        f->AddConstNumber(RandomNum(100000));

    int const_str = RandomNum(5);
    for (int i = 0; i < const_str; ++i)
        f->AddConstString(RandomString());

    CHECK_BARRIER(g_gc, f);

    return f;
}
		void SkinGroup::PreSubclassWindow()
		{
			__super::PreSubclassWindow();

			SetThemeParent(GetParent()->GetSafeHwnd());
			SetLine(i8desk::ui::SkinMgrInstance().GetSkin(_T("Common/GroupBK.png")));
		}
Beispiel #5
0
 void initialize( antlr::RefToken t )
 {
   antlr::CommonAST::initialize(t);
   
   //    DNode::SetLine( t->getLine());
   SetLine( t->getLine());
 }
Beispiel #6
0
int CGUIDialogYesNo::ShowAndGetInput(const KODI::MESSAGING::HELPERS::DialogYesNoMessage& options)
{
  //Set default yes/no labels, these might be overwritten further down if specified
  //by the caller
  SetChoice(0, 106);
  SetChoice(1, 107);
  if (!options.heading.isNull())
    SetHeading(options.heading);
  if (!options.text.isNull())
    SetText(options.text);
  if (!options.noLabel.isNull())
    SetChoice(0, options.noLabel);
  if (!options.yesLabel.isNull())
    SetChoice(1, options.yesLabel);
  if (options.autoclose > 0)
    SetAutoClose(options.autoclose);
  m_bCanceled = false;
  
  for (size_t i = 0; i < 3; ++i)
  {
    if (!options.lines[i].isNull())
      SetLine(i, options.lines[i]);
  }

  Open();
  if (m_bCanceled)
    return -1;
  
  return IsConfirmed() ? 1 : 0;
}
Beispiel #7
0
void  OGL2DBase::MajorGridDrawSetup()
{
    SetDrawColor(plot2Dbase.defaultPenSet->GetColor(plot2Dbase.plotAnnotation.gridLineDataPen));
    SetLine(plot2Dbase.plotAnnotation.majorGridWidth);
    SetLineType(plot2Dbase.plotAnnotation.majorGridLineType);
    if (plot2Dbase.plotAnnotation.gridOverData)
        SetGridHigh();
}
void PHPEntityNamespace::FromResultSet(wxSQLite3ResultSet& res)
{
    SetDbId(res.GetInt64("ID"));
    SetFullName(res.GetString("FULLNAME"));
    SetShortName(res.GetString("NAME"));
    SetFilename(res.GetString("FILE_NAME"));
    SetLine(res.GetInt("LINE_NUMBER"));
    SetFlags(0);
}
void PHPEntityFunctionAlias::FromResultSet(wxSQLite3ResultSet& res)
{
    SetDbId(res.GetInt("ID"));
    SetShortName(res.GetString("NAME"));
    SetRealname(res.GetString("REALNAME"));
    SetLine(res.GetInt("LINE_NUMBER"));
    SetFilename(res.GetString("FILE_NAME"));
    SetFullName(res.GetString("FULLNAME"));
    SetScope(res.GetString("SCOPE"));
}
void PHPEntityVariable::FromResultSet(wxSQLite3ResultSet& res)
{
    SetDbId(res.GetInt("ID"));
    SetFullName(res.GetString("FULLNAME"));
    SetShortName(res.GetString("NAME"));
    SetTypeHint(res.GetString("TYPEHINT"));
    SetFlags(res.GetInt("FLAGS"));
    SetDocComment(res.GetString("DOC_COMMENT"));
    SetLine(res.GetInt("LINE_NUMBER"));
    SetFilename(res.GetString("FILE_NAME"));
}
Beispiel #11
0
void CSysProgressDlg::FormatPathLine ( DWORD dwLine, CString FormatText, ...)
{
	va_list args;
	va_start(args, FormatText);

	CString sText;
	sText.FormatV(CString(FormatText), args);
	SetLine(dwLine, sText, true);

	va_end(args);
}
Beispiel #12
0
void CSysProgressDlg::FormatNonPathLine(DWORD dwLine, UINT idFormatText, ...)
{
	va_list args;
	va_start(args, idFormatText);

	CString sText;
	sText.FormatV(CString(MAKEINTRESOURCE(idFormatText)), args);
	SetLine(dwLine, sText, false);

	va_end(args);
}
Beispiel #13
0
void PHPEntityClass::FromResultSet(wxSQLite3ResultSet& res)
{
    SetDbId(res.GetInt("ID"));
    SetFullName(res.GetString("FULLNAME"));
    SetShortName(res.GetString("NAME"));
    SetExtends(res.GetString("EXTENDS"));
    SetImplements(::wxStringTokenize(res.GetString("IMPLEMENTS"), ";", wxTOKEN_STRTOK));
    SetTraits(::wxStringTokenize(res.GetString("USING_TRAITS"), ";", wxTOKEN_STRTOK));
    SetDocComment(res.GetString("DOC_COMMENT"));
    SetLine(res.GetInt("LINE_NUMBER"));
    SetFilename(res.GetString("FILE_NAME"));
    SetFlags(res.GetInt("FLAGS"));
}
Beispiel #14
0
sPalCv::sPalCv(const RGBA *palette, int ncolors, PaletteCv& cv_pal,
               int histogram[RASTER_MAP_R][RASTER_MAP_G][RASTER_MAP_B])
:	cv_pal(cv_pal), palette(palette), ncolors(ncolors)
{
	for(int b = 0; b < RASTER_MAP_B; b++) {
		for(int r = 0; r < RASTER_MAP_R; r++) {
			SetLine(r, b);
			for(int g = 0; g < RASTER_MAP_G; g++)
				if(histogram[r][g][b])
					Get(g);
		}
	}
}
Beispiel #15
0
bool CGUIDialogOK::ShowAndGetInput(const HELPERS::DialogOKMessage & options)
{
  if (!options.heading.isNull())
    SetHeading(options.heading);
  if (!options.text.isNull())
    SetText(options.text);

  for (size_t i = 0; i < 3; ++i)
  {
    if (!options.lines[i].isNull())
      SetLine(i, options.lines[i]);
  }
  Open();
  return IsConfirmed();
}
Beispiel #16
0
/**	@brief  	General initialization of the input and output pins. (public)
	@todo		KEYBED_Init(): Pin-Names should be defined in nl_board.h
*******************************************************************************/
void KEYBED_Init(void)
{
	/* output pins for the line decoder */
	GPIO_PinOpt(KEYBED_LINE_A);
	GPIO_PinOpt(KEYBED_LINE_B);
	GPIO_PinOpt(KEYBED_LINE_C);
	GPIO_PinOpt(KEYBED_LINE_D);
	GPIO_PinOpt(KEYBED_LINE_EN_DIS);	// Enable Pin of the Line Decoder

	/* explicite states */
	GPIO_PinClr(KEYBED_LINE_A);
	GPIO_PinClr(KEYBED_LINE_B);
	GPIO_PinClr(KEYBED_LINE_C);
	GPIO_PinClr(KEYBED_LINE_D);
	GPIO_PinSet(KEYBED_LINE_EN_DIS);	// turn decoder off (inverted logic)

	/* input pins for the keys*/
	GPIO_PinIpt(KEYBED_KEY_0);
	GPIO_PinIpt(KEYBED_KEY_1);
	GPIO_PinIpt(KEYBED_KEY_2);
	GPIO_PinIpt(KEYBED_KEY_3);
	GPIO_PinIpt(KEYBED_KEY_4);
	GPIO_PinIpt(KEYBED_KEY_5);
	GPIO_PinIpt(KEYBED_KEY_6);
	GPIO_PinIpt(KEYBED_KEY_7);

	/* no pull ups for the inputs */
	GPIO_PinMod(KEYBED_KEY_0, GPIO_FLOATING);
	GPIO_PinMod(KEYBED_KEY_1, GPIO_FLOATING);
	GPIO_PinMod(KEYBED_KEY_2, GPIO_FLOATING);
	GPIO_PinMod(KEYBED_KEY_3, GPIO_FLOATING);
	GPIO_PinMod(KEYBED_KEY_4, GPIO_FLOATING);
	GPIO_PinMod(KEYBED_KEY_5, GPIO_FLOATING);
	GPIO_PinMod(KEYBED_KEY_6, GPIO_FLOATING);
	GPIO_PinMod(KEYBED_KEY_7, GPIO_FLOATING);

	SetLine(1);
}
void TagEntry::Create(const wxString& fileName,
                      const wxString& name,
                      int lineNumber,
                      const wxString& pattern,
                      const wxString& kind,
                      std::map<wxString, wxString>& extFields)
{
    m_isCommentForamtted = false;
    m_flags = 0;
    m_isClangTag = false;
    SetName(name);
    SetLine(lineNumber);
    SetKind(kind.IsEmpty() ? wxT("<unknown>") : kind);
    SetPattern(pattern);
    SetFile(fileName);
    SetId(-1);
    m_extFields = extFields;
    wxString path;

    // Check if we can get full name (including path)
    path = GetExtField(wxT("class"));
    if(!path.IsEmpty()) {
        UpdatePath(path);
    } else {
        path = GetExtField(wxT("struct"));
        if(!path.IsEmpty()) {
            UpdatePath(path);
        } else {
            path = GetExtField(wxT("namespace"));
            if(!path.IsEmpty()) {
                UpdatePath(path);
            } else {
                path = GetExtField(wxT("interface"));
                if(!path.IsEmpty()) {
                    UpdatePath(path);
                } else {
                    path = GetExtField(wxT("enum"));
                    if(!path.IsEmpty()) {
                        UpdatePath(path);
                    } else {
                        path = GetExtField(wxT("union"));
                        wxString tmpname = path.AfterLast(wxT(':'));
                        if(!path.IsEmpty()) {
                            if(!tmpname.StartsWith(wxT("__anon"))) {
                                UpdatePath(path);
                            } else {
                                // anonymouse union, remove the anonymous part from its name
                                path = path.BeforeLast(wxT(':'));
                                path = path.BeforeLast(wxT(':'));
                                UpdatePath(path);
                            }
                        }
                    }
                }
            }
        }
    }

    if(!path.IsEmpty()) {
        SetScope(path);
    } else {
        SetScope(wxT("<global>"));
    }

    // If there is no path, path is set to name
    if(GetPath().IsEmpty()) SetPath(GetName());

    // Get the parent name
    StringTokenizer tok(GetPath(), wxT("::"));
    wxString parent;

    (tok.Count() < 2) ? parent = wxT("<global>") : parent = tok[tok.Count() - 2];
    SetParent(parent);
}
Beispiel #18
0
bool CGUIDialogGamepad::OnAction(const CAction &action)
{
  if ((action.GetButtonCode() >= KEY_BUTTON_A &&
       action.GetButtonCode() <= KEY_BUTTON_RIGHT_TRIGGER) ||
      (action.GetButtonCode() >= KEY_BUTTON_DPAD_UP &&
       action.GetButtonCode() <= KEY_BUTTON_DPAD_RIGHT) ||
      (action.GetID() >= ACTION_MOVE_LEFT &&
       action.GetID() <= ACTION_MOVE_DOWN) ||
      action.GetID() == ACTION_PLAYER_PLAY
     )
  {
    switch (action.GetButtonCode())
    {
    case KEY_BUTTON_A : m_strUserInput += "A"; break;
    case KEY_BUTTON_B : m_strUserInput += "B"; break;
    case KEY_BUTTON_X : m_strUserInput += "X"; break;
    case KEY_BUTTON_Y : m_strUserInput += "Y"; break;
    case KEY_BUTTON_BLACK : m_strUserInput += "K"; break;
    case KEY_BUTTON_WHITE : m_strUserInput += "W"; break;
    case KEY_BUTTON_LEFT_TRIGGER : m_strUserInput += "("; break;
    case KEY_BUTTON_RIGHT_TRIGGER : m_strUserInput += ")"; break;
    case KEY_BUTTON_DPAD_UP : m_strUserInput += "U"; break;
    case KEY_BUTTON_DPAD_DOWN : m_strUserInput += "D"; break;
    case KEY_BUTTON_DPAD_LEFT : m_strUserInput += "L"; break;
    case KEY_BUTTON_DPAD_RIGHT : m_strUserInput += "R"; break;
    default:
      switch (action.GetID())
      {
        case ACTION_MOVE_LEFT:   m_strUserInput += "L"; break;
        case ACTION_MOVE_RIGHT:  m_strUserInput += "R"; break;
        case ACTION_MOVE_UP:     m_strUserInput += "U"; break;
        case ACTION_MOVE_DOWN:   m_strUserInput += "D"; break;
        case ACTION_PLAYER_PLAY: m_strUserInput += "P"; break;
        default:
          return true;
      }
      break;
    }

    std::string strHiddenInput(m_strUserInput);
    for (int i = 0; i < (int)strHiddenInput.size(); i++)
    {
      strHiddenInput[i] = m_cHideInputChar;
    }
    SetLine(2, CVariant{std::move(strHiddenInput)});
    return true;
  }
  else if (action.GetButtonCode() == KEY_BUTTON_BACK || action.GetID() == ACTION_PREVIOUS_MENU || action.GetID() == ACTION_NAV_BACK)
  {
    m_bConfirmed = false;
    m_bCanceled = true;
    m_strUserInput = "";
    m_bHideInputChars = true;
    Close();
    return true;
  }
  else if (action.GetButtonCode() == KEY_BUTTON_START || action.GetID() == ACTION_SELECT_ITEM)
  {
    m_bConfirmed = false;
    m_bCanceled = false;

    std::string md5pword2 = XBMC::XBMC_MD5::GetMD5(m_strUserInput);

    if (!StringUtils::EqualsNoCase(m_strPassword, md5pword2))
    {
      // incorrect password entered
      m_iRetries--;

      // don't clean up if the calling code wants the bad user input
      if (m_bUserInputCleanup)
        m_strUserInput = "";
      else
        m_bUserInputCleanup = true;

      m_bHideInputChars = true;
      Close();
      return true;
    }

    // correct password entered
    m_bConfirmed = true;
    m_iRetries = 0;
    m_strUserInput = "";
    m_bHideInputChars = true;
    Close();
    return true;
  }
  else if (action.GetID() >= REMOTE_0 && action.GetID() <= REMOTE_9)
  {
    return true; // unhandled
  }
  else
  {
    return CGUIDialog::OnAction(action);
  }
}
Beispiel #19
0
bool
ProgressDialogImpl::StartProgressDialog (/*[in]*/ HWND hwndParent)
{
  if (haveProgressDialog)
    {
      FATAL_MIKTEX_ERROR ("ProgressDialogImpl::StartProgressDialog",
			  T_("A progress dialog window is already open."),
			  0);
    }

  CWnd * pParent = 0;

  if (hwndParent != 0)
    {
      pParent = CWnd::FromHandlePermanent(hwndParent);
      if (pParent == 0)
	{
	  INVALID_ARGUMENT ("ProgressDialogImpl::StartProgressDialog", 0);
	}
    }

  pParent = CWnd::GetSafeOwner(pParent, 0);

  if (pParent != 0)
    {
      hwndParent = pParent->GetSafeHwnd();
    }

  hParentWindow = hwndParent;

  // disable mouse and keyboard input in the parent window
  if (hParentWindow != 0)
    {
      EnableWindow (hParentWindow, FALSE);
    }

  // create the user interface thread
  pThread = new ProgressUIThread(0, &readyEvent);
  pThread->CreateThread ();

  // wait for the progress window to become available
  CSingleLock singleLock (&readyEvent);
  if (! singleLock.Lock(1000))
    {
      FATAL_MIKTEX_ERROR ("ProgressDialogImpl::StartProgressDialog",
			  T_("The progress window is not available."),
			  0);
    }
  hWindow = pThread->GetProgressWindow();
  MIKTEX_ASSERT (IsWindow(hWindow));
  haveProgressDialog = true;

  // set the window texts
  SetTitle (title.c_str());
  SetLine (1, lines[0].c_str());
  SetLine (2, lines[1].c_str());

  // make the progress window visible
  ShowWindow (hWindow, SW_SHOW);

  return (true);
}
Beispiel #20
0
/*
 * 函数名: rt_thread_entry_handle
 * 描  述: 手柄线程的入口函数
 * 输  入: 无
 * 输  出: 无
 * 调  用: 内部调用
 * 说  明: 
 */
static void rt_thread_entry_handle(void* parameter)
{
	double Handle_Speed_X;
	double Handle_Speed_Y;
	double Handle_Speed_Rotation;
	
	struct Point temp_point;
	struct Point now_point;
	u32 temp,temp2;
	u8 delay_flag = 1;
	u8 hall_flag = 0;
	u8 time_flag = 1,time_flag2 = 1;
	u8 handleoff_flag = 1,handleoff_flag2 = 1;
	u8 flag[6] = {0}; //对应电机的运行状态
	int16_t Speed_M = 500;
	float pos_openfan = 4;
	extern float Motor2_Aim_Pos[];
	extern u8 Motor2_Time_Flag;
	
	u8 x_con_flag = 0;	//X方向闭环
	u8 XY_Only = 0;
	Handle_Speed_X = 0;
	Handle_Speed_Y = 0;
  HandleData_X.lr= 12288;
  HandleData_Y.lr= 12288;
	TIM2->CNT = 0;
	
    while(1)
    {
		temp = *handle_count;
		temp2 = *handle_count2;
		while(*handle_count == temp)
		{
			time_flag++;
			Delay_ms(5);
			if(time_flag > 60)//超时
			{
				time_flag = 0;
				handle_timeout_flag = 1;
				if(handleoff_flag)
				{
					Handle_Off_Count++;
					handleoff_flag = 0;
				}
				break;
			}
		}
				while(*handle_count2 == temp2)
		{
			time_flag2++;
			Delay_ms(5);
			if(time_flag2 > 60)//超时
			{
				time_flag2 = 0;
				handle_timeout_flag2 = 1;
				if(handleoff_flag2)
				{
					Handle_Off_Count2++;
					handleoff_flag2 = 0;
				}
				break;
			}
		}
		
		if(time_flag||time_flag2)//手柄工作正常
		{
			time_flag = 1;
			time_flag2 = 1;
			handle_timeout_flag = 0;
			handle_timeout_flag2 = 0;
			handleoff_flag = 1;
			handleoff_flag2 = 1;
			Handle_Speed_X = HandleData_X.lr-12288;
			Handle_Speed_Y = HandleData_Y.lr-12288;
			Handle_Speed_Rotation = 0;
			//Handle_Speed_Y = HandleData_Y.ud-12288;
			//Handle_Speed_Rotation = (HandleData_X.turn-12288)/10.0;
			
			if(Button10_On && Button7_Off)
			{
				Handle_Speed_X /= 10.0;
				Handle_Speed_Y /= 10.0;
				Handle_Speed_Rotation /= 10.0;
				Speed_M = 150;
			}
			else
				Speed_M = 500;
			
			if(Button9_On)
			{
//				HandoverFlag[0]=1;
//				HandoverFlag[1]=1;
//				HandoverFlag[2]=0;
//				PoleFlag = 1;
//				SwingFlag = 1;
			}
			if(Button9_Off)
			{
//				HandoverFlag[0]=0;
//				HandoverFlag[1]=0;
//				HandoverFlag[2]=0;
//				PoleFlag = 0;
//				SwingFlag = 0;
			}
			
			if(XY_Only)
			{
			//	Handle_Speed_X=0;
				Handle_Speed_Rotation=0;
			}
			
			if(GROUND==RED_GROUND)
			{
				Handle_Speed_X = -Handle_Speed_X;
				Handle_Speed_Y = -Handle_Speed_Y;
			}
			
			if(x_con_flag)
			{
				temp_point.x = GPS.position.x + Handle_Speed_X*cos(GPS.radian);
				temp_point.y = GPS.position.y + Handle_Speed_X*sin(GPS.radian);
				
				SetSpeed(Speed_X,Speed_Y+Handle_Speed_Y,Speed_Rotation+Handle_Speed_Rotation);
				
				EasyLine(temp_point,GPS.radian,Abs(Handle_Speed_X));
			}
			else
 				SetSpeed(Speed_X+Handle_Speed_X,Speed_Y+Handle_Speed_Y,Speed_Rotation+Handle_Speed_Rotation);
          //SetSpeed(Speed_X,Speed_Y,Speed_Rotation+Handle_Speed_Rotation);   //手柄前后出现问题,先无视之。。。
			
			/*********************************上层动作控制***********************************/
			
			//------------单键控制电机------------//
			if(Button1_Up && Button7_Off && flag[1]==0)
			{
				flag[1]=1;
			    Moto_Set_GSpeed(W_MOTOR1_OLD_ID, 4*Speed_M);
			}
			if(Button1_Down && Button7_Off && flag[1]==0)
			{
				flag[1]=1;
			    Moto_Set_GSpeed(W_MOTOR1_OLD_ID, -4*Speed_M);
			}
			if(Button1_Off && (flag[1]==1))
			{
				flag[1]=0;
				Moto_Stop(W_MOTOR1_OLD_ID);
			}

			
			if(Button2_Up && Button7_Off && flag[2]==0)
			{
				flag[2]=1;
			    Moto_Set_GSpeed(W_MOTOR2_OLD_ID, -3*Speed_M);
			}
			if(Button2_Down && Button7_Off && flag[2]==0)
			{
				flag[2]=1;
			    Moto_Set_GSpeed(W_MOTOR2_OLD_ID, 3*Speed_M);
			}
			if(Button2_Off && (flag[2]==1))
			{
				Moto_Stop(W_MOTOR2_OLD_ID);
				flag[2]=0;
			}
			
			
			if(Button3_Up && Button7_Off && flag[3]==0)
			{
				flag[3]=1;
			    Moto_Set_GSpeed(W_MOTOR3_OLD_ID, -30*Speed_M);
			}
			if(Button3_Down && Button7_Off && flag[3]==0)
			{
				flag[3]=1;
			    Moto_Set_GSpeed(W_MOTOR3_OLD_ID, 30*Speed_M);
			}
			if(Button3_Off && (flag[3]==1))
			{
				flag[3]=0;
				Moto_Stop(W_MOTOR3_OLD_ID);
			}
			
			//------------涵道------------//
			if(Button4_Up && Button7_Off && Button10_Off)
			{
			    Fan_Duty(L_CH,60.0);
				Fan_Duty(R_CH,60.0);
			}
			if(Button4_Down && Button7_Off && Button10_Off)
			{
			    Fan_Stop();
			}
			
			//------------霍尔------------//
			if(Button5_Up && Button7_Off && Button10_Off && hall_flag == 0)
			{
				hall_flag = 1;
				if(Hall_Count > 6) Hall_Count=1;
			    Hall_Send(Hall_Count);
			}
			if(Button5_Down && Button7_Off && Button10_Off && hall_flag == 0)
			{
				hall_flag = 1;
				if(Hall_Count > 1) Hall_Count -= 2;
				Hall_Send(Hall_Count);
			}
			if(Button5_Off && hall_flag == 1)
			{
				hall_flag = 0;
			}
			
		  	//------------双键组合用来控制电磁阀,7键为第二功能键------------//
			
			if(Button6_Up && Button7_Off && Button10_Off){
				HandPush();
			}
			if(Button6_Down && Button7_Off && Button10_Off){
				HandPushOff();
			}
			
			//缓冲装置
			if(Button1_Up && Button7_On && Button10_Off){
				BufferOn();
			}
			if(Button1_Down && Button7_On && Button10_Off){
				BufferOff();
			}
			//旋转调姿
		  	if(Button2_Up && Button7_On && Button10_Off){
				HandTurnRight();
			}
			if(Button2_Down && Button7_On && Button10_Off){
				HandTurnLeft();
			}
			//俯仰调姿
			if(Button3_Up && Button7_On && Button10_Off){
				HandRaise();
			}
			if(Button3_Down && Button7_On && Button10_Off){
				HandFall();
			}
			//放置大炮
			if(Button4_Up && Button7_On && Button10_Off){
			    GunOn();
			}
			
			if(Button4_Down && Button7_On && Button10_Off){
			    GunOff();
			}
			//开炮
     		if(Button5_Up && Button7_On && Button10_Off){
				FireOn();
			}
			
			if(Button5_Down && Button7_On && Button10_Off){
				FireOff();
			}
			
			
			//交接爪
			if(Button6_Up && Button7_On && Button10_Off){
			    HandOpen();
			}
			
			if(Button6_Down && Button7_On && Button10_Off){
			    HandClose();
			}
			
			//------------双键组合用来控制上下电机的位置,10键为第二功能键------------//
			
			if(Button4_Up && Button7_Off && Button10_On){
			    Moto_Set_GPos(W_MOTOR2_OLD_ID,Motor2_Aim_Pos[0]);
			}
			
			if(Button4_Down && Button7_Off && Button10_On){
			    Moto_Set_GPos(W_MOTOR2_OLD_ID,Motor2_Aim_Pos[2]);
			}
			if(Button5_Up && Button7_Off && Button10_On){
			    Moto_Set_GPos(W_MOTOR2_OLD_ID,Motor2_Aim_Pos[4]);
			}
			
			if(Button5_Down && Button7_Off && Button10_On){
			    Moto_Set_GPos(W_MOTOR2_OLD_ID,Motor2_Aim_Pos[6]);
			}
			
			if(Button6_Up && Button7_Off && Button10_On){
			    HandUD(0,NO);
				Delay_ms(500);
				HandClose();//关爪子
				HandFB(0,NO,3500);
				FireOn();//开炮
				Delay_ms(100);

				now_point.x = GPS.position.x-700*cos(GPS.radian);
				now_point.y = GPS.position.y-700*sin(GPS.radian);
				SetLine(now_point,GPS.radian,100,1200,0);
				
				while(1)
				{
					GoLine();
					SetSpeed(Speed_X+Handle_Speed_X,Speed_Y+Handle_Speed_Y,Speed_Rotation+Handle_Speed_Rotation);
					if(delay_flag)
						delay_flag++;
					if(delay_flag>100)
					{
						delay_flag = 0;
						FireOff();
					}
					if(GetLength(GPS.position,now_point) < 10)
					{
						SPEED_STOP;
						break;
					}
					Delay_ms(5);
				}
				delay_flag = 1;
				FireClear();
				
				Delay_ms(50);
				BufferOn();//打开缓冲装置
				Delay_ms(500);
				BufferOff();//重新复位缓冲装置
			}
			
			if(Button6_Down && Button7_Off && Button10_On){
			    now_point.x = GPS.position.x+680*cos(GPS.radian);
				now_point.y = GPS.position.y+680*sin(GPS.radian);
				SetLine(now_point,GPS.radian,300,1200,0);
				HandFB(Motor1_Aim_Pos[4],NO,3500);//抓取自动机器人
				while(1)
				{
					GoLine();
					SetSpeed(Speed_X+Handle_Speed_X,Speed_Y+Handle_Speed_Y,Speed_Rotation+Handle_Speed_Rotation);
					if(GetLength(GPS.position,now_point) < 10)
					{
						SPEED_STOP;
						break;
					}
					Delay_ms(5);
				}
				SetSpeed(Speed_X,Speed_Y,Speed_Rotation);
				
				HandUD(0.5,NO);
				HandOpen();//松开爪子
				
				Delay_ms(300);
				FireOff();
				BufferOn();//打开缓冲装置
			}
			
			
			//三键组合用来重复任务
			if(Button1_Up && Button7_On && Button10_On){
				Retry = 1;
				RouteFinish=0;
				Hall_Send(1);//翘翘板初始化
				rt_mb_send(&Mb_Emergency, 7);
				rt_mb_send (&Mb_Arm, 1);
			}
			if(Button2_Up && Button7_On && Button10_On){
				Retry = 1;
				RouteFinish=0;
				Hall_Send(2);//梅花桩初始化
				rt_mb_send(&Mb_Emergency, 7);
				rt_mb_send (&Mb_Arm, 4);
			}
			if(Button3_Up && Button7_On && Button10_On){
				Retry = 1;
				RouteFinish=0;
				Hall_Send(4);//秋千初始化
				rt_mb_send(&Mb_Emergency, 7);
				rt_mb_send (&Mb_Arm, 6);
			}
			if(Button4_Up && Button7_On && Button10_On){
				Retry = 1;
				RouteFinish=0;
				Hall_Send(6);//楼梯初始化
				rt_mb_send(&Mb_Emergency, 7);
				rt_mb_send (&Mb_Arm, 7);
			}
			if(Button5_Up && Button7_On && Button10_On){
					rt_mb_send(&Mb_Emergency, 6);
			}
			if(Button6_Up && Button7_On && Button10_On){
				Retry = 1;
				RouteFinish=0;
				rt_mb_send(&Mb_Emergency, 7);
				//Motor_Init();
				FireOff();
				BufferOn();
				ChooseGround_Pole(GROUND);
				W_MOTOR_OLD_FUNC(W_MOTOR1_OLD_ID, 0.5 , 1000 , CMD_SET_PSG);
				Moto_Set_GPos(W_MOTOR2_OLD_ID,2.55);
				LCD_Clear();
				LCD_SetXY(0,1);
				LCD_Printf("Ready to go!");
				Wait_Button8_Change();
				rt_mb_send (&Mb_Auto, 1);
			}
		}
		
		else
		{
			SPEED_STOP;
			//Acc_Limit_Enable = 0;
			SetSpeed(0,0,0);
			//Acc_Limit_Enable = 1;
			Moto_Stop(W_MOTOR1_OLD_ID);
			Moto_Stop(W_MOTOR2_OLD_ID);
			//Moto_Stop(W_MOTOR3_OLD_ID);
			//Com_Printf(5,"v0\r");
		}
        
		if(Abs(Motor_Pos[0])>pos_openfan && CHILD_ON && !fan_flag)
		{
			fan_flag = 1;
			Fan_Duty(L_CH,60.0);
			Fan_Duty(R_CH,60.0);
		}
		if((Abs(Motor_Pos[0])<pos_openfan || CHILD_OFF) && fan_flag)
		{
			fan_flag = 0;
			Fan_Stop();
		}
		
		if(Motor2_Time_Flag>10)
		{
			//W_MOTOR_OLD_FUNC(W_MOTOR2_OLD_ID, 0 , 0 , CMD_INIT_CAN);
			Motor2_Time_Flag = 0;
		}
		
        Delay_ms(10);
    }
}
Beispiel #21
0
bool CGUIDialogGamepad::OnAction(const CAction &action)
{
  if ((action.GetButtonCode() >= KEY_BUTTON_A &&
       action.GetButtonCode() <= KEY_BUTTON_RIGHT_TRIGGER) ||
      (action.GetButtonCode() >= KEY_BUTTON_DPAD_UP &&
       action.GetButtonCode() <= KEY_BUTTON_DPAD_RIGHT))
  {
    switch (action.GetButtonCode())
    {
    case KEY_BUTTON_A : m_strUserInput += "A"; break;
    case KEY_BUTTON_B : m_strUserInput += "B"; break;
    case KEY_BUTTON_X : m_strUserInput += "X"; break;
    case KEY_BUTTON_Y : m_strUserInput += "Y"; break;
    case KEY_BUTTON_BLACK : m_strUserInput += "K"; break;
    case KEY_BUTTON_WHITE : m_strUserInput += "W"; break;
    case KEY_BUTTON_LEFT_TRIGGER : m_strUserInput += "("; break;
    case KEY_BUTTON_RIGHT_TRIGGER : m_strUserInput += ")"; break;
    case KEY_BUTTON_DPAD_UP : m_strUserInput += "U"; break;
    case KEY_BUTTON_DPAD_DOWN : m_strUserInput += "D"; break;
    case KEY_BUTTON_DPAD_LEFT : m_strUserInput += "L"; break;
    case KEY_BUTTON_DPAD_RIGHT : m_strUserInput += "R"; break;
    default : return true; break;
    }

    CStdString strHiddenInput(m_strUserInput);
    for (int i = 0; i < (int)strHiddenInput.size(); i++)
    {
      strHiddenInput[i] = m_cHideInputChar;
    }
    SetLine(2, strHiddenInput);
    return true;
  }
  else if (action.GetButtonCode() == KEY_BUTTON_BACK || action.GetID() == ACTION_PREVIOUS_MENU || action.GetID() == ACTION_NAV_BACK)
  {
    m_bConfirmed = false;
    m_bCanceled = true;
    m_strUserInput = "";
    m_bHideInputChars = true;
    Close();
    return true;
  }
  else if (action.GetButtonCode() == KEY_BUTTON_START)
  {
    m_bConfirmed = false;
    m_bCanceled = false;

    CStdString md5pword2;
    XBMC::XBMC_MD5 md5state;
    md5state.append(m_strUserInput);
    md5state.getDigest(md5pword2);

    if (!m_strPassword.Equals(md5pword2))
    {
      // incorrect password entered
      m_iRetries--;

      // don't clean up if the calling code wants the bad user input
      if (m_bUserInputCleanup)
        m_strUserInput = "";
      else
        m_bUserInputCleanup = true;

      m_bHideInputChars = true;
      Close();
      return true;
    }

    // correct password entered
    m_bConfirmed = true;
    m_iRetries = 0;
    m_strUserInput = "";
    m_bHideInputChars = true;
    Close();
    return true;
  }
  else if (action.GetID() >= REMOTE_0 && action.GetID() <= REMOTE_9)
  {
    return true; // unhandled
  }
  else
  {
    return CGUIDialog::OnAction(action);
  }
}
Beispiel #22
0
void TagEntry::Create(const wxString &fileName,
                      const wxString &name,
                      int lineNumber,
                      const wxString &pattern,
                      const wxString &kind,
                      std::map<wxString, wxString>& extFields)
{
    SetPosition( wxNOT_FOUND );
    SetName( name );
    SetLine( lineNumber );
    SetKind( kind.IsEmpty() ? wxT("<unknown>") : kind );
    SetPattern( pattern );
    SetFile( fileName );
    SetId(-1);
    SetParentId(-1);

    m_extFields = extFields;
    wxString path;

    // Check if we can get full name (including path)
    path = GetExtField(wxT("class"));
    if(!path.IsEmpty()) {
        UpdatePath( path ) ;
    } else {
        path = GetExtField(wxT("struct"));
        if(!path.IsEmpty()) {
            UpdatePath( path ) ;
        } else {
            path = GetExtField(wxT("namespace"));
            if(!path.IsEmpty()) {
                UpdatePath( path ) ;
            } else {
                path = GetExtField(wxT("interface"));
                if(!path.IsEmpty()) {
                    UpdatePath( path ) ;
                } else {
                    path = GetExtField(wxT("enum"));
                    if(!path.IsEmpty()) {
                        UpdatePath( path ) ;
                    } else {
                        path = GetExtField(wxT("union"));
                        if(!path.IsEmpty()) {
                            UpdatePath( path ) ;
                        }
                    }
                }
            }
        }
    }

    if(!path.IsEmpty()) {
        SetScope(path);
    } else {
        SetScope(wxT("<global>"));
    }

    // If there is no path, path is set to name
    if( GetPath().IsEmpty() )
        SetPath( GetName() );

    // Get the parent name
    StringTokenizer tok(GetPath(), wxT("::"));
    wxString parent;

    (tok.Count() < 2) ? parent = wxT("<global>") : parent = tok[tok.Count()-2];
    SetParent(parent);
}
Beispiel #23
0
AssKaraoke::AssKaraoke(AssDialogue *line, bool auto_split, bool normalize) {
	if (line) SetLine(line, auto_split, normalize);
}
Beispiel #24
0
void KEYBED_Process(void)
{
	timerTick++;
	
	upperSwitches = GetKeys();
	SetLine(0);
	ReadKeysFromOddLine(0);
	SetLine(3);
	Delay(22);

	upperSwitches = GetKeys();
	SetLine(2);
	ReadKeysFromOddLine(8);
	SetLine(5);
	Delay(22);

	upperSwitches = GetKeys();
	SetLine(4);
	ReadKeysFromOddLine(16);
	SetLine(7);
	Delay(22);

	upperSwitches = GetKeys();
	SetLine(6);
	ReadKeysFromOddLine(24);
	SetLine(9);
	Delay(22);

	upperSwitches = GetKeys();
	SetLine(8);
	ReadKeysFromOddLine(32);
	SetLine(11);
	Delay(22);

	upperSwitches = GetKeys();
	SetLine(10);
	ReadKeysFromOddLine(40);
	SetLine(13);
	Delay(22);

	upperSwitches = GetKeys();
	SetLine(12);
	ReadKeysFromOddLine(48);
	SetLine(15);
	Delay(22);

	upperSwitches = GetKeys();
	SetLine(14);
	ReadKeysFromOddLine(56);
	SetLine(1);
	Delay(22);
}
void VHTMLSyntax::SetLine( ICodeEditorDocument *inDocument, sLONG inLineNumber, bool inLoading )
{
#if 0
	VString source;
	inDocument->GetLine( inLineNumber, source );
	
	HTMLParser parser;
	HTMLParser::State *state = NULL;
	HTMLParser::State *prevLineState = NULL;
	if (inLineNumber > 0)	prevLineState = GetStateForLine( inDocument, inLineNumber - 1 );
	ParsingCookie *cookie = new ParsingCookie( inDocument, inLineNumber );
	parser.Parse( source, prevLineState, &state, this, (const void *)cookie );
	SetStateForLine( inDocument, inLineNumber, state );
	cookie->Release();
#else
	// Get the params for the current line so that we can set them up properly
	VLineSyntaxParams *currentLineParams = static_cast< VLineSyntaxParams * >( inDocument->GetLineSyntaxParams( inLineNumber ) );
	if (!currentLineParams) {
		currentLineParams = new VLineSyntaxParams();
		inDocument->AssignLineSyntaxParams( inLineNumber, currentLineParams );
	}
	bool previousOpenCommentState = currentLineParams->IsOpenComment();

	// We also want the params for the preceeding line, in case we're the continuation of
	// a comment.
	VLineSyntaxParams *previousLineParams = NULL;
	if (inLineNumber > 0) {
		previousLineParams = static_cast< VLineSyntaxParams * >( inDocument->GetLineSyntaxParams( inLineNumber - 1 ) );
	}

	VString xstr;
	inDocument->GetLine(inLineNumber,xstr);
	inDocument->SetLineStyle(inLineNumber,0,xstr.GetLength(),0);		//initiate the line

	char *lexinput = CreateUTF8String( xstr );
	struct htmlLexeme *list = parseHTML( lexinput );

	// If we used to be in comment continuation mode, the assumption is that we're still in 
	// comment continuation mode.  We'll switch this off if the comment ends though
	currentLineParams->CopyState( previousLineParams );

	// We are going to keep track of which open and close tags we've seen on the line.  This allows
	// us to determine which unmatched open and close tags exist so we can associate that data with
	// the line.  As we find open tags, we'll push them onto the open tag list.  As we find close tags,
	// we will scan the open tag list and *remove* any that match.  If there's no match, then we'll add
	// the tag to the close list.
	std::vector< VString > openList, closeList;

	// Given the list of HTML tokens, let's walk over the list and try to make some sense
	// of them.  Walk over the list one token at a time, and see if we can make sense of 
	// what we've got.
	struct htmlLexeme *cur = list;
	while (cur) {
		// There are only three types of comments we need to worry about.  Full comments, 
		// open comments and close comments.  We'll get a token representing any one of the
		// three.  However, we need to pay special attention to multi-line comments, since
		// they won't lex out entirely correct.  If the previous line was part of an open
		// comment, then we want to keep walking over the tokens, marking them as part of
		// the comment, until we run out of tokens, or we find a kCommentClose token.
		if (currentLineParams->IsOpenComment()) {
			if (kCommentClose == cur->fStyle) {
				// We found the end of the comment, so we can highlight it appropriately, 
				// and go back to our regularly scheduled lexing
				inDocument->SetLineStyle( inLineNumber, cur->fOffset, cur->fOffset + cur->fLength, htmlcolorShadow[ comment_col ] );

				// We're also done being a part of the comment continuation train
				currentLineParams->SetIsOpenComment( false );
			} else {
				// This is just another part of the comment
				inDocument->SetLineStyle( inLineNumber, cur->fOffset, cur->fOffset + cur->fLength, htmlcolorShadow[ comment_col ] );
			}
			// Advance
			cur = cur->fNext;
			continue;
		}
		if (kCompleteComment == cur->fStyle) {
			// A complete comment is the easiest of the three cases.  Just highlight it
			inDocument->SetLineStyle( inLineNumber, cur->fOffset, cur->fOffset + cur->fLength, htmlcolorShadow[ comment_col ] );
		} else if (kCommentOpen == cur->fStyle) {
			// An open comment must be the last token in the list
			xbox_assert( !cur->fNext );

			// We want to highlight from here to the end of the line
			inDocument->SetLineStyle( inLineNumber, cur->fOffset, cur->fOffset + cur->fLength, htmlcolorShadow[ comment_col ] );
			// We also want to flag that this line ends with an open comment
			currentLineParams->SetIsOpenComment( true );
		} else if (kCommentClose == cur->fStyle) {
			// If we got a close comment token, then something's off.  That means the user put in a close comment
			// token, but they never opened it.  We're going to ignore that state, and flag this as being normal
			inDocument->SetLineStyle( inLineNumber, cur->fOffset, cur->fOffset + cur->fLength, htmlcolorShadow[ scommentend_col ] );
		} else if (kString == cur->fStyle) {
			inDocument->SetLineStyle( inLineNumber, cur->fOffset, cur->fOffset + cur->fLength, htmlcolorShadow[ string_col ] );
		} else if (kKeyword == cur->fStyle) {
			// Keywords a bit trickier than you might think because we need to be sure they're actually part of a
			// tag.  If the user types something like: <b>This table rocks</b>, we only want to highlight the b in the
			// begin and end tag, and not the "table" in the user's text.  To deal with this, we have an "in tag" flag
			// that basically turns keyword highlighting on and off.
			if (currentLineParams->IsProcessingTag()) {
				inDocument->SetLineStyle( inLineNumber, cur->fOffset, cur->fOffset + cur->fLength, htmlcolorShadow[ keyword_col ] );

				// If we're processing an opening tag, then we want to push the keyword onto the tag stack.  But if we're
				// processing a closing tag, then we want to pop the last keyword off the tag stack and try to match it up
				// to what we just processed.  If they match, we're golden.  If not, we just assume the user's mismatching
				// their tags because they're an idiot.
				VString tagName;
				xstr.GetSubString( cur->fOffset + 1, cur->fLength, tagName );

				if (currentLineParams->IsProcessingStartTag()) {
					if (!IsTagWithoutClose( tagName )) {
						openList.push_back( tagName );
					}
					currentLineParams->PushTag( tagName );

					// Note that we are no longer processing the start of a tag.  This allows us to handle attributes
					// separately from the tag itself.
					currentLineParams->SetIsProcessingStartTag( false );
				} else {
					// Check to see if this closed tag is on the open list.  If it is, we want to remove it from the
					// list.  Otherwise, we want to add it to the close list.
					bool bAddToClose = true;
					for (std::vector< VString >::iterator iter = openList.begin(); bAddToClose && iter != openList.end();) {
						if (tagName.EqualTo( *iter, false )) {
							iter = openList.erase( iter );
							bAddToClose = false;
						} else {
							++iter;
						}
					}
					if (bAddToClose)	closeList.push_back( tagName );

					VString lastTag;
					currentLineParams->PopTag( lastTag );

					if (!lastTag.EqualTo( tagName, false )) {
						// The tags don't match, so we're just going to ignore the issue
						// TODO: do something more sensible here
					}
				}
			}
		} else if (kNumber == cur->fStyle) {
			inDocument->SetLineStyle( inLineNumber, cur->fOffset, cur->fOffset + cur->fLength, htmlcolorShadow[ allnum_col ] );
		} else if (kTagOpen == cur->fStyle || kEndTagOpen == cur->fStyle) {
			currentLineParams->SetIsProcessingTag( true );
			currentLineParams->SetIsProcessingStartTag( kTagOpen == cur->fStyle );
		} else if (kTagClose == cur->fStyle || kTagSelfClose == cur->fStyle) {
			currentLineParams->SetIsProcessingTag( false );

			// If we just handled a self-closing tag (like <br />), then we want to pop it from the stack
			VString lastTag;
			currentLineParams->LastTag( lastTag );
			if (kTagSelfClose == cur->fStyle || IsTagWithoutClose( lastTag )) {
				VString toss;
				currentLineParams->PopTag( toss );

				// We also do not want to add it to our list of open tags for the line, since it's self-closed
				for (std::vector< VString >::iterator iter = openList.begin(); iter != openList.end(); ++iter) {
					if (lastTag.EqualTo( *iter, false )) {
						iter = openList.erase( iter );
						break;
					}
				}
			}
		}

		cur = cur->fNext;
	}
	FreeLexemeList( list );

	// Now that we have an open and a close list, we want to associate them with the line.
	for (std::vector< VString >::iterator iter = openList.begin(); iter != openList.end(); ++iter) {
		currentLineParams->AddUnmatchedOpenTag( *iter );
	}
	for (std::vector< VString >::iterator iter = closeList.begin(); iter != closeList.end(); ++iter) {
		currentLineParams->AddUnmatchedCloseTag( *iter );
	}

	// There are two cases we really need to care about.  If the line now ends in
	// an open comment (and didn't used to), we want to colorize down the document.
	// Also, if the line no longer ends in an open comment (but used to), we want to
	// colorize down the document.  In either case, we want to keep colorizing subsequent
	// lines until the comment is ended or the end of the document is reached.
	if ((!previousOpenCommentState && currentLineParams->IsOpenComment() ||		// Now ends with open comment, didn't used to
		previousOpenCommentState && !currentLineParams->IsOpenComment()) &&		// Used to end with an open comment, but no longer does
		inLineNumber + 1 < inDocument->GetNbLines()) {
		SetLine( inDocument, inLineNumber + 1, inLoading );
	}
#endif // old code
}
Beispiel #26
0
void  OGL3DBase::DrawOneAxes( const double&         axMin,
                              const double&         axMax,
                              const SC_DoubleArray& majorIncs,
                              const SC_DoubleArray& minorIncs,
                              const PC_AxesFormat&  format,
                                    Point2D&        stPoint,
                                    Point2D&        majTicEndPoint,
                                    Point2D&        minTicEndPoint,
                                    Point2D&        gridEndPoint,
                                    Point2D&        offsetEndPoint,
                                    double&         stComponent,
                                    double&         majTicComponent,
                                    double&         minTicComponent,
                                    double&         gridComponent,
                                    double&         offsetComponent,
                              const double&         zValue,
                                    Plane3D         axPlane,
                                    bool            axisIsLog)
{

    Point2D* endPoint;
    double*  endComponent;

    PC_3DAxesFormat&  axesFormat = plot3Dbase.axesFormat;
    DC_PenSet&        penSet   = *plot3Dbase.defaultPenSet;          //  default PenSet used for plot

    if (format.axesLinePos == PC_AxesFormat::alpBoth)
    {
        SetDrawColor(penSet.GetColor(axesFormat.axesLinePen));
        SetLine(axesFormat.axesLineWidth);
        SetLineSolid();

        HardCopyBlockStart(6);

        stComponent = axMin;
        Point2D axSt = stPoint;
        stComponent = axMax;
        Point2D axEnd = stPoint;
        DrawLine(axSt, axEnd, zValue, axPlane);

        //  needed at axes end to make offsets look clean
        endPoint = &offsetEndPoint;
        endComponent = &offsetComponent;

        stComponent = axMin;
        *endComponent = stComponent;
        DrawLine(stPoint, *endPoint, zValue, axPlane);

        stComponent = axMax;
        *endComponent = stComponent;
        DrawLine(stPoint, *endPoint, zValue, axPlane);

        HardCopyBlockEnd();
    }


    if ((format.axesMajorInc == PC_Axes::aitGrid) ||
        ((format.axesMajorInc == PC_Axes::aitTic) && (format.axesTicPos == PC_AxesFormat::atpBoth)))
    {
        SetDrawColor(penSet.GetColor(axesFormat.majorPen));
        if (format.axesMajorInc == PC_Axes::aitTic)
        {
            SetLine(axesFormat.majorTicWidth);
            endPoint = &majTicEndPoint;
            endComponent = &majTicComponent;
        }
        else
        {
            SetLine(axesFormat.majorGridWidth);
            SetLineType(axesFormat.majorGridLineType);
            endPoint = &gridEndPoint;
            endComponent = &gridComponent;
        }
        HardCopyBlockStart(majorIncs.Size() * 2);
        for (int i = 0; i < majorIncs.Size(); i++)
        {
            stComponent = majorIncs[i];
            if (Limit::WithinOneLimit(axMin, axMax, stComponent))
            {
                *endComponent = stComponent;
                DrawLine(stPoint, *endPoint, zValue, axPlane);
            }
        }
        HardCopyBlockEnd();
    }



    if ((format.axesMinorInc == PC_Axes::aitGrid) ||
        ((format.axesMinorInc == PC_Axes::aitTic) && (format.axesTicPos == PC_AxesFormat::atpBoth)))
    {
        SetDrawColor(penSet.GetColor(axesFormat.minorPen));
        if (format.axesMinorInc == PC_Axes::aitTic)
        {
            SetLine(axesFormat.minorTicWidth);
            endPoint = &minTicEndPoint;
            endComponent = &minTicComponent;
        }
        else
        {
            SetLine(axesFormat.minorGridWidth);
            SetLineType(axesFormat.minorGridLineType);

            endPoint = &gridEndPoint;
            endComponent = &gridComponent;
        }


        HardCopyBlockStart((majorIncs.Size() + 1) * minorIncs.Size()  * 2);

        if (!axisIsLog)
        {
            double multVal = 1.0;
            if (axMin > axMax )
                multVal = -1.0;

            for (int i = -1; i < majorIncs.Size(); i++)
                for (int j = 0; j < minorIncs.Size(); j++)
                {
                    if (i < 0)
                        stComponent = majorIncs[0] - (minorIncs[j] * multVal);
                    else
                        stComponent = majorIncs[i] + (minorIncs[j] * multVal);

                    if (Limit::WithinOneLimit(axMin, axMax, stComponent))
                    {
                        *endComponent = stComponent;
                        DrawLine(stPoint, *endPoint, zValue, axPlane);
                    }
                }
        }
        else
        {
            //
            static const double logIncVals[] = {0.30103, 0.47712, 0.60206, 0.69897,
                                                0.77815, 0.84510, 0.90309, 0.95424};
            if (axMin < axMax)
            {
                for (int i = -1; i < majorIncs.Size(); i++)
                    for (int j = 0; j < 8; j++)
                    {
                        if (i < 0)
                            stComponent = majorIncs[0] - 1.0 + logIncVals[j];
                        else
                            stComponent = majorIncs[i] + logIncVals[j];

                        if (Limit::WithinOneLimit(axMin, axMax, stComponent))
                        {
                            *endComponent = stComponent;
                            DrawLine(stPoint, *endPoint, zValue, axPlane);
                        }
                    }
            }
            else
            {
                for (int i = -1; i < majorIncs.Size(); i++)
                    for (int j = 0; j < 8; j++)
                    {
                        if (i < 0)
                            stComponent = majorIncs[0] + logIncVals[j];
                        else
                            stComponent = majorIncs[i] - 1.0 + logIncVals[j];

                        if (Limit::WithinOneLimit(axMin, axMax, stComponent))
                        {
                            *endComponent = stComponent;
                            DrawLine(stPoint, *endPoint, zValue, axPlane);
                        }
                    }
            }

        }
        HardCopyBlockEnd();

    }
}
Beispiel #27
0
TokenLine::TokenLine(char *string)
{
	SetLine(string);
}
Beispiel #28
0
/*>HandleEvent(APTR object)
   ------------------------
   Dispatch menu events.
   12.03.92 Original.
   30.03.92 Modified MenuEdit to call OpenFile() directly.
   31.03.92 Modified MenuSave to call SaveAsFile() directly.
   05.05.92 Added Rexx menu handling
   12.06.92 Removed fill grey/hatch items and replaced with requester
   02.07.92 Added MenuPalette
   13.07.92 Added MenuScrBack
   20.07.92 Added DEMO_VERSION conditional
   07.08.92 Added RemoveFills()
*/
HandleEvent(APTR object)
{
   if(object == (APTR)MenuOpen)     { OpenFile(object);        return(0); }
   if(object == (APTR)MenuSave)     { SaveAsFile(object);      return(0); }
   if(object == (APTR)MenuSaveAs)   { SaveAsFile(object);      return(0); }
   if(object == (APTR)MenuEdit)     { OpenFile(object);        return(0); }
   if(object == (APTR)MenuPaper)    { SetPaper(object);        return(0); }
   if(object == (APTR)MenuSetPens)  { SetPens(object);         return(0); }
   if(object == (APTR)MenuPalette)  { SetPalette(object);      return(0); }
   if(object == (APTR)MenuScrBack)  { ScreenToBack(MyScreen);  return(0); }
   if(object == (APTR)MenuAbout)    { About(object);           return(0); }
   if(object == (APTR)MenuQuit)     { QuitProgram(object);     return(0); }
#ifndef DEMO_VERSION
   if(object == (APTR)MenuPS)       { PlotPS(object);          return(0); }
   if(object == (APTR)MenuHPGL)     { PlotHPGL(object);        return(0); }
   if(object == (APTR)MenuDR2D)     { PlotDR2D(object);        return(0); }
#endif
   if(object == (APTR)MenuXY)       { StyleXY(object);         return(0); }
   if(object == (APTR)MenuScatter)  { StyleScatter(object);    return(0); }
   if(object == (APTR)MenuBar)      { StyleBar(object);        return(0); }
   if(object == (APTR)MenuPie)      { StylePie(object);        return(0); }
   if(object == (APTR)MenuErrors)   { ToggleErrors(object);    return(0); }
   if(object == (APTR)MenuEject)    { EjectSlice(object);      return(0); }
   if(object == (APTR)MenuLineSet)  { SetLine(object);         return(0); }
   if(object == (APTR)MenuBarSet)   { SetBar(object);          return(0); }
   if(object == (APTR)MenuPieSet)   { SetPie(object);          return(0); }
   if(object == (APTR)MenuLogX)     { ToggleLogX(object);      return(0); }
   if(object == (APTR)MenuLogY)     { ToggleLogY(object);      return(0); }
   if(object == (APTR)MenuBoxed)    { ToggleBoxed(object);     return(0); }
   if(object == (APTR)MenuGrid)     { ToggleGrid(object);      return(0); }
   if(object == (APTR)MenuAxes)     { SetAxes(object);         return(0); }
   if(object == (APTR)MenuFZero)    { ToggleFZero(object);     return(0); }
   if(object == (APTR)MenuTitle)    { SetTitle(object);        return(0); }
   if(object == (APTR)MenuAxTitle)  { SetAxTitle(object);      return(0); }
   if(object == (APTR)MenuAxLabel)  { SetAxLabel(object);      return(0); }
   if(object == (APTR)MenuKey)      { SetKey(object);          return(0); }
   if(object == (APTR)MenuLabel)    { SetLabel(object);        return(0); }
   if(object == (APTR)MenuPen)      { ChangePen(object);       return(0); }
   if(object == (APTR)MenuFillType) { FillControl(object);     return(0); }
   if(object == (APTR)MenuRegress)  { SetRegress(object);      return(0); }
   if(object == (APTR)MenuRobust)   { ToggleRobust(object);    return(0); }
   if(object == (APTR)MenuFourier)  { SetFourier(object);      return(0); }
   if(object == (APTR)MenuRexxFit)  { RexxFit(object);         return(0); }
   if(object == (APTR)MenuRexx)     { InstallMacro(object);    return(0); }
   if(object == (APTR)MenuRunRexx)  { RunMacro(object);        return(0); }
   if(object == (APTR)MenuDebRexx)  { ToggleRexxDeb(object);   return(0); }
   if(object == (APTR)MenuLS1)      { SetLineDash(object);     return(0); }
   if(object == (APTR)MenuLS2)      { SetLineDash(object);     return(0); }
   if(object == (APTR)MenuLS3)      { SetLineDash(object);     return(0); }
   if(object == (APTR)MenuLS4)      { SetLineDash(object);     return(0); }
   if(object == (APTR)MenuLS5)      { SetLineDash(object);     return(0); }
   if(object == (APTR)MenuLS6)      { SetLineDash(object);     return(0); }
   if(object == (APTR)MenuFT1)      { SetFillType(object);     return(0); }
   if(object == (APTR)MenuFT2)      { SetFillType(object);     return(0); }
   if(object == (APTR)MenuFT3)      { SetFillType(object);     return(0); }
   if(object == (APTR)MenuFT4)      { SetFillType(object);     return(0); }
   if(object == (APTR)MenuFT5)      { SetFillType(object);     return(0); }
   if(object == (APTR)MenuFT6)      { SetFillType(object);     return(0); }
   if(object == (APTR)MenuNoFills)  { RemoveFills(object);     return(0); }

   return(0);
}
Beispiel #29
0
void  OGL2DBase::MinorTicDrawSetup()
{
    SetDrawColor(plot2Dbase.defaultPenSet->GetColor(plot2Dbase.plotAnnotation.axesDataPen));
    SetLine(plot2Dbase.plotAnnotation.minorTicWidth);
}