示例#1
0
文件: perft.cpp 项目: pd/benthos
void
do_perft(position_t *pos, scored_move_t *ms, int ply, int depth)
{
	scored_move_t *msbase = ms;
	uint8 stm = Stm(ply);
	scored_move_t *mv;

	if (Checked(stm^1))
		return;

	if (Checked(stm)) {
		ms = generate_evasions(pos, ms, ply);
		for (mv = msbase; mv < ms; mv++)
			if (PieceType(Capture(mv->move)) == KING)
				return;
	} else {
		ms = generate_captures(pos, ms, ply);
		for (mv = msbase; mv < ms; mv++)
			if (PieceType(Capture(mv->move)) == KING)
				return;
		ms = generate_noncaptures(pos, ms, ply);
	}

	for (mv = msbase; mv < ms; mv++) {
		make_move(pos, mv->move, ply);
		if (depth - 1)
			do_perft(pos, ms, ply + 1, depth - 1);
		else if (!Checked(stm))
			total_moves++;
		unmake_move(pos, mv->move, ply);
	}
}
示例#2
0
VOID UnloadHdwFilterDlg(HWND hwnd,DCB *pstComDCB)
  {
  char szReplaceChar[5];

  WinQueryDlgItemText(hwnd,HWR_ERRCHAR,3,szReplaceChar);
  pstComDCB->ErrChar = (BYTE)ASCIItoBin(szReplaceChar,16);

  WinQueryDlgItemText(hwnd,HWR_BRKCHAR,3,szReplaceChar);
  pstComDCB->BrkChar = (BYTE)ASCIItoBin(szReplaceChar,16);

  if (Checked(hwnd,HWR_ENABERR))
    pstComDCB->Flags2 |= F2_ENABLE_ERROR_REPL;
  else
    pstComDCB->Flags2 &= ~F2_ENABLE_ERROR_REPL;

  if (Checked(hwnd,HWR_ENABBRK))
    pstComDCB->Flags2 |= F2_ENABLE_BREAK_REPL;
  else
    pstComDCB->Flags2 &= ~F2_ENABLE_BREAK_REPL;

  if (Checked(hwnd,HWR_ENABNUL))
    pstComDCB->Flags2 |= F2_ENABLE_NULL_STRIP;
  else
    pstComDCB->Flags2 &= ~F2_ENABLE_NULL_STRIP;
  }
示例#3
0
BOOL TCHdwProtocolDlg(HWND hwnd,USHORT idButton)
  {
  switch(idButton)
    {
    case HWP_5BITS:
//      CheckButton(hwnd,idButton,~Checked(hwnd,idButton));
      ControlEnable(hwnd,HWP_15BITS,TRUE);
      ControlEnable(hwnd,HWP_2BITS,FALSE);
      if (Checked(hwnd,HWP_2BITS))
        {
        CheckButton(hwnd,HWP_2BITS,FALSE);
        CheckButton(hwnd,HWP_15BITS,TRUE);
        }
      break;
    case HWP_8BITS:
    case HWP_7BITS:
    case HWP_6BITS:
//      CheckButton(hwnd,idButton,~Checked(hwnd,idButton));
      ControlEnable(hwnd,HWP_15BITS,FALSE);
      ControlEnable(hwnd,HWP_2BITS,TRUE);
      if (Checked(hwnd,HWP_15BITS))
        {
        CheckButton(hwnd,HWP_15BITS,FALSE);
        CheckButton(hwnd,HWP_2BITS,TRUE);
        }
    default:
      return(FALSE);
    }
   return(TRUE);
  }
示例#4
0
void UnloadHdwTimeoutDlg(HWND hwnd,DCB *pstComDCB)
  {
  char szTimeout[9];

  if (Checked(hwnd,HWT_WINF))
    pstComDCB->Flags3 |= F3_INFINITE_WRT_TIMEOUT;
  else
    pstComDCB->Flags3 &= ~F3_INFINITE_WRT_TIMEOUT;

  WinQueryDlgItemText(hwnd,HWT_WTIME,6,szTimeout);
  pstComDCB->WrtTimeout = (WORD)atol(szTimeout);

  pstComDCB->Flags3 &= ~F3_RTO_MASK;
  if (Checked(hwnd,HWT_RNOWAIT))
    pstComDCB->Flags3 |= F3_WAIT_NONE;
  else
    {
    if (Checked(hwnd,HWT_RWAITSOME))
      pstComDCB->Flags3 |= F3_WAIT_SOMETHING;
    else
      pstComDCB->Flags3 |= F3_WAIT_NORM;
    }
  WinQueryDlgItemText(hwnd,HWT_RTIME,6,szTimeout);
  pstComDCB->ReadTimeout = (WORD)atol(szTimeout);
  }
示例#5
0
BOOL TCHdwTimeoutDlg(HWND hwnd,USHORT idButton)
  {
  switch(idButton)
    {
    case HWT_RNOWAIT:
      if (Checked(hwnd,HWT_RNOWAIT))
        {
        ControlEnable(hwnd,HWT_RTIMET,FALSE);
        ControlEnable(hwnd,HWT_RTIME,FALSE);
        }
      else
        {
        ControlEnable(hwnd,HWT_RTIMET,TRUE);
        ControlEnable(hwnd,HWT_RTIME,TRUE);
        }
      break;
    case HWT_RNORM:
    case HWT_RWAITSOME:
      if (Checked(hwnd,HWT_RNORM) || Checked(hwnd,HWT_RWAITSOME))
        {
        ControlEnable(hwnd,HWT_RTIMET,TRUE);
        ControlEnable(hwnd,HWT_RTIME,TRUE);
        }
      else
        {
        ControlEnable(hwnd,HWT_RTIMET,FALSE);
        ControlEnable(hwnd,HWT_RTIME,FALSE);
        }
      break;
    case HWT_WINF:
      if (Checked(hwnd,HWT_WINF))
        {
        ControlEnable(hwnd,HWT_WTIMET,FALSE);
        ControlEnable(hwnd,HWT_WTIME,FALSE);
        }
      else
        {
        ControlEnable(hwnd,HWT_WTIMET,TRUE);
        ControlEnable(hwnd,HWT_WTIME,TRUE);
        }
      break;
    case HWT_WNORM:
      if (Checked(hwnd,HWT_WNORM))
        {
        ControlEnable(hwnd,HWT_WTIMET,TRUE);
        ControlEnable(hwnd,HWT_WTIME,TRUE);
        }
      else
        {
        ControlEnable(hwnd,HWT_WTIMET,FALSE);
        ControlEnable(hwnd,HWT_WTIME,FALSE);
        }
      break;
    default:
      return(FALSE);
    }
  return(TRUE);
  }
示例#6
0
//
// Note: This method is from ViewerToggleAction but was transplanted
//       here to ensure that the action was updated. When using the
//       immediate base class's Update method the popup menu was not
//       updating on some platforms.
//
void
SetToolbarIconSizeActionUI::Update()
{
    // Update the action's enabled state.
    bool actionShouldBeEnabled = Enabled();
    if(action->isEnabled() != actionShouldBeEnabled)
        action->setEnabled(actionShouldBeEnabled);

    // Update the action's toggled state if it is a toggle action.
    if(action->isCheckable())
    {
        bool actionShouldBeToggled = Checked();
        if(toggled != actionShouldBeToggled)
        {
            // Set the appropriate icon into the action.
            if (!GetViewerProperties()->GetNowin() &&
                !action->icon().isNull())
            {
                if(actionShouldBeToggled)
                    SetIcon(QIcon(*toggledIcon));
                else
                    SetIcon(QIcon(*regularIcon));
            }
            action->blockSignals(true);
            action->setChecked(actionShouldBeToggled);
            action->blockSignals(false);
        }
        toggled = actionShouldBeToggled;
    }
}
示例#7
0
BOOL UnloadCfgFIFOsetupDlg(HWND hwnd,WORD *pwFlags,WORD *pwTxFIFOload)
  {
  *pwFlags &= ~F3_FIFO_MASK;
  if (Checked(hwnd,HWF_DISABFIFO))
    *pwFlags |= F3_HDW_BUFFER_DISABLE;
  else
    {
    if (Checked(hwnd,HWF_ENABFIFO))
      *pwFlags |= F3_HDW_BUFFER_ENABLE;
    else
      if (Checked(hwnd,HWF_APO))
        *pwFlags |= F3_HDW_BUFFER_APO;

    if (Checked(hwnd,HWF_4TRIG))
      *pwFlags |= F3_4_CHARACTER_FIFO;
    else
      if (Checked(hwnd,HWF_8TRIG))
        *pwFlags |= F3_8_CHARACTER_FIFO;
      else
        if (Checked(hwnd,HWF_14TRIG))
          *pwFlags |= F3_14_CHARACTER_FIFO;
    /*
    **  Set default TX load count
    */
    if (Checked(hwnd,HWF_TX_MIN))
      {
      *pwFlags &= ~F3_USE_TX_BUFFER;
      *pwTxFIFOload = 1;
      }
    else
      {
      *pwFlags |= F3_USE_TX_BUFFER;
      if (Checked(hwnd,HWF_TX_HALF))
        *pwTxFIFOload = 2;
      else
        if (Checked(hwnd,HWF_TX_HIHALF))
          *pwTxFIFOload = 3;
        else
          *pwTxFIFOload = 4;
      }
     /*
     **  Turn on bit to tell COMi that user has selected defaults for flag3
     */
    *pwFlags |= 0x8000;
    }
  return(TRUE);
  }
示例#8
0
void CToolbar::CheckAll(BOOL fCheck, ...)
{
	va_list argptr;
	va_start(argptr, fCheck);
	INT * idList = (INT*) argptr;

	for(INT i = 0; idList[i]; ++i)
		Checked(idList[i], fCheck);

	va_end(argptr);
}
BOOL _PositionStruct::MakeMove(int mv, int* ppcCaptured /*= NULL*/) {
  int pcCaptured;
  DWORD dwKey;

  dwKey = zobr.dwKey;
  pcCaptured = MovePiece(mv);
  if (Checked()) {
    UndoMovePiece(mv, pcCaptured);
    return FALSE;
  }
  ChangeSide();
  mvsList[nMoveNum].Set(mv, pcCaptured, Checked(), dwKey);
  nMoveNum ++;
  nDistance ++;
    
  // (HPHAN) Return the captured piece as well.
  if ( ppcCaptured != NULL ) {
    *ppcCaptured = pcCaptured;
  }
  return TRUE;
}
BOOL _PositionStruct::IsMate(void) {
  int i, nGenMoveNum, pcCaptured;
  int mvs[MAX_GEN_MOVES];

  nGenMoveNum = GenerateMoves(mvs);
  for (i = 0; i < nGenMoveNum; i ++) {
    pcCaptured = MovePiece(mvs[i]);
    if (!Checked()) {
      UndoMovePiece(mvs[i], pcCaptured);
      return FALSE;
    } else {
      UndoMovePiece(mvs[i], pcCaptured);
    }
  }
  return TRUE;
}
示例#11
0
// Compare the received checksum, and the calculated checksum. 
//If they are completely equal, return true. Otherwise return false.
boolean dGPS::Compare(){          
  char s[3];
  char *recCheck=Checks();                // received checksum
  long int x= Checked();                  // Computed checksum from the incoming $GPRMC string
  char *ccomCheck=itoa(x,s,16);           // convert long int to hexadecimal string 
  char comCheck[strlen(ccomCheck)];       
  for (int i=0;i<=strlen(ccomCheck);i++){ // convert ToUpper case, each character of hexadecimal string
    comCheck[i]= toupper(ccomCheck[i]);}

  boolean flag;
  // for each character in hexadecimal string, check if it matches with the received checksum value
  for (int i=0;i<min(strlen(recCheck),strlen(comCheck));i++){ 
    if (recCheck[i]==comCheck[i])
       { flag=true;  }                   // if characters in checksum match
    else { flag=false; }                 // if characters in checksum do not match
  }
  return flag;                // if all the characters in checksum match, then 'true' is returned. Otherwise, 'false' is returned.
}
void CheckBoxShadowNode::createView()
{
  Super::createView();

  auto checkbox = GetView().as<winrt::CheckBox>();
  auto wkinstance = GetViewManager()->GetReactInstance();
  checkbox.Checked([=](auto&&, auto&&)
  {
    auto instance = wkinstance.lock();
    if (!m_updating && instance != nullptr)
      OnCheckedChanged(*instance, m_tag, true);
  });
  checkbox.Unchecked([=](auto&&, auto&&)
  {
    auto instance = wkinstance.lock();
    if (!m_updating && instance != nullptr)
      OnCheckedChanged(*instance, m_tag, false);
  });
}
示例#13
0
void
ViewerAction::Update()
{
    // Update the action's enabled state.
    bool actionShouldBeEnabled = Enabled();
    if(action->isEnabled() != actionShouldBeEnabled)
        action->setEnabled(actionShouldBeEnabled);

    // Update the action's toggled state if it is a toggle action.
    if(action->isCheckable())
    {
        bool actionShouldBeChecked = Checked();
        if(action->isChecked() != actionShouldBeChecked)
        {
            action->blockSignals(true);
            action->setChecked(actionShouldBeChecked);
            action->blockSignals(false);
        }
    }
}
示例#14
0
MRESULT EXPENTRY fnwpConfigCommDlg(HWND hwnd,USHORT msg,MPARAM mp1,MPARAM mp2)
  {
  static COMADDR *pstAddr;

  switch (msg)
    {
    case WM_INITDLG:
      pstAddr = (COMADDR *)mp2;
      WinSendDlgItemMsg(hwnd,CFG_ADDRESS,EM_SETTEXTLIMIT,MPFROMSHORT(40),(MPARAM)NULL);
      WinSetDlgItemText(hwnd,CFG_ADDRESS,pstAddr->szAddressee);
      if (pstAddr->fAddrType == BY_ADDR)
        CheckButton(hwnd,CFG_IS_ADDRESS,TRUE);
      else
        CheckButton(hwnd,CFG_IS_HOST_NAME,TRUE);
      break;
    case WM_COMMAND:
      switch(SHORT1FROMMP(mp1))
        {
        case DID_OK:
          WinQueryDlgItemText(hwnd,CFG_ADDRESS,40,pstAddr->szAddressee);
          if (Checked(hwnd,CFG_IS_ADDRESS))
            pstAddr->fAddrType = BY_ADDR;
          else
            pstAddr->fAddrType = BY_HOST;
          WinDismissDlg(hwnd,TRUE);
          break;
        case DID_CANCEL:
          WinDismissDlg(hwnd,FALSE);
          break;
        default:
          return(WinDefDlgProc(hwnd,msg,mp1,mp2));
        }
      break;
    default:
      return(WinDefDlgProc(hwnd,msg,mp1,mp2));
    }
  return(FALSE);
  }
示例#15
0
void
ViewerToggleAction::PreExecute()
{
    toggled = Checked();
}
示例#16
0
BOOL TCCfgFIFOsetupDlg(HWND hwnd,USHORT idButton)
  {
  switch(idButton)
    {
    case HWF_DISABFIFO:
      if (!Checked(hwnd,HWF_DISABFIFO))
        {
//        CheckButton(hwnd,HWF_1TRIG,TRUE);
//        CheckButton(hwnd,HWF_TX_MIN,TRUE);
        CheckButton(hwnd,HWF_DISABFIFO,TRUE);
        CheckButton(hwnd,HWF_APO,FALSE);
        CheckButton(hwnd,HWF_ENABFIFO,FALSE);
        ControlEnable(hwnd,HWF_1TRIG,FALSE);
        ControlEnable(hwnd,HWF_4TRIG,FALSE);
        ControlEnable(hwnd,HWF_8TRIG,FALSE);
        ControlEnable(hwnd,HWF_14TRIG,FALSE);
        ControlEnable(hwnd,HWF_TX_HALF,FALSE);
        ControlEnable(hwnd,HWF_TX_MIN,FALSE);
        ControlEnable(hwnd,HWF_TX_HIHALF,FALSE);
        ControlEnable(hwnd,HWF_TX_MAX,FALSE);
        }
      break;
    case HWF_APO:
      if (!Checked(hwnd,HWF_APO))
        {
//        if (Checked(hwnd,HWF_DISABFIFO))
//          {
//          CheckButton(hwnd,HWF_14TRIG,TRUE);
//          CheckButton(hwnd,HWF_TX_MAX,TRUE);
//          }
        CheckButton(hwnd,HWF_APO,TRUE);
        CheckButton(hwnd,HWF_ENABFIFO,FALSE);
        CheckButton(hwnd,HWF_DISABFIFO,FALSE);
        ControlEnable(hwnd,HWF_1TRIG,TRUE);
        ControlEnable(hwnd,HWF_4TRIG,TRUE);
        ControlEnable(hwnd,HWF_8TRIG,TRUE);
        ControlEnable(hwnd,HWF_14TRIG,TRUE);
        ControlEnable(hwnd,HWF_TX_HALF,TRUE);
        ControlEnable(hwnd,HWF_TX_MIN,TRUE);
        ControlEnable(hwnd,HWF_TX_HIHALF,TRUE);
        ControlEnable(hwnd,HWF_TX_MAX,TRUE);
        }
      break;
    case HWF_ENABFIFO:
      if (!Checked(hwnd,HWF_ENABFIFO))
        {
//        if (Checked(hwnd,HWF_DISABFIFO))
//          {
//          CheckButton(hwnd,HWF_14TRIG,TRUE);
//          CheckButton(hwnd,HWF_TX_MAX,TRUE);
//          }
        CheckButton(hwnd,HWF_ENABFIFO,TRUE);
        CheckButton(hwnd,HWF_APO,FALSE);
        CheckButton(hwnd,HWF_DISABFIFO,FALSE);
        ControlEnable(hwnd,HWF_1TRIG,TRUE);
        ControlEnable(hwnd,HWF_4TRIG,TRUE);
        ControlEnable(hwnd,HWF_8TRIG,TRUE);
        ControlEnable(hwnd,HWF_14TRIG,TRUE);
        ControlEnable(hwnd,HWF_TX_HALF,TRUE);
        ControlEnable(hwnd,HWF_TX_MIN,TRUE);
        ControlEnable(hwnd,HWF_TX_HIHALF,TRUE);
        ControlEnable(hwnd,HWF_TX_MAX,TRUE);
        }
      break;
    default:
      return(FALSE);
    }
  return(TRUE);
  }
 void SetIrrev(void) {
   mvsList[0].Set(0, 0, Checked(), zobr.dwKey);
   nMoveNum = 1;
 }
示例#18
0
void KStars::initActions() {
    KIconLoader::global()->addAppDir( "kstars" );
    KAction *ka;

    // ==== File menu ================
    ka = KNS3::standardAction(i18n("Download New Data..."), this, SLOT(slotDownload()), actionCollection(), "get_data")
        << KShortcut( Qt::CTRL+Qt::Key_D );
    ka->setWhatsThis(i18n("Downloads new data"));
    ka->setToolTip(ka->whatsThis());
    ka->setStatusTip(ka->whatsThis());

#ifdef HAVE_CFITSIO_H
    actionCollection()->addAction("open_file", this, SLOT(slotOpenFITS()) )
        << i18n("Open FITS...")
        << KIcon("document-open")
        << KShortcut( Qt::CTRL+Qt::Key_O );
#endif

    actionCollection()->addAction("export_image", this, SLOT( slotExportImage() ) )
        << i18n("&Save Sky Image...")
        << KIcon("document-export-image")
        << KShortcut( Qt::CTRL+Qt::Key_I );
    actionCollection()->addAction("run_script", this, SLOT( slotRunScript() ))
        << i18n("&Run Script...")
        << KIcon("system-run" )
        << KShortcut( Qt::CTRL+Qt::Key_R );
    actionCollection()->addAction("printing_wizard", this, SLOT(slotPrintingWizard() ) )
            << i18nc("start Printing Wizard", "Printing &Wizard");
    actionCollection()->addAction( KStandardAction::Print, "print", this, SLOT( slotPrint() ) );
    actionCollection()->addAction( KStandardAction::Quit,  "quit",  this, SLOT( close() ) );

    // ==== Time Menu ================
    actionCollection()->addAction("time_to_now", this, SLOT( slotSetTimeToNow() ))
        << i18n("Set Time to &Now")
        << KShortcut( Qt::CTRL+Qt::Key_E )
        << KIcon("clock");

    actionCollection()->addAction("time_dialog", this, SLOT( slotSetTime() ) )
        << i18nc("set Clock to New Time", "&Set Time..." )
        << KShortcut( Qt::CTRL+Qt::Key_S )
        << KIcon("view-history");

    ka = actionCollection()->add<KToggleAction>("clock_startstop")
        << i18n("Stop &Clock" )
        << KIcon("media-playback-pause" );
    if ( ! StartClockRunning )
        ka->toggle();
    QObject::connect( ka, SIGNAL( triggered() ), this, SLOT( slotToggleTimer() ) );
    QObject::connect(data()->clock(), SIGNAL(clockToggled(bool)), ka, SLOT(setChecked(bool)) );
    //UpdateTime() if clock is stopped (so hidden objects get drawn)
    QObject::connect(data()->clock(), SIGNAL(clockToggled(bool)), this, SLOT(updateTime()) );
    actionCollection()->addAction("time_step_forward", this, SLOT( slotStepForward() ) )
        << i18n("Advance one step forward in time")
        << KIcon("media-skip-forward" )
        << KShortcut( Qt::Key_Greater, Qt::Key_Period );
    actionCollection()->addAction("time_step_backward", this, SLOT( slotStepBackward() ) )
        << i18n("Advance one step backward in time")
        << KIcon("media-skip-backward" )
        << KShortcut( Qt::Key_Less, Qt::Key_Comma );

    // ==== Pointing Menu ================
    actionCollection()->addAction("zenith", this, SLOT( slotPointFocus() ) )
        << i18n("&Zenith")
        << KShortcut("Z");
    actionCollection()->addAction("north", this, SLOT( slotPointFocus() ) )
        << i18n("&North")
        << KShortcut("N");
    actionCollection()->addAction("east", this, SLOT( slotPointFocus() ) )
        << i18n("&East")
        << KShortcut("E");
    actionCollection()->addAction("south", this, SLOT( slotPointFocus() ) )
        << i18n("&South")
        << KShortcut("S");
    actionCollection()->addAction("west", this, SLOT( slotPointFocus() ) )
        << i18n("&West")
        << KShortcut("W");

    actionCollection()->addAction("find_object", this, SLOT( slotFind() ) )
        << i18n("&Find Object...")
        << KIcon("edit-find")
        << KShortcut( Qt::CTRL+Qt::Key_F );
    actionCollection()->addAction("track_object", this, SLOT( slotTrack() ) )
        << i18n("Engage &Tracking")
        << KIcon("object-locked" )
        << KShortcut( Qt::CTRL+Qt::Key_T  );
    actionCollection()->addAction("manual_focus", this, SLOT( slotManualFocus() ) )
        << i18n("Set Coordinates &Manually..." )
        << KShortcut( Qt::CTRL+Qt::Key_M );

    // ==== View Menu ================
    actionCollection()->addAction( KStandardAction::ZoomIn,  "zoom_in",  map(), SLOT( slotZoomIn() ) );
    actionCollection()->addAction( KStandardAction::ZoomOut, "zoom_out", map(), SLOT( slotZoomOut() ) );
    actionCollection()->addAction("zoom_default", map(), SLOT( slotZoomDefault() ) )
        << i18n("&Default Zoom")
        << KIcon("zoom-fit-best" )
        << KShortcut( Qt::CTRL+Qt::Key_Z );
    actionCollection()->addAction("zoom_set", this, SLOT( slotSetZoom() ) )
        << i18n("&Zoom to Angular Size..." )
        << KIcon("zoom-original" )
        << KShortcut( Qt::CTRL+Qt::SHIFT+Qt::Key_Z );

    actionCollection()->addAction( KStandardAction::FullScreen, this, SLOT( slotFullScreen() ) );

    actionCollection()->addAction("coordsys", this, SLOT( slotCoordSys() ) )
        << (Options::useAltAz() ? i18n("Switch to star globe view (Equatorial &Coordinates)"): i18n("Switch to horizonal view (Horizontal &Coordinates)"))
        << KShortcut("Space" );

    #ifdef HAVE_OPENGL
    Q_ASSERT( SkyMap::Instance() ); // This assert should not fail, because SkyMap is already created by now. Just throwing it in anyway.
    actionCollection()->addAction("opengl", SkyMap::Instance(), SLOT( slotToggleGL() ) )
        << (Options::useGL() ? i18n("Switch to QPainter backend"): i18n("Switch to OpenGL backend"));
    #endif

    actionCollection()->addAction("project_lambert", this, SLOT( slotMapProjection() ) )
        << i18n("&Lambert Azimuthal Equal-area" )
        << KShortcut("F5" )
        << AddToGroup(projectionGroup)
        << Checked(Options::projection() == SkyMap::Lambert);
    actionCollection()->addAction("project_azequidistant", this, SLOT( slotMapProjection() ) )
        << i18n("&Azimuthal Equidistant" )
        << KShortcut("F6" )
        << AddToGroup(projectionGroup)
        << Checked(Options::projection() == SkyMap::AzimuthalEquidistant);
    actionCollection()->addAction("project_orthographic", this, SLOT( slotMapProjection() ) )
        << i18n("&Orthographic" )
        << KShortcut("F7" )
        << AddToGroup(projectionGroup)
        << Checked(Options::projection() == SkyMap::Orthographic);
    actionCollection()->addAction("project_equirectangular", this, SLOT( slotMapProjection() ) )
        << i18n("&Equirectangular" )
        << KShortcut("F8" )
        << AddToGroup(projectionGroup)
        << Checked(Options::projection() == SkyMap::Equirectangular);
    actionCollection()->addAction("project_stereographic", this, SLOT( slotMapProjection() ) )
        << i18n("&Stereographic" )
        << KShortcut("F9" )
        << AddToGroup(projectionGroup)
        << Checked(Options::projection() == SkyMap::Stereographic);
    actionCollection()->addAction("project_gnomonic", this, SLOT( slotMapProjection() ) )
        << i18n("&Gnomonic" )
        << KShortcut("F10" )
        << AddToGroup(projectionGroup)
        << Checked(Options::projection() == SkyMap::Gnomonic);

    //Settings Menu:
    //Info Boxes option actions
    KAction* kaBoxes = actionCollection()->add<KToggleAction>("show_boxes" )
        << i18nc("Show the information boxes", "Show &Info Boxes")
        << Checked( Options::showInfoBoxes() );
    connect( kaBoxes, SIGNAL(toggled(bool)), map(), SLOT(slotToggleInfoboxes(bool)));
    kaBoxes->setChecked( Options::showInfoBoxes() );

    ka = actionCollection()->add<KToggleAction>("show_time_box")
        << i18nc("Show time-related info box", "Show &Time Box");
    connect(kaBoxes, SIGNAL( toggled(bool) ), ka,    SLOT( setEnabled(bool) ) );
    connect(ka,      SIGNAL( toggled(bool) ), map(), SLOT( slotToggleTimeBox(bool)));
    ka->setChecked( Options::showTimeBox() );
    ka->setEnabled( Options::showInfoBoxes() );

    ka = actionCollection()->add<KToggleAction>("show_focus_box")
        << i18nc("Show focus-related info box", "Show &Focus Box");
    connect(kaBoxes, SIGNAL( toggled(bool) ), ka,    SLOT( setEnabled(bool) ) );
    connect(ka,      SIGNAL( toggled(bool) ), map(), SLOT( slotToggleFocusBox(bool)));
    ka->setChecked( Options::showFocusBox() );
    ka->setEnabled( Options::showInfoBoxes() );

    ka = actionCollection()->add<KToggleAction>("show_location_box")
        << i18nc("Show location-related info box", "Show &Location Box");
    connect(kaBoxes, SIGNAL( toggled(bool) ), ka,    SLOT( setEnabled(bool) ) );
    connect(ka,      SIGNAL( toggled(bool) ), map(), SLOT( slotToggleGeoBox(bool)));
    ka->setChecked( Options::showGeoBox() );
    ka->setEnabled( Options::showInfoBoxes() );


    //Toolbar options
    newToggleAction( actionCollection(), "show_mainToolBar", i18n("Show Main Toolbar"),
                     toolBar("kstarsToolBar"), SLOT(setVisible(bool)));
    newToggleAction( actionCollection(), "show_viewToolBar", i18n("Show View Toolbar"),
                     toolBar( "viewToolBar" ), SLOT(setVisible(bool)));

    //Statusbar view options
    newToggleAction( actionCollection(), "show_statusBar", i18n("Show Statusbar"),
                     this, SLOT(slotShowGUIItem(bool)));
    newToggleAction( actionCollection(), "show_sbAzAlt",   i18n("Show Az/Alt Field"),
                     this, SLOT(slotShowGUIItem(bool)));
    newToggleAction( actionCollection(), "show_sbRADec",   i18n("Show RA/Dec Field"),
                     this, SLOT(slotShowGUIItem(bool)));

    //Color scheme actions.  These are added to the "colorschemes" KActionMenu.
    colorActionMenu = actionCollection()->add<KActionMenu>("colorschemes" );
    colorActionMenu->setText( i18n("C&olor Schemes" ) );
    addColorMenuItem( i18n("&Classic" ), "cs_classic" );
    addColorMenuItem( i18n("&Star Chart" ), "cs_chart" );
    addColorMenuItem( i18n("&Night Vision" ), "cs_night" );
    addColorMenuItem( i18n("&Moonless Night" ), "cs_moonless-night" );

    //Add any user-defined color schemes:
    QFile file( KStandardDirs::locate("appdata", "colors.dat" ) ); //determine filename in local user KDE directory tree.
    if ( file.exists() && file.open( QIODevice::ReadOnly ) ) {
        QTextStream stream( &file );
        while ( !stream.atEnd() ) {
            QString line = stream.readLine();
            QString schemeName = line.left( line.indexOf( ':' ) );
            QString actionname = "cs_" + line.mid( line.indexOf( ':' ) +1, line.indexOf( '.' ) - line.indexOf( ':' ) - 1 );
            addColorMenuItem( i18n( schemeName.toLocal8Bit() ), actionname.toLocal8Bit() );
        }
        file.close();
    }

    //Add FOV Symbol actions
    fovActionMenu = actionCollection()->add<KActionMenu>("fovsymbols" );
    fovActionMenu->setText( i18n("&FOV Symbols" ) );
    repopulateFOV();

    actionCollection()->addAction("geolocation", this, SLOT( slotGeoLocator() ) )
        << i18nc("Location on Earth", "&Geographic..." )
        << KIcon("applications-internet" )
        << KShortcut( Qt::CTRL+Qt::Key_G );
    actionCollection()->addAction( KStandardAction::Preferences, "configure", this, SLOT( slotViewOps() ) );
    actionCollection()->addAction("startwizard", this, SLOT( slotWizard() ) )
        << i18n("Startup Wizard..." )
        << KIcon("tools-wizard" );

    // Updates actions
    actionCollection()->addAction( "update_comets", this, SLOT( slotUpdateComets() ) )
        << i18n( "Update comets orbital elements" );
    actionCollection()->addAction( "update_asteroids", this, SLOT( slotUpdateAsteroids() ) )
        << i18n( "Update asteroids orbital elements" );
    actionCollection()->addAction("update_supernovae", this, SLOT(slotUpdateSupernovae() ) )
        << i18n( "Update Recent Supernovae data" );
    actionCollection()->addAction("update_satellites", this, SLOT(slotUpdateSatellites() ) )
        << i18n( "Update satellites orbital elements" );

    //Tools Menu:
    actionCollection()->addAction("astrocalculator", this, SLOT( slotCalculator() ) )
        << i18n("Calculator")
        << KIcon("accessories-calculator" )
        << KShortcut( Qt::CTRL+Qt::Key_C );

    actionCollection()->addAction("moonphasetool", this, SLOT( slotMoonPhaseTool() ) )
        << i18n("Moon Phase Calendar");

    actionCollection()->addAction("obslist", this, SLOT( slotObsList() ) )
        << i18n("Observation Planner")
        << KShortcut( Qt::CTRL+Qt::Key_L );

    actionCollection()->addAction("altitude_vs_time", this, SLOT( slotAVT() ) )
        << i18n("Altitude vs. Time")
        << KShortcut( Qt::CTRL+Qt::Key_A );
    actionCollection()->addAction("whats_up_tonight", this, SLOT( slotWUT() ) )
        << i18n("What's up Tonight")
        << KShortcut(Qt::CTRL+Qt::Key_U );
    actionCollection()->addAction("whats_interesting", this, SLOT( slotWISettings() ) )
        << i18n("What's Interesting...")
        << KShortcut(Qt::CTRL+Qt::Key_W );
    actionCollection()->addAction("skycalendar", this, SLOT( slotCalendar() ) )
        << i18n("Sky Calendar");

#ifdef HAVE_INDI_H
#ifndef Q_WS_WIN
        actionCollection()->addAction("ekos", this, SLOT( slotEkos() ) )
            << i18n("Ekos");
#endif
#endif

//FIXME: implement glossary
//     ka = actionCollection()->addAction("glossary");
//     ka->setText( i18n("Glossary...") );
//     ka->setShortcuts( KShortcut(Qt::CTRL+Qt::Key_K ) );
//     connect( ka, SIGNAL( triggered() ), this, SLOT( slotGlossary() ) );

    actionCollection()->addAction("scriptbuilder", this, SLOT( slotScriptBuilder() ) )
        << i18n("Script Builder")
        << KShortcut(Qt::CTRL+Qt::Key_B );
    actionCollection()->addAction("solarsystem", this, SLOT( slotSolarSystem() ) )
        << i18n("Solar System")
        << KShortcut(Qt::CTRL+Qt::Key_Y );
    actionCollection()->addAction("jmoontool", this, SLOT( slotJMoonTool() ) )
        << i18n("Jupiter's Moons")
        << KShortcut(Qt::CTRL+Qt::Key_J );
    actionCollection()->addAction("flagmanager", this, SLOT( slotFlagManager() ) )
        << i18n("Flags");

    actionCollection()->addAction("ewriter", this, SLOT( slotEquipmentWriter() ) )
        << i18n("Define Equipment...")
        << KShortcut( Qt::CTRL+Qt::Key_0 );
    actionCollection()->addAction("obsadd", this, SLOT( slotObserverAdd() ) )
        << i18n( "Add Observer..." )
        << KShortcut( Qt::CTRL+Qt::Key_1 );

    // ==== observation menu ================
    ka = actionCollection()->addAction("execute", this, SLOT( slotExecute() ) )
        << i18n( "Execute the session Plan..." )
        << KShortcut( Qt::CTRL+Qt::Key_2 );

    // ==== devices Menu ================
#ifdef HAVE_INDI_H
#ifndef Q_WS_WIN


        actionCollection()->addAction("telescope_wizard", this, SLOT( slotTelescopeWizard() ) )
            << i18n("Telescope Wizard...")
            << KIcon("tools-wizard" );
        actionCollection()->addAction("device_manager", this, SLOT( slotINDIDriver() ) )
            << i18n("Device Manager...")
            << KIcon("network-server" );
        ka = actionCollection()->addAction("indi_cpl", this, SLOT( slotINDIPanel() ) )
            << i18n("INDI Control Panel...");
        ka->setEnabled(false);


#endif
#endif

    //Help Menu:
    actionCollection()->addAction( KStandardAction::TipofDay, "help_tipofday", this, SLOT( slotTipOfDay() ) )
	->setWhatsThis(i18n("Displays the Tip of the Day"));

    //	KStandardAction::help(this, SLOT( appHelpActivated() ), actionCollection(), "help_contents" );

    //Add timestep widget for toolbar
    TimeStep = new TimeStepBox( toolBar("kstarsToolBar") );
    // Add a tool tip to TimeStep describing the weird nature of time steps
    QString TSBToolTip = i18nc( "Tooltip describing the nature of the time step control", "Use this to set the rate at which time in the simulation flows.\nFor time step \'X\' up to 10 minutes, time passes at the rate of \'X\' per second.\nFor time steps larger than 10 minutes, frames are displayed at an interval of \'X\'." );
    TimeStep->setToolTip( TSBToolTip );
    TimeStep->tsbox()->setToolTip( TSBToolTip );
    ka = actionCollection()->addAction("timestep_control")
        << i18n("Time step control");
    ka->setDefaultWidget( TimeStep );

    // ==== viewToolBar actions ================
    actionCollection()->add<KToggleAction>("show_stars", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle Stars in the display", "Stars" )
        << KIcon("kstars_stars" )
        << ToolTip( i18n("Toggle stars") );
    actionCollection()->add<KToggleAction>("show_deepsky", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle Deep Sky Objects in the display", "Deep Sky" )
        << KIcon("kstars_deepsky" )
        << ToolTip( i18n("Toggle deep sky objects") );
    actionCollection()->add<KToggleAction>("show_planets", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle Solar System objects in the display", "Solar System" )
        << KIcon("kstars_planets" )
        << ToolTip( i18n("Toggle Solar system objects") );
    actionCollection()->add<KToggleAction>("show_clines", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle Constellation Lines in the display", "Const. Lines" )
        << KIcon("kstars_clines" )
        << ToolTip( i18n("Toggle constellation lines") );
    actionCollection()->add<KToggleAction>("show_cnames", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle Constellation Names in the display", "Const. Names" )
        << KIcon("kstars_cnames" )
        << ToolTip( i18n("Toggle constellation names") );
    actionCollection()->add<KToggleAction>("show_cbounds", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle Constellation Boundaries in the display", "C. Boundaries" )
        << KIcon("kstars_cbound" )
        << ToolTip( i18n("Toggle constellation boundaries") );
    actionCollection()->add<KToggleAction>("show_mw", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle Milky Way in the display", "Milky Way" )
        << KIcon("kstars_mw" )
        << ToolTip( i18n("Toggle milky way") );
    actionCollection()->add<KToggleAction>("show_equatorial_grid", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle Equatorial Coordinate Grid in the display", "Equatorial coord. grid" )
        << KIcon("kstars_grid" )
        << ToolTip( i18n("Toggle equatorial coordinate grid") );
    actionCollection()->add<KToggleAction>("show_horizontal_grid", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle Horizontal Coordinate Grid in the display", "Horizontal coord. grid" )
        << KIcon("kstars_hgrid" )
        << ToolTip( i18n("Toggle horizontal coordinate grid") );
    actionCollection()->add<KToggleAction>("show_horizon", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle the opaque fill of the ground polygon in the display", "Ground" )
        << KIcon("kstars_horizon" )
        << ToolTip( i18n("Toggle opaque ground") );
    actionCollection()->add<KToggleAction>("show_flags", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle flags in the display", "Flags" )
        << KIcon("kstars_flag" )
        << ToolTip( i18n("Toggle flags") );
    actionCollection()->add<KToggleAction>("show_satellites", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle satellites in the display", "Satellites" )
        << KIcon("kstars_satellites" )
        << ToolTip( i18n("Toggle satellites") );
    actionCollection()->add<KToggleAction>("show_supernovae", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle supernovae in the display", "Supernovae" )
        << KIcon("kstars_supernovae" )
        << ToolTip( i18n("Toggle supernovae") );

    setXMLFile("kstarsui.rc" );

    if (Options::fitsDir().isEmpty())
        Options::setFitsDir(QDir:: homePath());
}
示例#19
0
/**
 * Private slot that is called when the checkbox is checked 
 * See also setupConnections()
 */
void DeviceButton::stateChanged(int in)
{
  if (in == Qt::Checked)
    emit Checked(this, _device);
}
示例#20
0
void CheckBoxRed::onClick()
{
	RedButton::onClick();
	Checked(!checked);
}
示例#21
0
VOID UnloadHdwProtocolDlg(HWND hwnd,LINECHAR *pstLineChar)
  {
  if (Checked(hwnd,HWP_8BITS))
    pstLineChar->DataBits = 8;
  else
    if (Checked(hwnd,HWP_7BITS))
      pstLineChar->DataBits = 7;
    else
      if (Checked(hwnd,HWP_6BITS))
        pstLineChar->DataBits = 6;
      else
        if (Checked(hwnd,HWP_5BITS))
          pstLineChar->DataBits = 5;

  if (Checked(hwnd,HWP_1BIT))
    pstLineChar->StopBits = 0;
  else
    if (Checked(hwnd,HWP_15BITS))
      pstLineChar->StopBits = 1;
    else
      if (Checked(hwnd,HWP_2BITS))
        pstLineChar->StopBits = 2;

  if (Checked(hwnd,HWP_NONE))
    pstLineChar->Parity = 0;
  else
    if (Checked(hwnd,HWP_ODD))
      pstLineChar->Parity = 1;
    else
      if (Checked(hwnd,HWP_EVEN))
        pstLineChar->Parity = 2;
      else
        if (Checked(hwnd,HWP_ZERO))
          pstLineChar->Parity = 3;
        else
          if (Checked(hwnd,HWP_ONE))
            pstLineChar->Parity = 4;
  }
示例#22
0
MRESULT EXPENTRY fnwpNotifyDlg(HWND hwnd,USHORT msg,MPARAM mp1,MPARAM mp2)
  {
  static MSG *pMessage;
  NOTIFYLST *pNotify;
  ULONG ulSubNumber;
  ULONG ulGroupNumber;
  int iMsgLen;
  USHORT usLength;
  USHORT usSubCount;
  ULONG *pulSubNum;
  char szMessage[80];
  int iIndex;
  static TID tid;
  BYTE *pData;

  switch (msg)
    {
    case WM_INITDLG:
      pMessage = (MSG *)mp2;
      bNotifyLoop = FALSE;
      WinSendDlgItemMsg(hwnd,NOTIFY_SUB_NUMBER,
                                SPBM_SETLIMITS,
                                (MPARAM)usSubscriberListCount,
                                (MPARAM)1);
      WinSendDlgItemMsg(hwnd,NOTIFY_MESSAGE,MLM_FORMAT,(MPARAM)MLFIE_WINFMT,(MPARAM)NULL);
      break;
    case WM_COMMAND:
      switch(SHORT1FROMMP(mp1))
        {
        case DID_OK:
          if (bNotifyLoop)
            break;
          WinSendDlgItemMsg(hwnd,NOTIFY_SUB_NUMBER,SPBM_QUERYVALUE,&ulSubNumber,MPFROM2SHORT(0,SPBQ_DONOTUPDATE));
          iMsgLen = WinQueryDlgItemTextLength(hwnd,NOTIFY_MESSAGE);
//          iMsgLen = (int)WinSendDlgItemMsg(hwnd,NOTIFY_MESSAGE,MLM_QUERYTEXTLENGTH,(MPARAM)NULL,(MPARAM)NULL);
          if (iMsgLen <= 0)
            {
            sprintf(szMessage,"Message is too short, length = %u",iMsgLen);
            MessageBox(hwnd,szMessage);
            break;
            }
          if (astSubList[ulSubNumber].usMaxMsgLen < iMsgLen)
            {
            sprintf(szMessage,"Message is to long for defined subscriber, remove at least %u characters.",(iMsgLen - astSubList[ulSubNumber].usMaxMsgLen));
            MessageBox(hwnd,szMessage);
            break;
            }
          pNotify = (NOTIFYLST *)&pMessage->byData;
          pNotify->usSubCount = 1;
          pNotify->usGroupCount = 0;
          pNotify->usMsgLen = (USHORT)iMsgLen;
          pData = &pNotify->byData;
          iMsgLen = WinQueryDlgItemText(hwnd,NOTIFY_MESSAGE,(iMsgLen + 1),pData);
          pulSubNum = (ULONG *)(pData + iMsgLen);
          usSubCount = 0;
          for (iIndex = 0;iIndex < pNotify->usSubCount;iIndex++)
            {
            usSubCount++;
            *pulSubNum = (ULONG)ulSubNumber;
            pulSubNum++;
            }
          for (iIndex = 0;iIndex < pNotify->usGroupCount;iIndex++)
            {
            usSubCount++;
            *pulSubNum = (ULONG)ulGroupNumber;
            pulSubNum++;
            }
          usLength = ((sizeof(ULONG) * usSubCount) + (USHORT)iMsgLen);
          pMessage->cbDataSize = (usLength + sizeof(NOTIFYLST) - 1);
          if (Checked(hwnd,NOTIFY_CONTINUOUSLY))
            {
            pMessage->fMessageType = REQ_NOTIFY;
            pMessage->cbSize = (pMessage->cbDataSize + sizeof(MSG) - 1);
            bNotifyLoop = TRUE;
            pNotifyLoopMsg = pMessage;
            DosCreateThread(&tid,(PFNTHREAD)NotifyLoopThread,(ULONG)pMessage,0,8192);
            }
          else
            WinDismissDlg(hwnd,TRUE);
          break;
        case DID_CANCEL:
          if (bNotifyLoop)
            DosKillThread(tid);
          WinDismissDlg(hwnd,FALSE);
          break;
        default:
          return(WinDefDlgProc(hwnd,msg,mp1,mp2));
        }
      break;
    default:
      return(WinDefDlgProc(hwnd,msg,mp1,mp2));
    }
  return(FALSE);
  }
示例#23
0
VOID UnloadHandshakeDlg(HWND hwnd,DCB *pstComDCB,FIFOINF *pstFIFOinfo)
  {
  char szXchar[5];
  BOOL bXHS = FALSE;

  pstFIFOinfo->wFIFOflags &= ~FIFO_FLG_HDW_HS_MASK;
  if (pstFIFOinfo->wFIFOflags & FIFO_FLG_TYPE_MASK)
    {
    if (Checked(hwnd,HWF_HDW_CTS_HS))
      {
      pstFIFOinfo->wFIFOflags |= FIFO_FLG_HDW_CTS_HS;
      if (pstFIFOinfo->wFIFOflags & (FIFO_FLG_TYPE_16750 | FIFO_FLG_TYPE_TI16550C))
        pstFIFOinfo->wFIFOflags |= FIFO_FLG_HDW_RTS_HS;
      }
    if (Checked(hwnd,HWF_HDW_RTS_HS))
      pstFIFOinfo->wFIFOflags |= FIFO_FLG_HDW_RTS_HS;
#ifdef allow_16650_HDW_Xon_HS
    if (Checked(hwnd,HWF_HDW_RX_XON_HS))
      pstFIFOinfo->wFIFOflags |= FIFO_FLG_HDW_RX_XON_HS;
    if (Checked(hwnd,HWF_HDW_TX_XON_HS))
      pstFIFOinfo->wFIFOflags |= FIFO_FLG_HDW_TX_XON_HS;
#endif
    }
  if (Checked(hwnd,HS_TXFLOW))
    {
    bXHS = TRUE;
    pstComDCB->Flags2 |= F2_ENABLE_XMIT_XON_XOFF_FLOW;
    }
  else
    pstComDCB->Flags2 &= ~F2_ENABLE_XMIT_XON_XOFF_FLOW;

  pstComDCB->Flags2 &= ~F2_ENABLE_FULL_DUPLEX;
  if (Checked(hwnd,HS_RXFLOW))
    {
    bXHS = TRUE;
    pstComDCB->Flags2 |= F2_ENABLE_RCV_XON_XOFF_FLOW;
    if (Checked(hwnd,HS_FULLDUP))
#ifdef allow_16650_HDW_Xon_HS
      if ((pstFIFOinfo->wFIFOflags & FIFO_FLG_HDW_RX_XON_HS) == 0);
#endif
        pstComDCB->Flags2 |= F2_ENABLE_FULL_DUPLEX;
    }
  else
    pstComDCB->Flags2 &= ~F2_ENABLE_RCV_XON_XOFF_FLOW;

  if (bXHS)
    {
    WinQueryDlgItemText(hwnd,HS_XOFFCHAR,3,szXchar);
    pstComDCB->XoffChar = (BYTE)ASCIItoBin(szXchar,16);

    WinQueryDlgItemText(hwnd,HS_XONCHAR,3,szXchar);
    pstComDCB->XonChar = (BYTE)ASCIItoBin(szXchar,16);
    }

  pstComDCB->Flags2 &= ~F2_RTS_MASK;
  if (Checked(hwnd,HS_RTSENAB))
    pstComDCB->Flags2 |= F2_ENABLE_RTS;
  else
    if (Checked(hwnd,HS_RTSINHS))
      pstComDCB->Flags2 |= F2_ENABLE_RTS_INPUT_HS;
    else
      if (Checked(hwnd,HS_RTSTOG))
        pstComDCB->Flags2 |= F2_ENABLE_RTS_TOG_ON_XMIT;

  pstComDCB->Flags1 &= ~F1_DTR_MASK;
  if (Checked(hwnd,HS_DTRENAB))
    pstComDCB->Flags1 |= F1_ENABLE_DTR;
  else
    if (Checked(hwnd,HS_DTRINHS))
      pstComDCB->Flags1 |= F1_ENABLE_DTR_INPUT_HS;

  if (Checked(hwnd,HS_CTSOUT))
    pstComDCB->Flags1 |= F1_ENABLE_CTS_OUTPUT_HS;
  else
    pstComDCB->Flags1 &= ~F1_ENABLE_CTS_OUTPUT_HS;

  if (Checked(hwnd,HS_DSROUT))
    pstComDCB->Flags1 |= F1_ENABLE_DSR_OUTPUT_HS;
  else
    pstComDCB->Flags1 &= ~F1_ENABLE_DSR_OUTPUT_HS;

  if (Checked(hwnd,HS_DCDOUT))
    pstComDCB->Flags1 |= F1_ENABLE_DCD_OUTPUT_HS;
  else
    pstComDCB->Flags1 &= ~F1_ENABLE_DCD_OUTPUT_HS;

  if (Checked(hwnd,HS_DSRINSENSE))
    pstComDCB->Flags1 |= F1_ENABLE_DSR_INPUT_HS;
  else
    pstComDCB->Flags1 &= ~F1_ENABLE_DSR_INPUT_HS;

  }
示例#24
0
BOOL TCHandshakeDlg(HWND hwnd,USHORT idButton,DCB *pstComDCB,FIFOINF *pstFIFOinfo)
  {
  switch(idButton)
    {
#ifdef allow_16650_HDW_Xon_HS
    case HWF_HDW_RX_XON_HS:
      if (Checked(hwnd,HWF_HDW_RX_XON_HS))
        {
//        CheckButton(hwnd,HWF_HDW_RX_XON_HS,TRUE);
        ControlEnable(hwnd,HS_FULLDUP,FALSE);
        }
      else
        {
//        CheckButton(hwnd,HWF_HDW_RX_XON_HS,FALSE);
        if (Checked(hwnd,HS_RXFLOW))
          ControlEnable(hwnd,HS_FULLDUP,TRUE);
        }
      break;
#endif
      case HS_CTSOUT:
        if (!Checked(hwnd,HS_CTSOUT))
          {
          CheckButton(hwnd,HS_CTSOUT,TRUE);
          if (pstFIFOinfo->wFIFOflags & (FIFO_FLG_TYPE_16750 | FIFO_FLG_TYPE_TI16550C))
            if (Checked(hwnd,HWF_HDW_CTS_HS))
              {
              ControlEnable(hwnd,HS_RTSENAB,FALSE);
              ControlEnable(hwnd,HS_RTSTOG,FALSE);
              if (Checked(hwnd,HS_RTSENAB))
                CheckButton(hwnd,HS_RTSINHS,TRUE);
              else
                if (Checked(hwnd,HS_RTSTOG))
                  CheckButton(hwnd,HS_RTSDISAB,TRUE);
              }
          }
        else
          {
          CheckButton(hwnd,HS_CTSOUT,FALSE);
          if (pstFIFOinfo->wFIFOflags & (FIFO_FLG_TYPE_16750 | FIFO_FLG_TYPE_TI16550C))
            {
            ControlEnable(hwnd,HS_RTSENAB,TRUE);
            ControlEnable(hwnd,HS_RTSTOG,TRUE);
            }
          }
       break;
      case HWF_HDW_CTS_HS:
        if (!Checked(hwnd,HWF_HDW_CTS_HS))
          {
          CheckButton(hwnd,HWF_HDW_CTS_HS,TRUE);
          if (pstFIFOinfo->wFIFOflags & (FIFO_FLG_TYPE_16750 | FIFO_FLG_TYPE_TI16550C))
            if (Checked(hwnd,HS_CTSOUT))
              {
              ControlEnable(hwnd,HS_RTSENAB,FALSE);
              ControlEnable(hwnd,HS_RTSTOG,FALSE);
              if (Checked(hwnd,HS_RTSENAB))
                CheckButton(hwnd,HS_RTSINHS,TRUE);
              else
                if (Checked(hwnd,HS_RTSTOG))
                  CheckButton(hwnd,HS_RTSDISAB,TRUE);
              }
          }
        else
          {
          CheckButton(hwnd,HWF_HDW_CTS_HS,FALSE);
          if (pstFIFOinfo->wFIFOflags & (FIFO_FLG_TYPE_16750 | FIFO_FLG_TYPE_TI16550C))
            {
            ControlEnable(hwnd,HS_RTSENAB,TRUE);
            ControlEnable(hwnd,HS_RTSTOG,TRUE);
            }
          }
       break;
    case HS_RXFLOW:
    case HS_TXFLOW:
      if (Checked(hwnd,HS_RXFLOW) ||
          Checked(hwnd,HS_TXFLOW))
        {
        ControlEnable(hwnd,HS_XOFFCHART,TRUE);
        ControlEnable(hwnd,HS_XONCHART,TRUE);
        ControlEnable(hwnd,HS_XOFFCHAR,TRUE);
        ControlEnable(hwnd,HS_XONCHAR,TRUE);
        ControlEnable(hwnd,HS_XONCHARTT,TRUE);
        ControlEnable(hwnd,HS_XONCHARTTT,TRUE);
        ControlEnable(hwnd,HS_XOFFCHARTT,TRUE);
        ControlEnable(hwnd,HS_XOFFCHARTTT,TRUE);
        }
      else
        {
        ControlEnable(hwnd,HS_XOFFCHART,FALSE);
        ControlEnable(hwnd,HS_XONCHART,FALSE);
        ControlEnable(hwnd,HS_XOFFCHAR,FALSE);
        ControlEnable(hwnd,HS_XONCHAR,FALSE);
        ControlEnable(hwnd,HS_XONCHARTT,FALSE);
        ControlEnable(hwnd,HS_XONCHARTTT,FALSE);
        ControlEnable(hwnd,HS_XOFFCHARTT,FALSE);
        ControlEnable(hwnd,HS_XOFFCHARTTT,FALSE);
        }
      if (!Checked(hwnd,HS_RXFLOW))
        ControlEnable(hwnd,HS_FULLDUP,FALSE);
      else
        {
#ifdef allow_16650_HDW_Xon_HS
        if (!Checked(hwnd,HWF_HDW_RX_XON_HS))
#endif
          ControlEnable(hwnd,HS_FULLDUP,TRUE);
        }
      break;
    default:
      return(FALSE);
    }
  return(TRUE);
  }
示例#25
0
MRESULT EXPENTRY fnwpHdwFilterDlg(HWND hwnd,USHORT msg,MPARAM mp1,MPARAM mp2)
  {
  static DCB stComDCB;
  static COMCTL *pstComCtl;

  switch (msg)
    {
    case WM_INITDLG:
//      CenterDlgBox(hwnd);
//      WinSetFocus(HWND_DESKTOP,hwnd);
      pstComCtl = PVOIDFROMMP(mp2);
      if (pstComCtl->pszPortName != NULL)
        WinSetWindowText(hwnd,pstComCtl->pszPortName);
      if (GetDCB(pstComCtl->pstIOctl,pstComCtl->hCom,&stComDCB))
        {
        WinDismissDlg(hwnd,FALSE);
        return(FALSE);
        }
      FillHdwFilterDlg(hwnd,&stComDCB);
      break;
    case WM_CONTROL:
      if(SHORT2FROMMP(mp1) == BN_CLICKED)
        {
        switch(SHORT1FROMMP(mp1))
          {
          case HWR_ENABERR:
            if (!Checked(hwnd,HWR_ENABERR))
              {
              ControlEnable(hwnd,HWR_ERRTTT,FALSE);
              ControlEnable(hwnd,HWR_ERRTT,FALSE);
              ControlEnable(hwnd,HWR_ERRT,FALSE);
              ControlEnable(hwnd,HWR_ERRCHAR,FALSE);
              }
            else
              {
              ControlEnable(hwnd,HWR_ERRTTT,TRUE);
              ControlEnable(hwnd,HWR_ERRTT,TRUE);
              ControlEnable(hwnd,HWR_ERRT,TRUE);
              ControlEnable(hwnd,HWR_ERRCHAR,TRUE);
              }
            break;
          case HWR_ENABBRK:
            if (!Checked(hwnd,HWR_ENABBRK))
              {
              ControlEnable(hwnd,HWR_BRKTTT,FALSE);
              ControlEnable(hwnd,HWR_BRKTT,FALSE);
              ControlEnable(hwnd,HWR_BRKT,FALSE);
              ControlEnable(hwnd,HWR_BRKCHAR,FALSE);
              }
            else
              {
              ControlEnable(hwnd,HWR_BRKTTT,TRUE);
              ControlEnable(hwnd,HWR_BRKTT,TRUE);
              ControlEnable(hwnd,HWR_BRKT,TRUE);
              ControlEnable(hwnd,HWR_BRKCHAR,TRUE);
              }
            break;
          default:
           return(FALSE);
          }
        }
      break;
    case WM_COMMAND:
      switch(SHORT1FROMMP(mp1))
        {
        case DID_OK:
          UnloadHdwFilterDlg(hwnd,&stComDCB);
          SendDCB(pstComCtl->pstIOctl,pstComCtl->hCom,&stComDCB);
          WinDismissDlg(hwnd,TRUE);
          break;
        case DID_CANCEL:
          WinDismissDlg(hwnd,FALSE);
          break;
        case DID_HELP:
          DisplayHelpPanel(pstComCtl);
          break;
        default:
          return WinDefDlgProc(hwnd,msg,mp1,mp2);
        }
      break;
    default:
      return(WinDefDlgProc(hwnd,msg,mp1,mp2));
    }
  return FALSE;
  }