diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-08-02 16:13:36 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-08-03 21:50:05 +0300 |
commit | f651273ebf2a8b11aa01ed1434ecb613177ced6a (patch) | |
tree | c51d2bed1476270e27ad95c5a46e15af32eaccdd /src/gui | |
parent | 30846b7f68f1ad05a0719ae37f75fd2901a6545a (diff) | |
download | manaverse-f651273ebf2a8b11aa01ed1434ecb613177ced6a.tar.gz manaverse-f651273ebf2a8b11aa01ed1434ecb613177ced6a.tar.bz2 manaverse-f651273ebf2a8b11aa01ed1434ecb613177ced6a.tar.xz manaverse-f651273ebf2a8b11aa01ed1434ecb613177ced6a.zip |
Add gui mode for dyecmd. Now only basic code added.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/dialogsmanager.cpp | 23 | ||||
-rw-r--r-- | src/gui/gui.cpp | 9 | ||||
-rw-r--r-- | src/gui/popupmanager.cpp | 16 | ||||
-rw-r--r-- | src/gui/popups/popupmenu.h | 3 | ||||
-rw-r--r-- | src/gui/viewport.h | 6 | ||||
-rw-r--r-- | src/gui/widgets/browserbox.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/textfield.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/window.cpp | 10 | ||||
-rw-r--r-- | src/gui/windowmanager.cpp | 15 |
9 files changed, 81 insertions, 5 deletions
diff --git a/src/gui/dialogsmanager.cpp b/src/gui/dialogsmanager.cpp index 745ef2cc2..69ea6ae11 100644 --- a/src/gui/dialogsmanager.cpp +++ b/src/gui/dialogsmanager.cpp @@ -28,14 +28,19 @@ #include "being/playerinfo.h" #include "gui/widgets/createwidget.h" -#include "gui/widgets/selldialog.h" #include "gui/windows/confirmdialog.h" + +#ifndef DYECMD +#include "gui/widgets/selldialog.h" + #include "gui/windows/buyselldialog.h" #include "gui/windows/buydialog.h" #include "gui/windows/updaterwindow.h" #include "listeners/playerpostdeathlistener.h" +#endif + #include "listeners/weightlistener.h" #include "net/inventoryhandler.h" @@ -55,11 +60,13 @@ DialogsManager *dialogsManager = nullptr; OkDialog *weightNotice = nullptr; int weightNoticeTime = 0; +#ifndef DYECMD namespace { PlayerPostDeathListener postDeathListener; WeightListener weightListener; } // namespace +#endif DialogsManager::DialogsManager() : AttributeListener(), @@ -69,6 +76,7 @@ DialogsManager::DialogsManager() : void DialogsManager::closeDialogs() { +#ifndef DYECMD NpcDialog::clearDialogs(); BuyDialog::closeAll(); BuySellDialog::closeAll(); @@ -76,6 +84,7 @@ void DialogsManager::closeDialogs() SellDialog::closeAll(); if (inventoryHandler) inventoryHandler->destroyStorage(); +#endif if (deathNotice) { deathNotice->scheduleDelete(); @@ -85,11 +94,13 @@ void DialogsManager::closeDialogs() void DialogsManager::createUpdaterWindow() { +#ifndef DYECMD CREATEWIDGETV(updaterWindow, UpdaterWindow, settings.updateHost, settings.oldUpdates, false, UpdateType::Normal); +#endif } Window *DialogsManager::openErrorDialog(const std::string &header, @@ -126,6 +137,7 @@ Window *DialogsManager::openErrorDialog(const std::string &header, void DialogsManager::playerDeath() { +#ifndef DYECMD if (!deathNotice) { // TRANSLATORS: message header @@ -141,8 +153,10 @@ void DialogsManager::playerDeath() 260); deathNotice->addActionListener(&postDeathListener); } +#endif } +#ifndef DYECMD void DialogsManager::attributeChanged(const AttributesT id, const int oldVal, const int newVal) @@ -197,3 +211,10 @@ void DialogsManager::attributeChanged(const AttributesT id, } } } +#else +void DialogsManager::attributeChanged(const AttributesT id A_UNUSED, + const int oldVal A_UNUSED, + const int newVal A_UNUSED) +{ +} +#endif diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 382cd42bf..a7e14983e 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -73,7 +73,11 @@ #include "gui/widgets/window.h" +#ifndef DYECMD #include "dragdrop.h" +#else +#include "resources/image.h" +#endif #include "settings.h" #include "touchmanager.h" @@ -477,6 +481,7 @@ void Gui::draw() if ((settings.mouseFocused || button & SDL_BUTTON(1)) && mMouseCursors && mCustomCursor && mMouseCursorAlpha > 0.0F) { +#ifndef DYECMD const Image *const image = dragDrop.getItemImage(); if (mGuiFont) { @@ -497,6 +502,7 @@ void Gui::draw() const int posY = mouseY - (image->mBounds.h / 2); mGraphics->drawImage(image, posX, posY); } +#endif Image *const mouseCursor = mMouseCursors->get( static_cast<int>(mCursorType)); if (mouseCursor) @@ -906,9 +912,10 @@ void Gui::distributeMouseEvent(Widget *const source, widget = parent; parent = swap->getParent(); +#ifndef DYECMD if (type == MouseEventType::RELEASED) dragDrop.clear(); - +#endif if (!widget || event.isConsumed()) break; diff --git a/src/gui/popupmanager.cpp b/src/gui/popupmanager.cpp index 3749a6502..cca9cffd4 100644 --- a/src/gui/popupmanager.cpp +++ b/src/gui/popupmanager.cpp @@ -42,14 +42,18 @@ PopupManager::~PopupManager() void PopupManager::closePopupMenu() { +#ifndef DYECMD if (popupMenu) popupMenu->handleLink("cancel", nullptr); +#endif } void PopupManager::hideBeingPopup() { +#ifndef DYECMD if (beingPopup) beingPopup->setVisible(Visible_false); +#endif } void PopupManager::hideTextPopup() @@ -60,19 +64,27 @@ void PopupManager::hideTextPopup() void PopupManager::hidePopupMenu() { +#ifndef DYECMD if (popupMenu) popupMenu->setVisible(Visible_false); +#endif } bool PopupManager::isPopupMenuVisible() { +#ifndef DYECMD return popupMenu ? popupMenu->isPopupVisible() : false; +#else + return false; +#endif } void PopupManager::clearPopup() { +#ifndef DYECMD if (popupMenu) popupMenu->clear(); +#endif } bool PopupManager::isTextPopupVisible() @@ -82,5 +94,9 @@ bool PopupManager::isTextPopupVisible() bool PopupManager::isBeingPopupVisible() { +#ifndef DYECMD return beingPopup ? beingPopup->isPopupVisible() : false; +#else + return false; +#endif } diff --git a/src/gui/popups/popupmenu.h b/src/gui/popups/popupmenu.h index ac6798ce1..d83fd7bd5 100644 --- a/src/gui/popups/popupmenu.h +++ b/src/gui/popups/popupmenu.h @@ -23,6 +23,8 @@ #ifndef GUI_POPUPS_POPUPMENU_H #define GUI_POPUPS_POPUPMENU_H +#ifndef DYECMD + #include "enums/inventorytype.h" #include "enums/simpletypes/beingid.h" @@ -229,4 +231,5 @@ class PopupMenu final : public Popup, public LinkHandler extern PopupMenu *popupMenu; +#endif // DYE_CMD #endif // GUI_POPUPS_POPUPMENU_H diff --git a/src/gui/viewport.h b/src/gui/viewport.h index 0963bd394..fa2dd7508 100644 --- a/src/gui/viewport.h +++ b/src/gui/viewport.h @@ -23,6 +23,11 @@ #ifndef GUI_VIEWPORT_H #define GUI_VIEWPORT_H +#ifdef DYECMD +#include "dyetool/gui/viewport.h" + +#else + #include "position.h" #include "enums/simpletypes/beingid.h" @@ -235,4 +240,5 @@ class Viewport final : public WindowContainer, extern Viewport *viewport; /**< The viewport. */ +#endif // DYECMD #endif // GUI_VIEWPORT_H diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 068894418..67dbbe632 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -235,10 +235,12 @@ void BrowserBox::addRow(const std::string &row, const bool atTop) bLink.y2 = bLink.y1 + font->getHeight(); if (bLink.caption.empty()) { +#ifndef DYECMD const int id = atoi(bLink.link.c_str()); if (id) bLink.caption = ItemDB::get(id).getName(); else +#endif bLink.caption = bLink.link; if (translator) bLink.caption = translator->getStr(bLink.caption); diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index c7b9cd312..497f17d2f 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -748,8 +748,10 @@ void TextField::mousePressed(MouseEvent &event) event.consume(); if (event.getButton() == MouseButton::RIGHT) { +#ifndef DYECMD if (popupMenu) popupMenu->showTextFieldPopup(this); +#endif } else if (event.getButton() == MouseButton::LEFT) { diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 73355e3fc..cd8da96bf 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -67,7 +67,11 @@ #include "client.h" #include "configuration.h" +#ifndef DYECMD #include "dragdrop.h" +#else +#include "resources/image.h" +#endif #include "graphicsvertexes.h" #include "soundconsts.h" #include "soundmanager.h" @@ -236,8 +240,10 @@ Window::~Window() if (gui) gui->removeDragged(this); +#ifndef DYECMD if (setupWindow) setupWindow->unregisterWindowForReset(this); +#endif client->windowRemoved(this); @@ -848,6 +854,7 @@ void Window::mousePressed(MouseEvent &event) else mMoved = false; } +#ifndef DYECMD else if (button == MouseButton::RIGHT) { if (popupMenu) @@ -856,6 +863,7 @@ void Window::mousePressed(MouseEvent &event) popupMenu->showWindowPopup(this); } } +#endif } void Window::close() @@ -891,8 +899,10 @@ void Window::updateResizeHandler(MouseEvent &event) if (!gui) return; +#ifndef DYECMD if (!dragDrop.isEmpty()) return; +#endif mResizeHandles = getResizeHandles(event); diff --git a/src/gui/windowmanager.cpp b/src/gui/windowmanager.cpp index d61ffea6e..01cc2c670 100644 --- a/src/gui/windowmanager.cpp +++ b/src/gui/windowmanager.cpp @@ -32,16 +32,19 @@ #include "gui/gui.h" #include "gui/userpalette.h" +#include "gui/popups/textpopup.h" + +#ifndef DYECMD #include "gui/popups/beingpopup.h" #include "gui/popups/itempopup.h" #include "gui/popups/popupmenu.h" #include "gui/popups/spellpopup.h" #include "gui/popups/textboxpopup.h" -#include "gui/popups/textpopup.h" #include "gui/windows/didyouknowwindow.h" #include "gui/windows/helpwindow.h" #include "gui/windows/setupwindow.h" +#endif #include "gui/widgets/createwidget.h" #include "gui/widgets/desktop.h" @@ -95,21 +98,23 @@ void WindowManager::init() void WindowManager::createWindows() { userPalette = new UserPalette; +#ifndef DYECMD CREATEWIDGETV0(setupWindow, SetupWindow); CREATEWIDGETV0(helpWindow, HelpWindow); CREATEWIDGETV0(didYouKnowWindow, DidYouKnowWindow); CREATEWIDGETV0(popupMenu, PopupMenu); CREATEWIDGETV0(beingPopup, BeingPopup); - CREATEWIDGETV0(textPopup, TextPopup); CREATEWIDGETV0(textBoxPopup, TextBoxPopup); CREATEWIDGETV0(itemPopup, ItemPopup); CREATEWIDGETV0(spellPopup, SpellPopup); +#endif + CREATEWIDGETV0(textPopup, TextPopup); } void WindowManager::deleteWindows() { +#ifndef DYECMD delete2(textBoxPopup); - delete2(textPopup); delete2(beingPopup); delete2(itemPopup); delete2(spellPopup); @@ -120,6 +125,8 @@ void WindowManager::deleteWindows() delete2(userPalette); delete2(spellManager) delete2(spellShortcut) +#endif + delete2(textPopup); } void WindowManager::initTitle() @@ -196,9 +203,11 @@ void WindowManager::resizeVideo(int actualWidth, client->moveButtons(width); +#ifndef DYECMD Game *const game = Game::instance(); if (game) game->videoResized(width, height); +#endif if (gui) gui->draw(); |