void CEntityEditorSoundPropertyPanel::OnButtonClicked(IGameGUIButton *piControl)
{
	if(m_Object.m_piDesign==NULL){return;}
	bool bUpdateConfig=false;
	SSoundAnimationObjectTypeConfig sConfig;
	m_Object.m_piDesign->GetConfig(&sConfig);

	unsigned int nIncrement=10;
	if(m_piGUIManager->IsKeyDown(GK_LCONTROL)){nIncrement=100;}
	if(m_piGUIManager->IsKeyDown(GK_LSHIFT)){nIncrement=500;}
	
	if(m_piBTLoop==piControl){bUpdateConfig=true;sConfig.bLoop=!sConfig.bLoop;}
	if(m_piBTIncreaseVolume==piControl){bUpdateConfig=true;sConfig.nVolume+=5;if(sConfig.nVolume>100){sConfig.nVolume=100;}}
	if(m_piBTDecreaseVolume==piControl){bUpdateConfig=true;sConfig.nVolume-=5;if(sConfig.nVolume<0){sConfig.nVolume=0;}}
	if(m_piBTIncreaseStartTime==piControl){bUpdateConfig=true;sConfig.nStartTime+=nIncrement;}
	if(m_piBTDecreaseStartTime==piControl){bUpdateConfig=true;sConfig.nStartTime=(sConfig.nStartTime<nIncrement)?0:sConfig.nStartTime-nIncrement;}
	if(m_piBTIncreaseEndTime==piControl){bUpdateConfig=true;sConfig.nEndTime+=nIncrement;}
	if(m_piBTDecreaseEndTime==piControl){bUpdateConfig=true;sConfig.nEndTime=(sConfig.nEndTime<nIncrement)?0:sConfig.nEndTime-nIncrement;}

	if(bUpdateConfig)
	{
		m_Object.m_piDesign->SetConfig(&sConfig);
		UpdateData();
		NOTIFY_EVENT(IEntityEditorPropertyPanelEvents,OnObjectChanged(this,m_Object.m_piObject));
	}
	if(piControl==m_piBTRemove)
	{
		if(!ConfirmDialog("Remove sound '"+m_Object.m_piDesign->GetAnimationObjectDescription()+"' ?","Entity Editor",eMessageDialogType_Warning)){return;}

		ISystemObject *piObject=ADD(m_Object.m_piObject);
		m_Object.Detach();
		NOTIFY_EVENT(IEntityEditorPropertyPanelEvents,OnObjectRemoved(this,piObject));
		REL(piObject);
	}
}
Example #2
0
EXTERN_C int WINAPI LogoffWindowsDialog(HWND hWndOwner)
{
    if (ConfirmDialog(hWndOwner, IDS_LOGOFF_PROMPT, IDS_LOGOFF_TITLE))
        ExitWindowsEx(EWX_LOGOFF, 0);

    return 0;
}
void CGameGUIFileDialog::ProcessSelect()
{
	std::string sFile=m_sFile;
	if(m_piEDPath){sFile=m_piEDPath->GetText();}
	
	if(FileIsDirectory(sFile.c_str()))
	{
	  UpdateFiles();
	  return;
	}
	
	if(m_bOpenMode)
	{
	  if(!FileExists(sFile.c_str()))
	  {
		MessageDialog((std::string)"The file '"+sFile+"' does not exist.","Error",eMessageDialogType_Error);
		if(m_piEDPath){m_piGUIManager->SetFocus(m_piEDPath);}
		return;
	  }
	}
	else
	{
	  if(FileExists(sFile.c_str()) && m_bOverWriteWarn)
	  {
		if(ConfirmDialog((std::string)"Overwrite '"+sFile+"' ?.","Warning!",eMessageDialogType_Warning)!=DIALOG_OK)
		{
		  if(m_piEDPath){m_piGUIManager->SetFocus(m_piEDPath);}
		  return;
		}
	  }
	}
	m_sFile=sFile;
	EndDialog(DIALOG_OK);
}
int Transaction::ReqOrderInsert(AirTradeFtdcInputOrderField* pInputOrder, int nRequestID)
{
	// 尝试获取资金信息,发送Ctrl+C
	m_stockTreeView.ClickItem(TEXT("中签")); // 需要先切换到不常用的界面然后再点需要的界面才工作正常
	m_stockTreeView.ClickItem(TEXT("资金股票"));
	RefreshDialogsAndControls();
	m_sendKeys.Send("^C", m_controls[CONTROL_CHAXUN_ZJGP]);

    // 加载买入股票界面
	m_stockTreeView.ClickItem(TEXT("中签")); 
	m_stockTreeView.ClickItem(TEXT("买入[F1]"));
    RefreshDialogsAndControls();

    // 填写买入信息
	::PostMessage(m_controls[CONTROL_MAIRU_DAIMA], EM_SETSEL, 0, -1);
	m_sendKeys.Send("000793", m_controls[CONTROL_MAIRU_DAIMA]);
	::PostMessage(m_controls[CONTROL_MAIRU_JIAGE], EM_SETSEL, 0, -1);
	m_sendKeys.Send("9.99", m_controls[CONTROL_MAIRU_JIAGE]);
	::PostMessage(m_controls[CONTROL_MAIRU_SHULIANG], EM_SETSEL, 0, -1);
	m_sendKeys.Send("20000", m_controls[CONTROL_MAIRU_SHULIANG]);

    // 执行买入操作
	m_sendKeys.Send("B", m_controls[CONTROL_MAIRU_DAIMA]);

    // 确认买入操作
    ConfirmDialog(true);

    // 获取提示信息
    GetHint();

    return 0;
}
void CEntityEditorEventPropertyPanel::OnButtonClicked(IGameGUIButton *piControl)
{
	if(m_Object.m_piDesign==NULL){return;}
	bool bUpdateConfig=false;
	SEventAnimationObjectTypeConfig sConfig;
	m_Object.m_piDesign->GetConfig(&sConfig);
	if(m_piBTIncreaseTime==piControl){bUpdateConfig=true;sConfig.nTime+=100;}
	if(m_piBTDecreaseTime==piControl){bUpdateConfig=true;sConfig.nTime=(sConfig.nTime<100)?0:sConfig.nTime-100;}
	if(bUpdateConfig)
	{
		m_Object.m_piDesign->SetConfig(&sConfig);
		UpdateData();

		NOTIFY_EVENT(IEntityEditorPropertyPanelEvents,OnObjectChanged(this,m_Object.m_piObject));
	}
	if(piControl==m_piBTRemove)
	{
		if(!ConfirmDialog("Remove event '"+m_Object.m_piDesign->GetAnimationObjectDescription()+"' ?","Entity Editor",eMessageDialogType_Warning)){return;}

		ISystemObject *piObject=ADD(m_Object.m_piObject);
		m_Object.Detach();
		NOTIFY_EVENT(IEntityEditorPropertyPanelEvents,OnObjectRemoved(this,piObject));
		REL(piObject);
	}
}
Example #6
0
void VideosWindow::onDeleteClicked()
{
    if (ConfirmDialog(ConfirmDialog::Delete, this).exec() == QMessageBox::Yes) {
        mafwTrackerSource->destroyObject(ui->objectList->currentIndex().data(UserRoleObjectID).toString());
        objectProxyModel->removeRow(ui->objectList->currentIndex().row());
    }
    ui->objectList->clearSelection();
}
void __fastcall TChooseSilentMRWModeDLG::Timer1Timer(TObject *Sender)
{
  CBackEndInterface *BackEnd = CBackEndInterface::Instance();
  
  // Reason for having the timer is for the case where user inserts one incompatibe cart. then chooses silent, then chooses DM,
  // then gets "Please insert the other Model ..." and then he inserts a VALID catr. to other housing.
  // Since it is Valid, no TTankDialog is launched that can handle the closing of it.
#ifdef OBJET_MACHINE
// In DM mode confirm that both Tanks are inserted:
  if (BackEnd->IsRelevantTankInserted(TYPE_TANK_MODEL2) && BackEnd->IsRelevantTankInserted(TYPE_TANK_MODEL4)
    || BackEnd->IsRelevantTankInserted(TYPE_TANK_MODEL4) && BackEnd->IsRelevantTankInserted(TYPE_TANK_MODEL6)
    ||  BackEnd->IsRelevantTankInserted(TYPE_TANK_MODEL2) && BackEnd->IsRelevantTankInserted(TYPE_TANK_MODEL6))
             if (BackEnd->GetTankMaterialType(TYPE_TANK_MODEL2) != "" && BackEnd->GetTankMaterialType(TYPE_TANK_MODEL4) != ""
                || BackEnd->GetTankMaterialType(TYPE_TANK_MODEL4) != "" && BackEnd->GetTankMaterialType(TYPE_TANK_MODEL6) != ""
                ||  BackEnd->GetTankMaterialType(TYPE_TANK_MODEL2) != "" && BackEnd->GetTankMaterialType(TYPE_TANK_MODEL6) != "")
    ConfirmDialog();
  #else
  if (BackEnd->IsRelevantTankInserted(TYPE_TANK_MODEL1) && BackEnd->IsRelevantTankInserted(TYPE_TANK_MODEL2))
    if (BackEnd->GetTankMaterialType(TYPE_TANK_MODEL1) != "" && BackEnd->GetTankMaterialType(TYPE_TANK_MODEL2) != "")
      ConfirmDialog();
#endif
}
NS_IMETHODIMP 
nsSecurityWarningDialogs::ConfirmPostToInsecureFromSecure(nsIInterfaceRequestor *ctx, bool* _result)
{
  nsresult rv;

  // The Telemetry clickthrough constant is 1 more than the constant for the dialog.
  rv = ConfirmDialog(ctx, nullptr, // No preference for this one - it's too important
                     MOZ_UTF16("PostToInsecureFromSecureMessage"),
                     nullptr,
                     nsISecurityUITelemetry::WARNING_CONFIRM_POST_TO_INSECURE_FROM_SECURE,
                     _result);

  return rv;
}
NS_IMETHODIMP 
nsSecurityWarningDialogs::ConfirmPostToInsecure(nsIInterfaceRequestor *ctx, bool* _result)
{
  nsresult rv;

  // The Telemetry clickthrough constant is 1 more than the constant for the dialog.
  rv = ConfirmDialog(ctx, INSECURE_SUBMIT_PREF,
                     NS_LITERAL_STRING("PostToInsecureFromInsecureMessage").get(),
                     NS_LITERAL_STRING("PostToInsecureFromInsecureShowAgain").get(),
                     nsISecurityUITelemetry::WARNING_CONFIRM_POST_TO_INSECURE_FROM_INSECURE,
                     _result);

  return rv;
}
Example #10
0
/*************************************************************************
 * ExitWindowsDialog                [SHELL32.60]
 *
 * NOTES
 *     exported by ordinal
 */
void WINAPI ExitWindowsDialog(HWND hWndOwner)
{
    TRACE("(%p)\n", hWndOwner);

    if (ConfirmDialog(hWndOwner, IDS_SHUTDOWN_PROMPT, IDS_SHUTDOWN_TITLE))
    {
        HANDLE hToken;
        TOKEN_PRIVILEGES npr;

        /* enable shutdown privilege for current process */
        if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken))
        {
            LookupPrivilegeValueA(0, "SeShutdownPrivilege", &npr.Privileges[0].Luid);
            npr.PrivilegeCount = 1;
            npr.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
            AdjustTokenPrivileges(hToken, FALSE, &npr, 0, 0, 0);
            CloseHandle(hToken);
        }
        ExitWindowsEx(EWX_SHUTDOWN, 0);
    }
}
Example #11
0
int WINAPI RestartDialogEx(HWND hWndOwner, LPCWSTR lpwstrReason, DWORD uFlags, DWORD uReason)
{
    TRACE("(%p)\n", hWndOwner);

    /* FIXME: use lpwstrReason */
    if (ConfirmDialog(hWndOwner, IDS_RESTART_PROMPT, IDS_RESTART_TITLE))
    {
        HANDLE hToken;
        TOKEN_PRIVILEGES npr;

        /* enable the shutdown privilege for the current process */
        if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken))
        {
            LookupPrivilegeValueA(0, "SeShutdownPrivilege", &npr.Privileges[0].Luid);
            npr.PrivilegeCount = 1;
            npr.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
            AdjustTokenPrivileges(hToken, FALSE, &npr, 0, 0, 0);
            CloseHandle(hToken);
        }
        ExitWindowsEx(EWX_REBOOT, uReason);
    }

    return 0;
}
Example #12
0
int UI::PlacePieces(Board *b) {
	//Create windows
	//navigate piece placement using arrow keys
	//Select 'W' & 'S' to select which ship you want to select
	//user 'Q' & 'E' to rotate the ship CCW & CW
	//Select delete over a selected ship to remove it from the
	initscr();
	if (!b->BoardisValid()) {
		b->ClearBoard();
	}
	//new win(int height, int width, int starty, int startx)
	//gameboard
	WINDOW *winboard = newwin(23, 24, 1, 1);
	//selection * instructions
	//WINDOW *wnd = subwin(mwnd, 25, 52, 0, 25);
	WINDOW *wnd = newwin(25, 52, 0, 25);
	wborder(winboard, '|', '|', '-', '-', '+', '+', '+', '+');
	noecho();
	//cbreak();
	curs_set(0);
	keypad(stdscr, TRUE);
	SetColor(winboard, 1, COLOR_WHITE, COLOR_BLACK, false); //Text
	SetColor(winboard, 2, COLOR_BLUE, COLOR_BLACK); //Water
	SetColor(winboard, 3, COLOR_RED, COLOR_BLACK);	//placed ships
	SetColor(winboard, 4, COLOR_YELLOW, COLOR_BLACK);//Highligted ships
	SetColor(winboard, 5, COLOR_GREEN, COLOR_BLACK); //???
	SetColor(wnd, 1, COLOR_WHITE, COLOR_BLACK, false); //Text
	SetColor(wnd, 2, COLOR_YELLOW, COLOR_BLACK); //Highlighted text
	SetColor(wnd, 3, COLOR_RED, COLOR_BLACK); //Cursor
	int selected = 0; //Currently selected ship [0 to 4]
	Piece tempship = Piece();
	tempship.piecelength = 0;
	tempship.CenterAxis.x = 8;
	tempship.CenterAxis.y = 8;
	tempship.orientation = ZeroDegrees;
	tempship.isValid = true;
	while (true) {
		wclear(winboard);
		wclear(wnd);
		wborder(winboard, '|', '|', '-', '-', '+', '+', '+', '+');
		//render current view
		SetColor(winboard, 1);
		//draw backround of battle square
		mvwprintw(winboard, 1, 4, "A B C D E F G H I J");
		for (int i = 0; i < 22; i+=2) {
			SetColor(winboard, 2);
			string gletter = std::to_string(i/2);
			SetColor(winboard, 2);
			mvwprintw(winboard, i + 3, 4, "0 0 0 0 0 0 0 0 0 0");
			SetColor(winboard, 1);
			if (i % 2 == 0) {
				SetColor(winboard, 1);
				mvwprintw(winboard, i + 1, 1, gletter.c_str());
			}
		}
		//Draw ships
		SetColor(winboard, 3);
		for (auto ship : b->BoardPieces) {
			/*vector<Coordinate> ls;
			ls = ship.GetOccupiedSpace();
			for (int i = 0; i < getPieceLength(ship.Type); i++) {
				mvwprintw(winboard, ls[i].x + 3, ls[i].y + 4, "X");
			}*/
			RenderToGrid(winboard, ship);
		}
		//Print ship names
		SetColor(wnd, (short)1, COLOR_WHITE, COLOR_BLACK);
		(b->IsPieceOnBoard(AircraftCarrier)) ? SetColor(wnd, 2) : SetColor(wnd, 1);
		mvwprintw(wnd, 1, 15, "Aircraft Carrier");
		mvwprintw(wnd, 2, 20, "XXXXX");
		(b->IsPieceOnBoard(Battleship)) ? SetColor(wnd, 2) : SetColor(wnd, 1);
		mvwprintw(wnd, 4, 18, "BattleShip");
		mvwprintw(wnd, 5, 21, "XXXX");
		(b->IsPieceOnBoard(Submarine)) ? SetColor(wnd, 2) : SetColor(wnd, 1);
		mvwprintw(wnd, 7, 18, "Submarine");
		mvwprintw(wnd, 8, 21, "XXX");
		(b->IsPieceOnBoard(Cruiser)) ? SetColor(wnd, 2) : SetColor(wnd, 1);
		mvwprintw(wnd, 10, 19, "Cruiser");
		mvwprintw(wnd, 11, 21, "XXX");
		(b->IsPieceOnBoard(Destroyer)) ? SetColor(wnd, 2) : SetColor(wnd, 1);
		mvwprintw(wnd, 13, 18, "Destroyer");
		mvwprintw(wnd, 14, 22, "XX");
		mvwprintw(wnd, 16, 6, "Navigate piece placement using arrow keys");
		mvwprintw(wnd, 17, 10, "Use 'W' & 'S' to select the ship");
		mvwprintw(wnd, 18, 3, "Use 'Q' & 'E' to rotate the ship CCW & CW");
		mvwprintw(wnd, 19, 0, "Press 'backspace' to remove a selected ship");
		mvwprintw(wnd, 20, 9, "Press enter to add ship/proceed");
		//refresh();
		//wrefresh(winboard);
		//wrefresh(wnd);
		//
		//what to print
		//Cursor
		bool highlightship = false;
		vector<Coordinate> ls;
		PieceType cpt = static_cast<PieceType>(selected);
		//if already placed
			//turn the temp ship to "invalid" so it won't be rendered.
			//render the ship using "yellow" hit markers
			//break;
		//if the current piece isn't this type, make it so
			//find a valid spot for it
		if (b->IsPieceOnBoard(cpt)) {
			tempship.isValid = false;
			highlightship = true;
			//break;
		}
		else if(tempship.Type != cpt) {
			tempship.Type = cpt;
			//Let's hope this doesnt crash anything at runtime
			b->NextValidPieceSpot(&tempship, ShipChange);
		}
		//Render the current ship, or highlight
		if (highlightship) {
			if (b->IsPieceOnBoard(cpt)) {
				SetColor(winboard, 4);
				int pos = b->GetPieceOnBoard(cpt);
				if (pos != -1) {
					SetColor(wnd, 2);
					RenderToGrid(winboard, b->BoardPieces.at(pos));
				}
			}
		}
		else {
			//piece is not on board, so render as a sort of 'overlay'
			if (!b->IsPieceOnBoard(cpt)) {
				SetColor(winboard, 4);
				int pos = b->GetPieceOnBoard(cpt);
				if (pos == -1) {
					RenderToGrid(winboard, tempship, "O");
				}
			}
		}//clear cursor
		mvwprintw(wnd, 1, 13, "  ");
		mvwprintw(wnd, 1, 31, "  ");
		mvwprintw(wnd, 4, 16, "  ");
		mvwprintw(wnd, 4, 28, "  ");
		mvwprintw(wnd, 7, 16, "  ");
		mvwprintw(wnd, 7, 27, "  ");
		mvwprintw(wnd, 10, 17, "  ");
		mvwprintw(wnd, 10, 26, "  ");
		mvwprintw(wnd, 13, 16, "  ");
		mvwprintw(wnd, 13, 27, "  ");
		//paint cursor
		SetColor(wnd, 3);
		switch (static_cast<PieceType>(selected))
		{
		case AircraftCarrier:
			mvwprintw(wnd, 1, 13, ">>");
			mvwprintw(wnd, 1, 31, "<<");
			break;
		case Battleship:
			mvwprintw(wnd, 4, 16, ">>");
			mvwprintw(wnd, 4, 28, "<<");
			break;
		case Submarine:
			mvwprintw(wnd, 7, 16, ">>");
			mvwprintw(wnd, 7, 27, "<<");
			break;
		case Cruiser:
			mvwprintw(wnd, 10, 17, ">>");
			mvwprintw(wnd, 10, 26, "<<");
			break;
		case Destroyer:
			mvwprintw(wnd, 13, 16, ">>");
			mvwprintw(wnd, 13, 27, "<<");
			break;
		default:
			break;
		}
		SetColor(wnd, 1);
		refresh();
		wrefresh(winboard);
		wrefresh(wnd);
		char ckey = getch();
		switch (ckey)
		{
		//Attempt to move piece up
		case '\x3':
			if (tempship.isValid) {
				b->NextValidPieceSpot(&tempship, Up);
			}
			break;
		//Attempt to move piece down
		case '\x2':
			if (tempship.isValid) {
				b->NextValidPieceSpot(&tempship, Down);
			}
			break;
		//Attempt to move piece down
		case '\x4':
			if (tempship.isValid) {
				b->NextValidPieceSpot(&tempship, Left);
			}
			break;
		//Attempt to move piece Right
		case '\x5':
			if (tempship.isValid) {
				b->NextValidPieceSpot(&tempship, Right);
			}
			break;
		//Attempt to rotate right
		case 'q':
			if (tempship.isValid) {
				b->NextValidPieceSpot(&tempship, CounterClockwise);
			}
			break;
		//Attempt to rotate left
		case 'e':
			if (tempship.isValid) {
				b->NextValidPieceSpot(&tempship, CounterClockwise);
			}
			break;
		//Move cursor up
		case 'w':
			(selected == 0) ? (selected = 4) : (selected--);
			//setup ship info
			//piece already exists
			if (b->IsPieceOnBoard(static_cast<PieceType>(selected))) {
				tempship.isValid = false;
			}
			else
			{
				//doesnt exist
				tempship.isValid = true;
				tempship.Type = static_cast<PieceType>(selected);
				b->NextValidPieceSpot(&tempship, ShipChange);
			}
			break;
		//Move cursor down
		case 's':
			(selected == 4) ? (selected = 0) : (selected++);
			//setup ship info
			if (b->IsPieceOnBoard(static_cast<PieceType>(selected))) {
				tempship.isValid = false;
			}
			else
			{
				//doesnt exist, yet
				tempship.isValid = true;
				tempship.Type = static_cast<PieceType>(selected);
				b->NextValidPieceSpot(&tempship, ShipChange);
			}
			break;
		/*
		Attempt to place piece.
		If already selected, ignore.
		if all pieces placed, start game
		*/
		case '\n':
			//already piece on board
			if (b->IsPieceOnBoard(static_cast<PieceType>(selected))) {
				if (b->BoardisValid()) {
					bool result = ConfirmDialog("Would you like to continue?");
					if (result) {
						return 1;
					}
				}
			}
			//Add to board if possible
			//ship is valid, not a duplicate, 
			else {
				if (b->ValidPieceSpot(tempship)) {
					b->BoardPieces.push_back(tempship);
					tempship.isValid = false;
				}
			}
			break;
		//If piece is already placed down, remove it
		case '\b':
			if (b->IsPieceOnBoard(static_cast<PieceType>(selected))) {
				int pos = b->GetPieceOnBoard(static_cast<PieceType>(selected));
				if (pos != -1) {
					Piece px = b->BoardPieces.at(pos);
					//if (b->ValidPieceSpot(px)) {
						tempship.CenterAxis = px.CenterAxis;
						tempship.orientation = px.orientation;
						tempship.isValid = true;
						tempship.Type = px.Type;
						b->PopPieceFromBoard(static_cast<PieceType>(selected));
					//}
				}
			}
			break;
		//clears board, and returns to main menu
		case '\x1b':
		{
				bool result = ConfirmDialog("Would you like to quit?");
				if (result) {
					b->ClearBoard();
					return 0;
				}
				//Confirm dialog!
				break;
			}
		default:
			break;
		}
	}
	wclear(wnd);
	wclear(winboard);
	delwin(wnd);
	delwin(winboard);
	endwin();
	return 1;
}