Add the journal window (J key). It's still not in the right position.

actorid
gugus 13 years ago
parent 241cf2555d
commit bc51ba5a38

@ -0,0 +1,52 @@
#include "journal_window.hpp"
#include "window_manager.hpp"
void formatText()
{
//std::string
}
MWGui::JournalWindow::JournalWindow (WindowManager& parWindowManager)
: WindowBase("openmw_journal_layout.xml", parWindowManager)
, lastPos(0)
{
setCoord(0,0,498, 342);
getWidget(mLeftTextWidget, "LeftText");
getWidget(mRightTextWidget, "RightText");
//MyGUI::ItemBox* list = new MyGUI::ItemBox();
//list->addItem("qaq","aqzazaz");
//mScrollerWidget->addChildItem(list);
//mScrollerWidget->addItem("dserzt",MyGUI::UString("fedgdfg"));
//mEditWidget->addText("ljblsxdvdsfvgedfvdfvdkjfghldfjgn sdv,nhsxl;vvn lklksbvlksb lbsdflkbdSLKJGBLskdhbvl<kbvlqksbgkqsjhdvb");
//mEditWidget->show();
//mEditWidget->setEditStatic(true);
mLeftTextWidget->addText("left texxxt ");
mLeftTextWidget->setEditReadOnly(true);
mRightTextWidget->setEditReadOnly(true);
mRightTextWidget->setEditStatic(true);
mLeftTextWidget->setEditStatic(true);
mRightTextWidget->addText("Right texxt ");
displayLeftText("sdfsdfsdfvf");
MyGUI::WindowPtr t = static_cast<MyGUI::WindowPtr>(mMainWidget);
t->eventWindowChangeCoord = MyGUI::newDelegate(this, &JournalWindow::onWindowResize);
}
void MWGui::JournalWindow::onWindowResize(MyGUI::Window* window)
{
}
void MWGui::JournalWindow::displayLeftText(std::string text)
{
mLeftTextWidget->removeAllRenderItems();
mLeftTextWidget->addText(text);
}
void MWGui::JournalWindow::displayRightText(std::string text)
{
mRightTextWidget->addText(text);
}

@ -0,0 +1,45 @@
#ifndef MWGUI_JOURNAL_H
#define MWGUI_JOURNAL_H
#include <sstream>
#include <set>
#include <string>
#include <utility>
#include "../mwdialogue/journal.hpp"
#include "window_base.hpp"
namespace MWGui
{
class WindowManager;
class JournalWindow : public WindowBase
{
public:
JournalWindow(WindowManager& parWindowManager);
private:
enum ColorStyle
{
CS_Sub,
CS_Normal,
CS_Super
};
void onWindowResize(MyGUI::Window* window);
void displayLeftText(std::string text);
void displayRightText(std::string text);
static const int lineHeight;
MyGUI::WidgetPtr skillAreaWidget, skillClientWidget;
MyGUI::VScrollPtr skillScrollerWidget;
int lastPos, clientHeight;
MyGUI::EditPtr mLeftTextWidget;
MyGUI::EditPtr mRightTextWidget;
};
}
#endif

@ -10,6 +10,7 @@ namespace MWGui
GM_MainMenu, // Main menu mode
GM_Console, // Console mode
GM_Journal, // Journal mode
// None of the following are implemented yet

@ -14,6 +14,7 @@
#include "../mwinput/inputmanager.hpp"
#include "console.hpp"
#include "journal_window.hpp"
#include <assert.h>
#include <iostream>
@ -61,6 +62,7 @@ WindowManager::WindowManager(MyGUI::Gui *_gui, MWWorld::Environment& environment
inventory = new InventoryWindow ();
#endif
console = new Console(w,h, environment, extensions);
mJournal = new JournalWindow(*this);
mMessageBoxManager = new MessageBoxManager(this);
// The HUD is always on
@ -89,6 +91,7 @@ WindowManager::~WindowManager()
delete map;
delete menu;
delete stats;
delete mJournal;
#if 0
delete inventory;
#endif
@ -156,6 +159,7 @@ void WindowManager::updateVisible()
inventory->setVisible(false);
#endif
console->disable();
mJournal->setVisible(false);
// Mouse is visible whenever we're not in game mode
gui->setVisiblePointer(isGuiMode());
@ -338,6 +342,12 @@ void WindowManager::updateVisible()
return;
}
if(mode == GM_Journal)
{
mJournal->setVisible(true);
return;
}
// Unsupported mode, switch back to game
// Note: The call will eventually end up this method again but

@ -51,6 +51,7 @@ namespace MWGui
class StatsWindow;
class InventoryWindow;
class Console;
class JournalWindow;
class TextInputDialog;
class InfoBoxDialog;
@ -90,6 +91,7 @@ namespace MWGui
InventoryWindow *inventory;
#endif
Console *console;
JournalWindow* mJournal;
// Character creation
TextInputDialog *nameDialog;

@ -134,6 +134,21 @@ namespace MWInput
else setGuiMode(GM_Console);
}
void toggleJournal()
{
using namespace MWGui;
GuiMode mode = windows.getMode();
// Toggle between game mode and journal mode
if(mode == GM_Game)
setGuiMode(GM_Journal);
else if(mode == GM_Journal)
setGuiMode(GM_Game);
// .. but don't touch any other mode.
}
void activate()
{
mEngine.activate();
@ -188,6 +203,8 @@ namespace MWInput
"Toggle inventory screen");
disp->funcs.bind(A_Console, boost::bind(&InputImpl::toggleConsole, this),
"Toggle console");
disp->funcs.bind(A_Journal, boost::bind(&InputImpl::toggleJournal, this),
"Toggle journal");
disp->funcs.bind(A_Activate, boost::bind(&InputImpl::activate, this),
"Activate");
disp->funcs.bind(A_AutoMove, boost::bind(&InputImpl::toggleAutoMove, this),
@ -236,6 +253,7 @@ namespace MWInput
disp->bind(A_Screenshot, KC_SYSRQ);
disp->bind(A_Inventory, KC_I);
disp->bind(A_Console, KC_F1);
disp->bind(A_Journal, KC_J);
disp->bind(A_Activate, KC_SPACE);
disp->bind(A_AutoMove, KC_Z);
disp->bind(A_ToggleSneak, KC_X);

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Layout">
<Widget type="Window" skin="StaticImage" layer="Windows"position="0 0 485 375" name="_Main">
<Widget type="StaticImage" skin="StaticImage" layer="Windows" position_real="0 0 1 1" name="JImage">
<Property key="Image_Texture" value="textures\tx_menubook.dds"/>
<Widget type="Edit" skin="MW_ConsoleLog" position_real="0.22 0.186667 0.31 0.613333" name = "LeftText"/>
<Widget type="Edit" skin="MW_ConsoleLog" position_real="0.58 0.2 0.3 0.6" name = "RightText"/>
</Widget>
</Widget>
</MyGUI>
Loading…
Cancel
Save