Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2013-11-05 19:07:50 +0000
committerStijn Buys <ingar@osirion.org>2013-11-05 19:07:50 +0000
commit85c5f8e91fc69c55c138b00fdc505005b2b3e932 (patch)
tree41a270893508e09e82879e9ec7ede84ddc799e39
parent29c26acef59a342179fd21405867ff6fee58f58e (diff)
Show both entity and info name on map target info and inventory ship info,
moved the modelview widgets to the top of the widget stack to make sure it gets rendered behind anything else.
-rw-r--r--src/client/inventorywindow.cc42
-rw-r--r--src/client/inventorywindow.h2
-rw-r--r--src/client/mapwindow.cc38
-rw-r--r--src/client/mapwindow.h1
4 files changed, 54 insertions, 29 deletions
diff --git a/src/client/inventorywindow.cc b/src/client/inventorywindow.cc
index 4ab7f25..0a60259 100644
--- a/src/client/inventorywindow.cc
+++ b/src/client/inventorywindow.cc
@@ -23,6 +23,13 @@ InventoryWindow::InventoryWindow(ui::Widget *parent) : ui::Window(parent)
inventorywindow_inforecord = 0;
inventorywindow_amount = 0;
+ // modelview, add it first so it gets rendered before anything else
+ inventorywindow_modelview = new ui::ModelView(this);
+ inventorywindow_modelview->set_label("modelview");
+ inventorywindow_modelview->set_background(false);
+ inventorywindow_modelview->set_border(false);
+
+ // window title
inventorywindow_titlelabel = new ui::Label(this);
inventorywindow_titlelabel->set_label("title");
inventorywindow_titlelabel->set_background(false);
@@ -33,12 +40,7 @@ InventoryWindow::InventoryWindow(ui::Widget *parent) : ui::Window(parent)
// close button
inventorywindow_closebutton = new ui::IconButton(inventorywindow_titlelabel, "bitmaps/icons/window_close");
-
- inventorywindow_modelview = new ui::ModelView(this);
- inventorywindow_modelview->set_label("modelview");
- inventorywindow_modelview->set_background(false);
- inventorywindow_modelview->set_border(false);
-
+
inventorywindow_modeltitlelabel = new ui::Label(inventorywindow_modelview);
inventorywindow_modeltitlelabel->set_background(false);
inventorywindow_modeltitlelabel->set_border(false);
@@ -306,8 +308,12 @@ void InventoryWindow::draw()
void InventoryWindow::show()
{
inventorywindow_listview->deselect();
- set_info(core::localcontrol() ? core::localcontrol()->info() : 0, 0);
- inventorywindow_modeltitlelabel->set_text("Ship Info");
+ inventorywindow_modelnamelabel->set_text(core::localplayer()->name());
+ if (core::localcontrol() && core::localcontrol()->info()) {
+ set_info(core::localcontrol()->info(), 0);
+ } else {
+ set_info(0, 0);
+ }
Window::show();
}
@@ -316,7 +322,7 @@ void InventoryWindow::show_eject_dialog(const core::Info *info, const int amount
if (!info || amount < 0)
return;
- inventorywindow_modeltitlelabel->set_text("Eject Cargo");
+ inventorywindow_modelnamelabel->set_text("Eject cargo");
inventorywindow_infotext.clear();
inventorywindow_ejectconfirmbutton->show();
@@ -325,17 +331,17 @@ void InventoryWindow::show_eject_dialog(const core::Info *info, const int amount
inventorywindow_ejectslider->set_range(1, amount);
inventorywindow_ejectslider->set_value(amount);
inventorywindow_ejectslider->show();
- show_eject_amount(amount);
+ show_eject_amount(info, amount);
//std::string text("Select amount to eject");
//inventorywindow_infotext.push_back(text);
}
-void InventoryWindow::show_eject_amount(const int amount)
+void InventoryWindow::show_eject_amount(const core::Info *info, const int amount)
{
std::ostringstream str;
- str << "Eject Cargo";
+ str << "Eject " << (info ? info->name() : "cargo");
if (amount > 0) {
str << " (";
@@ -409,13 +415,13 @@ void InventoryWindow::set_info(const core::Info *info, const int amount)
inventorywindow_ejectslider->hide();
if (!info) {
- inventorywindow_modelview->clear();
- inventorywindow_modeltitlelabel->set_text("");
+ inventorywindow_modelview->clear();
inventorywindow_modelnamelabel->set_text("");
+ inventorywindow_modeltitlelabel->set_text("");
} else {
core::game()->request_info(info->id());
inventorywindow_modelview->set_modelname(info->modelname());
- inventorywindow_modelnamelabel->set_text(info->name());
+ inventorywindow_modeltitlelabel->set_text(info->name());
inventorywindow_modelview->set_colors(core::localplayer()->color(), core::localplayer()->color_second());
for (core::Info::Text::const_iterator it = inventorywindow_inforecord->text().begin(); it != inventorywindow_inforecord->text().end(); it++) {
@@ -435,7 +441,7 @@ bool InventoryWindow::on_emit(Widget *sender, const Event event, void *data)
if (sender == inventorywindow_shipbutton) {
inventorywindow_listview->deselect();
set_info(core::localcontrol() ? core::localcontrol()->info() : 0, 0);
- inventorywindow_modeltitlelabel->set_text("Ship Info");
+ inventorywindow_modelnamelabel->set_text(core::localplayer()->name());
} else if (sender == inventorywindow_ejectbutton) {
if (inventorywindow_listview->selected()) {
show_eject_dialog(inventorywindow_listview->selected()->info(), inventorywindow_listview->selected()->item()->amount());
@@ -455,7 +461,7 @@ bool InventoryWindow::on_emit(Widget *sender, const Event event, void *data)
} else if (event == ui::Widget::EventListViewChanged) {
if (sender == inventorywindow_listview) {
- inventorywindow_modeltitlelabel->set_text("Cargo Info");
+ inventorywindow_modelnamelabel->set_text("Cargo Info");
show_item_info(inventorywindow_listview->selected());
}
@@ -464,7 +470,7 @@ bool InventoryWindow::on_emit(Widget *sender, const Event event, void *data)
} else if (event == ui::Widget::EventSliderChanged) {
if (sender == inventorywindow_ejectslider) {
- show_eject_amount(inventorywindow_ejectslider->value());
+ show_eject_amount(inventorywindow_inforecord, inventorywindow_ejectslider->value());
}
return true;
}
diff --git a/src/client/inventorywindow.h b/src/client/inventorywindow.h
index 95c0a51..be2db40 100644
--- a/src/client/inventorywindow.h
+++ b/src/client/inventorywindow.h
@@ -53,7 +53,7 @@ private:
void show_eject_dialog(const core::Info *info, const int amount);
- void show_eject_amount(const int amount);
+ void show_eject_amount(const core::Info *info, const int amount);
void act_eject();
diff --git a/src/client/mapwindow.cc b/src/client/mapwindow.cc
index 19cf687..925f938 100644
--- a/src/client/mapwindow.cc
+++ b/src/client/mapwindow.cc
@@ -27,6 +27,12 @@ MapWindow::MapWindow(ui::Widget *parent) : ui::Window(parent)
set_background(true);
set_font(ui::root()->font_small());
+ // modelview, add it first so it gets rendered before anything else
+ mapwindow_modelview = new ui::ModelView(this);
+ mapwindow_modelview->set_label("modelview");
+ mapwindow_modelview->set_background(false);
+ mapwindow_modelview->set_border(false);
+
// window title
mapwindow_titlelabel = new ui::Label(this);
mapwindow_titlelabel->set_label("title");
@@ -60,20 +66,24 @@ MapWindow::MapWindow(ui::Widget *parent) : ui::Window(parent)
// map buttons
mapwindow_zonebutton = new ui::IconButton(this, "bitmaps/icons/button_map");
mapwindow_galaxybutton = new ui::IconButton(this, "bitmaps/icons/button_galaxy");
+
- // modelview
- mapwindow_modelview = new ui::ModelView(this);
- mapwindow_modelview->set_label("modelview");
- mapwindow_modelview->set_background(false);
- mapwindow_modelview->set_border(false);
-
- // target title (modelview child)
+ // target title
mapwindow_targetlabel = new ui::Label(this);
mapwindow_targetlabel->set_label("targetlabel");
mapwindow_targetlabel->set_background(false);
mapwindow_targetlabel->set_border(false);
mapwindow_targetlabel->set_alignment(ui::AlignCenter);
+
+
+ // info label (modelview child)
+ mapwindow_infolabel = new ui::Label(mapwindow_modelview);
+ mapwindow_infolabel ->set_label("infolabel");
+ mapwindow_infolabel->set_background(false);
+ mapwindow_infolabel->set_border(false);
+ mapwindow_infolabel->set_alignment(ui::AlignCenter);
+
// target text
mapwindow_scrollpane = new ui::ScrollPane(this, mapwindow_infotext);
mapwindow_scrollpane->set_background(false);
@@ -168,6 +178,10 @@ void MapWindow::resize()
// resize target modelview
mapwindow_modelview->set_size(mapwindow_targetlabel->width(), (height() - mapwindow_targetlabel->bottom() - padding * 3.0f) * 0.5f);
mapwindow_modelview->set_location(mapwindow_mapwidget->right() + padding, mapwindow_targetlabel->bottom() + padding);
+
+ // resize info label (modelview child)
+ mapwindow_infolabel->set_size(mapwindow_modelview->width(), mapwindow_infolabel->font()->height());
+ mapwindow_infolabel->set_location(0.0f, mapwindow_modelview->height() - mapwindow_infolabel->height());
// resize target infopane text
mapwindow_scrollpane->set_size(mapwindow_modelview->size());
@@ -201,16 +215,18 @@ void MapWindow::set_info(const core::Info *info)
mapwindow_inforecord = 0;
mapwindow_infotimestamp = 0;
mapwindow_infotext.clear();
+ mapwindow_infolabel->clear();
if (info) {
mapwindow_inforecord = core::game()->request_info(info->id());
}
if (mapwindow_inforecord) {
+ mapwindow_infolabel->set_text(mapwindow_inforecord->name());
for (core::Info::Text::const_iterator it = mapwindow_inforecord->text().begin(); it != mapwindow_inforecord->text().end(); it++) {
mapwindow_infotext.push_back((*it));
}
- mapwindow_infotimestamp = mapwindow_inforecord->timestamp();
+ mapwindow_infotimestamp = mapwindow_inforecord->timestamp();
} else {
mapwindow_infotext.push_back("Information is not available");
mapwindow_infotimestamp = 0;
@@ -260,9 +276,11 @@ void MapWindow::show_entity_info(const core::Entity *entity)
} else {
set_info(0);
- mapwindow_infotext.clear();
- mapwindow_targetlabel->clear();
+ mapwindow_infotext.clear();
mapwindow_modelview->clear();
+
+ mapwindow_targetlabel->clear();
+ mapwindow_infolabel->clear();
}
}
diff --git a/src/client/mapwindow.h b/src/client/mapwindow.h
index d667ca4..b746d2b 100644
--- a/src/client/mapwindow.h
+++ b/src/client/mapwindow.h
@@ -68,6 +68,7 @@ private:
ui::ModelView *mapwindow_modelview;
ui::Label *mapwindow_targetlabel;
+ ui::Label *mapwindow_infolabel;
ui::ScrollPane *mapwindow_scrollpane;
ui::IconButton *mapwindow_closebutton;
ui::IconButton *mapwindow_zonebutton;