Ejemplo n.º 1
0
void
TrafficListWidget::OnAction(int id)
{
  switch (Buttons(id)) {
  case DETAILS:
    OpenDetails(GetList().GetCursorIndex());
    break;

  case MAP:
    OpenMap(GetList().GetCursorIndex());
    break;
  }
}
Ejemplo n.º 2
0
bool MAPS::OpenMap(HWND hMaps)
{
	return OpenMap(hMaps, nullptr);
}
Ejemplo n.º 3
0
bool Maps::OpenMap()
{
    return OpenMap("");
}
Ejemplo n.º 4
0
bool Maps::OpenMap()
{
    return OpenMap(nullptr);
}
Ejemplo n.º 5
0
/**
 * Constructs and displays the main UI for FortEdit
 * @param parent QWidget parent, typically null
 */
CFortEdit::CFortEdit(QWidget *parent) :
    QMainWindow(parent),
    DUi(new Ui::FortEdit),
    DActiveTool(0),
    DTerrainTool(0),
    DTerritoryTool(0),
    DObjectTool(0),
    DSelectTool(0),
    DSoundHandler(this),
    DLuaEditor(0)
{
    DUi->setupUi(this);
    DGraphicsScene = new QGraphicsScene();
    DUi->GraphicsView->setMouseTracking(true);
    DUi->GraphicsView->setScene(DGraphicsScene);
    DUi->GraphicsView->setUpdatesEnabled(true);

    // Ui connectivity / setup
    QObject::connect(DUi->ActionOpen, SIGNAL(triggered()), this, SLOT(OpenMap()));
    QObject::connect(DUi->ActionSaveAs, SIGNAL(triggered()), this, SLOT(SaveMapAs()));
    QObject::connect(DUi->ActionSave, SIGNAL(triggered()), this, SLOT(SaveMap()));
    QObject::connect(DUi->ActionNew, SIGNAL(triggered()), this, SLOT(NewMap()));
    QObject::connect(DUi->MapNameLineEdit, SIGNAL(textChanged(QString)), this, SLOT(UpdateSceneTitle(QString)));
    QObject::connect(DUi->MapWidthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(UpdateSceneWidth(int)));
    QObject::connect(DUi->MapHeightSpinBox, SIGNAL(valueChanged(int)), this, SLOT(UpdateSceneHeight(int)));
    QObject::connect(DUi->ObjectVisibilityToggle, SIGNAL(toggled(bool)), this, SLOT(UpdateSceneObjectVisibility(bool)));
    QObject::connect(DUi->GridCheckBox, SIGNAL(toggled(bool)), this, SLOT(UpdateSceneGridVisibility(bool)));
    QObject::connect(DUi->DisplayModeCombo, SIGNAL(currentIndexChanged(QString)), this, SLOT(UpdateSceneDisplayMode(QString)));

    QObject::connect(DUi->ToolTerrain, SIGNAL(clicked()), this, SLOT(UpdateActiveTool()));
    QObject::connect(DUi->ToolTerritory, SIGNAL(clicked()), this, SLOT(UpdateActiveTool()));
    QObject::connect(DUi->ToolObject, SIGNAL(clicked()), this, SLOT(UpdateActiveTool()));
    QObject::connect(DUi->ToolSelect, SIGNAL(clicked()), this, SLOT(UpdateActiveTool()));

    QObject::connect(DUi->AudioOptions, SIGNAL(clicked()), this, SLOT(UpdateActiveTool()));
    QObject::connect(DUi->ActionSaveSoundSet, SIGNAL(triggered()), this, SLOT(SaveSoundSet()));
    QObject::connect(DUi->ActionLoadSoundSet, SIGNAL(triggered()), &DSoundHandler, SLOT(LoadSoundSet()));

    QObject::connect(DUi->LuaEditorButton, SIGNAL(clicked()), this, SLOT(ToggleLuaEditor()));

    QObject::connect(DUi->PlayButton, SIGNAL(clicked()), this, SLOT(InvokeEngineDialog()));

    // Invocation dialog connectivity
    DInvocationDialog = new QDialog;
    DInvocationUi.setupUi(DInvocationDialog);

    LoadSettings();
    DInvocationUi.executablePath->setText(DEnginePath);
    DInvocationUi.modeCombo->setCurrentIndex(DInvocationMode);
    DInvocationUi.aiCombo->setCurrentIndex(DInvocationDifficulty);
    DInvocationUi.castleIndexCombo->setCurrentIndex(DInvocationIndex);
    DInvocationUi.windCheck->setChecked(DInvocationWind);

    QObject::connect(DInvocationUi.locateButton, SIGNAL(clicked()), this, SLOT(LocateEngine()));
    QObject::connect(DInvocationUi.modeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateInvocationConfig()));
    QObject::connect(DInvocationUi.aiCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateInvocationConfig()));
    QObject::connect(DInvocationUi.castleIndexCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateInvocationConfig()));
    QObject::connect(DInvocationUi.windCheck, SIGNAL(stateChanged(int)), this, SLOT(UpdateInvocationConfig()));
    QObject::connect(DInvocationUi.buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(InvokeEngine(QAbstractButton*)));

    // TODO: Make sure this order is consistent... This is pretty bad as it stands
    DUi->PropertyPageStack->addWidget(DTerrainTool.GetPropertiesWidget());
    DUi->PropertyPageStack->addWidget(DTerritoryTool.GetPropertiesWidget());
    DUi->PropertyPageStack->addWidget(DSelectTool.GetPropertiesWidget());
    DUi->PropertyPageStack->addWidget(DSoundHandler.GetPropertiesWidget());
    DUi->PropertyPageStack->addWidget(DObjectTool.GetPropertiesWidget());

    DScene = new CScene(":/default-maps/res/new.map", DGraphicsScene, &DSoundHandler);
    DUi->ActionSave->setEnabled(false);
    UpdateUi();
}
Ejemplo n.º 6
0
//钩子过程
static LRESULT CALLBACK KeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
{
	//首先判断魔兽是否处于激活状态,不处于激活状态则不进行改建
	HWND ahwnd = GetForegroundWindow(); //当前激活的窗口
	if(ahwnd && ahwnd!=g_hwnd)
		return CallNextHookEx(NULL,nCode,wParam,lParam);

	if(nCode<0)
		CallNextHookEx(NULL,nCode,wParam,lParam);
	if(nCode==HC_ACTION)
	{
		//检查是否处于聊天状态
		bool isChat=false;
		bool bSuc = ReadChatFlag(isChat);
		if(bSuc && isChat)  //聊天,不进行改建
			return CallNextHookEx(NULL,nCode,wParam,lParam);

		KBDLLHOOKSTRUCT* kb = (KBDLLHOOKSTRUCT*)lParam;
		
		//按下空格则开图
		if( kb && kb->vkCode==VK_SPACE )
		{
			OpenMap();
			return 1;
		}

		//------ 英雄快捷键 --------------
		for(int i=0;i<KEY_COUNT;i++)
		{
			DWORD key = (DWORD)(g_keyInfo.NewKey[i]);
			if(key>='a' && key<='z') //小写转换成大写
				key -= 32;
			if( kb && kb->vkCode==key )
			{	
				BYTE bVk = (BYTE)(g_keyInfo.OldKey[i]);
				if(bVk>='a' && key<='z') //小写转换成大写
					bVk -= 32;
				if(wParam==WM_KEYDOWN)
					keybd_event( bVk ,0,0,0);
				if(wParam==WM_KEYUP)
					keybd_event(bVk,0,0x2,0);
				return 1;
			}
		}

		//物品栏
		for(int i=0;i<KEY_COUNT;i++)
		{
			DWORD key = (DWORD)(g_keyInfo.Num[i]);
			if(key>='a' && key<='z') //小写转换成大写
				key -= 32;
			if( kb && kb->vkCode==key )
			{	
				switch(i)
				{
				case 0:		//小键盘7
					if(wParam==WM_KEYDOWN)
						keybd_event(VK_NUM7,0,0,0);
					if(wParam==WM_KEYUP)
						keybd_event(VK_NUM7,0,0x2,0);
					return 1;
				case 1:		//小键盘4
					if(wParam==WM_KEYDOWN)
						keybd_event(VK_NUM4,0,0,0);
					if(wParam==WM_KEYUP)
						keybd_event(VK_NUM4,0,0x2,0);
					return 1;
					
				case 2:		//小键盘1
					if(wParam==WM_KEYDOWN)
						keybd_event(VK_NUM1,0,0,0);
					if(wParam==WM_KEYUP)
						keybd_event(VK_NUM1,0,0x2,0);
					return 1;
				case 3:		//小键盘8
					if(wParam==WM_KEYDOWN)
						keybd_event(VK_NUM8,0,0,0);
					if(wParam==WM_KEYUP)
						keybd_event(VK_NUM8,0,0x2,0);
					return 1;
				case 4:		//小键盘5
					if(wParam==WM_KEYDOWN)
						keybd_event(VK_NUM5,0,0,0);
					if(wParam==WM_KEYUP)
						keybd_event(VK_NUM5,0,0x2,0);
					return 1;
				case 5:		//小键盘2
					if(wParam==WM_KEYDOWN)
						keybd_event(VK_NUM2,0,0,0);
					if(wParam==WM_KEYUP)
						keybd_event(VK_NUM2,0,0x2,0);
					return 1;
				}
				
			}
		}	
	}

	return CallNextHookEx(NULL,nCode,wParam,lParam);
}