fix screenshot function

actorid
scrawl 13 years ago
parent 5ebcaeb098
commit c5e55d3cac

@ -171,6 +171,8 @@ namespace MWBase
virtual void setWeaponVisibility(bool visible) = 0;
virtual void setSpellVisibility(bool visible) = 0;
virtual void activateQuickKey (int index) = 0;
virtual void setSelectedSpell(const std::string& spellId, int successChancePercent) = 0;
virtual void setSelectedEnchantItem(const MWWorld::Ptr& item, int chargePercent) = 0;
virtual void setSelectedWeapon(const MWWorld::Ptr& item, int durabilityPercent) = 0;

@ -82,6 +82,8 @@ namespace MWGui
while (key->getChildCount ())
MyGUI::Gui::getInstance ().destroyWidget (key->getChildAt(0));
key->setUserData(Type_Unassigned);
MyGUI::TextBox* textBox = key->createWidgetReal<MyGUI::TextBox>("SandText", MyGUI::FloatCoord(0,0,1,1), MyGUI::Align::Default);
textBox->setTextAlign (MyGUI::Align::Center);
textBox->setCaption (boost::lexical_cast<std::string>(index+1));
@ -159,16 +161,25 @@ namespace MWGui
while (button->getChildCount ())
MyGUI::Gui::getInstance ().destroyWidget (button->getChildAt(0));
MyGUI::ImageBox* image = button->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(9, 8, 42, 42), MyGUI::Align::Default);
image->setUserString ("ToolTipType", "ItemPtr");
image->setUserData(item);
button->setUserData(Type_Item);
MyGUI::ImageBox* frame = button->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(9, 8, 42, 42), MyGUI::Align::Default);
std::string backgroundTex = "textures\\menu_icon_barter.dds";
frame->setImageTexture (backgroundTex);
frame->setImageCoord (MyGUI::IntCoord(4, 4, 40, 40));
frame->setUserString ("ToolTipType", "ItemPtr");
frame->setUserData(item);
frame->eventMouseButtonClick += MyGUI::newDelegate(this, &QuickKeysMenu::onQuickKeyButtonClicked);
MyGUI::ImageBox* image = frame->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(5, 5, 32, 32), MyGUI::Align::Default);
std::string path = std::string("icons\\");
path += MWWorld::Class::get(item).getInventoryIcon(item);
int pos = path.rfind(".");
path.erase(pos);
path.append(".dds");
image->setImageTexture (path);
image->eventMouseButtonClick += MyGUI::newDelegate(this, &QuickKeysMenu::onQuickKeyButtonClicked);
image->setNeedMouseFocus (false);
mItemSelectionDialog->setVisible(false);
}
@ -180,7 +191,29 @@ namespace MWGui
void QuickKeysMenu::onAssignMagicItem (MWWorld::Ptr item)
{
onAssignItem(item);
MyGUI::Button* button = mQuickKeyButtons[mSelectedIndex];
while (button->getChildCount ())
MyGUI::Gui::getInstance ().destroyWidget (button->getChildAt(0));
button->setUserData(Type_MagicItem);
MyGUI::ImageBox* frame = button->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(9, 8, 42, 42), MyGUI::Align::Default);
std::string backgroundTex = "textures\\menu_icon_select_magic_magic.dds";
frame->setImageTexture (backgroundTex);
frame->setImageCoord (MyGUI::IntCoord(2, 2, 40, 40));
frame->setUserString ("ToolTipType", "ItemPtr");
frame->setUserData(item);
frame->eventMouseButtonClick += MyGUI::newDelegate(this, &QuickKeysMenu::onQuickKeyButtonClicked);
MyGUI::ImageBox* image = frame->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(5, 5, 32, 32), MyGUI::Align::Default);
std::string path = std::string("icons\\");
path += MWWorld::Class::get(item).getInventoryIcon(item);
int pos = path.rfind(".");
path.erase(pos);
path.append(".dds");
image->setImageTexture (path);
image->setNeedMouseFocus (false);
mMagicSelectionDialog->setVisible(false);
}
@ -190,9 +223,17 @@ namespace MWGui
while (button->getChildCount ())
MyGUI::Gui::getInstance ().destroyWidget (button->getChildAt(0));
MyGUI::ImageBox* image = button->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(9, 8, 42, 42), MyGUI::Align::Default);
image->setUserString ("ToolTipType", "Spell");
image->setUserString ("Spell", spellId);
button->setUserData(Type_Magic);
MyGUI::ImageBox* frame = button->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(9, 8, 42, 42), MyGUI::Align::Default);
std::string backgroundTex = "textures\\menu_icon_select_magic.dds";
frame->setImageTexture (backgroundTex);
frame->setImageCoord (MyGUI::IntCoord(2, 2, 40, 40));
frame->setUserString ("ToolTipType", "Spell");
frame->setUserString ("Spell", spellId);
frame->eventMouseButtonClick += MyGUI::newDelegate(this, &QuickKeysMenu::onQuickKeyButtonClicked);
MyGUI::ImageBox* image = frame->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(5, 5, 32, 32), MyGUI::Align::Default);
// use the icon of the first effect
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(spellId);
@ -206,7 +247,7 @@ namespace MWGui
path.append(".dds");
image->setImageTexture (path);
image->eventMouseButtonClick += MyGUI::newDelegate(this, &QuickKeysMenu::onQuickKeyButtonClicked);
image->setNeedMouseFocus (false);
mMagicSelectionDialog->setVisible(false);
}
@ -216,6 +257,29 @@ namespace MWGui
mMagicSelectionDialog->setVisible(false);
}
void QuickKeysMenu::activateQuickKey(int index)
{
MyGUI::Button* button = mQuickKeyButtons[index-1];
QuickKeyType type = *button->getUserData<QuickKeyType>();
if (type == Type_Magic)
{
std::string spellId = button->getChildAt(0)->getUserString("Spell");
MWBase::Environment::get().getWindowManager ()->setSelectedSpell (spellId, 100);
}
else if (type == Type_Item)
{
MWWorld::Ptr item = *button->getChildAt (0)->getUserData<MWWorld::Ptr>();
MWBase::Environment::get().getWindowManager ()->setSelectedWeapon(item, 100);
}
else if (type == Type_MagicItem)
{
MWWorld::Ptr item = *button->getChildAt (0)->getUserData<MWWorld::Ptr>();
MWBase::Environment::get().getWindowManager ()->setSelectedEnchantItem (item, 100);
}
}
// ---------------------------------------------------------------------------------------------------------
QuickKeysMenuAssign::QuickKeysMenuAssign (MWBase::WindowManager &parWindowManager, QuickKeysMenu* parent)

@ -31,6 +31,16 @@ namespace MWGui
void onAssignMagic (const std::string& spellId);
void onAssignMagicCancel ();
void activateQuickKey(int index);
enum QuickKeyType
{
Type_Item,
Type_Magic,
Type_MagicItem,
Type_Unassigned
};
private:
MyGUI::EditBox* mInstructionLabel;

@ -854,3 +854,8 @@ void WindowManager::notifyInputActionBound ()
mSettingsWindow->updateControlsBox ();
allowMouse();
}
void WindowManager::activateQuickKey (int index)
{
mQuickKeysMenu->activateQuickKey(index);
}

@ -152,6 +152,8 @@ namespace MWGui
virtual void setWeaponVisibility(bool visible);
virtual void setSpellVisibility(bool visible);
virtual void activateQuickKey (int index);
virtual void setSelectedSpell(const std::string& spellId, int successChancePercent);
virtual void setSelectedEnchantItem(const MWWorld::Ptr& item, int chargePercent);
virtual void setSelectedWeapon(const MWWorld::Ptr& item, int durabilityPercent);

@ -599,7 +599,7 @@ namespace MWInput
void InputManager::quickKey (int index)
{
std::cout << "quick key " << index << std::endl;
mWindows.activateQuickKey (index);
}
void InputManager::showQuickKeysMenu()
@ -669,6 +669,7 @@ namespace MWInput
defaultKeyBindings[A_QuickKey8] = OIS::KC_8;
defaultKeyBindings[A_QuickKey9] = OIS::KC_9;
defaultKeyBindings[A_QuickKey10] = OIS::KC_0;
defaultKeyBindings[A_Screenshot] = OIS::KC_SYSRQ;
std::map<int, int> defaultMouseButtonBindings;
defaultMouseButtonBindings[A_Inventory] = OIS::MB_Right;
@ -689,7 +690,10 @@ namespace MWInput
control = mInputCtrl->getChannel(i)->getAttachedControls ().front().control;
}
if (!controlExists || force)
if (!controlExists || force ||
( mInputCtrl->getKeyBinding (control, ICS::Control::INCREASE) == OIS::KC_UNASSIGNED
&& mInputCtrl->getMouseButtonBinding (control, ICS::Control::INCREASE) == ICS_MAX_DEVICE_BUTTONS
))
{
clearAllBindings (control);

@ -4,14 +4,14 @@
<Widget type="TextBox" skin="SandText" position="8 8 300 18" name="Label"/>
<Widget type="Widget" skin="MW_Box" position="8 34 340 70" name="box" align="Left Top Stretch">
<Widget type="ScrollView" skin="MW_ScrollViewH" position="4 4 332 62" name="ItemView" align="Left Top Stretch">
<Widget type="Widget" skin="MW_Box" position="8 34 355 70" name="box" align="Left Top Stretch">
<Widget type="ScrollView" skin="MW_ScrollViewH" position="4 4 347 62" name="ItemView" align="Left Top Stretch">
<Property key="CanvasAlign" value="Left Top"/>
<Widget type="Button" skin="" name="Items" position="0 0 332 62" name="Items" align="Left Top Stretch"/>
<Widget type="Button" skin="" name="Items" position="0 0 347 62" name="Items" align="Left Top Stretch"/>
</Widget>
</Widget>
<Widget type="Button" skin="MW_Button" position="350 110 24 24" name="CancelButton">
<Widget type="Button" skin="MW_Button" position="340 110 24 24" name="CancelButton">
<Property key="Caption" value="#{sCancel}"/>
</Widget>

Loading…
Cancel
Save