Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d52b049
kauai/tools/chomp.cpp: remove __cdecl from main() function declaration
mcayland Nov 22, 2025
b4ade8f
kauai/src/fni.h: replace HWND with KWND to indicate owner window
mcayland Nov 22, 2025
d4362d3
kauai/src/platform.h: add GetExecutableName() platform function for n…
mcayland Nov 22, 2025
d62cb88
kauai/src: add new fniposix.cpp implementation
mcayland Nov 22, 2025
17bc787
kauai/src: add new fileposix.cpp implementation
mcayland Nov 22, 2025
a4e1acf
kauai/src/appb.cpp: replace MacWin() macro usage
mcayland Nov 22, 2025
aa26bbf
kauai/src/appb.cpp: fix up APPB::WarnProcApp() for non-Windows platforms
mcayland Nov 22, 2025
0869e74
kauai/src/gfx.cpp: replace Mac() macro usage
mcayland Nov 22, 2025
00f47ab
kauai/src/gob.cpp: implement GOB::FGetRcInval() for non-Windows platf…
mcayland Nov 22, 2025
9e6393e
kauai/src/gob.cpp: implement GOB::_HwndGetDptFromCoo() for non-Window…
mcayland Nov 22, 2025
9add2c1
kauai/src/gob.cpp: implement GOB::PgobFromPtGlobal() for non-Windows …
mcayland Nov 22, 2025
4c7cd09
kauai/src/appbsdl.cpp: fix APPB::CreateConsole() for non-Windows plat…
mcayland Nov 22, 2025
d8cab3d
kauai/src/appbsdl.cpp: don't compile Windows platform code for SDL_SY…
mcayland Nov 22, 2025
28d5d4d
kauai/src/gfxsdl.cpp: ignore GPT::PgptNew() on non-Windows platforms
mcayland Nov 22, 2025
b54fad0
kauai/src/gfxsdl.cpp: remove unused HDC variable from GPT::PgptNewHwnd()
mcayland Nov 22, 2025
4f361f0
kauai/src/gfxsdl.cpp: replace byte type with cstdint uint8_t type
mcayland Nov 22, 2025
9726bf2
kauai/src/fontsdl.cpp: replace BOOL type with cstdint bool type
mcayland Nov 22, 2025
acb783f
kauai/src/clip.cpp: move #ifdef WIN in CLIP::FInitExport()
mcayland Nov 22, 2025
b14073a
kauai/src/docb.cpp: enable DSG class for non-classic Mac platforms
mcayland Nov 22, 2025
d532f53
kauai/src/ctl.cpp: fix compilation on non-Windows platforms
mcayland Nov 22, 2025
fdd903c
kauai/src: add new picstub.cpp implementation
mcayland Nov 22, 2025
bd8b6d9
kauai/CMakeLists.txt: add missing KauaiBase dependency to khello
mcayland Nov 22, 2025
c0ebcb2
cmake/TargetChompSources.cmake: add gcc support to studio-chomp-chunk…
mcayland Nov 22, 2025
cc951c2
kauai/tools/chomp.c: fix options parser for filenames beginning with /
mcayland Nov 22, 2025
c465cf3
kauai/src/utilstr.cpp: implement FEqualUserRgch() for non-Windows pla…
mcayland Nov 22, 2025
349dc52
kauai/src/chcm.cpp: implement CHLX::FGetPath() for non-Windows platforms
mcayland Nov 22, 2025
73344b8
kauai/src/mbmp.cpp: implement BITMAPFILEHEADER and BITMAPINFOHEADER f…
mcayland Nov 22, 2025
585a0e8
kauai/src/lex.cpp: use UNIX-style line endings on non-Windows platforms
mcayland Nov 22, 2025
9ba681d
kauai/src/lex.cpp: read gcc pre-processor soure file information from…
mcayland Nov 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion cmake/TargetChompSources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ function(target_chomp_sources target)

set(is-msvc 0)
set(is-clangcl 0)
set(is-gcc 0)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(is-msvc 1)
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND "${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "MSVC")
set(is-msvc 1)
set(is-clangcl 1)
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(is-gcc 1)
endif()

set(external-chomp 0)
Expand Down Expand Up @@ -56,6 +59,9 @@ function(target_chomp_sources target)
"$<${is-msvc}:/E>"
"$<${is-msvc}:/TP>"
"$<${is-clangcl}:/clang:-fuse-line-directives>"
"$<${is-gcc}:-E>"
"$<${is-gcc}:-x>"
"$<${is-gcc}:c>"
"${include-directories}"
"${compile-definitions}"
"${source}" > "${processed}"
Expand All @@ -78,4 +84,4 @@ function(target_chomp_sources target)
add_custom_target(${target}-chomp-chunks
DEPENDS $<TARGET_PROPERTY:${target},CHOMPED_CHUNKS>)
add_dependencies(${target} ${target}-chomp-chunks)
endfunction()
endfunction()
38 changes: 20 additions & 18 deletions kauai/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ add_library(KauaiFile
# Windows implementations
$<$<PLATFORM_ID:Windows>:${PROJECT_SOURCE_DIR}/kauai/src/filewin.cpp>
$<$<PLATFORM_ID:Windows>:${PROJECT_SOURCE_DIR}/kauai/src/fniwin.cpp>

# Linux implementations
$<$<PLATFORM_ID:Linux>:${PROJECT_SOURCE_DIR}/kauai/src/fileposix.cpp>
$<$<PLATFORM_ID:Linux>:${PROJECT_SOURCE_DIR}/kauai/src/fniposix.cpp>
)
if (ENABLE_ASM_X86)
target_sources(
Expand Down Expand Up @@ -307,6 +311,7 @@ endif()
add_library(KauaiPic
"${PROJECT_SOURCE_DIR}/kauai/src/pic.cpp"
$<$<PLATFORM_ID:Windows>:${PROJECT_SOURCE_DIR}/kauai/src/picwin.cpp>
$<$<NOT:$<PLATFORM_ID:Windows>>:${PROJECT_SOURCE_DIR}/kauai/src/picstub.cpp>
)
target_link_libraries(
KauaiPic
Expand Down Expand Up @@ -485,17 +490,15 @@ elseif(3DMM_GUI STREQUAL "SDL")
# SDL dialogs are implemented in the studio project
endif()

# Ctl: Control support (Win32 only)
if (3DMM_GUI STREQUAL "Win32")
add_library(KauaiCtl
"${PROJECT_SOURCE_DIR}/kauai/src/ctl.cpp"
)
target_link_libraries(
KauaiCtl
PUBLIC
KauaiGui
)
endif()
# Ctl: Control support
Comment thread
mcayland marked this conversation as resolved.
add_library(KauaiCtl
"${PROJECT_SOURCE_DIR}/kauai/src/ctl.cpp"
)
target_link_libraries(
KauaiCtl
PUBLIC
KauaiGui
)

# Doc: Base document class support
add_library(KauaiDoc
Expand All @@ -508,13 +511,11 @@ target_link_libraries(
KauaiGui
)

if (3DMM_GUI STREQUAL "Win32")
target_link_libraries(
KauaiDoc
PRIVATE
KauaiCtl
)
endif()
target_link_libraries(
KauaiDoc
PRIVATE
KauaiCtl
)

# RichText: Rich text document support
add_library(KauaiRichText
Expand Down Expand Up @@ -669,6 +670,7 @@ target_sources(khello
target_link_libraries(
khello
PRIVATE
KauaiBase
KauaiGui
KauaiGuiMain
KauaiDoc # TODO: should this be a dependency of KauaiGui?
Expand Down
23 changes: 19 additions & 4 deletions kauai/src/appb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,11 @@ int32_t APPB::OnnDefVariable(void)
{
STN stn;

stn = MacWin(PszLit("New York"), PszLit("Times New Roman"));
#ifdef MAC
stn = PszLit("New York");
#else
stn = PszLit("Times New Roman");
#endif
if (!vntl.FGetOnn(&stn, &_onnDefVariable))
_onnDefVariable = vntl.OnnSystem();
}
Expand All @@ -215,7 +219,11 @@ int32_t APPB::OnnDefFixed(void)
{
STN stn;

stn = MacWin(PszLit("Courier"), PszLit("Courier New"));
#ifdef MAC
stn = PszLit("Courier");
#else
stn = PszLit("Courier New");
#endif
if (!vntl.FGetOnn(&stn, &_onnDefFixed))
{
// just use the first fixed pitch font
Expand Down Expand Up @@ -1664,8 +1672,15 @@ void APPB::WarnProcApp(PSZS pszsFile, int32_t lwLine, PSZS pszsMsg)
stnFile.SetSzs(pszsFile);
stnMsg.SetSzs(pszsMsg);

stn.FFormatSz(PszLit("%s(%d): %s\xD") Win(PszLit("\xA")), &stnFile, lwLine, &stnMsg);
Win(OutputDebugString(stn.Psz());) _pfilWarn->FWriteRgbSeq(stn.Prgch(), stn.Cch(), &_fpCur);
#ifdef WIN
stn.FFormatSz(PszLit("%s(%d): %s\xD\xA"), &stnFile, lwLine, &stnMsg);
OutputDebugString(stn.Psz());
#elif defined(MAC)
stn.FFormatSz(PszLit("%s(%d): %s\xD"), &stnFile, lwLine, &stnMsg);
#else
stn.FFormatSz(PszLit("%s(%d): %s\xA"), &stnFile, lwLine, &stnMsg);
#endif
_pfilWarn->FWriteRgbSeq(stn.Prgch(), stn.Cch(), &_fpCur);

LDone:
_fInWarn = fFalse;
Expand Down
2 changes: 1 addition & 1 deletion kauai/src/appb.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ class APPB : public APPB_PAR
// setting up the heap
static void _SetupHeap(int32_t cbExtraStack, int32_t cactMoreMasters);
virtual void SetupHeap(void);
#elif defined(WIN)
#else
static void CreateConsole();
#endif

Expand Down
4 changes: 3 additions & 1 deletion kauai/src/appbsdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ void APPB::CreateConsole()
freopen_s(&fDummy, "CONOUT$", "w", stdout);
freopen_s(&fDummy, "CONOUT$", "w", stderr);
freopen_s(&fDummy, "CONIN$", "r", stdin);
#endif // WIN32
std::cout.clear();
std::clog.clear();
std::cerr.clear();
std::cin.clear();
#endif // WIN32
}

/***************************************************************************
Expand Down Expand Up @@ -251,6 +251,7 @@ void APPB::_DispatchEvt(PEVT pevt)
ResetToolTip();
break;
case SDL_SYSWMEVENT:
#ifdef WIN
if (pevt->syswm.msg->msg.win.msg == WM_COMMAND)
{
int32_t lwT = pevt->syswm.msg->msg.win.wParam;
Expand All @@ -263,6 +264,7 @@ void APPB::_DispatchEvt(PEVT pevt)
else if (pvNil != vpcex)
vpcex->EnqueueCid(lwT);
}
#endif
break;
case SDL_MOUSEBUTTONDOWN:
ResetToolTip();
Expand Down
2 changes: 1 addition & 1 deletion kauai/src/chcm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2344,7 +2344,7 @@ bool CHLX::FGetPath(FNI *pfni)
stn.FAppendCh(ch);
}

#ifdef WIN
#ifndef MAC
if (pfni->FSearchInPath(&stn, _pszSearchPath))
{
return fTrue;
Expand Down
2 changes: 1 addition & 1 deletion kauai/src/clip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,9 @@ bool CLIP::FInitExport(void)
return fFalse;
}

#ifdef WIN
_hnExport = hNil;

#ifdef WIN
if (!OpenClipboard(vwig.hwndApp))
return fFalse;
if (!EmptyClipboard())
Expand Down
19 changes: 11 additions & 8 deletions kauai/src/ctl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ PCTL CTL::PctlFromHctl(HCTL hctl)
***************************************************************************/
void CTL::_NewRc(void)
{
#ifdef WIN
RC rc;
RECT rcs;
HWND hwnd;
Expand All @@ -108,6 +109,7 @@ void CTL::_NewRc(void)
hwnd = _HwndGetRc(&rc);
Assert(hwnd != hNil, "control isn't based in an hwnd");
rcs = RCS(rc);
#endif
#ifdef MAC
RCS rcsOld = (*_hctl)->contrlRect;

Expand Down Expand Up @@ -203,10 +205,9 @@ int32_t SCB::DxpNormal(void)
if (_dxp > 0)
return _dxp;
return (_dxp = GetSystemMetrics(SM_CXVSCROLL));
#endif // WIN
#ifdef MAC
#else // WIN
return 16;
#endif // MAC
#endif
}

/***************************************************************************
Expand All @@ -220,10 +221,9 @@ int32_t SCB::DypNormal(void)
if (_dyp > 0)
return _dyp;
return (_dyp = GetSystemMetrics(SM_CYHSCROLL));
#endif // WIN
#ifdef MAC
#else // WIN
return 16;
#endif // MAC
#endif
}

/***************************************************************************
Expand Down Expand Up @@ -273,6 +273,8 @@ void SCB::GetClientRc(uint32_t grfscb, RC *prcAbs, RC *prcRel)
bool SCB::_FCreate(int32_t val, int32_t valMin, int32_t valMax, uint32_t grfscb)
{
Assert(_Hctl() == hNil, "scb already created");
bool redraw = fFalse;
#ifdef WIN
RC rc;
HWND hwnd;
HCTL hctl;
Expand All @@ -283,7 +285,7 @@ bool SCB::_FCreate(int32_t val, int32_t valMin, int32_t valMax, uint32_t grfscb)
Bug("can only add controls to hwnd based gobs");
return fFalse;
}

#endif
#ifdef MAC
GNV gnv(this);
gnv.Set();
Expand All @@ -292,6 +294,7 @@ bool SCB::_FCreate(int32_t val, int32_t valMin, int32_t valMax, uint32_t grfscb)
if (hctl == hNil || !_FSetHctl(hctl))
return fFalse;
ValidRc(pvNil);
redraw = true;
#endif // MAC
#ifdef WIN
RECT rcs(rc);
Expand All @@ -303,7 +306,7 @@ bool SCB::_FCreate(int32_t val, int32_t valMin, int32_t valMax, uint32_t grfscb)
SetScrollPos(hctl, SB_CTL, 0, fFalse);
#endif // WIN

SetValMinMax(val, valMin, valMax, MacWin(fTrue, fFalse));
SetValMinMax(val, valMin, valMax, redraw);
return fTrue;
}

Expand Down
11 changes: 9 additions & 2 deletions kauai/src/docb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,17 @@ bool DOCB::FSaveToFni(FNI *pfni, bool fSetFni)
***************************************************************************/
bool DOCB::FGetFniSave(FNI *pfni)
{
#ifdef WIN
return FGetFniSaveMacro(pfni, 'TEXT',
"\x9"
"Save As: ",
"", PszLit("All files\0*.*\0"), vwig.hwndApp);
#else
return FGetFniSaveMacro(pfni, 'TEXT',
"\x9"
"Save As: ",
"", PszLit("All files\0*.*\0"), nullptr);
#endif
}

/***************************************************************************
Expand Down Expand Up @@ -1347,7 +1354,7 @@ void DDG::MarkMem(void)
}
#endif // DEBUG

#if defined(KAUAI_WIN32)
#ifndef MAC

/***************************************************************************
Static method: create a new Document MDI window. Put a size box in
Expand Down Expand Up @@ -2476,4 +2483,4 @@ tribool DSSM::TVert(void)
return pdmw->TVert(pdsg);
}

#endif // KAUAI_WIN32
#endif // !MAC
2 changes: 2 additions & 0 deletions kauai/src/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ class FIL : public FIL_PAR
int16_t _fref;
#elif defined(WIN)
HANDLE _hfile;
#else
FILE *_fp;
#endif // WIN

// private methods
Expand Down
Loading