Esempio n. 1
0
    virtual BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
    {
        int id = LOWORD(wParam);
        int code = HIWORD(wParam);

        IParamBlock2 *pb = map->GetParamBlock();
        HWND cbox = NULL;

        switch (msg)
        {
        case WM_INITDIALOG:
            int i;
            for (i = 0; i < plMAXCameraLayer::kMaxUVSrc; i++)
            {
                cbox = GetDlgItem(hWnd, IDC_CAM_LAYER_UV_SRC);
                SendMessage(cbox, CB_ADDSTRING, 0, (LPARAM)plMAXCameraLayer::kUVStrings[i]);
            }
            UpdateDisplay(map);
            return TRUE;

        case WM_COMMAND:
            if (id == IDC_CAM_LAYER_UV_SRC)
            {
                pb->SetValue(plMAXCameraLayer::kUVSource, t, SendMessage(GetDlgItem(hWnd, id), CB_GETCURSEL, 0, 0));
                return TRUE;
            }
            else if (id == IDC_CAM_LAYER_EXPLICIT_CAM)
            {
                UpdateDisplay(map);
                return TRUE;
            }
            break;
        }
        return FALSE;
    }
Esempio n. 2
0
void ProcessHexCommand(SHORT comm)
{
   double       temp;

    if (bShiftMode) {
        bShiftMode = FALSE;
        WinSetWindowText(hwndSmode, "");

        EntryToStackHex();
        bLift = TRUE;

        switch (comm ) {
        case K_BS: /* CLx */
           if (bError) {
              UpdateDisplay(stack[0]);
           } else {
              UpdateDisplay(0.0);
              bLift = FALSE;
           } /* endif */
           break;
        case K_DOT: /* lastx */
           LiftStack();
           UpdateDisplay(lastx);
           break;
        default:
        }
    } else {
Esempio n. 3
0
/*
 * Function: GetTrianglePoints
 * Usage: GetTrianglePoints(tri)
 * -----------------------------------
 * This function watches the user click three points on the Graphics Console.
 * The function notes the location of those points by loading the 'tri' array
 * with three pointT structs.
 * The function connects the dots to create a triangle on the screen.
 * Graphics should already be initialized.  We assume working with triangles,
 * but the constant nPOINTS will let us see if this works for four points.
 */
void GetTrianglePoints(pointT tri[]) {
    int pt_ct = 0;
    while ( pt_ct < nPOINTS ) {
        //cout << "got to this point" << endl;
        WaitForMouseDown();
        WaitForMouseUp();
        tri[pt_ct].xp = GetMouseX();
        tri[pt_ct].yp = GetMouseY();
        if ( pt_ct == 0 )
        {
            MovePen(tri[0].xp, tri[0].yp);
        }
        else
        {
            DrawLine(
                (tri[pt_ct].xp - tri[pt_ct - 1].xp ),
                (tri[pt_ct].yp - tri[pt_ct - 1].yp )
                    );
        }
        UpdateDisplay();
        pt_ct ++;
    }

    // Connect the third and first points of the triangle with lines
    DrawLine(
        (tri[0].xp - tri[nPOINTS - 1].xp ),
        (tri[0].yp - tri[nPOINTS - 1].yp )
            );
    UpdateDisplay();
}
Esempio n. 4
0
/*
 * ProcessPin
 * Description:      Process the entered Pin Number.
 *                   
 * Arguments:        nextstate- expected next state
 *                   event    - current event
 * Return:           nextstate- next state assuming unverified pin.
 *
 * Input:            None
 * Output:           None
 *
 * Operation:        If the pin number is complete, verify the pin number. A
 *                   verified pin number means the FSM can move on to "Home"
 *                   
 * Error Handling:   None
 *
 * Algorithms:       None
 * Data Strutures:   None
 *
 * Shared Variables: None
 *
 * Revision History:
 *   Apr. 23, 2013      Nnoduka Eruchalu     Initial Revision
 */
state ProcessPin(state nextstate, eventcode event)
{
  state result = nextstate;
  if (num_digits == NUM_PIN_DIGITS) { /* if pin number is complete */
    
    /* let user know the pin is being verified */
    UpdateDisplay(1, 0, "                    "); /* row 1, col 0   */
    UpdateDisplay(2, 0, "   Verifying Pin    "); /* row 2, col 0   */
    UpdateDisplay(3, 0, "                    "); /* row 3, col 0   */
    
    /*TODO: Use DataPinValidate(uid_easycard, number) */
    if (TRUE) { /* and if is verified, the   */
      __delay_s(0.5);   /* delay to mimic verfication. TODO: remove */
      result = STATE_HOME;         /* nextstate is the homepage */
      /* flash success message */
      UpdateDisplay(2, 0, "   Sucessful Pin!   "); /* row 2, col 0 */
          
    } else {                          /* if pin number is invalid  */
       result = STATE_WELCOME;        /* go back to welcome page   */
      /* flash error message */
      UpdateDisplay(2, 0, "    Invalid  Pin!   "); /* row 2, col 0 */
    }
    
    __delay_s(MSG_FLASH_TIME);        /* a msg flash takes time    */
    ClearNumber();                    /* clear pin since it was complete */
  } 
  
  return result;
}
Esempio n. 5
0
/*
 * MobileGet
 * Description:      Function for getting mobile topup of a specific amount
 *                   
 * Arguments:        amount: value of mobile recharge to process (in Naira)
 * Return:           None.
 *
 * Input:            None
 * Output:           None
 *
 * Operation:        Flash success message before returning home
 *
 * Error Handling:   None
 *
 * Algorithms:       None
 * Data Strutures:   None
 *
 * Shared Variables: None
 *
 * Revision History:
 *   Apr. 24, 2013      Nnoduka Eruchalu     Initial Revision
 *   Apr. 25, 2013      Nnoduka Eruchalu     Added DisplayMoney
 */
static void MobileGet(uint32_t amount)
{
   /* update LCD */
  UpdateDisplay(1, 0, "                    "); /* row 1, col 0   */
  UpdateDisplay(2, 0, " Successful Top-Up  "); /* row 2, col 0   */
  UpdateDisplay(3, 0, "+                   "); /* row 3, col 0   */
  DisplayMoney(3, 1, amount*100);              /* show amount of topup   */
  balance -= amount*100;                       /* update balance. */
  __delay_s(MSG_FLASH_TIME);                   /* a msg flash takes time */
}
void CEventWizardDlg::OnFilterChange()
{
	m_bOK = false;

	m_Find.GetWindowText(m_Filter);
	m_Filter.MakeLower();

	if (m_iStep == 1)
	{
		int Sel = m_List.GetSelectedItem();
		CString Name = m_List.GetItemText(Sel, NULL); // Previously selected name

		// Clear list
		m_List.DeleteAllItems();
		
		UpdateDisplay(Name);

		if (m_List.GetItemCount() == 1)
		{
			m_List.SetItemState(0, LVIS_SELECTED, LVIS_SELECTED);
			m_List.Invalidate();
			UpdateButtons();
		}
		else
		{
			// We work out which is the best possible one to select


		}
	}

	else if (m_iStep == 2)
	{
		int curSel = m_ACEList.GetSelectedItem();
		CString name = m_ACEList.GetItemText(curSel,NULL);

		// Clear list
		m_ACEList.DeleteAllItems();
		m_ACEList.RemoveAllGroups();
	
		UpdateDisplay(name, false);

		m_ACEList.EnableGroups();

		if (m_ACEList.GetItemCount() == 1)
		{
			m_ACEList.SetItemState(0, LVIS_SELECTED, LVIS_SELECTED);
			m_ACEList.Invalidate();
			UpdateButtons();
		}
	} 

	m_Find.SetFocus();
}
Esempio n. 7
0
void CChineseChessView::OnLButtonUp(UINT nFlags, CPoint point)
{
	// TODO: ÔÚ´ËÌí¼ÓÏûÏ¢´¦Àí³ÌÐò´úÂëºÍ/»òµ÷ÓÃĬÈÏÖµ
	if (isMouseDown){
		isMouseDown=false;		
		CRect rect;
		GetClientRect(&rect);

		CPoint logpoint=PhysicalToLogicPoint(point);
		if (logpoint.x>=0){	
			//human move
			Gen();
			newmove.from = LogicPointToNum(selectedPoint); 
			newmove.dest = LogicPointToNum(logpoint);
			for (int i=gen_begin[ply]; i<gen_end[ply]; i++){
				if (gen_dat[i].m.from==newmove.from && gen_dat[i].m.dest==newmove.dest){
					if(UpdateNewMove()){
						UpdateDisplay(rect);
						int ret;
						ret=MessageBox("you are really a lucky dog,dare to try again?","Game Over",MB_YESNO);
						if (ret==IDYES){
							NewGame(true);
							return;
						}else{
							exit(0);
						}
					}
					side = xside; xside = 1-xside;
					//computer move
					short best;			
					best = AlphaBeta(-INFINITY, INFINITY, MAX_PLY);
					if(UpdateNewMove()){
						UpdateDisplay(rect);
						int ret;
						ret=MessageBox("afraid?dare to try again?","Game Over",MB_YESNO);
						if (ret==IDYES){
							NewGame(true);
							return;
						}else{
							exit(0);
						}
					}
					side = xside; xside = 1-xside;
					break;
				}
			}
			
		}

		UpdateDisplay(rect);
		
	}
	CView::OnLButtonUp(nFlags, point);
}
void
JXSaveFileDialog::Receive
	(
	JBroadcaster*	sender,
	const Message&	message
	)
{
	JXDirTable* fileBrowser = GetFileBrowser();

	if (sender == itsFileNameInput)
		{
		if (message.Is(JXWidget::kGotFocus))
			{
			itsSaveButton->SetLabel(kSaveLabel);
			UpdateDisplay();
			}
		else if (message.Is(JXWidget::kLostFocus))
			{
			itsSaveButton->SetLabel(kOpenLabel);
			UpdateDisplay();
			}
		else if (message.Is(JTextEditor::kTextChanged) ||
				 message.Is(JTextEditor::kTextSet))
			{
			UpdateDisplay();
			}
		}

	else if (sender == fileBrowser && message.Is(JXDirTable::kFileDblClicked))
		{
		const JXDirTable::FileDblClicked* info =
			dynamic_cast<const JXDirTable::FileDblClicked*>(&message);
		assert( info != NULL );
		const JString fileName = (info->GetDirEntry()).GetName();
		itsFileNameInput->SetText(fileName);
		itsFileNameInput->Focus();
		}

	else
		{
		if (sender == &(fileBrowser->GetTableSelection()))
			{
			UpdateDisplay();
			}
		else if (sender == fileBrowser &&
				 (message.Is(JXWidget::kGotFocus) ||
				  message.Is(JXWidget::kLostFocus)))
			{
			UpdateDisplay();
			}

		JXCSFDialogBase::Receive(sender, message);
		}
}
Esempio n. 9
0
void CPROC tick( uintptr_t psv )
{
	uint32_t now = GetTickCount();

	if( target_in_start )
	{
		if( now >= target_in_start )
		{
			if( !target_in )
			{
				//lprintf( "Begin fading in the new image..." );
				target_in = target_in_start + g.fade_in;
				g.currents[g.next_up] = g.current_image;
				g.current_image++;
				if( g.current_image >= g.nImages )
					g.current_image = 0;
				//lprintf( "(!)Setting fade to..> %d", 255 - (255*(now-target_in_start))/(target_in-target_in_start) );
				SetDisplayFade( g.displays[g.next_up], 255 - (255*(now-target_in_start))/(target_in-target_in_start) );
				g.is_up[g.next_up] = 1;
	            RestoreDisplay( g.displays[g.next_up] );
				//ForceDisplayFront( g.displays[g.next_up] );
			}
			else
			{
				if( target_in && now > target_in )
				{
					//lprintf( "Fade is is complete, set alpha to 0, and hide old display..." );
					SetDisplayFade( g.displays[g.next_up], 0 );
					UpdateDisplay( g.displays[g.next_up] );
					target_in_start = now + g.show_time;
					target_in = 0;
					g.next_up++;
					if( g.next_up >= 2 ) // two displayss
						g.next_up = 0;
					//lprintf( "Next up is %d", g.next_up );

					// hide the old display...
					//lprintf( "hiding old display..." );
					g.is_up[g.next_up] = 0;
					HideDisplay( g.displays[g.next_up] );
				}
				else
				{
					//lprintf( "Setting fade to..> %d", 255 - (255*(now-target_in_start))/(target_in-target_in_start) );
					SetDisplayFade( g.displays[g.next_up], 255 - (255*(now-target_in_start))/(target_in-target_in_start) );
					UpdateDisplay( g.displays[g.next_up] );
				}
			}
		}
	}
}
Esempio n. 10
0
void CDlgCalcDlg::DisplayXRegister()
{
    double dblVal = m_dblStack[0];

    if ((dblVal >= 1000000000000.0) || (dblVal <= -1000000000000.0)) {
        UpdateDisplay (CString (_T ("Overflow error")));
        m_bErrorFlag = TRUE;
        MessageBeep (MB_ICONASTERISK);
    }
    else {
        m_strDisplay.Format (m_strFormat, dblVal);
        UpdateDisplay (m_strDisplay);
    }
}
Esempio n. 11
0
void DraggableListCtrl::OnChar(wxKeyEvent& event)
{
	// Don't respond to the keyboard if the user is dragging things (else
	// the undo system might get slightly confused)
	if (HasCapture())
		return;

	if (event.GetKeyCode() == WXK_DELETE)
	{
		long item = GetNextItem(-1,
				wxLIST_NEXT_ALL,
				wxLIST_STATE_SELECTED);

		if (item != -1)
		{
			AtlasWindowCommandProc::GetFromParentFrame(this)->Submit(
				new DeleteCommand(this, item)
			);
			UpdateDisplay();
		}
	}
	else
	{
		event.Skip();
	}
}
LRESULT CDlgScraperOutput::OnWinMgr(WPARAM wp, LPARAM lp) 
{
	NMWINMGR& nmw = *(NMWINMGR*)lp;
	RECT		rect = {0};

	if (nmw.code==NMWINMGR::GET_SIZEINFO) 
	{
		if (wp==(WORD)GetDlgCtrlID()) 
		{
			// Parent frame is requesting my size info. Report min size.
			m_winMgr.GetMinMaxInfo(this, nmw.sizeinfo);
			return true; // handled--important!
		}
	}

	else if (nmw.code==NMWINMGR::SIZEBAR_MOVED) 
	{
		// User moved a sizer bar: call WinMgr to do it!
		m_winMgr.MoveRect(wp, nmw.sizebar.ptMoved, this);
		m_winMgr.SetWindowPositions(this);
		if (!in_startup)
		{
			m_Zoom.GetWindowRect(&rect);
			m_Zoom.SetWindowPos(NULL, 0, 0, rect.right-rect.left, 9999, SWP_NOMOVE);
			UpdateDisplay();
		}
		return true;
	}

	return false; // not handled
}
Esempio n. 13
0
BOOL CdIpmDoc::ForceRefresh()
{
	try
	{
		CTreeCtrl* pTree = m_pTreeGD->GetPTree();

		CWaitCursor hourGlass;
		IPMUPDATEPARAMS ups;
		memset (&ups, 0, sizeof(ups));
		ups.nType = 0;
		ups.pStruct = NULL;
		CaIpmQueryInfo queryInfo (this, OT_MON_ALL, &ups);
		IPM_UpdateInfo(&queryInfo);
		IPM_SetNormalState(this);
		if (IsLoadedDoc())
		{
			UpdateDisplay();
			m_bLoaded = FALSE;
		}
		return TRUE;
	}
	catch (CeIpmException e)
	{
		AfxMessageBox (e.GetReason(), MB_ICONEXCLAMATION|MB_OK);
	}
	catch (...)
	{
		TRACE0("Exception in: CdIpmDoc::ForceRefresh\n");
	}
	return FALSE;
}
Esempio n. 14
0
BOOL CdIpmDoc::ManageMonSpecialState()
{
	if (m_hNode != -1) 
	{
		if (IPM_IsFirstAccessDataAfterLoad(this))
		{
			CWaitCursor doWaitCursor;
			IPMUPDATEPARAMS ups;
			memset (&ups, 0, sizeof(ups));
			ups.nType = 0;
			ups.pStruct = NULL;
			CaIpmQueryInfo info (this, OT_MON_ALL, &ups);
			IPM_UpdateInfo (&info);

			BOOL bFirstAccess = FALSE;
			IPM_SetFirstAccessDataAfterLoad(this, bFirstAccess);
			UpdateDisplay();

			// _T("Monitor Information has been refreshed, (according to previous message when loading an environment), and the selected item may have changed.");
			AfxMessageBox(IDS_MONITOR_INFO);
			return TRUE;
		}
	}
	return FALSE;
}
Esempio n. 15
0
/*
 * DisplayMoney
 * Description:      At the specified row and column, write a monetary value
 *                   that is supplied in kobos.
 *                   Example: n = 123456 becomes N1,234.56
 *                            n = 0      becomes N0.00
 *
 * Arguments:        row: 0-indexed LCD row
 *                   col: 0-indexed LCD column
 *                   n:   monetary amount in kobos
 * Return:           None
 *
 * Input:            None
 * Output:           None
 *
 * Operation:        Write exactly 2 digits after a decimal point, and at least
 *                   1 digit before the decimal point. To ensure you get a
 *                   digit before decimal point, use a do-while loop so that
 *                   even if the number starts out as 0, it is written at least
 *                   once.
 *
 * Error Handling:   None
 *
 * Algorithms:       None
 * Data Strutures:   None
 *
 * Shared Variables: None
 *
 * Revision History:
 *   Apr. 25, 2013      Nnoduka Eruchalu     Initial Revision
 */
static void DisplayMoney(uint8_t row, uint8_t col, uint32_t n)
{
  char retbuf[30];                    /* allocate space for writing string    */
  char *p = &retbuf[sizeof(retbuf)-1];/* and prepare to start from end        */
  int i = 0;                          /* counter of chars written             */
  
  
  *p = '\0';                          /* strings end with a null terminator   */
  
  do {                                /* pre-decimal point loop               */
    *--p = '0' + (n % 10);            /* save next char in ASCII by adding '0'*/
    n /= 10;                          /* and drop the saved char from number  */
    i++;                              /* 1 more digit written                 */
  } while(i<2);                       /* write at least 2 digits b4 decimal pt*/
  *--p = '.';                         /* write decimal point                  */
  i = 0;                              /* and reset counter for next loop      */
  
  do {                                /* comma insertion loop                 */
    if ((i%3 == 0) && (i != 0)) {     /* if on a 3rd digit                    */
      *--p = ',';                     /* then next character is a comma       */
    }
    *--p = '0' + (n % 10);            /* save next char in ASCII by adding '0'*/
    n /= 10;                          /* and drop the saved char from number  */
    i++;                              /* 1 more digit written                 */
  } while (n != 0);                   /* keep going till number is exhausted  */
  
  *--p = NAIRA_CHAR;                  /* throw in currency logo               */
  
  UpdateDisplay(row, col, p);         /* FINALLY, update display              */
}
Esempio n. 16
0
/// Set the attributes and optionally update the display
bool wxRichTextFormattingDialog::SetStyle(const wxRichTextAttr& style, bool update)
{
    m_attributes = style;
    if (update)
        UpdateDisplay();
    return true;
}
Esempio n. 17
0
void CChineseChessView::OnMouseMove(UINT nFlags, CPoint point)
{
	// TODO: ÔÚ´ËÌí¼ÓÏûÏ¢´¦Àí³ÌÐò´úÂëºÍ/»òµ÷ÓÃĬÈÏÖµ
	if (isMouseDown){
		CPoint dragPoint=pieceDragPoint+point-lastMousePoint;
		CRect rc;
		if (dragPoint.x>=pieceDragPoint.x){
			rc.right=dragPoint.x+icon_len;
			rc.left=pieceDragPoint.x;
		}else{
			rc.right=pieceDragPoint.x+icon_len;
			rc.left=dragPoint.x;
		}
		if (dragPoint.y>=pieceDragPoint.y){
			rc.bottom=dragPoint.y+icon_len;
			rc.top=pieceDragPoint.y;
		}else{
			rc.bottom=pieceDragPoint.y+icon_len;
			rc.top=dragPoint.y;
		}
		pieceDragPoint=dragPoint;
		lastMousePoint=point;
		UpdateDisplay(rc);
	}
	
	CView::OnMouseMove(nFlags, point);
}
Esempio n. 18
0
void PostCounter::setTimescaleMode(RDLogLine::TimescaleMode mode)
{
  if(mode!=post_timescale_mode) {
    post_timescale_mode=mode;
    UpdateDisplay();
  }
}
bool TutorialMenuHandler::PageBtnClickEvent(const CEGUI::EventArgs& e)
{
	CEGUI::WindowEventArgs& w = (CEGUI::WindowEventArgs&)e;

	const CEGUI::String& windowName = w.window->getName();

	if(windowName == "GeneralPage")
	{
		currentPage = &generalPages[0];
		currDirectory = General;
	}
	else if(windowName == "EarthPage")
	{
		currentPage = &earthPages[0];
		currDirectory = Earth;
	}
	else if(windowName == "FirePage")
	{
		currentPage = &firePages[0];
		currDirectory = Fire;
	}
	else if(windowName == "WaterPage")
	{
		currentPage = &waterPages[0];
		currDirectory = Water;
	}

	atEnd = currentPage->Next == NULL;

	UpdateDisplay();

	return true;
}
Esempio n. 20
0
void CPicDLg::NextState( )
{
	
	if ( state<endState )
	{
		++state;
	}
	else
	{
		KillTimer( timer_next_state )	;
		timer_next_state = 0;
		timer_change = SetTimer( ID_TIMER_SNOW_CHANGE, 500+(unsigned)rand()%3000 ,NULL);
		state =  rand()%3;
		if ( isBigSnow )
		{
			endState = state+BIG_SNOW_KINDS;
		} 
		else
		{
			endState = state+SMALL_SNOW_KINDS;
		}

	}
	UpdateDisplay( 100 );
}
Esempio n. 21
0
void KPstateTutorial3::HookAfterTokenMoved(KPstateContext *pContext,
        TokenId id,
        MoveToken direction, bool successfullyMoved)
{
    actionState = ActionState::Started;

    if (!successfullyMoved && id == TokenId::EMPTY)
    {
        actionState = ActionState::MissedAnyToken;
    }
    else if (!successfullyMoved && id == GetEmphasizedTokenId() &&
             direction == MoveToken::Not)
    {
        actionState = ActionState::TokenKlickedOnly;
    }
    else if (!successfullyMoved)
    {
        actionState = ActionState::TokenNotMoveable;
    }
    else if (id == GetEmphasizedTokenId())
    {
        actionState = ActionState::RightTokenMoved;
        pContext->GetUserInterface().PlayAudio(KPSound::MoveToken);
    }
    else if (id != TokenId::EMPTY)
    {
        pContext->GetUserInterface().PlayAudio(KPSound::MoveToken);
        actionState = ActionState::WrongTokenMoved;
    }

    UpdateDisplay(pContext);
}
Esempio n. 22
0
void SjMainFrame::SetDisplayMsg(const wxString& text, long holdMs)
{
	m_display.m_msg1 = text.BeforeFirst('\n');
	m_display.m_msg2 = text.AfterFirst('\n');
	m_display.m_msgCancelAtTimestamp = SjTools::GetMsTicks()+holdMs;
	UpdateDisplay();
}
Esempio n. 23
0
void QtCalculator::display_selected(){

  if(calc_display->Button() == LeftButton){

    if(calc_display->isLit()){

      QClipboard *cb = QApplication::clipboard();
      cb->setText(calc_display->text());
      selection_timer->start(100);

    }
    else{

      selection_timer->stop();

    }

    invertColors();
  }
  else{

    QClipboard *cb = QApplication::clipboard();

    CALCAMNT result;
    result = (CALCAMNT) cb->text().toDouble();
    //    printf("%Lg\n",result);
    last_input = PASTE;
    DISPLAY_AMOUNT = result;
    UpdateDisplay();
  }

}
Esempio n. 24
0
void TextInputHandler::InsertInText(const char* toInsert)
{
	//if text contains brackets, verify they are correctly matched
	if (m_menu->IsHTML())
	{
		bool bFoundOpenBracket = false;
		UInt32 insertLen = strlen(toInsert);
		for (UInt32 i = 0; i < insertLen; i++)
		{
			char curChar = toInsert[i];
			if (curChar == '<')
			{
				if (!bFoundOpenBracket)
					bFoundOpenBracket = true;
				else
					return;				//two consecutive opening brackets = bad
			}
			else if (curChar == '>')
			{
				if (bFoundOpenBracket)
					bFoundOpenBracket = false;		//closing bracket matches opening bracket
				else
					return;							//closing bracket without opening bracket = bad
			}
		}
	}

	//brackets all match up, so go ahead and insert the text
	m_cursorPos = m_menu->InsertText(m_cursorPos, toInsert);

	//don't update display until next Update() call
	// actually, do update now.
	UpdateDisplay();
}
Esempio n. 25
0
bool TextInputHandler::SetInputText(const std::string& text, UInt32 newCursorPos)
{
	// script is responsible for making sure text is in an appropriate format
	// we make sure cursor doesn't end up outside text or inside an html tag
	if (newCursorPos >= text.length()) {
		return false;
	}
	else if (m_menu->IsHTML()) {
		size_t bracPos = text.find_first_of("<>", newCursorPos);
		if (bracPos != std::string::npos && text[bracPos] == '>') {
			return false;
		}
		else {
			bracPos = text.find_last_of("<>", newCursorPos);
			if (bracPos != std::string::npos && text[bracPos] == '<') {
				return false;
			}
		}
	}

	m_menu->SetText(text);
	m_cursorPos = newCursorPos;
	UpdateDisplay();
	return true;
}
Esempio n. 26
0
void CDlgCalcDlg::OnDigit(UINT nID) 
{
    TCHAR cDigit = (char) nID;

    if (m_bFixPending) {
        m_strFormat.SetAt (3, cDigit - IDC_0 + 0x30);
        DisplayXRegister ();
        m_bFixPending = FALSE;
        m_bStackLiftEnabled = TRUE;
        m_bNewX = TRUE;
        return;
    }

    if (m_bNewX) {
        m_bNewX = FALSE;
        if (m_bStackLiftEnabled) {
            m_bStackLiftEnabled = FALSE;
            LiftStack ();
        }
        m_bDecimalInString = FALSE;
        m_strDisplay.Empty ();
    }

    int nLength = m_strDisplay.GetLength ();
    if ((nLength == MAXCHARS) ||
        ((nLength == (MAXCHARS - 10)) && !m_bDecimalInString))
        ::MessageBeep (MB_ICONASTERISK);
    else {
        m_strDisplay += (cDigit - IDC_0 + 0x30);
        UpdateDisplay (m_strDisplay);
        m_dblStack[0] = _tcstod (m_strDisplay.GetBuffer (0), NULL);
    }
}
Esempio n. 27
0
/// Get attributes from the given range
bool wxRichTextFormattingDialog::GetStyle(wxRichTextCtrl* ctrl, const wxRichTextRange& range)
{
    if (ctrl->GetFocusObject()->GetStyleForRange(range.ToInternal(), m_attributes))
        return UpdateDisplay();
    else
        return false;
}
Esempio n. 28
0
static VOID
OnDisplayDeviceChanged(IN HWND hwndDlg, IN PDATA pData, IN PDISPLAY_DEVICE_ENTRY pDeviceEntry)
{
    PSETTINGS_ENTRY Current;
    DWORD index;

    pData->CurrentDisplayDevice = pDeviceEntry; /* Update variable */

    /* Fill color depths combo box */
    SendDlgItemMessage(hwndDlg, IDC_SETTINGS_BPP, CB_RESETCONTENT, 0, 0);
    for (Current = pDeviceEntry->Settings; Current != NULL; Current = Current->Flink)
    {
        TCHAR Buffer[64];
        if (LoadString(hApplet, (2900 + Current->dmBitsPerPel), Buffer, sizeof(Buffer) / sizeof(TCHAR)))
        {
            index = (DWORD) SendDlgItemMessage(hwndDlg, IDC_SETTINGS_BPP, CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)Buffer);
            if (index == (DWORD)CB_ERR)
            {
                index = (DWORD) SendDlgItemMessage(hwndDlg, IDC_SETTINGS_BPP, CB_ADDSTRING, 0, (LPARAM)Buffer);
                SendDlgItemMessage(hwndDlg, IDC_SETTINGS_BPP, CB_SETITEMDATA, index, Current->dmBitsPerPel);
            }
        }
    }

    /* Fill resolutions slider */
    SendDlgItemMessage(hwndDlg, IDC_SETTINGS_RESOLUTION, TBM_CLEARTICS, TRUE, 0);
    SendDlgItemMessage(hwndDlg, IDC_SETTINGS_RESOLUTION, TBM_SETRANGE, TRUE, MAKELONG(0, pDeviceEntry->ResolutionsCount - 1));

    UpdateDisplay(hwndDlg, pData, TRUE);
}
Esempio n. 29
0
PostCounter::PostCounter(QWidget *parent,const char *name)
  : QPushButton(parent,name)
{
  post_running=false;
  post_time_format="hh:mm:ss";
  post_time=QTime();
  post_offset=0;
  post_offset_valid=false;

  //
  // Generate Fonts
  //
  post_small_font=QFont("Helvetica",12,QFont::Normal);
  post_small_font.setPixelSize(12);
  post_large_font=QFont("Helvetica",26,QFont::Normal);
  post_large_font.setPixelSize(26);

  //
  // Generate Palettes
  //
  post_idle_palette=palette();
  post_early_palette=
    QPalette(QColor(POSTPOINT_EARLY_COLOR),backgroundColor());
  post_ontime_palette=
    QPalette(QColor(POSTPOINT_ONTIME_COLOR),backgroundColor());
  post_late_palette=
    QPalette(QColor(POSTPOINT_LATE_COLOR),backgroundColor());

  post_offset = 0;
  UpdateDisplay();
}
Esempio n. 30
0
void QtCalculator::temp_stack_next(){

  CALCAMNT *number;

  if( temp_stack.current() == temp_stack.getLast()){
        KNotifyClient::beep();
        return;
  }

  number = temp_stack.next();

  if(number == NULL){
       KNotifyClient::beep();
    return;
  }
  else{
    //    printf("Number: %Lg\n",*number);
    last_input = RECALL;
    DISPLAY_AMOUNT = *number;
    UpdateDisplay();

  }


}