Commit e5779772 authored by fallenstardust's avatar fallenstardust Committed by GitHub

Merge pull request #15 from mercury233/patch-settings-scroll

add settings scrollbar
parents 800cace2 d6fff911
...@@ -1880,6 +1880,18 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) { ...@@ -1880,6 +1880,18 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
return true; return true;
break; break;
} }
case SCROLL_TAB_HELPER: {
rect<s32> pos = mainGame->tabHelper->getRelativePosition();
mainGame->tabHelper->setRelativePosition(recti(0, mainGame->scrTabHelper->getPos() * -1, pos.LowerRightCorner.X, pos.LowerRightCorner.Y));
return true;
break;
}
case SCROLL_TAB_SYSTEM: {
rect<s32> pos = mainGame->tabSystem->getRelativePosition();
mainGame->tabSystem->setRelativePosition(recti(0, mainGame->scrTabSystem->getPos() * -1, pos.LowerRightCorner.X, pos.LowerRightCorner.Y));
return true;
break;
}
} }
break; break;
} }
......
...@@ -433,9 +433,19 @@ bool Game::Initialize() { ...@@ -433,9 +433,19 @@ bool Game::Initialize() {
lstLog->setItemHeight(22 * yScale); lstLog->setItemHeight(22 * yScale);
btnClearLog = env->addButton(rect<s32>(160 * xScale, 300 * yScale, 260 * xScale, 325 * yScale), tabLog, BUTTON_CLEAR_LOG, dataManager.GetSysString(1272)); btnClearLog = env->addButton(rect<s32>(160 * xScale, 300 * yScale, 260 * xScale, 325 * yScale), tabLog, BUTTON_CLEAR_LOG, dataManager.GetSysString(1272));
//helper //helper
irr::gui::IGUITab* tabHelper = wInfos->addTab(dataManager.GetSysString(1298)); irr::gui::IGUITab* _tabHelper = wInfos->addTab(dataManager.GetSysString(1298));
int posX = 20 * xScale; _tabHelper->setRelativePosition(recti(16 * xScale, 49 * yScale, 299 * xScale, 362 * yScale));
int posY = 20 * yScale; tabHelper = env->addWindow(recti(0, 0, 250 * xScale, 300 * yScale), false, L"", _tabHelper);
tabHelper->setDrawTitlebar(false);
tabHelper->getCloseButton()->setVisible(false);
tabHelper->setDrawBackground(false);
tabHelper->setDraggable(false);
scrTabHelper = env->addScrollBar(false, rect<s32>(242 * xScale, 0 * yScale, 272 * xScale, 300 * yScale), _tabHelper, SCROLL_TAB_HELPER);
scrTabHelper->setLargeStep(1);
scrTabHelper->setSmallStep(1);
scrTabHelper->setVisible(false);
int posX = 0;
int posY = 0;
chkMAutoPos = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260 * xScale, posY + 30 * yScale), tabHelper, -1, dataManager.GetSysString(1274)); chkMAutoPos = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260 * xScale, posY + 30 * yScale), tabHelper, -1, dataManager.GetSysString(1274));
chkMAutoPos->setChecked(gameConf.chkMAutoPos != 0); chkMAutoPos->setChecked(gameConf.chkMAutoPos != 0);
posY += 60; posY += 60;
...@@ -450,10 +460,30 @@ bool Game::Initialize() { ...@@ -450,10 +460,30 @@ bool Game::Initialize() {
posY += 60; posY += 60;
chkWaitChain = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260 * xScale, posY + 30 * yScale), tabHelper, -1, dataManager.GetSysString(1277)); chkWaitChain = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260 * xScale, posY + 30 * yScale), tabHelper, -1, dataManager.GetSysString(1277));
chkWaitChain->setChecked(gameConf.chkWaitChain != 0); chkWaitChain->setChecked(gameConf.chkWaitChain != 0);
elmTabHelperLast = chkWaitChain;
//show scroll
s32 tabHelperLastY = elmTabHelperLast->getRelativePosition().LowerRightCorner.Y;
s32 tabHelperHeight = 300 * yScale;
if(tabHelperLastY > tabHelperHeight) {
scrTabHelper->setMax(tabHelperLastY - tabHelperHeight + 5);
scrTabHelper->setPos(0);
scrTabHelper->setVisible(true);
}
else
scrTabHelper->setVisible(false);
//system //system
irr::gui::IGUITab* tabSystem = wInfos->addTab(dataManager.GetSysString(1273)); irr::gui::IGUITab* _tabSystem = wInfos->addTab(dataManager.GetSysString(1273));
posY = 20 * xScale; _tabSystem->setRelativePosition(recti(16 * xScale, 49 * yScale, 299 * xScale, 362 * yScale));
tabSystem = env->addWindow(recti(0, 0, 250 * xScale, 300 * yScale), false, L"", _tabSystem);
tabSystem->setDrawTitlebar(false);
tabSystem->getCloseButton()->setVisible(false);
tabSystem->setDrawBackground(false);
tabSystem->setDraggable(false);
scrTabSystem = env->addScrollBar(false, rect<s32>(242 * xScale, 0, 272 * xScale, 300 * yScale), _tabSystem, SCROLL_TAB_SYSTEM);
scrTabSystem->setLargeStep(1);
scrTabSystem->setSmallStep(1);
scrTabSystem->setVisible(false);
posY = 0;
chkIgnore1 = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 30 * yScale), tabSystem, CHECKBOX_DISABLE_CHAT, dataManager.GetSysString(1290)); chkIgnore1 = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 30 * yScale), tabSystem, CHECKBOX_DISABLE_CHAT, dataManager.GetSysString(1290));
chkIgnore1->setChecked(gameConf.chkIgnore1 != 0); chkIgnore1->setChecked(gameConf.chkIgnore1 != 0);
posY += 60; posY += 60;
...@@ -474,6 +504,16 @@ bool Game::Initialize() { ...@@ -474,6 +504,16 @@ bool Game::Initialize() {
posY += 60; posY += 60;
chkPreferExpansionScript = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260 * xScale, posY + 30 * yScale), tabSystem, CHECKBOX_PREFER_EXPANSION, dataManager.GetSysString(1379)); chkPreferExpansionScript = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260 * xScale, posY + 30 * yScale), tabSystem, CHECKBOX_PREFER_EXPANSION, dataManager.GetSysString(1379));
chkPreferExpansionScript->setChecked(gameConf.prefer_expansion_script != 0); chkPreferExpansionScript->setChecked(gameConf.prefer_expansion_script != 0);
elmTabSystemLast = chkPreferExpansionScript;
//show scroll
s32 tabSystemLastY = elmTabSystemLast->getRelativePosition().LowerRightCorner.Y;
s32 tabSystemHeight = 300 * yScale;
if(tabSystemLastY > tabSystemHeight) {
scrTabSystem->setMax(tabSystemLastY - tabSystemHeight + 5);
scrTabSystem->setPos(0);
scrTabSystem->setVisible(true);
} else
scrTabSystem->setVisible(false);
// //
wHand = env->addWindow(rect<s32>(500 * xScale, 450 * yScale, 825 * xScale, 605 * yScale), false, L""); wHand = env->addWindow(rect<s32>(500 * xScale, 450 * yScale, 825 * xScale, 605 * yScale), false, L"");
wHand->getCloseButton()->setVisible(false); wHand->getCloseButton()->setVisible(false);
......
...@@ -240,11 +240,17 @@ public: ...@@ -240,11 +240,17 @@ public:
irr::gui::IGUIListBox* lstLog; irr::gui::IGUIListBox* lstLog;
irr::gui::IGUIButton* btnClearLog; irr::gui::IGUIButton* btnClearLog;
irr::gui::IGUIButton* btnSaveLog; irr::gui::IGUIButton* btnSaveLog;
irr::gui::IGUIWindow* tabHelper;
irr::gui::IGUIElement* elmTabHelperLast;
irr::gui::IGUIScrollBar* scrTabHelper;
irr::gui::IGUICheckBox* chkMAutoPos; irr::gui::IGUICheckBox* chkMAutoPos;
irr::gui::IGUICheckBox* chkSTAutoPos; irr::gui::IGUICheckBox* chkSTAutoPos;
irr::gui::IGUICheckBox* chkRandomPos; irr::gui::IGUICheckBox* chkRandomPos;
irr::gui::IGUICheckBox* chkAutoChain; irr::gui::IGUICheckBox* chkAutoChain;
irr::gui::IGUICheckBox* chkWaitChain; irr::gui::IGUICheckBox* chkWaitChain;
irr::gui::IGUIWindow* tabSystem;
irr::gui::IGUIElement* elmTabSystemLast;
irr::gui::IGUIScrollBar* scrTabSystem;
irr::gui::IGUICheckBox* chkDrawFieldSpell; irr::gui::IGUICheckBox* chkDrawFieldSpell;
irr::gui::IGUICheckBox* chkQuickAnimation; irr::gui::IGUICheckBox* chkQuickAnimation;
irr::gui::IGUICheckBox* chkAutoSaveReplay; irr::gui::IGUICheckBox* chkAutoSaveReplay;
...@@ -642,9 +648,11 @@ extern Game* mainGame; ...@@ -642,9 +648,11 @@ extern Game* mainGame;
#define BUTTON_BOT_START 340 #define BUTTON_BOT_START 340
#define LISTBOX_BOT_LIST 341 #define LISTBOX_BOT_LIST 341
#define CHECKBOX_BOT_OLD_RULE 342 #define CHECKBOX_BOT_OLD_RULE 342
#define LISTBOX_SINGLEPLAY_LIST 350 #define LISTBOX_SINGLEPLAY_LIST 343
#define BUTTON_LOAD_SINGLEPLAY 351 #define BUTTON_LOAD_SINGLEPLAY 344
#define BUTTON_CANCEL_SINGLEPLAY 352 #define BUTTON_CANCEL_SINGLEPLAY 345
#define SCROLL_TAB_HELPER 350
#define SCROLL_TAB_SYSTEM 351
#define CHECKBOX_AUTO_SEARCH 360 #define CHECKBOX_AUTO_SEARCH 360
#define CHECKBOX_MULTI_KEYWORDS 372 #define CHECKBOX_MULTI_KEYWORDS 372
#define CHECKBOX_PREFER_EXPANSION 373 #define CHECKBOX_PREFER_EXPANSION 373
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment