Exemplo n.º 1
0
/*
 * ToolbarButtonProc:  Subclassed window procedure for toolbar buttons
 */
long CALLBACK ToolbarButtonProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
   MSG msg;
   
   msg.hwnd = hwnd;
   msg.message = message;
   msg.wParam = wParam;
   msg.lParam = lParam;

   TooltipForwardMessage(&msg);

   switch (message)
   {
   case WM_LBUTTONUP:
      // If user moves pointer off button and then releases, focus is left on button.
      // So move focus back to main window if button not highlighted.
      if (!(Button_GetState(hwnd) & 0x0004))
	 SetFocus(hMain);
      else
      {
	// If releasing a toggle button, don't pop button out.
	Button *b = ToolbarFindButtonByHandle(hwnd);
	if (b != NULL && b->action2 != A_NOACTION)
	    b->pressed = !b->pressed;
      }
      break;

   case WM_LBUTTONDBLCLK:
     message = WM_LBUTTONDOWN;
     break;
   }
   return CallWindowProc(lpfnDefButtonProc, hwnd, message, wParam, lParam);
}
Exemplo n.º 2
0
INT_PTR CALLBACK ExecuteDialog::WndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
{
	static struct ExecuteDialog* dlg;

	switch(nmsg) {
	  case WM_INITDIALOG:
		dlg = (struct ExecuteDialog*) lparam;
		return 1;

	  case WM_COMMAND: {
		int id = (int)wparam;

		if (id == IDOK) {
			GetWindowText(GetDlgItem(hwnd, 201), dlg->cmd, COUNTOF(dlg->cmd));
			dlg->cmdshow = Button_GetState(GetDlgItem(hwnd,214))&BST_CHECKED?
											SW_SHOWMINIMIZED: SW_SHOWNORMAL;
			EndDialog(hwnd, id);
		} else if (id == IDCANCEL)
			EndDialog(hwnd, id);

		return 1;}
	}

	return 0;
}
Exemplo n.º 3
0
bool structGuiRadioButton :: f_getValue () {
	bool value = false;
	#if gtk
		value = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (d_widget));   // gtk_check_button inherits from gtk_toggle_button
	#elif cocoa
	#elif win
		value = (Button_GetState (d_widget -> window) & 0x0003) == BST_CHECKED;
	#elif mac
		value = GetControlValue (d_widget -> nat.control.handle);
	#endif
	return value;
}
Exemplo n.º 4
0
int main() {
	uint8_t state;
	char buf[100];

	while(1) {
		// Build state report
		state = Button_GetState();
		sprintf(buf, "Mask: %02X\n\nFire: %d\nRight: %d\nLeft: %d",
			state,
			(state & BUTTON_MASK_FIRE) ? 1 : 0,
			(state & BUTTON_MASK_RIGHT) ? 1 : 0,
			(state & BUTTON_MASK_LEFT) ? 1 : 0);

		// Clear and blit text
		Display_Clear();
		Display_PutText(0, 0, buf, FONT_DEJAVU_8PT);
		Display_Update();
	}
}
Exemplo n.º 5
0
static bool IsCheckboxChecked(HWND hwnd)
{
    return (Button_GetState(hwnd) & BST_CHECKED) == BST_CHECKED;
}
Exemplo n.º 6
0
  bool IsDown() const {
    AssertNoneLocked();
    AssertThread();

    return (Button_GetState(hWnd) & BST_PUSHED) != 0;
  }
Exemplo n.º 7
0
  bool is_down() const {
    assert_none_locked();
    assert_thread();

    return (Button_GetState(hWnd) & BST_PUSHED) != 0;
  }
Exemplo n.º 8
0
void PLAYBACK::update()
{
	// controls:
	// update < and > buttons
	rewindButtonOldState = rewindButtonState;
	rewindButtonState = ((Button_GetState(hwndRewind) & BST_PUSHED) != 0 || mustRewindNow);
	if (rewindButtonState)
	{
		if (!rewindButtonOldState)
		{
			buttonHoldTimer = clock();
			handleRewindFrame();
		} else if (buttonHoldTimer + BUTTON_HOLD_REPEAT_DELAY < clock())
		{
			handleRewindFrame();
		}
	}
	forwardButtonOldState = forwardButtonState;
	forwardButtonState = (Button_GetState(hwndForward) & BST_PUSHED) != 0;
	if (forwardButtonState && !rewindButtonState)
	{
		if (!forwardButtonOldState)
		{
			buttonHoldTimer = clock();
			handleForwardFrame();
		} else if (buttonHoldTimer + BUTTON_HOLD_REPEAT_DELAY < clock())
		{
			handleForwardFrame();
		}
	}
	// update << and >> buttons
	rewindFullButtonOldState = rewindFullButtonState;
	rewindFullButtonState = ((Button_GetState(hwndRewindFull) & BST_PUSHED) != 0);
	if (rewindFullButtonState && !rewindButtonState && !forwardButtonState)
	{
		if (!rewindFullButtonOldState)
		{
			buttonHoldTimer = clock();
			handleRewindFull();
		} else if (buttonHoldTimer + BUTTON_HOLD_REPEAT_DELAY < clock())
		{
			handleRewindFull();
		}
	}
	forwardFullButtonOldState = forwardFullButtonState;
	forwardFullButtonState = (Button_GetState(hwndForwardFull) & BST_PUSHED) != 0;
	if (forwardFullButtonState && !rewindButtonState && !forwardButtonState && !rewindFullButtonState)
	{
		if (!forwardFullButtonOldState)
		{
			buttonHoldTimer = clock();
			handleForwardFull();
		} else if (buttonHoldTimer + BUTTON_HOLD_REPEAT_DELAY < clock())
		{
			handleForwardFull();
		}
	}

	// update the Playback cursor
	if (currFrameCounter != lastCursorPos)
	{
		// update gfx of the old and new rows
		pianoRoll.redrawRow(lastCursorPos);
		bookmarks.redrawChangedBookmarks(lastCursorPos);
		pianoRoll.redrawRow(currFrameCounter);
		bookmarks.redrawChangedBookmarks(currFrameCounter);
		lastCursorPos = currFrameCounter;
		// follow the Playback cursor, but in case of seeking don't follow it
		pianoRoll.followPlaybackCursorIfNeeded(false);	//pianoRoll.updatePlaybackCursorPositionInPianoRoll();	// an unfinished experiment
		// enforce redrawing now
		UpdateWindow(pianoRoll.hwndList);
		// lazy update of "Playback's Marker text"
		int current_marker = markersManager.getMarkerAboveFrame(currFrameCounter);
		if (displayedMarkerNumber != current_marker)
		{
			markersManager.updateEditedMarkerNote();
			displayedMarkerNumber = current_marker;
			redrawMarkerData();
			mustFindCurrentMarker = false;
		}
	}
	// [non-lazy] update "Playback's Marker text" if needed
	if (mustFindCurrentMarker)
	{
		markersManager.updateEditedMarkerNote();
		displayedMarkerNumber = markersManager.getMarkerAboveFrame(currFrameCounter);
		redrawMarkerData();
		mustFindCurrentMarker = false;
	}

	// pause when seeking hits pause_frame
	if (pauseFrame && currFrameCounter + 1 >= pauseFrame)
		stopSeeking();
	else if (currFrameCounter >= getLastPosition() && currFrameCounter >= currMovieData.getNumRecords() - 1 && mustAutopauseAtTheEnd && taseditorConfig.autopauseAtTheEndOfMovie && !isTaseditorRecording())
		// pause at the end of the movie
		pauseEmulation();

	// update flashing pauseframe
	if (oldPauseFrame != pauseFrame && oldPauseFrame)
	{
		// pause_frame was changed, clear old_pauseframe gfx
		pianoRoll.redrawRow(oldPauseFrame-1);
		bookmarks.redrawChangedBookmarks(oldPauseFrame-1);
	}
	oldPauseFrame = pauseFrame;
	oldStateOfShowPauseFrame = showPauseFrame;
	if (pauseFrame)
	{
		if (emuPausedState)
			showPauseFrame = (int)(clock() / PAUSEFRAME_BLINKING_PERIOD_WHEN_PAUSED) & 1;
		else
			showPauseFrame = (int)(clock() / PAUSEFRAME_BLINKING_PERIOD_WHEN_SEEKING) & 1;
	} else showPauseFrame = false;
	if (oldStateOfShowPauseFrame != showPauseFrame)
	{
		// update pauseframe gfx
		pianoRoll.redrawRow(pauseFrame - 1);
		bookmarks.redrawChangedBookmarks(pauseFrame - 1);
	}

	// update seeking progressbar
	emuPausedOldState = emuPausedState;
	emuPausedState = (FCEUI_EmulationPaused() != 0);
	if (pauseFrame)
	{
		if (oldStateOfShowPauseFrame != showPauseFrame)		// update progressbar from time to time
			// display seeking progress
			setProgressbar(currFrameCounter - seekingBeginningFrame, pauseFrame - seekingBeginningFrame);
	} else if (emuPausedOldState != emuPausedState)
	{
		// emulator got paused/unpaused externally
		if (emuPausedOldState && !emuPausedState)
		{
			// externally unpaused - show empty progressbar
			setProgressbar(0, 1);
		} else
		{
			// externally paused - progressbar should be full
			setProgressbar(1, 1);
		}
	}

	// prepare to stop at the end of the movie in case user unpauses emulator
	if (emuPausedState)
	{
		if (currFrameCounter < currMovieData.getNumRecords() - 1)
			mustAutopauseAtTheEnd = true;
		else
			mustAutopauseAtTheEnd = false;
	}

	// this little statement is very important for adequate work of the "green arrow" and "Restore last position"
	if (!emuPausedState)
		// when emulating, lost_position_frame becomes unstable (which means that it's probably not equal to the end of current segment anymore)
		lastPositionIsStable = false;
}