Skip to content

Commit 3424fdf

Browse files
author
dashodanger
committed
Allow for FLTK < 1.4; do not build FLTK on nix platforms
1 parent 3eba035 commit 3424fdf

File tree

8 files changed

+59
-5
lines changed

8 files changed

+59
-5
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ if(UNIX)
4747
)
4848
find_package(Fontconfig REQUIRED)
4949
endif()
50+
if (NOT CONSOLE_ONLY)
51+
find_package(FLTK REQUIRED)
52+
endif()
5053
endif()
5154

5255
add_subdirectory(libraries)

libraries/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
add_subdirectory(fastPRNG)
2-
if(NOT CONSOLE_ONLY)
2+
if(WIN32 AND NOT CONSOLE_ONLY)
33
add_subdirectory(fltk)
44
endif()
55
add_subdirectory(minilua)

source/lib_util.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
#ifndef _WIN32
2525
#include <dirent.h>
26-
#include <ftw.h>
2726
#include <sys/stat.h>
2827
#include <sys/types.h>
2928
#include <unistd.h>
@@ -32,6 +31,7 @@
3231
#include <sys/stat.h>
3332
#endif
3433

34+
#include <stdarg.h>
3535
#include <stdint.h>
3636

3737
#include <algorithm>

source/m_dialog.cc

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
#include <FL/fl_ask.H>
2525
#include <FL/fl_utf8.h>
2626

27+
#include <stdarg.h>
28+
2729
#include <limits>
2830
#include <stdexcept>
2931
#include <string>
@@ -318,19 +320,33 @@ std::string DLG_OutputFilename(const char *ext, const char *preset)
318320

319321
void DLG_EditSeed(void)
320322
{
321-
;
323+
std::string user_buf;
322324

325+
#if FL_MINOR_VERSION > 3
323326
int user_response;
324-
std::string user_buf =
327+
user_buf =
325328
fl_input_str(user_response, 0 /* limit */, "%s",
326329
string_seed.empty() ? std::to_string(next_rand_seed).c_str() : string_seed.c_str(),
327330
_("Enter New Seed Number or Phrase:"));
328-
329331
// cancelled?
330332
if (user_response < 0)
331333
{
332334
return;
333335
}
336+
#else
337+
const char *fl_buf =
338+
fl_input(_("Enter New Seed Number or Phrase:"),
339+
string_seed.empty() ? std::to_string(next_rand_seed).c_str() : string_seed.c_str());
340+
// cancelled?
341+
if (!fl_buf)
342+
{
343+
return;
344+
}
345+
else
346+
{
347+
user_buf = fl_buf;
348+
}
349+
#endif
334350

335351
std::string word = {user_buf.c_str(), static_cast<size_t>(user_buf.size())};
336352
try

source/m_theme.cc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,9 +744,11 @@ class UI_ThemeWin : public Fl_Window
744744
case 3:
745745
Fl::scheme("plastic");
746746
break;
747+
#if FL_MINOR_VERSION > 3
747748
case 4:
748749
Fl::scheme("oxy");
749750
break;
751+
#endif
750752
// Shouldn't be reached, but still
751753
default:
752754
Fl::scheme("gtk+");
@@ -793,9 +795,11 @@ class UI_ThemeWin : public Fl_Window
793795
case 3:
794796
box_style = FL_PLASTIC_DOWN_BOX;
795797
break;
798+
#if FL_MINOR_VERSION > 3
796799
case 4:
797800
box_style = FL_OXY_DOWN_BOX;
798801
break;
802+
#endif
799803
default:
800804
box_style = FL_GTK_DOWN_BOX;
801805
break;
@@ -816,9 +820,11 @@ class UI_ThemeWin : public Fl_Window
816820
case 3:
817821
box_style = FL_PLASTIC_THIN_UP_BOX;
818822
break;
823+
#if FL_MINOR_VERSION > 3
819824
case 4:
820825
box_style = FL_OXY_THIN_UP_BOX;
821826
break;
827+
#endif
822828
default:
823829
box_style = FL_GTK_THIN_UP_BOX;
824830
break;
@@ -846,9 +852,11 @@ class UI_ThemeWin : public Fl_Window
846852
case 3:
847853
button_style = FL_PLASTIC_DOWN_BOX;
848854
break;
855+
#if FL_MINOR_VERSION > 3
849856
case 4:
850857
button_style = FL_OXY_DOWN_BOX;
851858
break;
859+
#endif
852860
default:
853861
button_style = FL_GTK_DOWN_BOX;
854862
break;
@@ -869,9 +877,11 @@ class UI_ThemeWin : public Fl_Window
869877
case 3:
870878
button_style = FL_PLASTIC_UP_BOX;
871879
break;
880+
#if FL_MINOR_VERSION > 3
872881
case 4:
873882
button_style = FL_OXY_UP_BOX;
874883
break;
884+
#endif
875885
default:
876886
button_style = FL_GTK_UP_BOX;
877887
break;
@@ -990,9 +1000,11 @@ class UI_ThemeWin : public Fl_Window
9901000
case 3:
9911001
box_style = FL_PLASTIC_DOWN_BOX;
9921002
break;
1003+
#if FL_MINOR_VERSION > 3
9931004
case 4:
9941005
box_style = FL_OXY_DOWN_BOX;
9951006
break;
1007+
#endif
9961008
default:
9971009
box_style = FL_GTK_DOWN_BOX;
9981010
break;
@@ -1013,9 +1025,11 @@ class UI_ThemeWin : public Fl_Window
10131025
case 3:
10141026
box_style = FL_PLASTIC_THIN_UP_BOX;
10151027
break;
1028+
#if FL_MINOR_VERSION > 3
10161029
case 4:
10171030
box_style = FL_OXY_THIN_UP_BOX;
10181031
break;
1032+
#endif
10191033
default:
10201034
box_style = FL_GTK_THIN_UP_BOX;
10211035
break;
@@ -1070,9 +1084,11 @@ class UI_ThemeWin : public Fl_Window
10701084
case 3:
10711085
button_style = FL_PLASTIC_DOWN_BOX;
10721086
break;
1087+
#if FL_MINOR_VERSION > 3
10731088
case 4:
10741089
button_style = FL_OXY_DOWN_BOX;
10751090
break;
1091+
#endif
10761092
default:
10771093
button_style = FL_GTK_DOWN_BOX;
10781094
break;
@@ -1093,9 +1109,11 @@ class UI_ThemeWin : public Fl_Window
10931109
case 3:
10941110
button_style = FL_PLASTIC_UP_BOX;
10951111
break;
1112+
#if FL_MINOR_VERSION > 3
10961113
case 4:
10971114
button_style = FL_OXY_UP_BOX;
10981115
break;
1116+
#endif
10991117
default:
11001118
button_style = FL_GTK_UP_BOX;
11011119
break;
@@ -1756,7 +1774,11 @@ UI_ThemeWin::UI_ThemeWin(int W, int H, const char *label) : Fl_Window(W, H, labe
17561774
opt_widget_theme = new UI_CustomMenu(cx + W * .38, cy, listwidth, KromulentHeight(24), "");
17571775
opt_widget_theme->copy_label(_("Widget Theme: "));
17581776
opt_widget_theme->align(FL_ALIGN_LEFT);
1777+
#if FL_MINOR_VERSION > 3
17591778
opt_widget_theme->add(_("Default|Gleam|Win95|Plastic|Oxy"));
1779+
#else
1780+
opt_widget_theme->add(_("Default|Gleam|Win95|Plastic"));
1781+
#endif
17601782
opt_widget_theme->callback(callback_WidgetTheme, this);
17611783
opt_widget_theme->value(widget_theme);
17621784
opt_widget_theme->labelfont(font_style);

source/main.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,9 +696,11 @@ void Main::SetupFLTK()
696696
Fl::get_color(GRADIENT_COLOR, gradient_red, gradient_green, gradient_blue);
697697
Fl::get_color(BUTTON_COLOR, button_red, button_green, button_blue);
698698
}
699+
#if FL_MINOR_VERSION > 3
699700
Fl::set_boxtype(FL_OXY_UP_BOX, coxy_up_box, 2, 2, 4, 4);
700701
Fl::set_boxtype(FL_OXY_THIN_UP_BOX, coxy_up_box, 1, 1, 2, 2);
701702
Fl::set_boxtype(FL_OXY_DOWN_BOX, coxy_down_box, 2, 2, 4, 4);
703+
#endif
702704
Fl::set_boxtype(FL_GLEAM_UP_BOX, cgleam_up_box, 2, 2, 4, 4);
703705
Fl::set_boxtype(FL_GLEAM_THIN_UP_BOX, cgleam_thin_up_box, 2, 2, 4, 4);
704706
Fl::set_boxtype(FL_GLEAM_DOWN_BOX, cgleam_down_box, 2, 2, 4, 4);
@@ -768,9 +770,11 @@ void Main::SetupFLTK()
768770
case 3:
769771
box_style = FL_PLASTIC_DOWN_BOX;
770772
break;
773+
#if FL_MINOR_VERSION > 3
771774
case 4:
772775
box_style = FL_OXY_DOWN_BOX;
773776
break;
777+
#endif
774778
default:
775779
box_style = FL_GTK_DOWN_BOX;
776780
break;
@@ -791,9 +795,11 @@ void Main::SetupFLTK()
791795
case 3:
792796
box_style = FL_PLASTIC_THIN_UP_BOX;
793797
break;
798+
#if FL_MINOR_VERSION > 3
794799
case 4:
795800
box_style = FL_OXY_THIN_UP_BOX;
796801
break;
802+
#endif
797803
default:
798804
box_style = FL_GTK_THIN_UP_BOX;
799805
break;
@@ -821,9 +827,11 @@ void Main::SetupFLTK()
821827
case 3:
822828
button_style = FL_PLASTIC_DOWN_BOX;
823829
break;
830+
#if FL_MINOR_VERSION > 3
824831
case 4:
825832
button_style = FL_OXY_DOWN_BOX;
826833
break;
834+
#endif
827835
default:
828836
button_style = FL_GTK_DOWN_BOX;
829837
break;
@@ -844,9 +852,11 @@ void Main::SetupFLTK()
844852
case 3:
845853
button_style = FL_PLASTIC_UP_BOX;
846854
break;
855+
#if FL_MINOR_VERSION > 3
847856
case 4:
848857
button_style = FL_OXY_UP_BOX;
849858
break;
859+
#endif
850860
default:
851861
button_style = FL_GTK_UP_BOX;
852862
break;

source/sys_assert.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#include "main.h"
2323
#include "sys_macro.h"
2424

25+
#include <stdarg.h>
26+
2527
//----------------------------------------------------------------------------
2628

2729
void AssertFail(const char *msg, ...)

source/sys_debug.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
#include "sys_debug.h"
2323

24+
#include <stdarg.h>
2425
#include <time.h>
2526

2627
#include "lib_util.h"

0 commit comments

Comments
 (0)