summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-02-10 17:24:57 -0700
committerIra Rice <irarice@gmail.com>2009-02-10 17:24:57 -0700
commitd067d7da8e6ee333a4941d4fe6ee9eb926d37f00 (patch)
tree03374aa436a0f2e1f3ba7cca250f260a5b4d60d3 /src/gui
parent00d8f57800042a324795b30dd35b21d67d47a2aa (diff)
downloadmana-d067d7da8e6ee333a4941d4fe6ee9eb926d37f00.tar.gz
mana-d067d7da8e6ee333a4941d4fe6ee9eb926d37f00.tar.bz2
mana-d067d7da8e6ee333a4941d4fe6ee9eb926d37f00.tar.xz
mana-d067d7da8e6ee333a4941d4fe6ee9eb926d37f00.zip
Added two more options for displaying speech overhead (don't show it at
all and show speech bubbles without names). Since a checkbox won't work any more for all of these modes, it's now a slider. Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/setup.cpp4
-rw-r--r--src/gui/setup_audio.cpp2
-rw-r--r--src/gui/setup_colours.cpp2
-rw-r--r--src/gui/setup_joystick.cpp2
-rw-r--r--src/gui/setup_keyboard.cpp2
-rw-r--r--src/gui/setup_players.cpp2
-rw-r--r--src/gui/setup_video.cpp89
-rw-r--r--src/gui/setup_video.h5
-rw-r--r--src/gui/speechbubble.cpp20
-rw-r--r--src/gui/speechbubble.h2
10 files changed, 88 insertions, 42 deletions
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index 19575cfb..e165ba57 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -49,8 +49,8 @@ Setup::Setup():
Window(_("Setup"))
{
setCloseButton(true);
- int width = 310;
- int height = 310;
+ int width = 340;
+ int height = 340;
setContentSize(width, height);
static const char *buttonNames[] = {
diff --git a/src/gui/setup_audio.cpp b/src/gui/setup_audio.cpp
index 5c189882..a4bc05ae 100644
--- a/src/gui/setup_audio.cpp
+++ b/src/gui/setup_audio.cpp
@@ -71,7 +71,7 @@ Setup_Audio::Setup_Audio():
place(0, 2, mMusicSlider);
place(1, 2, musicLabel);
- setDimension(gcn::Rectangle(0, 0, 290, 250));
+ setDimension(gcn::Rectangle(0, 0, 325, 280));
}
void Setup_Audio::apply()
diff --git a/src/gui/setup_colours.cpp b/src/gui/setup_colours.cpp
index f986fded..ee2d2f5e 100644
--- a/src/gui/setup_colours.cpp
+++ b/src/gui/setup_colours.cpp
@@ -126,7 +126,7 @@ Setup_Colours::Setup_Colours() :
place(2, 10, mBlueSlider);
place(3, 10, mBlueText).setPadding(1);
- setDimension(gcn::Rectangle(0, 0, 290, 250));
+ setDimension(gcn::Rectangle(0, 0, 325, 280));
}
Setup_Colours::~Setup_Colours()
diff --git a/src/gui/setup_joystick.cpp b/src/gui/setup_joystick.cpp
index 2ebcdbde..c0c04949 100644
--- a/src/gui/setup_joystick.cpp
+++ b/src/gui/setup_joystick.cpp
@@ -56,7 +56,7 @@ Setup_Joystick::Setup_Joystick():
place = h.getPlacer(0, 1);
place(0, 0, mCalibrateButton);
- setDimension(gcn::Rectangle(0, 0, 290, 75));
+ setDimension(gcn::Rectangle(0, 0, 325, 75));
}
void Setup_Joystick::action(const gcn::ActionEvent &event)
diff --git a/src/gui/setup_keyboard.cpp b/src/gui/setup_keyboard.cpp
index 06a5a520..8638b277 100644
--- a/src/gui/setup_keyboard.cpp
+++ b/src/gui/setup_keyboard.cpp
@@ -97,7 +97,7 @@ Setup_Keyboard::Setup_Keyboard():
place(0, 6, mMakeDefaultButton);
place(3, 6, mAssignKeyButton);
- setDimension(gcn::Rectangle(0, 0, 295, 250));
+ setDimension(gcn::Rectangle(0, 0, 325, 280));
}
Setup_Keyboard::~Setup_Keyboard()
diff --git a/src/gui/setup_players.cpp b/src/gui/setup_players.cpp
index 7e76055a..8601d289 100644
--- a/src/gui/setup_players.cpp
+++ b/src/gui/setup_players.cpp
@@ -289,7 +289,7 @@ Setup_Players::Setup_Players():
player_relations.addListener(this);
- setDimension(gcn::Rectangle(0, 0, 290, 250));
+ setDimension(gcn::Rectangle(0, 0, 325, 280));
}
Setup_Players::~Setup_Players(void)
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp
index 1775665f..855a13fd 100644
--- a/src/gui/setup_video.cpp
+++ b/src/gui/setup_video.cpp
@@ -108,18 +108,19 @@ Setup_Video::Setup_Video():
mOpenGLEnabled(config.getValue("opengl", false)),
mCustomCursorEnabled(config.getValue("customcursor", true)),
mParticleEffectsEnabled(config.getValue("particleeffects", true)),
- mSpeechBubbleEnabled(config.getValue("speechbubble", true)),
mNameEnabled(config.getValue("showownname", false)),
mOpacity(config.getValue("guialpha", 0.8)),
mFps((int) config.getValue("fpslimit", 0)),
+ mSpeechMode(config.getValue("speech", 3)),
mModeListModel(new ModeListModel),
mModeList(new ListBox(mModeListModel)),
mFsCheckBox(new CheckBox(_("Full screen"), mFullScreenEnabled)),
mOpenGLCheckBox(new CheckBox(_("OpenGL"), mOpenGLEnabled)),
mCustomCursorCheckBox(new CheckBox(_("Custom cursor"), mCustomCursorEnabled)),
mParticleEffectsCheckBox(new CheckBox(_("Particle effects"), mParticleEffectsEnabled)),
- mSpeechBubbleCheckBox(new CheckBox(_("Speech bubbles"), mSpeechBubbleEnabled)),
mNameCheckBox(new CheckBox(_("Show name"), mNameEnabled)),
+ mSpeechSlider(new Slider(0, 3)),
+ mSpeechLabel(new gcn::Label("")),
mAlphaSlider(new Slider(0.2, 1.0)),
mFpsCheckBox(new CheckBox(_("FPS Limit:"))),
mFpsSlider(new Slider(10, 200)),
@@ -142,6 +143,7 @@ Setup_Video::Setup_Video():
ScrollArea *scrollArea = new ScrollArea(mModeList);
scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
+ gcn::Label *speechLabel = new gcn::Label(_("Overhead text"));
gcn::Label *alphaLabel = new gcn::Label(_("Gui opacity"));
gcn::Label *scrollRadiusLabel = new gcn::Label(_("Scroll radius"));
gcn::Label *scrollLazinessLabel = new gcn::Label(_("Scroll laziness"));
@@ -167,10 +169,10 @@ Setup_Video::Setup_Video():
mModeList->setActionEventId("videomode");
mCustomCursorCheckBox->setActionEventId("customcursor");
mParticleEffectsCheckBox->setActionEventId("particleeffects");
- mSpeechBubbleCheckBox->setActionEventId("speechbubble");
mNameCheckBox->setActionEventId("showownname");
mAlphaSlider->setActionEventId("guialpha");
mFpsCheckBox->setActionEventId("fpslimitcheckbox");
+ mSpeechSlider->setActionEventId("speech");
mFpsSlider->setActionEventId("fpslimitslider");
mScrollRadiusSlider->setActionEventId("scrollradiusslider");
mScrollRadiusField->setActionEventId("scrollradiusfield");
@@ -184,10 +186,10 @@ Setup_Video::Setup_Video():
mModeList->addActionListener(this);
mCustomCursorCheckBox->addActionListener(this);
mParticleEffectsCheckBox->addActionListener(this);
- mSpeechBubbleCheckBox->addActionListener(this);
mNameCheckBox->addActionListener(this);
mAlphaSlider->addActionListener(this);
mFpsCheckBox->addActionListener(this);
+ mSpeechSlider->addActionListener(this);
mFpsSlider->addActionListener(this);
mFpsField->addKeyListener(this);
mScrollRadiusSlider->addActionListener(this);
@@ -205,6 +207,23 @@ Setup_Video::Setup_Video():
mScrollLazinessField->setText(toString(mOriginalScrollLaziness));
mScrollLazinessSlider->setValue(mOriginalScrollLaziness);
+ switch (mSpeechMode)
+ {
+ case 0:
+ mSpeechLabel->setCaption(_("No text"));
+ break;
+ case 1:
+ mSpeechLabel->setCaption(_("Text"));
+ break;
+ case 2:
+ mSpeechLabel->setCaption(_("Bubbles, no names"));
+ break;
+ case 3:
+ mSpeechLabel->setCaption(_("Bubbles with names"));
+ break;
+ }
+ mSpeechSlider->setValue(mSpeechMode);
+
switch (mOverlayDetail)
{
case 0:
@@ -244,31 +263,33 @@ Setup_Video::Setup_Video():
place(1, 0, mFsCheckBox, 3);
place(1, 1, mOpenGLCheckBox, 3);
place(1, 2, mCustomCursorCheckBox, 3);
- place(1, 3, mSpeechBubbleCheckBox, 3);
- place(1, 4, mNameCheckBox, 3);
- place(1, 5, mParticleEffectsCheckBox, 3);
-
- place(0, 7, mAlphaSlider);
- place(0, 8, mFpsSlider);
- place(0, 9, mScrollRadiusSlider);
- place(0, 10, mScrollLazinessSlider);
+ place(1, 3, mNameCheckBox, 3);
+ place(1, 4, mParticleEffectsCheckBox, 3);
+
+ place(0, 6, mAlphaSlider);
+ place(0, 7, mFpsSlider);
+ place(0, 8, mScrollRadiusSlider);
+ place(0, 9, mScrollLazinessSlider);
+ place(0, 10, mSpeechSlider);
place(0, 11, mOverlayDetailSlider);
place(0, 12, mParticleDetailSlider);
- place(1, 7, alphaLabel, 2);
- place(1, 8, mFpsCheckBox).setPadding(3);
- place(1, 9, scrollRadiusLabel);
- place(1, 10, scrollLazinessLabel);
+ place(1, 6, alphaLabel, 2);
+ place(1, 7, mFpsCheckBox).setPadding(3);
+ place(1, 8, scrollRadiusLabel);
+ place(1, 9, scrollLazinessLabel);
+ place(1, 10, speechLabel);
place(1, 11, overlayDetailLabel);
place(1, 12, particleDetailLabel);
- place(2, 8, mFpsField).setPadding(1);
- place(2, 9, mScrollRadiusField).setPadding(1);
- place(2, 10, mScrollLazinessField).setPadding(1);
+ place(2, 7, mFpsField).setPadding(1);
+ place(2, 8, mScrollRadiusField).setPadding(1);
+ place(2, 9, mScrollLazinessField).setPadding(1);
+ place(2, 10, mSpeechLabel, 2).setPadding(2);
place(2, 11, mOverlayDetailField, 2).setPadding(2);
place(2, 12, mParticleDetailField, 2).setPadding(2);
- setDimension(gcn::Rectangle(0, 0, 295, 250));
+ setDimension(gcn::Rectangle(0, 0, 325, 280));
}
Setup_Video::~Setup_Video()
@@ -333,8 +354,8 @@ void Setup_Video::apply()
mFullScreenEnabled = config.getValue("screen", false);
mCustomCursorEnabled = config.getValue("customcursor", true);
mParticleEffectsEnabled = config.getValue("particleeffects", true);
- mSpeechBubbleEnabled = config.getValue("speechbubble", true);
mNameEnabled = config.getValue("showownname", false);
+ mSpeechMode = config.getValue("speech", 3);
mOpacity = config.getValue("guialpha", 0.8);
mOverlayDetail = (int) config.getValue("OverlayDetail", 2);
mOpenGLEnabled = config.getValue("opengl", false);
@@ -366,7 +387,7 @@ void Setup_Video::cancel()
mOpenGLCheckBox->setSelected(mOpenGLEnabled);
mCustomCursorCheckBox->setSelected(mCustomCursorEnabled);
mParticleEffectsCheckBox->setSelected(mParticleEffectsEnabled);
- mSpeechBubbleCheckBox->setSelected(mSpeechBubbleEnabled);
+ mSpeechSlider->setValue(mSpeechMode);
mNameCheckBox->setSelected(mNameEnabled);
mAlphaSlider->setValue(mOpacity);
mOverlayDetailSlider->setValue(mOverlayDetail);
@@ -380,7 +401,7 @@ void Setup_Video::cancel()
config.setValue("screen", mFullScreenEnabled ? true : false);
config.setValue("customcursor", mCustomCursorEnabled ? true : false);
config.setValue("particleeffects", mParticleEffectsEnabled ? true : false);
- config.setValue("speechbubble", mSpeechBubbleEnabled ? true : false);
+ config.setValue("speech", mSpeechMode);
config.setValue("showownname", mNameEnabled ? true : false);
config.setValue("guialpha", mOpacity);
config.setValue("opengl", mOpenGLEnabled ? true : false);
@@ -417,10 +438,26 @@ void Setup_Video::action(const gcn::ActionEvent &event)
new OkDialog(_("Particle effect settings changed"),
_("Restart your client or change maps for the change to take effect."));
}
- else if (event.getId() == "speechbubble")
+ else if (event.getId() == "speech")
{
- config.setValue("speechbubble",
- mSpeechBubbleCheckBox->isSelected() ? true : false);
+ int val = (int) mSpeechSlider->getValue();
+ switch (val)
+ {
+ case 0:
+ mSpeechLabel->setCaption(_("No text"));
+ break;
+ case 1:
+ mSpeechLabel->setCaption(_("Text"));
+ break;
+ case 2:
+ mSpeechLabel->setCaption(_("Bubbles, no names"));
+ break;
+ case 3:
+ mSpeechLabel->setCaption(_("Bubbles with names"));
+ break;
+ }
+ mSpeechSlider->setValue(val);
+ config.setValue("speech", val);
}
else if (event.getId() == "showownname")
{
diff --git a/src/gui/setup_video.h b/src/gui/setup_video.h
index 303b5bfc..8230569a 100644
--- a/src/gui/setup_video.h
+++ b/src/gui/setup_video.h
@@ -52,10 +52,10 @@ class Setup_Video : public SetupTab, public gcn::ActionListener,
bool mOpenGLEnabled;
bool mCustomCursorEnabled;
bool mParticleEffectsEnabled;
- bool mSpeechBubbleEnabled;
bool mNameEnabled;
double mOpacity;
int mFps;
+ int mSpeechMode;
class ModeListModel *mModeListModel;
@@ -64,9 +64,10 @@ class Setup_Video : public SetupTab, public gcn::ActionListener,
gcn::CheckBox *mOpenGLCheckBox;
gcn::CheckBox *mCustomCursorCheckBox;
gcn::CheckBox *mParticleEffectsCheckBox;
- gcn::CheckBox *mSpeechBubbleCheckBox;
gcn::CheckBox *mNameCheckBox;
+ gcn::Slider *mSpeechSlider;
+ gcn::Label *mSpeechLabel;
gcn::Slider *mAlphaSlider;
gcn::CheckBox *mFpsCheckBox;
gcn::Slider *mFpsSlider;
diff --git a/src/gui/speechbubble.cpp b/src/gui/speechbubble.cpp
index f8c69e87..7a191c37 100644
--- a/src/gui/speechbubble.cpp
+++ b/src/gui/speechbubble.cpp
@@ -74,20 +74,28 @@ void SpeechBubble::setCaption(const std::string &name, const gcn::Color &color)
mCaption->setForegroundColor(color);
}
-void SpeechBubble::setText(std::string mText)
+void SpeechBubble::setText(std::string mText, bool showName)
{
- int width = mCaption->getWidth() + 3;
+ int width = mCaption->getWidth();
mSpeechBox->setTextWrapped(mText, 130 > width ? 130 : width);
const int fontHeight = getFont()->getHeight();
- const int numRows = mSpeechBox->getNumberOfRows() + 1;
+ const int numRows = showName ? mSpeechBox->getNumberOfRows() + 1 :
+ mSpeechBox->getNumberOfRows();
+ int yPos = showName ? fontHeight + 3 : 3;
+ int height = (numRows * fontHeight);
if (width < mSpeechBox->getMinWidth())
width = mSpeechBox->getMinWidth();
- setContentSize(width + fontHeight, (numRows * fontHeight) + 6);
- mSpeechArea->setDimension(gcn::Rectangle(4, fontHeight + 3, width + 5,
- (numRows * fontHeight)));
+ if (numRows == 1)
+ {
+ yPos = (fontHeight / 4) + 3;
+ height = ((3 * fontHeight) / 2) + 1;
+ }
+
+ setContentSize(width + fontHeight, height + 6);
+ mSpeechArea->setDimension(gcn::Rectangle(4, yPos, width + 5, height));
}
unsigned int SpeechBubble::getNumRows()
diff --git a/src/gui/speechbubble.h b/src/gui/speechbubble.h
index 43267a4e..6b71c09e 100644
--- a/src/gui/speechbubble.h
+++ b/src/gui/speechbubble.h
@@ -36,7 +36,7 @@ class SpeechBubble : public Window
void setCaption(const std::string &name,
const gcn::Color &color = 0x000000);
- void setText(std::string mText);
+ void setText(std::string mText, bool showName = true);
void setLocation(int x, int y);
unsigned int getNumRows();