diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-09-23 22:01:44 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-09-23 22:01:44 +0300 |
commit | 3c404128c4669a1f4f190e20a89553677717fc50 (patch) | |
tree | 2db4e5031089c800c4e00fd6244e578f44a7c910 /src/gui/widgets | |
parent | 89b267d6d73bbc59f7c313b8a22b97fbb27f99a8 (diff) | |
download | manaverse-3c404128c4669a1f4f190e20a89553677717fc50.tar.gz manaverse-3c404128c4669a1f4f190e20a89553677717fc50.tar.bz2 manaverse-3c404128c4669a1f4f190e20a89553677717fc50.tar.xz manaverse-3c404128c4669a1f4f190e20a89553677717fc50.zip |
Add missing comments into defines.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/browserbox.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/inttextfield.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/scrollarea.cpp | 6 | ||||
-rw-r--r-- | src/gui/widgets/tabs/chat/chattab.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/tabs/debugwindowtabs.cpp | 31 | ||||
-rw-r--r-- | src/gui/widgets/tabs/debugwindowtabs.h | 5 | ||||
-rw-r--r-- | src/gui/widgets/tabs/setup_audio.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/tabs/setup_other.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/tabs/setup_perfomance.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/tabs/setup_video.cpp | 31 | ||||
-rw-r--r-- | src/gui/widgets/tabs/setup_video.h | 3 | ||||
-rw-r--r-- | src/gui/widgets/tabs/setup_visual.cpp | 6 | ||||
-rw-r--r-- | src/gui/widgets/textfield.cpp | 18 | ||||
-rw-r--r-- | src/gui/widgets/textfield.h | 5 | ||||
-rw-r--r-- | src/gui/widgets/window.cpp | 12 | ||||
-rw-r--r-- | src/gui/widgets/window.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/windowcontainer.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/windowcontainer.h | 2 |
18 files changed, 81 insertions, 62 deletions
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 7aeeda6a8..a229cb10f 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -268,7 +268,8 @@ void BrowserBox::addRow(const std::string &row, const bool atTop) if (id) bLink.caption = ItemDB::get(id).getName(); } -#endif +#endif // DYECMD + if (translator) bLink.caption = translator->getStr(bLink.caption); } diff --git a/src/gui/widgets/inttextfield.cpp b/src/gui/widgets/inttextfield.cpp index e28aae7e2..5ac5ec38f 100644 --- a/src/gui/widgets/inttextfield.cpp +++ b/src/gui/widgets/inttextfield.cpp @@ -81,10 +81,11 @@ void IntTextField::keyPressed(KeyEvent &event) if (chr < '0' || chr > '9') return; } -#else +#else // USE_SDL2 + if (!event.getKey().isNumber()) return; -#endif +#endif // USE_SDL2 TextField::keyPressed(event); diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index db44a8a93..6ec9d73d7 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -841,10 +841,12 @@ void ScrollArea::mouseReleased(MouseEvent& event) #ifdef ANDROID int dx = mClickX - event.getX(); int dy = mClickY - event.getY(); -#else +#else // ANDROID + int dx = event.getX() - mClickX; int dy = event.getY() - mClickY; -#endif +#endif // ANDROID + if ((dx < 20 && dx > 0) || (dx > -20 && dx < 0)) dx = 0; diff --git a/src/gui/widgets/tabs/chat/chattab.cpp b/src/gui/widgets/tabs/chat/chattab.cpp index fad52cfb4..fccd428f4 100644 --- a/src/gui/widgets/tabs/chat/chattab.cpp +++ b/src/gui/widgets/tabs/chat/chattab.cpp @@ -52,7 +52,7 @@ #ifdef WIN32 #include <sys/time.h> -#endif +#endif // WIN32 #include <sstream> diff --git a/src/gui/widgets/tabs/debugwindowtabs.cpp b/src/gui/widgets/tabs/debugwindowtabs.cpp index 2757d591c..4ee856ef4 100644 --- a/src/gui/widgets/tabs/debugwindowtabs.cpp +++ b/src/gui/widgets/tabs/debugwindowtabs.cpp @@ -36,7 +36,7 @@ #ifdef USE_OPENGL #include "resources/imagehelper.h" -#endif +#endif // USE_OPENGL #include "resources/map/map.h" @@ -75,12 +75,12 @@ MapDebugTab::MapDebugTab(const Widget2 *const widget) : mDrawCallsLabel(new Label(this, strprintf("%s %s", // TRANSLATORS: debug window label _("Draw calls:"), "?"))), -#endif +#endif // DEBUG_DRAW_CALLS #ifdef DEBUG_BIND_TEXTURE mBindsLabel(new Label(this, strprintf("%s %s", // TRANSLATORS: debug window label _("Texture binds:"), "?"))), -#endif +#endif // DEBUG_BIND_TEXTURE // TRANSLATORS: debug window label, frames per second mFPSLabel(new Label(this, strprintf(_("%d FPS"), 0))), // TRANSLATORS: debug window label, logic per second @@ -125,10 +125,11 @@ MapDebugTab::MapDebugTab(const Widget2 *const widget) : mFPSText = _("%d FPS (SDL2 default)"); break; }; -#else +#else // USE_OPENGL + // TRANSLATORS: debug window label mFPSText = _("%d FPS (Software)"); -#endif +#endif // USE_OPENGL place(0, 0, mFPSLabel, 2); place(0, 1, mLPSLabel, 2); @@ -144,22 +145,24 @@ MapDebugTab::MapDebugTab(const Widget2 *const widget) : #if defined (DEBUG_OPENGL_LEAKS) || defined(DEBUG_DRAW_CALLS) \ || defined(DEBUG_BIND_TEXTURE) int n = 10; -#endif +#endif // defined (DEBUG_OPENGL_LEAKS) || defined(DEBUG_DRAW_CALLS) + // || defined(DEBUG_BIND_TEXTURE) #ifdef DEBUG_OPENGL_LEAKS mTexturesLabel = new Label(this, strprintf("%s %s", // TRANSLATORS: debug window label _("Textures count:"), "?")); place(0, n, mTexturesLabel, 2); n ++; -#endif +#endif // DEBUG_OPENGL_LEAKS #ifdef DEBUG_DRAW_CALLS place(0, n, mDrawCallsLabel, 2); n ++; -#endif +#endif // DEBUG_DRAW_CALLS #ifdef DEBUG_BIND_TEXTURE place(0, n, mBindsLabel, 2); -#endif -#endif +#endif // DEBUG_BIND_TEXTURE +#endif // USE_OPENGL + place.getCell().matchColWidth(0, 0); place = h.getPlacer(0, 1); setDimension(Rect(0, 0, 600, 300)); @@ -221,7 +224,7 @@ void MapDebugTab::logic() mTexturesLabel->setCaption(strprintf("%s %d", // TRANSLATORS: debug window label _("Textures count:"), textures_count)); -#endif +#endif // DEBUG_OPENGL_LEAKS #ifdef DEBUG_DRAW_CALLS if (mainGraphics) { @@ -229,7 +232,7 @@ void MapDebugTab::logic() // TRANSLATORS: debug window label _("Draw calls:"), mainGraphics->getDrawCalls())); } -#endif +#endif // DEBUG_DRAW_CALLS #ifdef DEBUG_BIND_TEXTURE if (mainGraphics) { @@ -237,8 +240,8 @@ void MapDebugTab::logic() // TRANSLATORS: debug window label _("Texture binds:"), mainGraphics->getBinds())); } -#endif -#endif +#endif // DEBUG_BIND_TEXTURE +#endif // USE_OPENGL } } else diff --git a/src/gui/widgets/tabs/debugwindowtabs.h b/src/gui/widgets/tabs/debugwindowtabs.h index 044a2884c..a526d71f3 100644 --- a/src/gui/widgets/tabs/debugwindowtabs.h +++ b/src/gui/widgets/tabs/debugwindowtabs.h @@ -71,10 +71,11 @@ class MapDebugTab final : public DebugTab time_t mUpdateTime; #ifdef DEBUG_DRAW_CALLS Label *mDrawCallsLabel A_NONNULLPOINTER; -#endif +#endif // DEBUG_DRAW_CALLS #ifdef DEBUG_BIND_TEXTURE Label *mBindsLabel A_NONNULLPOINTER; -#endif +#endif // DEBUG_BIND_TEXTURE + Label *mFPSLabel A_NONNULLPOINTER; Label *mLPSLabel A_NONNULLPOINTER; std::string mFPSText; diff --git a/src/gui/widgets/tabs/setup_audio.cpp b/src/gui/widgets/tabs/setup_audio.cpp index af23ad2fe..f4b9534df 100644 --- a/src/gui/widgets/tabs/setup_audio.cpp +++ b/src/gui/widgets/tabs/setup_audio.cpp @@ -158,7 +158,7 @@ Setup_Audio::Setup_Audio(const Widget2 *const widget) : // TRANSLATORS: settings option new SetupItemCheckBox(_("Enable mumble voice chat"), "", "enableMumble", this, "enableMumbleEvent"); -#endif +#endif // USE_MUMBLE // TRANSLATORS: settings option new SetupItemCheckBox(_("Download music"), "", diff --git a/src/gui/widgets/tabs/setup_other.cpp b/src/gui/widgets/tabs/setup_other.cpp index 186e76fc2..4008a42af 100644 --- a/src/gui/widgets/tabs/setup_other.cpp +++ b/src/gui/widgets/tabs/setup_other.cpp @@ -415,7 +415,7 @@ Setup_Other::Setup_Other(const Widget2 *const widget) : // TRANSLATORS: settings option new SetupItemCheckBox(_("Use FBO for screenshots (only for opengl)"), "", "usefbo", this, "usefboEvent"); -#endif +#endif // ANDROID #ifndef WIN32 // TRANSLATORS: settings option @@ -423,7 +423,7 @@ Setup_Other::Setup_Other(const Widget2 *const widget) : "screenshotDirectory3", this, "screenshotDirectory3Event", MainConfig_true, UseBase64_true); -#endif +#endif // WIN32 // TRANSLATORS: settings option new SetupItemIntTextField(_("Network delay between sub servers"), diff --git a/src/gui/widgets/tabs/setup_perfomance.cpp b/src/gui/widgets/tabs/setup_perfomance.cpp index 25f25a4c7..a55d264f0 100644 --- a/src/gui/widgets/tabs/setup_perfomance.cpp +++ b/src/gui/widgets/tabs/setup_perfomance.cpp @@ -78,7 +78,7 @@ Setup_Perfomance::Setup_Perfomance(const Widget2 *const widget) : // TRANSLATORS: settings option new SetupItemCheckBox(_("Enable map reduce (Software)"), "", "enableMapReduce", this, "enableMapReduceEvent"); -#endif +#endif // USE_SDL2 // TRANSLATORS: settings option new SetupItemCheckBox(_("Enable compound sprite delay (Software)"), "", @@ -127,7 +127,7 @@ Setup_Perfomance::Setup_Perfomance(const Widget2 *const widget) : // TRANSLATORS: settings option new SetupItemCheckBox(_("Disable beings caching (Software)"), "", "disableBeingCaching", this, "disableBeingCachingEvent"); -#endif +#endif // USE_SDL2 // TRANSLATORS: settings group new SetupItemLabel(_("Different options (enable or disable can " diff --git a/src/gui/widgets/tabs/setup_video.cpp b/src/gui/widgets/tabs/setup_video.cpp index 3797884a3..85927cd0e 100644 --- a/src/gui/widgets/tabs/setup_video.cpp +++ b/src/gui/widgets/tabs/setup_video.cpp @@ -48,11 +48,11 @@ #if defined(ANDROID) || defined(__APPLE__) || !defined(USE_OPENGL) #include "configuration.h" -#endif +#endif // defined(ANDROID) || defined(__APPLE__) || !defined(USE_OPENGL) #if defined(ANDROID) || defined(__APPLE__) #include "utils/stringutils.h" -#endif +#endif // defined(ANDROID) || defined(__APPLE__) #include "gui/models/modelistmodel.h" #include "gui/models/opengllistmodel.h" @@ -86,7 +86,8 @@ Setup_Video::Setup_Video(const Widget2 *const widget) : #if !defined(ANDROID) && !defined(__APPLE__) && !defined(__native_client__) // TRANSLATORS: video settings button mDetectButton(new Button(this, _("Detect best mode"), "detect", this)), -#endif +#endif // !defined(ANDROID) && !defined(__APPLE__) && + // !defined(__native_client__) mDialog(nullptr), mCustomCursorEnabled(config.getBoolValue("customcursor")), mEnableResize(config.getBoolValue("enableresize")), @@ -95,11 +96,11 @@ Setup_Video::Setup_Video(const Widget2 *const widget) : #ifdef ANDROID // TRANSLATORS: video settings checkbox _("Show cursor"), -#else +#else // ANDROID // TRANSLATORS: video settings checkbox _("Custom cursor"), -#endif - mCustomCursorEnabled)), +#endif // ANDROID + mCustomCursorEnabled)), // TRANSLATORS: video settings checkbox mEnableResizeCheckBox(new CheckBox(this, _("Enable resize"), mEnableResize)), @@ -179,13 +180,15 @@ Setup_Video::Setup_Video(const Widget2 *const widget) : #if !defined(ANDROID) && !defined(__APPLE__) && !defined(__native_client__) place(0, 8, mDetectButton); -#else +#else // !defined(ANDROID) && !defined(__APPLE__) && + // !defined(__native_client__) mNoFrameCheckBox->setEnabled(false); mEnableResizeCheckBox->setEnabled(false); #ifndef __native_client__ mFsCheckBox->setEnabled(false); #endif // __native_client__ -#endif +#endif // !defined(ANDROID) && !defined(__APPLE__) && + // !defined(__native_client__) int width = 600; @@ -220,7 +223,7 @@ void Setup_Video::apply() // checks for opengl usage if (intToRenderType(config.getIntValue("opengl")) == RENDER_SOFTWARE) { -#endif +#endif // defined(WIN32) || defined(__APPLE__) || defined(ANDROID) if (!WindowManager::setFullScreen(fullscreen)) { fullscreen = !fullscreen; @@ -261,7 +264,8 @@ void Setup_Video::apply() nullptr, 260); } -#endif +#endif // defined(WIN32) || defined(__APPLE__) || defined(ANDROID) + config.setValue("screen", fullscreen); } @@ -425,10 +429,11 @@ void Setup_Video::action(const ActionEvent &event) 260); } } -#else +#else // defined(WIN32) || defined(__APPLE__) || defined(ANDROID) + mainGraphics->setWindowSize(width, height); WindowManager::doResizeVideo(width, height, false); -#endif +#endif // defined(WIN32) || defined(__APPLE__) || defined(ANDROID) } config.setValue("oldscreen", config.getBoolValue("screen")); @@ -501,5 +506,5 @@ void Setup_Video::action(const ActionEvent &event) delete test; } } -#endif +#endif // defined(USE_OPENGL) && !defined(ANDROID) && !defined(__APPLE__) } diff --git a/src/gui/widgets/tabs/setup_video.h b/src/gui/widgets/tabs/setup_video.h index e1a94557e..5cc519315 100644 --- a/src/gui/widgets/tabs/setup_video.h +++ b/src/gui/widgets/tabs/setup_video.h @@ -70,7 +70,8 @@ class Setup_Video final : public SetupTab, Label *mAltFpsLabel; #if !defined(ANDROID) && !defined(__APPLE__) && !defined(__native_client__) Button *mDetectButton; -#endif +#endif // !defined(ANDROID) && !defined(__APPLE__) && + // !defined(__native_client__) TextDialog *mDialog; bool mCustomCursorEnabled; bool mEnableResize; diff --git a/src/gui/widgets/tabs/setup_visual.cpp b/src/gui/widgets/tabs/setup_visual.cpp index 6cb00ad17..a8b783af2 100644 --- a/src/gui/widgets/tabs/setup_visual.cpp +++ b/src/gui/widgets/tabs/setup_visual.cpp @@ -133,7 +133,7 @@ Setup_Visual::Setup_Visual(const Widget2 *const widget) : // TRANSLATORS: settings option new SetupItemCheckBox(_("Grab mouse and keyboard input"), "", "grabinput", this, "grabinputEvent"); -#endif +#endif // ANDROID // TRANSLATORS: settings option new SetupItemCheckBox(_("Blurring textures (OpenGL)"), @@ -211,7 +211,7 @@ Setup_Visual::Setup_Visual(const Widget2 *const widget) : // TRANSLATORS: settings option new SetupItemCheckBox(_("Center game window"), "", "centerwindow", this, "centerwindowEvent"); -#endif +#endif // defined(WIN32) || defined(__APPLE__) // TRANSLATORS: settings option new SetupItemCheckBox(_("Allow screensaver to run"), @@ -244,5 +244,5 @@ void Setup_Visual::apply() WindowManager::applyGrabMode(); #ifndef WIN32 WindowManager::applyScale(); -#endif +#endif // WIN32 } diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index b80e21eeb..13fddb119 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -312,7 +312,8 @@ void TextField::keyPressed(KeyEvent &event) return; } bool consumed(false); -#else +#else // USE_SDL2 + if (val >= 32) { if (mNumeric) @@ -375,7 +376,7 @@ void TextField::keyPressed(KeyEvent &event) mLastEventPaste = 0; bool consumed(false); -#endif +#endif // USE_SDL2 const InputActionT action = event.getActionId(); if (!inputManager.isActionActive(InputAction::GUI_CTRL)) @@ -562,13 +563,15 @@ void TextField::handleCtrlKeys(const InputActionT action, bool &consumed) { #ifdef USE_SDL2 handlePaste(); -#else +#else // USE_SDL2 + // hack to prevent paste key sticking if (mLastEventPaste && mLastEventPaste > cur_time) break; handlePaste(); mLastEventPaste = cur_time + 2; -#endif +#endif // USE_SDL2 + consumed = true; break; } @@ -762,14 +765,15 @@ void TextField::mousePressed(MouseEvent &event) #ifdef ANDROID if (!WindowManager::isKeyboardVisible()) inputManager.executeAction(InputAction::SHOW_KEYBOARD); -#endif +#endif // ANDROID + event.consume(); if (event.getButton() == MouseButton::RIGHT) { #ifndef DYECMD if (popupMenu) popupMenu->showTextFieldPopup(this); -#endif +#endif // DYECMD } else if (event.getButton() == MouseButton::LEFT) { @@ -784,7 +788,7 @@ void TextField::focusGained(const Event &event A_UNUSED) #ifdef ANDROID if (!WindowManager::isKeyboardVisible()) inputManager.executeAction(InputAction::SHOW_KEYBOARD); -#endif +#endif // ANDROID } void TextField::focusLost(const Event &event A_UNUSED) diff --git a/src/gui/widgets/textfield.h b/src/gui/widgets/textfield.h index e5173b3f1..359d54971 100644 --- a/src/gui/widgets/textfield.h +++ b/src/gui/widgets/textfield.h @@ -181,9 +181,10 @@ class TextField notfinal : public Widget, #ifdef ANDROID void focusGained(const Event &event) override final; -#else +#else // ANDROID + void focusGained(const Event &event) override final A_CONST; -#endif +#endif // ANDROID void focusLost(const Event &event) override A_CONST; diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 55dfe166a..f0ae81f17 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -69,9 +69,9 @@ #include "configuration.h" #ifndef DYECMD #include "dragdrop.h" -#else +#else // DYECMD #include "resources/image/image.h" -#endif +#endif // DYECMD #include "soundmanager.h" #include "const/sound.h" @@ -247,7 +247,7 @@ Window::~Window() #ifndef DYECMD if (setupWindow) setupWindow->unregisterWindowForReset(this); -#endif +#endif // DYECMD client->windowRemoved(this); @@ -869,7 +869,7 @@ void Window::mousePressed(MouseEvent &event) popupMenu->showWindowPopup(this); } } -#endif +#endif // DYECMD } void Window::close() @@ -908,7 +908,7 @@ void Window::updateResizeHandler(MouseEvent &event) #ifndef DYECMD if (!dragDrop.isEmpty()) return; -#endif +#endif // DYECMD mResizeHandles = getResizeHandles(event); @@ -1481,4 +1481,4 @@ void Window::logic() logicChildren(); BLOCK_END("Window::logic") } -#endif +#endif // USE_PROFILER diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index 7aca70bd9..bc77264a2 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -578,7 +578,7 @@ class Window notfinal : public BasicContainer2, #ifdef USE_PROFILER virtual void logic(); -#endif +#endif // USE_PROFILER protected: bool canMove() const A_WARN_UNUSED; diff --git a/src/gui/widgets/windowcontainer.cpp b/src/gui/widgets/windowcontainer.cpp index b3f01d0fe..3a2f35dba 100644 --- a/src/gui/widgets/windowcontainer.cpp +++ b/src/gui/widgets/windowcontainer.cpp @@ -101,4 +101,4 @@ void WindowContainer::draw(Graphics *const graphics) Container::draw(graphics); BLOCK_END("WindowContainer::draw") } -#endif +#endif // USE_PROFILER diff --git a/src/gui/widgets/windowcontainer.h b/src/gui/widgets/windowcontainer.h index cc9b3c814..feb9d719c 100644 --- a/src/gui/widgets/windowcontainer.h +++ b/src/gui/widgets/windowcontainer.h @@ -56,7 +56,7 @@ class WindowContainer notfinal : public Container #ifdef USE_PROFILER void draw(Graphics *const graphics) override A_NONNULL(2); -#endif +#endif // UNITTESTS private: /** |