X Tutup
Skip to content

Commit a304f85

Browse files
committed
ALL: Remove USE_PRINTING and implement no-op default print manager
WIN32-specific printing is behind --enable-system-printing configure option
1 parent efa71e3 commit a304f85

File tree

14 files changed

+21
-53
lines changed

14 files changed

+21
-53
lines changed

backends/platform/sdl/win32/win32.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ void OSystem_Win32::init() {
8585
initializeJpegLibraryForWin95();
8686
#endif
8787

88-
#if defined(USE_PRINTING)
88+
#if defined(USE_SYSTEM_PRINTING)
8989
_printingManager = createWin32PrintingManager();
9090
#endif
9191

@@ -158,11 +158,6 @@ bool OSystem_Win32::hasFeature(Feature f) {
158158
return true;
159159
#endif
160160

161-
#ifdef USE_PRINTING
162-
if (f == kFeaturePrinting)
163-
return true;
164-
#endif
165-
166161
return OSystem_SDL::hasFeature(f);
167162
}
168163

backends/printing/printman.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
*
2020
*/
2121

22-
#ifdef USE_PRINTING
23-
2422
#include "common/config-manager.h"
2523
#include "common/file.h"
2624
#include "common/savefile.h"
@@ -96,6 +94,8 @@ void PrintingManager::saveAsImage(const Graphics::ManagedSurface &surf, const Co
9694
delete saveFile;
9795
}
9896

99-
} // End of namespace Common
97+
void PrintingManager::doPrint(const Graphics::ManagedSurface &surf) {
98+
warning("PrintingManager::doPrint: No printing support in this backend");
99+
}
100100

101-
#endif
101+
} // End of namespace Common

backends/printing/printman.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class PrintingManager {
5656
void setJobName(const Common::String &jobName) { _jobName = jobName; }
5757

5858
protected:
59-
virtual void doPrint(const Graphics::ManagedSurface &surf) = 0;
59+
virtual void doPrint(const Graphics::ManagedSurface &surf);
6060

6161
virtual Common::StringArray listPrinterNames() const;
6262

backends/printing/win32/win32-printman.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*
2020
*/
2121

22-
#ifdef USE_PRINTING
22+
#ifdef USE_SYSTEM_PRINTING
2323
#ifdef WIN32
2424

2525
#define WIN32_LEAN_AND_MEAN

common/system.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ OSystem::OSystem() {
4848
_eventManager = nullptr;
4949
_timerManager = nullptr;
5050
_savefileManager = nullptr;
51-
#if defined(USE_PRINTING)
5251
_printingManager = nullptr;
53-
#endif
5452
#if defined(USE_TASKBAR)
5553
_taskbarManager = nullptr;
5654
#endif
@@ -76,10 +74,8 @@ OSystem::~OSystem() {
7674
delete _timerManager;
7775
_timerManager = nullptr;
7876

79-
#if defined(USE_PRINTING)
8077
delete _printingManager;
8178
_printingManager = nullptr;
82-
#endif
8379

8480
#if defined(USE_TASKBAR)
8581
delete _taskbarManager;
@@ -126,6 +122,10 @@ void OSystem::initBackend() {
126122
// if (!_fsFactory)
127123
// error("Backend failed to instantiate fs factory");
128124

125+
// Initialize default printing manager unless overridden by backend
126+
if (!_printingManager)
127+
_printingManager = new Common::PrintingManager();
128+
129129
_backendInitialized = true;
130130
}
131131

common/system.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ class TextToSpeechManager;
6969
#if defined(USE_SYSDIALOGS)
7070
class DialogManager;
7171
#endif
72-
#if defined(USE_PRINTING)
7372
class PrintingManager;
74-
#endif
7573
class TimerManager;
7674
class SeekableReadStream;
7775
class WriteStream;
@@ -267,14 +265,12 @@ class OSystem : Common::NonCopyable {
267265
*/
268266
FilesystemFactory *_fsFactory;
269267

270-
#if defined(USE_PRINTING)
271268
/**
272269
* No default value is provided for _printingManager by OSystem.
273270
*
274271
* @note _printingManager is deleted by the OSystem destructor.
275272
*/
276273
Common::PrintingManager *_printingManager;
277-
#endif
278274

279275
/**
280276
* Used by the DLC Manager implementation
@@ -598,11 +594,6 @@ class OSystem : Common::NonCopyable {
598594
*/
599595
kFeatureNoQuit,
600596

601-
/**
602-
* Putting text and/or images on physical paper
603-
*/
604-
kFeaturePrinting,
605-
606597
/**
607598
* The presence of this feature indicates that the backend uses a touchscreen.
608599
*
@@ -1809,7 +1800,6 @@ class OSystem : Common::NonCopyable {
18091800
return _textToSpeechManager;
18101801
}
18111802

1812-
#if defined(USE_PRINTING)
18131803
/**
18141804
* Return the PrintingManager, used to handle printing.
18151805
*
@@ -1818,7 +1808,6 @@ class OSystem : Common::NonCopyable {
18181808
virtual Common::PrintingManager *getPrintingManager() {
18191809
return _printingManager;
18201810
}
1821-
#endif
18221811

18231812
#if defined(USE_SYSDIALOGS)
18241813
/**

configure

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,8 +1409,8 @@ for ac_option in $@; do
14091409
--disable-vkeybd) _vkeybd=no ;;
14101410
--enable-eventrecorder) _eventrec=yes ;;
14111411
--disable-eventrecorder) _eventrec=no ;;
1412-
--enable-printing) _printing=yes ;;
1413-
--disable-printing) _printing=no ;;
1412+
--enable-system-printing) _printing=yes ;;
1413+
--disable-system-printing) _printing=no ;;
14141414
--enable-text-console) _text_console=yes ;;
14151415
--disable-text-console) _text_console=no ;;
14161416
--enable-ext-sse2) _ext_sse2=yes ;;
@@ -7238,8 +7238,12 @@ case $_host_os in
72387238
mingw*)
72397239
echo "win32"
72407240
append_var LIBS '-lMsimg32'
7241+
;;
7242+
*)
7243+
echo "no"
7244+
;;
72417245
esac
7242-
define_in_config_if_yes $_printing 'USE_PRINTING'
7246+
define_in_config_if_yes $_printing 'USE_SYSTEM_PRINTING'
72437247

72447248
#
72457249
# Check whether to build system dialogs support

devtools/create_project/create_project.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1221,7 +1221,7 @@ const Feature s_features[] = {
12211221
{ "translation", "USE_TRANSLATION", false, true, "Translation support" },
12221222
{ "vkeybd", "ENABLE_VKEYBD", false, false, "Virtual keyboard support"},
12231223
{ "eventrecorder", "ENABLE_EVENTRECORDER", false, false, "Event recorder support"},
1224-
{ "printing", "USE_PRINTING", false, true, "Printing support"},
1224+
{ "printing", "USE_SYSTEM_PRINTING", false, true, "Printing support"},
12251225
{ "updates", "USE_UPDATES", false, false, "Updates support"},
12261226
{ "dialogs", "USE_SYSDIALOGS", false, true, "System dialogs support"},
12271227
{ "langdetect", "USE_DETECTLANG", false, true, "System language detection support" }, // This feature actually depends on "translation", there

engines/director/debugger/dt-score.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ void showScore() {
616616
if (ImGui::BeginCombo("##mode", selMode)) {
617617
for (int n = 0; n < ARRAYSIZE(modes); n++) {
618618
const bool selected = (_state->_scoreMode == n);
619-
if (ImGui::Selectable(modes[n], selected))
619+
if (ImGui::Selectable(Common::String::format("%s##%d", modes[n], n).c_str(), selected))
620620
_state->_scoreMode = n;
621621

622622
if (selected)

engines/testbed/printing.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
*
2020
*/
2121

22-
#if defined(USE_PRINTING)
23-
2422
#include "base/version.h"
2523

2624
#include "common/rect.h"
@@ -82,5 +80,3 @@ TestExitStatus PrintingTests::printTestPage() {
8280
}
8381

8482
} // End of namespace Testbed
85-
86-
#endif

0 commit comments

Comments
 (0)
X Tutup