comparison win/dw.c @ 2958:33e77761703f

Win/C++: Get dwtestoo building with MinGW32 on Windows 2000. Split BUILD_DLL and BUILD_HTML so they can be used separately. BUILD_DLL will imply BUILD_HTML unless NO_BUILD_HTML is defined. MinGW32 is missing headers required for HTML and RICHEDIT support. https://osdn.net/projects/mingw/ still supports Windows 2000. Replace -DRICHEDIT with -DNO_BUILD_HTML and remove browser.o to build.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Wed, 11 Jan 2023 10:21:57 +0000
parents 0577a97fe36d
children 0058ab32e1bd
comparison
equal deleted inserted replaced
2957:217ebbee034f 2958:33e77761703f
40 #endif 40 #endif
41 #include <richedit.h> 41 #include <richedit.h>
42 42
43 #ifdef RICHEDIT 43 #ifdef RICHEDIT
44 int _DW_MLE_RICH_EDIT = DW_FEATURE_UNSUPPORTED; 44 int _DW_MLE_RICH_EDIT = DW_FEATURE_UNSUPPORTED;
45 #endif
46
47 /* For backwards compatibility BUILD_DLL will imply BUILD_HTML
48 * unless it is explicitly denied by defining NO_BUILD_HTML
49 */
50 #if defined(BUILD_DLL) && !defined(NO_BUILD_HTML) && !defined(BUILD_HTML)
51 #define BUILD_HTML
45 #endif 52 #endif
46 53
47 #define STATICCLASSNAME TEXT("STATIC") 54 #define STATICCLASSNAME TEXT("STATIC")
48 #define COMBOBOXCLASSNAME TEXT("COMBOBOX") 55 #define COMBOBOXCLASSNAME TEXT("COMBOBOX")
49 #define LISTBOXCLASSNAME TEXT("LISTBOX") 56 #define LISTBOXCLASSNAME TEXT("LISTBOX")
321 328
322 HBRUSH _dw_colors[18]; 329 HBRUSH _dw_colors[18];
323 330
324 HFONT _DWDefaultFont = NULL; 331 HFONT _DWDefaultFont = NULL;
325 332
326 #if (defined(BUILD_DLL) || defined(BUILD_HTML)) 333 #ifdef BUILD_HTML
327 LRESULT CALLBACK _dw_browserwndproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); 334 LRESULT CALLBACK _dw_browserwndproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
328 #ifdef BUILD_EDGE 335 #ifdef BUILD_EDGE
329 BOOL _dw_edge_detect(LPWSTR AppID); 336 BOOL _dw_edge_detect(LPWSTR AppID);
330 BOOL _DW_EDGE_DETECTED = FALSE; 337 BOOL _DW_EDGE_DETECTED = FALSE;
331 LRESULT CALLBACK _dw_edgewndproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); 338 LRESULT CALLBACK _dw_edgewndproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
4808 if(pos) 4815 if(pos)
4809 pos++; 4816 pos++;
4810 strncpy(_dw_app_name, pos ? pos : fullpath, _DW_APP_ID_SIZE); 4817 strncpy(_dw_app_name, pos ? pos : fullpath, _DW_APP_ID_SIZE);
4811 } 4818 }
4812 4819
4813 #if (defined(BUILD_DLL) || defined(BUILD_HTML)) 4820 #ifdef BUILD_HTML
4814 /* Register HTML renderer class */ 4821 /* Register HTML renderer class */
4815 memset(&wc, 0, sizeof(WNDCLASS)); 4822 memset(&wc, 0, sizeof(WNDCLASS));
4816 wc.lpszClassName = BrowserClassName; 4823 wc.lpszClassName = BrowserClassName;
4817 wc.style = CS_HREDRAW | CS_VREDRAW; 4824 wc.style = CS_HREDRAW | CS_VREDRAW;
4818 #ifdef BUILD_EDGE 4825 #ifdef BUILD_EDGE
5535 thisheight = _DW_SCROLLED_MIN_HEIGHT; 5542 thisheight = _DW_SCROLLED_MIN_HEIGHT;
5536 if(thisheight > _DW_SCROLLED_MAX_HEIGHT) 5543 if(thisheight > _DW_SCROLLED_MAX_HEIGHT)
5537 thisheight = _DW_SCROLLED_MAX_HEIGHT; 5544 thisheight = _DW_SCROLLED_MAX_HEIGHT;
5538 } 5545 }
5539 /* Entryfields and MLE */ 5546 /* Entryfields and MLE */
5540 else if(_tcsnicmp(tmpbuf, EDITCLASSNAME, _tcslen(EDITCLASSNAME)+1) == 0 || 5547 else if(_tcsnicmp(tmpbuf, EDITCLASSNAME, _tcslen(EDITCLASSNAME)+1) == 0
5541 _tcsnicmp(tmpbuf, RICHEDIT_CLASS, _tcslen(RICHEDIT_CLASS)+1) == 0 || 5548 #ifdef RICHEDIT
5542 _tcsnicmp(tmpbuf, MSFTEDIT_CLASS, _tcslen(MSFTEDIT_CLASS)+1) == 0) 5549 || _tcsnicmp(tmpbuf, RICHEDIT_CLASS, _tcslen(RICHEDIT_CLASS)+1) == 0
5550 || _tcsnicmp(tmpbuf, MSFTEDIT_CLASS, _tcslen(MSFTEDIT_CLASS)+1) == 0
5551 #endif
5552 )
5543 { 5553 {
5544 LONG style = GetWindowLong(handle, GWL_STYLE); 5554 LONG style = GetWindowLong(handle, GWL_STYLE);
5545 if((style & ES_MULTILINE)) 5555 if((style & ES_MULTILINE))
5546 { 5556 {
5547 unsigned long bytes; 5557 unsigned long bytes;
6264 * Parameters: 6274 * Parameters:
6265 * id: An ID to be used with dw_window_from_id or 0L. 6275 * id: An ID to be used with dw_window_from_id or 0L.
6266 */ 6276 */
6267 HWND API dw_html_new(unsigned long id) 6277 HWND API dw_html_new(unsigned long id)
6268 { 6278 {
6269 #if (defined(BUILD_DLL) || defined(BUILD_HTML)) 6279 #ifdef BUILD_HTML
6270 return CreateWindow(BrowserClassName, 6280 return CreateWindow(BrowserClassName,
6271 NULL, 6281 NULL,
6272 WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS, 6282 WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS,
6273 0,0,0,0, 6283 0,0,0,0,
6274 DW_HWND_OBJECT, 6284 DW_HWND_OBJECT,
6279 dw_debug("HTML widget not available; Support not enabled in this build.\n"); 6289 dw_debug("HTML widget not available; Support not enabled in this build.\n");
6280 return 0; 6290 return 0;
6281 #endif 6291 #endif
6282 } 6292 }
6283 6293
6284 #if (defined(BUILD_DLL) || defined(BUILD_HTML)) 6294 #ifdef BUILD_HTML
6285 void _dw_html_action(HWND hwnd, int action); 6295 void _dw_html_action(HWND hwnd, int action);
6286 int _dw_html_raw(HWND hwnd, const char *string); 6296 int _dw_html_raw(HWND hwnd, const char *string);
6287 int _dw_html_url(HWND hwnd, const char *url); 6297 int _dw_html_url(HWND hwnd, const char *url);
6288 int _dw_html_javascript_run(HWND hwnd, const char *script, void *scriptdata); 6298 int _dw_html_javascript_run(HWND hwnd, const char *script, void *scriptdata);
6289 #ifdef BUILD_EDGE 6299 #ifdef BUILD_EDGE
6300 * handle: Handle to the window. 6310 * handle: Handle to the window.
6301 * action: One of the DW_HTML_* constants. 6311 * action: One of the DW_HTML_* constants.
6302 */ 6312 */
6303 void API dw_html_action(HWND handle, int action) 6313 void API dw_html_action(HWND handle, int action)
6304 { 6314 {
6305 #if (defined(BUILD_DLL) || defined(BUILD_HTML)) 6315 #ifdef BUILD_HTML
6306 #ifdef BUILD_EDGE 6316 #ifdef BUILD_EDGE
6307 if (_DW_EDGE_DETECTED) 6317 if (_DW_EDGE_DETECTED)
6308 _dw_edge_action(handle, action); 6318 _dw_edge_action(handle, action);
6309 else 6319 else
6310 #endif 6320 #endif
6321 * Returns: 6331 * Returns:
6322 * DW_ERROR_NONE (0) on success. 6332 * DW_ERROR_NONE (0) on success.
6323 */ 6333 */
6324 int API dw_html_raw(HWND handle, const char *string) 6334 int API dw_html_raw(HWND handle, const char *string)
6325 { 6335 {
6326 #if (defined(BUILD_DLL) || defined(BUILD_HTML)) 6336 #ifdef BUILD_HTML
6327 #ifdef BUILD_EDGE 6337 #ifdef BUILD_EDGE
6328 if (_DW_EDGE_DETECTED) 6338 if (_DW_EDGE_DETECTED)
6329 return _dw_edge_raw(handle, string); 6339 return _dw_edge_raw(handle, string);
6330 #endif 6340 #endif
6331 return _dw_html_raw(handle, string); 6341 return _dw_html_raw(handle, string);
6343 * Returns: 6353 * Returns:
6344 * DW_ERROR_NONE (0) on success. 6354 * DW_ERROR_NONE (0) on success.
6345 */ 6355 */
6346 int API dw_html_url(HWND handle, const char *url) 6356 int API dw_html_url(HWND handle, const char *url)
6347 { 6357 {
6348 #if (defined(BUILD_DLL) || defined(BUILD_HTML)) 6358 #ifdef BUILD_HTML
6349 #if BUILD_EDGE 6359 #ifdef BUILD_EDGE
6350 if (_DW_EDGE_DETECTED) 6360 if (_DW_EDGE_DETECTED)
6351 return _dw_edge_url(handle, url); 6361 return _dw_edge_url(handle, url);
6352 #endif 6362 #endif
6353 return _dw_html_url(handle, url); 6363 return _dw_html_url(handle, url);
6354 #else 6364 #else
6366 * Returns: 6376 * Returns:
6367 * DW_ERROR_NONE (0) on success. 6377 * DW_ERROR_NONE (0) on success.
6368 */ 6378 */
6369 int dw_html_javascript_run(HWND handle, const char *script, void *scriptdata) 6379 int dw_html_javascript_run(HWND handle, const char *script, void *scriptdata)
6370 { 6380 {
6371 #if (defined(BUILD_DLL) || defined(BUILD_HTML)) 6381 #ifdef BUILD_HTML
6372 #if BUILD_EDGE 6382 #ifdef BUILD_EDGE
6373 if (_DW_EDGE_DETECTED) 6383 if (_DW_EDGE_DETECTED)
6374 return _dw_edge_javascript_run(handle, script, scriptdata); 6384 return _dw_edge_javascript_run(handle, script, scriptdata);
6375 #endif 6385 #endif
6376 return _dw_html_javascript_run(handle, script, scriptdata); 6386 return _dw_html_javascript_run(handle, script, scriptdata);
6377 #else 6387 #else
13010 env->MajorBuild = 0; 13020 env->MajorBuild = 0;
13011 } 13021 }
13012 13022
13013 strcpy(env->buildDate, __DATE__); 13023 strcpy(env->buildDate, __DATE__);
13014 strcpy(env->buildTime, __TIME__); 13024 strcpy(env->buildTime, __TIME__);
13015 #if (defined(BUILD_DLL) || defined(BUILD_HTML)) 13025 #ifdef BUILD_HTML
13016 # ifdef BUILD_EDGE 13026 # ifdef BUILD_EDGE
13017 strcpy(env->htmlEngine, _DW_EDGE_DETECTED ? "EDGE" : "IE"); 13027 strcpy(env->htmlEngine, _DW_EDGE_DETECTED ? "EDGE" : "IE");
13018 # else 13028 # else
13019 strcpy(env->htmlEngine, "IE"); 13029 strcpy(env->htmlEngine, "IE");
13020 # endif 13030 # endif
13915 switch(feature) 13925 switch(feature)
13916 { 13926 {
13917 #ifdef UNICODE 13927 #ifdef UNICODE
13918 case DW_FEATURE_UTF8_UNICODE: 13928 case DW_FEATURE_UTF8_UNICODE:
13919 #endif 13929 #endif
13920 #if (defined(BUILD_DLL) || defined(BUILD_HTML)) 13930 #ifdef BUILD_HTML
13921 case DW_FEATURE_HTML: 13931 case DW_FEATURE_HTML:
13922 case DW_FEATURE_HTML_RESULT: 13932 case DW_FEATURE_HTML_RESULT:
13923 #endif 13933 #endif
13924 case DW_FEATURE_CONTAINER_STRIPE: 13934 case DW_FEATURE_CONTAINER_STRIPE:
13925 case DW_FEATURE_MDI: 13935 case DW_FEATURE_MDI:
13998 { 14008 {
13999 /* These features are supported but not configurable */ 14009 /* These features are supported but not configurable */
14000 #ifdef UNICODE 14010 #ifdef UNICODE
14001 case DW_FEATURE_UTF8_UNICODE: 14011 case DW_FEATURE_UTF8_UNICODE:
14002 #endif 14012 #endif
14003 #if (defined(BUILD_DLL) || defined(BUILD_HTML)) 14013 #ifdef BUILD_HTML
14004 case DW_FEATURE_HTML: 14014 case DW_FEATURE_HTML:
14005 case DW_FEATURE_HTML_RESULT: 14015 case DW_FEATURE_HTML_RESULT:
14006 #endif 14016 #endif
14007 #ifdef AEROGLASS 14017 #ifdef AEROGLASS
14008 case DW_FEATURE_WINDOW_TRANSPARENCY: 14018 case DW_FEATURE_WINDOW_TRANSPARENCY: