Skip to content

Commit

Permalink
Move hsMessageBox from CoreLib to PubUtilLib/plMessageBox
Browse files Browse the repository at this point in the history
  • Loading branch information
dpogue committed Aug 16, 2023
1 parent 6f85e90 commit 9d91abf
Show file tree
Hide file tree
Showing 40 changed files with 325 additions and 209 deletions.
1 change: 1 addition & 0 deletions Sources/Plasma/Apps/plClient/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ target_link_libraries(
plGLight
plInputCore
plMessage
plMessageBox
plModifier
plNetClient
plNetCommon
Expand Down
1 change: 1 addition & 0 deletions Sources/Plasma/Apps/plClient/Mac-Cocoa/main.mm
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
#include "pfGameGUIMgr/pfGameGUIMgr.h"
#include "plInputCore/plInputDevice.h"
#include "plMessage/plDisplayScaleChangedMsg.h"
#include "plMessageBox/hsMessageBox.h"
#include "plNetClient/plNetClientMgr.h"
#include "plNetGameLib/plNetGameLib.h"
#include "plProduct.h"
Expand Down
1 change: 1 addition & 0 deletions Sources/Plasma/Apps/plClient/plClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plMessage/plResPatcherMsg.h"
#include "plMessage/plRoomLoadNotifyMsg.h"
#include "plMessage/plTransitionMsg.h"
#include "plMessageBox/hsMessageBox.h"
#include "plModifier/plSimpleModifier.h"
#include "plNetClient/plLinkEffectsMgr.h"
#include "plNetClient/plNetLinkingMgr.h"
Expand Down
1 change: 1 addition & 0 deletions Sources/Plasma/Apps/plClient/plClientLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plPipeline.h"

#include "plClientResMgr/plClientResMgr.h"
#include "plMessageBox/hsMessageBox.h"
#include "plNetClient/plNetClientMgr.h"
#include "plPhysX/plSimulationMgr.h"
#include "plResMgr/plResManager.h"
Expand Down
1 change: 1 addition & 0 deletions Sources/Plasma/Apps/plClient/win32/winmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plNetClient/plNetClientMgr.h"
#include "plNetGameLib/plNetGameLib.h"
#include "plMessage/plDisplayScaleChangedMsg.h"
#include "plMessageBox/hsMessageBox.h"
#include "plPhysX/plPXSimulation.h"
#include "plPipeline/hsG3DDeviceSelector.h"
#include "plResMgr/plLocalization.h"
Expand Down
1 change: 1 addition & 0 deletions Sources/Plasma/Apps/plCrashHandler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ target_link_libraries(
PRIVATE
CoreLib
plClipboard
plMessageBox
pfCrashHandler

$<$<PLATFORM_ID:Windows>:Comctl32>
Expand Down
1 change: 1 addition & 0 deletions Sources/Plasma/Apps/plCrashHandler/winmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "resource.h"

#include "plClipboard/plClipboard.h"
#include "plMessageBox/hsMessageBox.h"

#include "pfCrashHandler/plCrashSrv.h"

Expand Down
1 change: 1 addition & 0 deletions Sources/Plasma/Apps/plUruLauncher/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ target_link_libraries(
CoreLib
pnAsyncCore
pnNetBase
plMessageBox
plNetGameLib
plStatusLog
plWinDpi
Expand Down
1 change: 1 addition & 0 deletions Sources/Plasma/Apps/plUruLauncher/plClientLauncher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Mead, WA 99021

#include "pnAsyncCore/pnAsyncCore.h"

#include "plMessageBox/hsMessageBox.h"
#include "plNetGameLib/plNetGameLib.h"
#include "plStatusLog/plStatusLog.h"

Expand Down
3 changes: 0 additions & 3 deletions Sources/Plasma/CoreLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ set(CoreLib_SOURCES
plProduct.cpp
plViewTransform.cpp
hsWindows.cpp
$<$<PLATFORM_ID:Darwin>:HeadSpin_Mac.mm>
$<$<PLATFORM_ID:Windows>:HeadSpin_Win.cpp>
)

if(CMAKE_USE_WIN32_THREADS_INIT)
Expand Down Expand Up @@ -85,7 +83,6 @@ target_link_libraries(
"$<$<PLATFORM_ID:Darwin>:-framework Accelerate>"
PRIVATE
"$<$<PLATFORM_ID:Darwin>:-framework CoreFoundation>"
"$<$<PLATFORM_ID:Darwin>:-framework Cocoa>"
)
target_include_directories(
CoreLib
Expand Down
39 changes: 0 additions & 39 deletions Sources/Plasma/CoreLib/HeadSpin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,45 +273,6 @@ void hsStatusMessageF(const char * fmt, ...)

#endif

bool hsMessageBox_SuppressPrompts = false;

#if !defined(HS_BUILD_FOR_APPLE) && !defined(HS_BUILD_FOR_WIN32)
// Need a proper implementation for Linux, but for now let's just print out to the console
int hsMessageBoxWithOwner(hsWindowHndl owner, const ST::string& message, const ST::string& caption, int kind, int icon)
{
if (hsMessageBox_SuppressPrompts)
return hsMBoxOk;

hsStatusMessage(ST::format("{}\n{}", message, caption).c_str());
return hsMBoxCancel;
}
#endif

int hsMessageBoxWithOwner(hsWindowHndl owner, const char* message, const char* caption, int kind, int icon)
{
return hsMessageBoxWithOwner(owner, ST::string::from_latin_1(message), ST::string::from_latin_1(caption), kind, icon);
}

int hsMessageBoxWithOwner(hsWindowHndl owner, const wchar_t* message, const wchar_t* caption, int kind, int icon)
{
return hsMessageBoxWithOwner(owner, ST::string::from_wchar(message), ST::string::from_wchar(caption), kind, icon);
}

int hsMessageBox(const ST::string& message, const ST::string& caption, int kind, int icon)
{
return hsMessageBoxWithOwner(nullptr, message, caption, kind, icon);
}

int hsMessageBox(const char* message, const char* caption, int kind, int icon)
{
return hsMessageBoxWithOwner(nullptr, ST::string::from_latin_1(message), ST::string::from_latin_1(caption), kind, icon);
}

int hsMessageBox(const wchar_t* message, const wchar_t* caption, int kind, int icon)
{
return hsMessageBoxWithOwner(nullptr, ST::string::from_wchar(message), ST::string::from_wchar(caption), kind, icon);
}

/**************************************/
char* hsStrcpy(char* dst, const char* src)
{
Expand Down
36 changes: 0 additions & 36 deletions Sources/Plasma/CoreLib/HeadSpin.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include <cstdint>
#include <type_traits>

namespace ST { class string; }

//======================================
// Winblows Hacks
//======================================
Expand Down Expand Up @@ -278,40 +276,6 @@ inline char *hsStrncpy(char *strDest, const char *strSource, size_t count)
# define strnicmp strncasecmp
#endif

enum { // Kind of MessageBox...passed to hsMessageBox
hsMessageBoxAbortRetyIgnore,
hsMessageBoxNormal, // Just Ok
hsMessageBoxOkCancel,
hsMessageBoxRetryCancel,
hsMessageBoxYesNo,
hsMessageBoxYesNoCancel,
};

enum {
hsMessageBoxIconError,
hsMessageBoxIconQuestion,
hsMessageBoxIconExclamation,
hsMessageBoxIconAsterisk,
};

enum { // RETURN VALUES FROM hsMessageBox
hsMBoxOk = 1, // OK button was selected.
hsMBoxCancel, // Cancel button was selected.
hsMBoxAbort, // Abort button was selected.
hsMBoxRetry, // Retry button was selected.
hsMBoxIgnore, // Ignore button was selected.
hsMBoxYes, // Yes button was selected.
hsMBoxNo // No button was selected.
};

extern bool hsMessageBox_SuppressPrompts;
int hsMessageBox(const ST::string& message, const ST::string& caption, int kind, int icon=hsMessageBoxIconAsterisk);
int hsMessageBox(const char* message, const char* caption, int kind, int icon=hsMessageBoxIconAsterisk);
int hsMessageBox(const wchar_t* message, const wchar_t* caption, int kind, int icon=hsMessageBoxIconAsterisk);
int hsMessageBoxWithOwner(hsWindowHndl owner, const ST::string& message, const ST::string& caption, int kind, int icon=hsMessageBoxIconAsterisk);
int hsMessageBoxWithOwner(hsWindowHndl owner, const char* message, const char* caption, int kind, int icon=hsMessageBoxIconAsterisk);
int hsMessageBoxWithOwner(hsWindowHndl owner, const wchar_t* message, const wchar_t* caption, int kind, int icon=hsMessageBoxIconAsterisk);

// flag testing / clearing
#define hsCheckBits(f,c) ((f & c)==c)
#define hsTestBits(f,b) ( (f) & (b) )
Expand Down
123 changes: 0 additions & 123 deletions Sources/Plasma/CoreLib/HeadSpin_Mac.mm

This file was deleted.

1 change: 1 addition & 0 deletions Sources/Plasma/FeatureLib/pfConsole/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ target_link_libraries(
plNetGameLib
plNetMessage
plMessage
plMessageBox
plModifier
plParticleSystem
plPhysical
Expand Down
1 change: 1 addition & 0 deletions Sources/Plasma/FeatureLib/pfConsole/pfConsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plMessage/plConsoleMsg.h"
#include "plMessage/plInputEventMsg.h"
#include "plMessage/plInputIfaceMgrMsg.h"
#include "plMessageBox/hsMessageBox.h"
#include "plPipeline/plDebugText.h"

#include "pfConsoleCore/pfConsoleEngine.h"
Expand Down
1 change: 1 addition & 0 deletions Sources/Plasma/FeatureLib/pfConsole/pfConsoleDirSrc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com

#include "HeadSpin.h"
#include "hsExceptions.h"
#include "plMessageBox/hsMessageBox.h"


//// ParseDirectory //////////////////////////////////////////////////////////
Expand Down
1 change: 1 addition & 0 deletions Sources/Plasma/FeatureLib/pfDXPipeline/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ target_link_libraries(pfDXPipeline
plGImage
plGLight
plMessage
plMessageBox
plResMgr
plScene
plStatusLog
Expand Down
1 change: 1 addition & 0 deletions Sources/Plasma/FeatureLib/pfDXPipeline/plDXPipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plGLight/plShadowMaster.h"
#include "plGLight/plShadowSlave.h"
#include "plMessage/plDeviceRecreateMsg.h"
#include "plMessageBox/hsMessageBox.h"
#include "plResMgr/plLocalization.h"
#include "plScene/plRenderRequest.h"
#include "plScene/plVisMgr.h"
Expand Down
1 change: 1 addition & 0 deletions Sources/Plasma/PubUtilLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ add_subdirectory(plInterp)
add_subdirectory(plIntersect)
add_subdirectory(plMath)
add_subdirectory(plMessage)
add_subdirectory(plMessageBox)
add_subdirectory(plModifier)
add_subdirectory(plNetClient)
add_subdirectory(plNetClientComm)
Expand Down
1 change: 1 addition & 0 deletions Sources/Plasma/PubUtilLib/plAvatar/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ target_link_libraries(
plInputCore
plInterp
plMessage
plMessageBox
plNetClient
plNetCommon
plNetMessage
Expand Down
1 change: 1 addition & 0 deletions Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plDrawable/plSpaceTree.h"
#include "plGImage/plMipmap.h"
#include "plMessage/plRenderMsg.h"
#include "plMessageBox/hsMessageBox.h"
#include "plResMgr/plKeyFinder.h"
#include "plSDL/plSDL.h"
#include "plSurface/hsGMaterial.h"
Expand Down
1 change: 1 addition & 0 deletions Sources/Plasma/PubUtilLib/plGImage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ target_link_libraries(
pnDispatch
pnMessage
pnNucleusInc
plMessageBox
plResMgr
JPEG::JPEG
PNG::PNG
Expand Down
1 change: 1 addition & 0 deletions Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "hsTimer.h"
#include "plMipmap.h"
#include "plMessage/plRenderMsg.h"
#include "plMessageBox/hsMessageBox.h"
#include "plPipeline.h"
#include "pnDispatch/plDispatch.h"
#include "pnKeyedObject/plFixedKey.h"
Expand Down
Loading

0 comments on commit 9d91abf

Please sign in to comment.