Skip to content

Commit

Permalink
Merge pull request OpenMW#1403 from akortunov/guifixes
Browse files Browse the repository at this point in the history
Get only text from input fields (alternative implementation)
  • Loading branch information
scrawl authored Aug 19, 2017
2 parents dc8b35a + 65d05ee commit d200287
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 18 deletions.
2 changes: 1 addition & 1 deletion apps/openmw/mwgui/alchemywindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ namespace MWGui

void AlchemyWindow::onCreateButtonClicked(MyGUI::Widget* _sender)
{
MWMechanics::Alchemy::Result result = mAlchemy->create (mNameEdit->getOnlyText());
MWMechanics::Alchemy::Result result = mAlchemy->create (mNameEdit->getCaption ());
MWBase::WindowManager *winMgr = MWBase::Environment::get().getWindowManager();

switch (result)
Expand Down
2 changes: 1 addition & 1 deletion apps/openmw/mwgui/class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ namespace MWGui

std::string CreateClassDialog::getName() const
{
return mEditName->getOnlyText();
return mEditName->getCaption();
}

std::string CreateClassDialog::getDescription() const
Expand Down
5 changes: 2 additions & 3 deletions apps/openmw/mwgui/enchantingdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <iomanip>

#include <MyGUI_Button.h>
#include <MyGUI_EditBox.h>
#include <MyGUI_ScrollView.h>

#include <components/widgets/list.hpp>
Expand Down Expand Up @@ -313,7 +312,7 @@ namespace MWGui
return;
}

if (mName->getOnlyText().empty())
if (mName->getCaption ().empty())
{
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage10}");
return;
Expand All @@ -337,7 +336,7 @@ namespace MWGui
return;
}

mEnchanting.setNewItemName(mName->getOnlyText());
mEnchanting.setNewItemName(mName->getCaption());
mEnchanting.setEffect(mEffectList);

MWWorld::Ptr player = MWMechanics::getPlayer();
Expand Down
2 changes: 1 addition & 1 deletion apps/openmw/mwgui/enchantingdialog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace MWGui
MyGUI::Button* mTypeButton;
MyGUI::Button* mBuyButton;

MyGUI::EditBox* mName;
MyGUI::TextBox* mName;
MyGUI::TextBox* mEnchantmentPoints;
MyGUI::TextBox* mCastCost;
MyGUI::TextBox* mCharge;
Expand Down
4 changes: 2 additions & 2 deletions apps/openmw/mwgui/savegamedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ namespace MWGui
dialog->eventCancelClicked.clear();
return;
}
if (mSaveNameEdit->getOnlyText().empty())
if (mSaveNameEdit->getCaption().empty())
{
MWBase::Environment::get().getWindowManager()->messageBox("#{sNotifyMessage65}");
return;
Expand All @@ -275,7 +275,7 @@ namespace MWGui

if (mSaving)
{
MWBase::Environment::get().getStateManager()->saveGame (mSaveNameEdit->getOnlyText(), mCurrentSlot);
MWBase::Environment::get().getStateManager()->saveGame (mSaveNameEdit->getCaption(), mCurrentSlot);
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions apps/openmw/mwgui/spellcreationdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ namespace MWGui
return;
}

if (mNameEdit->getOnlyText() == "")
if (mNameEdit->getCaption () == "")
{
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage10}");
return;
Expand All @@ -394,7 +394,7 @@ namespace MWGui
return;
}

mSpell.mName = mNameEdit->getOnlyText();
mSpell.mName = mNameEdit->getCaption();

int price = MyGUI::utility::parseInt(mPriceLabel->getCaption());

Expand Down
4 changes: 2 additions & 2 deletions apps/openmw/mwgui/textinput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace MWGui

void TextInputDialog::onOkClicked(MyGUI::Widget* _sender)
{
if (mTextEdit->getOnlyText() == "")
if (mTextEdit->getCaption() == "")
{
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage37}");
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget (mTextEdit);
Expand All @@ -69,7 +69,7 @@ namespace MWGui

std::string TextInputDialog::getTextInput() const
{
return mTextEdit->getOnlyText();
return mTextEdit->getCaption();
}

void TextInputDialog::setTextInput(const std::string &text)
Expand Down
8 changes: 2 additions & 6 deletions apps/openmw/mwgui/windowmanagerimp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1983,12 +1983,8 @@ namespace MWGui
char* text=0;
text = SDL_GetClipboardText();
if (text)
{
// MyGUI's clipboard might still have color information, to retain that information, only set the new text
// if it actually changed (clipboard inserted by an external application)
if (MyGUI::TextIterator::getOnlyText(_data) != text)
_data = text;
}
_data = MyGUI::TextIterator::toTagsString(text);

SDL_free(text);
}

Expand Down

0 comments on commit d200287

Please sign in to comment.