Permalink
Browse files

Make FLTK-C work.

  • Loading branch information...
JX7P committed Dec 21, 2015
1 parent 56b2f3b commit 1bface57d4e6392503a1b64aa471362f711cb510
Showing with 55,195 additions and 42,385 deletions.
  1. +7 −1 Config.kmk
  2. +107 −80 external/fltkhs/DerivedShared_Image.cpp
  3. +15 −11 external/fltkhs/DerivedShared_Image.h
  4. +167 −117 external/fltkhs/DerivedText_Editor.cpp
  5. +73 −55 external/fltkhs/DerivedText_Editor.h
  6. +442 −326 external/fltkhs/Fl_AdjusterC.cpp
  7. +108 −107 external/fltkhs/Fl_AdjusterC.h
  8. +67 −49 external/fltkhs/Fl_AskC.cpp
  9. +27 −25 external/fltkhs/Fl_AskC.h
  10. +90 −66 external/fltkhs/Fl_BitmapC.cpp
  11. +25 −24 external/fltkhs/Fl_BitmapC.h
  12. +576 −431 external/fltkhs/Fl_BoxC.cpp
  13. +140 −134 external/fltkhs/Fl_BoxC.h
  14. +933 −664 external/fltkhs/Fl_BrowserC.cpp
  15. +230 −225 external/fltkhs/Fl_BrowserC.h
  16. +658 −487 external/fltkhs/Fl_ButtonC.cpp
  17. +157 −152 external/fltkhs/Fl_ButtonC.h
  18. +648 −582 external/fltkhs/Fl_C.cpp
  19. +207 −202 external/fltkhs/Fl_C.h
  20. +226 −218 external/fltkhs/Fl_Cairo_WindowC.h
  21. +188 −141 external/fltkhs/Fl_CallbackC.cpp
  22. +61 −49 external/fltkhs/Fl_CallbackC.h
  23. +396 −288 external/fltkhs/Fl_Check_ButtonC.cpp
  24. +96 −95 external/fltkhs/Fl_Check_ButtonC.h
  25. +615 −436 external/fltkhs/Fl_ChoiceC.cpp
  26. +157 −154 external/fltkhs/Fl_ChoiceC.h
  27. +403 −295 external/fltkhs/Fl_ClockC.cpp
  28. +97 −96 external/fltkhs/Fl_ClockC.h
  29. +550 −378 external/fltkhs/Fl_Color_ChooserC.cpp
  30. +132 −131 external/fltkhs/Fl_Color_ChooserC.h
  31. +24 −17 external/fltkhs/Fl_Copy_SurfaceC.cpp
  32. +7 −6 external/fltkhs/Fl_Copy_SurfaceC.h
  33. +477 −352 external/fltkhs/Fl_CounterC.cpp
  34. +121 −119 external/fltkhs/Fl_CounterC.h
  35. +101 −66 external/fltkhs/Fl_DeviceC.cpp
  36. +30 −28 external/fltkhs/Fl_DeviceC.h
  37. +468 −347 external/fltkhs/Fl_DialC.cpp
  38. +120 −118 external/fltkhs/Fl_DialC.h
  39. +1,057 −742 external/fltkhs/Fl_Double_WindowC.cpp
  40. +252 −244 external/fltkhs/Fl_Double_WindowC.h
  41. +478 −418 external/fltkhs/Fl_DrawC.cpp
  42. +159 −156 external/fltkhs/Fl_DrawC.h
  43. +100 −30 external/fltkhs/Fl_EnumerationsC.cpp
  44. +434 −418 external/fltkhs/Fl_EnumerationsC.h
  45. +11 −10 external/fltkhs/Fl_ExportMacros.h
  46. +753 −514 external/fltkhs/Fl_File_BrowserC.cpp
  47. +191 −190 external/fltkhs/Fl_File_BrowserC.h
  48. +328 −243 external/fltkhs/Fl_File_ChooserC.cpp
  49. +78 −77 external/fltkhs/Fl_File_ChooserC.h
  50. +94 −68 external/fltkhs/Fl_File_IconC.cpp
  51. +24 −23 external/fltkhs/Fl_File_IconC.h
  52. +582 −419 external/fltkhs/Fl_File_InputC.cpp
  53. +139 −138 external/fltkhs/Fl_File_InputC.h
  54. +565 −404 external/fltkhs/Fl_Float_InputC.cpp
  55. +135 −134 external/fltkhs/Fl_Float_InputC.h
  56. +1,121 −802 external/fltkhs/Fl_Gl_WindowC.cpp
  57. +267 −261 external/fltkhs/Fl_Gl_WindowC.h
  58. +510 −363 external/fltkhs/Fl_GroupC.cpp
  59. +134 −131 external/fltkhs/Fl_GroupC.h
  60. +728 −496 external/fltkhs/Fl_Hold_BrowserC.cpp
  61. +188 −187 external/fltkhs/Fl_Hold_BrowserC.h
  62. +183 −137 external/fltkhs/Fl_ImageC.cpp
  63. +49 −46 external/fltkhs/Fl_ImageC.h
  64. +29 −20 external/fltkhs/Fl_Image_SurfaceC.cpp
  65. +8 −7 external/fltkhs/Fl_Image_SurfaceC.h
  66. +555 −407 external/fltkhs/Fl_InputC.cpp
  67. +135 −134 external/fltkhs/Fl_InputC.h
  68. +541 −396 external/fltkhs/Fl_Input_C.cpp
  69. +139 −138 external/fltkhs/Fl_Input_C.h
  70. +792 −564 external/fltkhs/Fl_Int_InputC.cpp
  71. +184 −179 external/fltkhs/Fl_Int_InputC.h
  72. +421 −303 external/fltkhs/Fl_Light_ButtonC.cpp
  73. +100 −99 external/fltkhs/Fl_Light_ButtonC.h
  74. +625 −432 external/fltkhs/Fl_Menu_ButtonC.cpp
  75. +162 −157 external/fltkhs/Fl_Menu_ButtonC.h
  76. +829 −598 external/fltkhs/Fl_Menu_C.cpp
  77. +204 −197 external/fltkhs/Fl_Menu_C.h
  78. +346 −234 external/fltkhs/Fl_Menu_ItemC.cpp
  79. +74 −73 external/fltkhs/Fl_Menu_ItemC.h
  80. +1,041 −659 external/fltkhs/Fl_Multi_BrowserC.cpp
  81. +229 −224 external/fltkhs/Fl_Multi_BrowserC.h
  82. +617 −407 external/fltkhs/Fl_Multiline_InputC.cpp
  83. +134 −133 external/fltkhs/Fl_Multiline_InputC.h
  84. +640 −407 external/fltkhs/Fl_Multiline_OutputC.cpp
  85. +135 −134 external/fltkhs/Fl_Multiline_OutputC.h
  86. +99 −72 external/fltkhs/Fl_Native_File_ChooserC.cpp
  87. +42 −39 external/fltkhs/Fl_Native_File_ChooserC.h
  88. +555 −407 external/fltkhs/Fl_OutputC.cpp
  89. +135 −134 external/fltkhs/Fl_OutputC.h
  90. +783 −531 external/fltkhs/Fl_Overlay_WindowC.cpp
  91. +196 −188 external/fltkhs/Fl_Overlay_WindowC.h
  92. +82 −59 external/fltkhs/Fl_PNM_ImageC.cpp
  93. +21 −20 external/fltkhs/Fl_PNM_ImageC.h
  94. +32 −24 external/fltkhs/Fl_PackC.cpp
  95. +9 −8 external/fltkhs/Fl_PackC.h
  96. +160 −100 external/fltkhs/Fl_Paged_DeviceC.cpp
  97. +37 −36 external/fltkhs/Fl_Paged_DeviceC.h
  98. +90 −66 external/fltkhs/Fl_PixmapC.cpp
  99. +23 −22 external/fltkhs/Fl_PixmapC.h
  100. +464 −333 external/fltkhs/Fl_PositionerC.cpp
  101. +109 −108 external/fltkhs/Fl_PositionerC.h
  102. +216 −142 external/fltkhs/Fl_PreferencesC.cpp
  103. +50 −48 external/fltkhs/Fl_PreferencesC.h
  104. +161 −104 external/fltkhs/Fl_PrinterC.cpp
  105. +38 −37 external/fltkhs/Fl_PrinterC.h
  106. +419 −303 external/fltkhs/Fl_ProgressC.cpp
  107. +99 −98 external/fltkhs/Fl_ProgressC.h
  108. +104 −77 external/fltkhs/Fl_RGB_ImageC.cpp
  109. +26 −25 external/fltkhs/Fl_RGB_ImageC.h
  110. +421 −303 external/fltkhs/Fl_Radio_ButtonC.cpp
  111. +100 −99 external/fltkhs/Fl_Radio_ButtonC.h
  112. +431 −303 external/fltkhs/Fl_Radio_Light_ButtonC.cpp
  113. +100 −99 external/fltkhs/Fl_Radio_Light_ButtonC.h
  114. +421 −303 external/fltkhs/Fl_Repeat_ButtonC.cpp
  115. +100 −99 external/fltkhs/Fl_Repeat_ButtonC.h
  116. +421 −303 external/fltkhs/Fl_Return_ButtonC.cpp
  117. +100 −99 external/fltkhs/Fl_Return_ButtonC.h
  118. +437 −323 external/fltkhs/Fl_RollerC.cpp
  119. +107 −106 external/fltkhs/Fl_RollerC.h
  120. +421 −303 external/fltkhs/Fl_Round_ButtonC.cpp
  121. +100 −99 external/fltkhs/Fl_Round_ButtonC.h
  122. +404 −291 external/fltkhs/Fl_Round_ClockC.cpp
  123. +94 −93 external/fltkhs/Fl_Round_ClockC.h
  124. +52 −39 external/fltkhs/Fl_ScrollC.cpp
  125. +14 −13 external/fltkhs/Fl_ScrollC.h
  126. +492 −357 external/fltkhs/Fl_ScrollbarC.cpp
  127. +114 −113 external/fltkhs/Fl_ScrollbarC.h
  128. +574 −407 external/fltkhs/Fl_Secret_InputC.cpp
  129. +135 −134 external/fltkhs/Fl_Secret_InputC.h
  130. +757 −499 external/fltkhs/Fl_Select_BrowserC.cpp
  131. +185 −184 external/fltkhs/Fl_Select_BrowserC.h
  132. +137 −97 external/fltkhs/Fl_Shared_ImageC.cpp
  133. +38 −37 external/fltkhs/Fl_Shared_ImageC.h
  134. +1,059 −747 external/fltkhs/Fl_Single_WindowC.cpp
  135. +259 −251 external/fltkhs/Fl_Single_WindowC.h
  136. +564 −413 external/fltkhs/Fl_SliderC.cpp
  137. +128 −127 external/fltkhs/Fl_SliderC.h
  138. +112 −84 external/fltkhs/Fl_SpinnerC.cpp
  139. +34 −32 external/fltkhs/Fl_SpinnerC.h
  140. +629 −429 external/fltkhs/Fl_Sys_Menu_BarC.cpp
  141. +150 −146 external/fltkhs/Fl_Sys_Menu_BarC.h
  142. +1,148 −737 external/fltkhs/Fl_TableC.cpp
  143. +232 −226 external/fltkhs/Fl_TableC.h
  144. +1,305 −786 external/fltkhs/Fl_Table_RowC.cpp
  145. +238 −231 external/fltkhs/Fl_Table_RowC.h
  146. +453 −327 external/fltkhs/Fl_TabsC.cpp
  147. +114 −113 external/fltkhs/Fl_TabsC.h
  148. +391 −261 external/fltkhs/Fl_Text_BufferC.cpp
  149. +94 −93 external/fltkhs/Fl_Text_BufferC.h
  150. +790 −535 external/fltkhs/Fl_Text_DisplayC.cpp
  151. +184 −182 external/fltkhs/Fl_Text_DisplayC.h
  152. +970 −648 external/fltkhs/Fl_Text_EditorC.cpp
  153. +205 −204 external/fltkhs/Fl_Text_EditorC.h
  154. +42 −29 external/fltkhs/Fl_Text_SelectionC.cpp
  155. +10 −9 external/fltkhs/Fl_Text_SelectionC.h
  156. +472 −339 external/fltkhs/Fl_TileC.cpp
  157. +117 −116 external/fltkhs/Fl_TileC.h
  158. +397 −292 external/fltkhs/Fl_TimerC.cpp
  159. +100 −99 external/fltkhs/Fl_TimerC.h
  160. +421 −303 external/fltkhs/Fl_Toggle_ButtonC.cpp
  161. +100 −99 external/fltkhs/Fl_Toggle_ButtonC.h
  162. +101 −86 external/fltkhs/Fl_TooltipC.cpp
  163. +33 −32 external/fltkhs/Fl_TooltipC.h
  164. +1,001 −705 external/fltkhs/Fl_TreeC.cpp
  165. +236 −235 external/fltkhs/Fl_TreeC.h
  166. +452 −305 external/fltkhs/Fl_Tree_ItemC.cpp
  167. +96 −95 external/fltkhs/Fl_Tree_ItemC.h
  168. +259 −185 external/fltkhs/Fl_Tree_PrefsC.cpp
  169. +66 −65 external/fltkhs/Fl_Tree_PrefsC.h
  170. +671 −609 external/fltkhs/Fl_Types.h
  171. +695 −499 external/fltkhs/Fl_ValuatorC.cpp
  172. +157 −151 external/fltkhs/Fl_ValuatorC.h
  173. +492 −353 external/fltkhs/Fl_Value_InputC.cpp
  174. +116 −115 external/fltkhs/Fl_Value_InputC.h
  175. +489 −347 external/fltkhs/Fl_Value_OutputC.cpp
  176. +114 −113 external/fltkhs/Fl_Value_OutputC.h
  177. +512 −365 external/fltkhs/Fl_Value_SliderC.cpp
  178. +121 −121 external/fltkhs/Fl_Value_SliderC.h
  179. +624 −460 external/fltkhs/Fl_WidgetC.cpp
  180. +141 −136 external/fltkhs/Fl_WidgetC.h
  181. +1,044 −765 external/fltkhs/Fl_WindowC.cpp
  182. +250 −244 external/fltkhs/Fl_WindowC.h
  183. +489 −348 external/fltkhs/Fl_WizardC.cpp
  184. +122 −122 external/fltkhs/Fl_WizardC.h
  185. +0 −141 external/fltkhs/Makefile.in
  186. +9 −7 external/fltkhs/UtilsC.cpp
  187. +1 −1 external/fltkhs/UtilsC.h
  188. +67 −52 external/fltkhs/filenameC.cpp
  189. +19 −18 external/fltkhs/filenameC.h
  190. +6 −4 external/fltkhs/fl_show_colormapC.cpp
  191. +3 −2 external/fltkhs/fl_show_colormapC.h
  192. +77 −73 external/fltkhs/glC.cpp
  193. +31 −30 external/fltkhs/glC.h
  194. +274 −271 external/fltkhs/glutC.cpp
  195. +92 −91 external/fltkhs/glutC.h
  196. +33 −49 external/fltkhs/xC.cpp
  197. +22 −21 external/fltkhs/xC.h
  198. +3 −0 src/Makefile.kmk
  199. +8 −2 src/tmp.m
@@ -5,6 +5,7 @@ PKGCONF ?= pkg-config
FLTKCONF ?= fltk-config
PKGCONF = pkg-config
CXX_LDFLAGS = -lstdc++
TOX_CFLAGS = $(shell $(PKGCONF) libtoxcore --cflags)
TOX_LDFLAGS = $(shell $(PKGCONF) libtoxcore --libs)
@@ -19,6 +20,7 @@ TEMPLATE_OBJC_CXXFLAGS = $(ALLFLAGS)
TEMPLATE_OBJC_CFLAGS = $(ALLFLAGS)
TEMPLATE_OBJC_OBJCFLAGS = $(ALLFLAGS)
TEMPLATE_OBJC_INCS = $(PATH_ROOT)/objcrt/hdr $(PATH_ROOT)/objpak/hdr . hdr
TEMPLATE_OBJC_LDFLAGS = ${CXX_LDFLAGS}
TEMPLATE_XwCXX = C/C++ base template
TEMPLATE_XwCXX_TOOL = GCC
@@ -30,4 +32,8 @@ TEMPLATE_XwSTATIC_EXTENDS = XwCXX
TEMPLATE_XwSTATIC_EXTENDS_BY = appending
TEMPLATE_XwSTATIC_CFLAGS = -fPIC -static
TEMPLATE_XwSTATIC_CXXFLAGS = -fPIC -static
TEMPLATE_XwSTATIC_LDFLAGS = -fPIC -static
TEMPLATE_XwSTATIC_LDFLAGS = -fPIC -static
FLTKHS_INCS = $(PATH_ROOT)/external/fltkhs
FLTKHS_LIBS = ${libfltkhs_1_TARGET} ${FLTK_LIB}
FLTKHS_LDFLAGS = ${FLTK_LDFLAGS}
@@ -1,92 +1,119 @@
#include "DerivedShared_Image.h"
fl_Shared_Handler* DerivedShared_Image::fl_handlers_ = 0;
int DerivedShared_Image::fl_num_handlers_ = 0;
int DerivedShared_Image::fl_alloc_handlers_ = 0;
fl_Shared_Handler * DerivedShared_Image::fl_handlers_ = 0;
int DerivedShared_Image::fl_num_handlers_ = 0;
int DerivedShared_Image::fl_alloc_handlers_ = 0;
// a total copy, needed because fl_Shared_Handler is different
void DerivedShared_Image::add_handler(fl_Shared_Handler f){
int i; // Looping var...
fl_Shared_Handler *temp; // New image handler array...
// First see if we have already added the handler...
for (i = 0; i < fl_num_handlers_; i ++) {
if (fl_handlers_[i] == f) return;
}
if (fl_num_handlers_ >= fl_alloc_handlers_) {
// Allocate more memory...
temp = new fl_Shared_Handler [fl_alloc_handlers_ + 32];
if (alloc_handlers_) {
memcpy(temp, fl_handlers_, fl_alloc_handlers_ * sizeof(fl_Shared_Handler));
delete[] fl_handlers_;
void DerivedShared_Image::add_handler (fl_Shared_Handler f)
{
int i; // Looping var...
fl_Shared_Handler * temp; // New image handler array...
// First see if we have already added the handler...
for (i = 0; i < fl_num_handlers_; i++)
{
if (fl_handlers_[i] == f)
return;
}
if (fl_num_handlers_ >= fl_alloc_handlers_)
{
// Allocate more memory...
temp = new fl_Shared_Handler[fl_alloc_handlers_ + 32];
fl_handlers_ = temp;
fl_alloc_handlers_ += 32;
}
if (alloc_handlers_)
{
memcpy (temp, fl_handlers_,
fl_alloc_handlers_ * sizeof (fl_Shared_Handler));
fl_handlers_[fl_num_handlers_] = f;
fl_num_handlers_ ++;
}
void DerivedShared_Image::reload(){
int i;
FILE *fp;
uchar header[64];
Fl_Image *img;
if (!name_) return;
if ((fp = fl_fopen(name_, "rb")) != NULL) {
if (fread(header, 1, sizeof(header), fp)==0) { /* ignore */ }
fclose(fp);
} else {
return;
}
if (memcmp(header, "#define", 7) == 0) // XBM file
img = new Fl_XBM_Image(name_);
else if (memcmp(header, "/* XPM */", 9) == 0) // XPM file
img = new Fl_XPM_Image(name_);
else {
for (i = 0, img = 0; i < num_handlers_; i ++) {
// The only difference is the cast
img = (static_cast<Fl_Image*>((fl_handlers_[i])(name_, header, sizeof(header))));
if (img) break;
}
}
delete[] fl_handlers_;
}
if (img) {
if (alloc_image_) delete image_;
fl_handlers_ = temp;
fl_alloc_handlers_ += 32;
}
alloc_image_ = 1;
fl_handlers_[fl_num_handlers_] = f;
fl_num_handlers_++;
}
void DerivedShared_Image::reload ()
{
int i;
FILE * fp;
uchar header[64];
Fl_Image * img;
if (!name_)
return;
if ((fp = fl_fopen (name_, "rb")) != NULL)
{
if (fread (header, 1, sizeof (header), fp) == 0)
{ /* ignore */
}
fclose (fp);
}
else
{
return;
}
if ((img->w() != w() && w()) || (img->h() != h() && h())) {
Fl_Image *temp = img->copy(w(), h());
delete img;
image_ = temp;
} else {
image_ = img;
if (memcmp (header, "#define", 7) == 0) // XBM file
img = new Fl_XBM_Image (name_);
else if (memcmp (header, "/* XPM */", 9) == 0) // XPM file
img = new Fl_XPM_Image (name_);
else
{
for (i = 0, img = 0; i < num_handlers_; i++)
{
// The only difference is the cast
img = (static_cast<Fl_Image *> (
(fl_handlers_[i]) (name_, header, sizeof (header))));
if (img)
break;
}
}
update();
}
if (img)
{
if (alloc_image_)
delete image_;
alloc_image_ = 1;
if ((img->w () != w () && w ()) || (img->h () != h () && h ()))
{
Fl_Image * temp = img->copy (w (), h ());
delete img;
image_ = temp;
}
else
{
image_ = img;
}
update ();
}
};
void DerivedShared_Image::remove_handler(fl_Shared_Handler f){
int i; // Looping var...
// First see if the handler has been added...
for (i = 0; i < fl_num_handlers_; i ++) {
if (fl_handlers_[i] == f) break;
}
if (i >= fl_num_handlers_) return;
// OK, remove the handler from the array...
fl_num_handlers_ --;
if (i < fl_num_handlers_) {
// Shift later handlers down 1...
memmove(fl_handlers_ + i, fl_handlers_ + i + 1,
(fl_num_handlers_ - i) * sizeof(fl_Shared_Handler ));
}
void DerivedShared_Image::remove_handler (fl_Shared_Handler f)
{
int i; // Looping var...
// First see if the handler has been added...
for (i = 0; i < fl_num_handlers_; i++)
{
if (fl_handlers_[i] == f)
break;
}
if (i >= fl_num_handlers_)
return;
// OK, remove the handler from the array...
fl_num_handlers_--;
if (i < fl_num_handlers_)
{
// Shift later handlers down 1...
memmove (fl_handlers_ + i, fl_handlers_ + i + 1,
(fl_num_handlers_ - i) * sizeof (fl_Shared_Handler));
}
}
@@ -5,17 +5,21 @@
#include "FL/Fl_XBM_Image.H"
#include "FL/Fl_XPM_Image.H"
#include "Fl_Types.h"
typedef void* (*fl_Shared_Handler)(const char *name, uchar *header,int headerlen);
class DerivedShared_Image : public Fl_Shared_Image {
static fl_Shared_Handler* fl_handlers_;
static int fl_num_handlers_;
static int fl_alloc_handlers_;
public:
void reload();
static void add_handler(fl_Shared_Handler h);
static void remove_handler(fl_Shared_Handler h);
DerivedShared_Image() : Fl_Shared_Image() {};
DerivedShared_Image(const char *n, Fl_Image *img = 0) : Fl_Shared_Image(n, img) {};
typedef void * (*fl_Shared_Handler) (const char * name, uchar * header,
int headerlen);
class DerivedShared_Image : public Fl_Shared_Image
{
static fl_Shared_Handler * fl_handlers_;
static int fl_num_handlers_;
static int fl_alloc_handlers_;
public:
void reload ();
static void add_handler (fl_Shared_Handler h);
static void remove_handler (fl_Shared_Handler h);
DerivedShared_Image () : Fl_Shared_Image (){};
DerivedShared_Image (const char * n, Fl_Image * img = 0)
: Fl_Shared_Image (n, img){};
};
#endif /* __DERIVEDSHARED_IMAGE__ */
Oops, something went wrong.

0 comments on commit 1bface5

Please sign in to comment.