# HG changeset patch # User mhessling@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1590902718 0 # Node ID 24875681eec553a74669236fe81b6c1a8c112ced # Parent 8f08d4c9d3fce1754e8ca347c71389983e8c45bf Added htmlEngine to DWEnv diff -r 8f08d4c9d3fc -r 24875681eec5 dw.h --- a/dw.h Mon May 25 13:03:01 2020 +0000 +++ b/dw.h Sun May 31 05:25:18 2020 +0000 @@ -270,7 +270,7 @@ #include -/* Mostly safe but slow snprintf() for compilers that don't have it... +/* Mostly safe but slow snprintf() for compilers that don't have it... * like VisualAge. So we can write safe code and still use VAC to test. */ #if defined(__IBMC__) && !defined(snprintf) @@ -1338,6 +1338,8 @@ short MajorVersion, MinorVersion, MajorBuild, MinorBuild; /* Dynamic Window version */ short DWMajorVersion, DWMinorVersion, DWSubVersion; + /* Which HTML engine is compiled in */ + char htmlEngine[30]; } DWEnv; diff -r 8f08d4c9d3fc -r 24875681eec5 dwtest.c --- a/dwtest.c Mon May 25 13:03:01 2020 +0000 +++ b/dwtest.c Sun May 31 05:25:18 2020 +0000 @@ -570,9 +570,10 @@ DWEnv env; dw_environment_query(&env); - dw_messagebox( "About dwindows", DW_MB_OK | DW_MB_INFORMATION, "dwindows test\n\nOS: %s %s %s Version: %d.%d.%d.%d\n\ndwindows Version: %d.%d.%d", + dw_messagebox( "About dwindows", DW_MB_OK | DW_MB_INFORMATION, "dwindows test\n\nOS: %s %s %s Version: %d.%d.%d.%d HTML: %s\n\ndwindows Version: %d.%d.%d", env.osName, env.buildDate, env.buildTime, env.MajorVersion, env.MinorVersion, env.MajorBuild, env.MinorBuild, + env.htmlEngine, env.DWMajorVersion, env.DWMinorVersion, env.DWSubVersion ); return 0; } @@ -593,7 +594,7 @@ if ( tmp ) { HWND notification = dw_notification_new("New file loaded", NULL, "dwtest loaded \"%s\" into the file browser on the Render tab, with \"File Display\" selected from the drop down list.", tmp); - + if ( current_file ) { dw_free( current_file ); @@ -1699,7 +1700,7 @@ int DWSIGNAL web_back_clicked(HWND button, void *data) { HWND html = (HWND)data; - + dw_html_action(html, DW_HTML_GOBACK); return FALSE; } @@ -1708,7 +1709,7 @@ int DWSIGNAL web_forward_clicked(HWND button, void *data) { HWND html = (HWND)data; - + dw_html_action(html, DW_HTML_GOFORWARD); return FALSE; } @@ -1717,7 +1718,7 @@ int DWSIGNAL web_reload_clicked(HWND button, void *data) { HWND html = (HWND)data; - + dw_html_action(html, DW_HTML_RELOAD); return FALSE; } @@ -1728,7 +1729,7 @@ HWND html = (HWND)data; HWND javascript = (HWND)dw_window_get_data(button, "javascript"); char *script = dw_window_get_text(javascript); - + dw_html_javascript_run(html, script, NULL); dw_free(script); return FALSE; @@ -1737,7 +1738,7 @@ /* Handle web javascript result */ int DWSIGNAL web_html_result(HWND html, int status, char *result, void *script_data, void *user_data) { - dw_messagebox("Javascript Result", DW_MB_OK | (status ? DW_MB_ERROR : DW_MB_INFORMATION), + dw_messagebox("Javascript Result", DW_MB_OK | (status ? DW_MB_ERROR : DW_MB_INFORMATION), result ? result : "Javascript result is not a string value"); return TRUE; } @@ -1747,7 +1748,7 @@ { HWND hwndstatus = (HWND)data; char *statusnames[] = { "none", "started", "redirect", "loading", "complete", NULL }; - + if(hwndstatus && url && status < 5) { int length = (int)strlen(url) + (int)strlen(statusnames[status]) + 10; @@ -1756,7 +1757,7 @@ snprintf(text, length, "Status %s: %s", statusnames[status], url); dw_window_set_text(hwndstatus, text); free(text); - } + } return FALSE; } @@ -1846,42 +1847,42 @@ HWND hbox = dw_box_new(DW_HORZ, 0); HWND item; HWND javascript = dw_combobox_new("", 0); - + dw_listbox_append(javascript, "window.scrollTo(0,500);"); dw_listbox_append(javascript, "window.document.title;"); - + dw_box_pack_start( notebookbox7, rawhtml, 0, 100, TRUE, FALSE, 0); dw_html_raw(rawhtml, "

dwtest

"); html = dw_html_new(1002); - + dw_box_pack_start(notebookbox7, hbox, 0, 0, TRUE, FALSE, 0); - + /* Add navigation buttons */ item = dw_button_new("Back", 0); dw_box_pack_start(hbox, item, -1, -1, FALSE, FALSE, 0); dw_signal_connect(item, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(web_back_clicked), DW_POINTER(html)); - + item = dw_button_new("Forward", 0); dw_box_pack_start(hbox, item, -1, -1, FALSE, FALSE, 0); dw_signal_connect(item, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(web_forward_clicked), DW_POINTER(html)); - + /* Put in some extra space */ dw_box_pack_start(hbox, 0, 5, 1, FALSE, FALSE, 0); - + item = dw_button_new("Reload", 0); dw_box_pack_start(hbox, item, -1, -1, FALSE, FALSE, 0); dw_signal_connect(item, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(web_reload_clicked), DW_POINTER(html)); - + /* Put in some extra space */ dw_box_pack_start(hbox, 0, 5, 1, FALSE, FALSE, 0); dw_box_pack_start(hbox, javascript, -1, -1, TRUE, FALSE, 0); - + item = dw_button_new("Run", 0); dw_window_set_data(item, "javascript", DW_POINTER(javascript)); dw_box_pack_start(hbox, item, -1, -1, FALSE, FALSE, 0); dw_signal_connect(item, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(web_run_clicked), DW_POINTER(html)); dw_window_click_default(javascript, item); - + dw_box_pack_start( notebookbox7, html, 0, 100, TRUE, TRUE, 0); dw_html_url(html, "http://dwindows.netlabs.org"); htmlstatus = dw_status_text_new("HTML status loading...", 0); diff -r 8f08d4c9d3fc -r 24875681eec5 gtk/dw.c --- a/gtk/dw.c Mon May 25 13:03:01 2020 +0000 +++ b/gtk/dw.c Sun May 31 05:25:18 2020 +0000 @@ -1254,14 +1254,14 @@ char *location = (char *)webkit_web_view_get_uri(web_view); int status = 0; void **params = data; - + if(params) status = DW_POINTER_TO_INT(params[3]); - + if(status && location && work.window && work.func) { int (*htmlchangedfunc)(HWND, int, char *, void *) = work.func; - + htmlchangedfunc(work.window, status, location, work.data); } } @@ -2111,7 +2111,7 @@ /* Generate an Application ID based on the PID if all else fails. */ snprintf(_dw_app_id, 100, "%s.pid.%d", DW_APP_DOMAIN_DEFAULT, getpid()); } - + /* Initialize the application subsystem on supported versions... * we generate an application ID based on the binary name or PID * instead of passing NULL to enable full application support. @@ -12335,14 +12335,14 @@ * A handle to the notification which can be used to attach a "clicked" event if desired, * or NULL if it fails or notifications are not supported by the system. * Remarks: - * This will create a system notification that will show in the notifaction panel + * This will create a system notification that will show in the notifaction panel * on supported systems, which may be clicked to perform another task. */ HWND dw_notification_new(const char *title, HPIXMAP pixmap, const char *description, ...) { #if GLIB_CHECK_VERSION(2,40,0) GNotification *notification = g_notification_new(title); - + if(notification) { if(description) @@ -12360,7 +12360,7 @@ /* GTK 1.x is not implemented as pixbuf, so only allow icons on 2.x */ if(pixmap && pixmap->pixbuf) g_notification_set_icon(notification, G_ICON(pixmap->pixbuf)); -#endif +#endif } return (HWND)notification; #else @@ -12381,8 +12381,8 @@ if(notification) { char id[101] = {0}; - - /* Generate a unique ID based on the notification handle, + + /* Generate a unique ID based on the notification handle, * so we can use it to remove the notification in dw_window_destroy(). */ snprintf(id, 100, "dw-notification-%llu", (unsigned long long)notification); @@ -12417,6 +12417,11 @@ #else env->DWSubVersion = DW_SUB_VERSION; #endif +#ifdef USE_WEBKIT + strncpy(env->htmlEngine, "WEBKIT", sizeof(env->htmlEngine)-1); +#else + strncpy(env->htmlEngine, "N/A", sizeof(env->htmlEngine)-1); +#endif if((dot = strchr(tempbuf, '.')) != NULL) { @@ -12912,7 +12917,7 @@ if(web_view) { WebKitWebFrame *frame; - + switch(action) { case DW_HTML_GOBACK: @@ -13015,7 +13020,7 @@ #ifdef USE_WEBKIT int _locked_by_me = FALSE; WebKitWebView *web_view; - + DW_MUTEX_LOCK; if((web_view = (WebKitWebView *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_web_view"))) webkit_web_view_execute_script(web_view, script); diff -r 8f08d4c9d3fc -r 24875681eec5 gtk3/dw.c --- a/gtk3/dw.c Mon May 25 13:03:01 2020 +0000 +++ b/gtk3/dw.c Sun May 31 05:25:18 2020 +0000 @@ -2032,14 +2032,14 @@ /* Create a global object for glib activities */ _DWObject = g_object_new(G_TYPE_OBJECT, NULL); - + #if GLIB_CHECK_VERSION(2,28,0) if(!_dw_app_id[0]) { /* Generate an Application ID based on the PID if all else fails. */ snprintf(_dw_app_id, 100, "%s.pid.%d", DW_APP_DOMAIN_DEFAULT, getpid()); } - + /* Initialize the application subsystem on supported versions... * we generate an application ID based on the binary name or PID * instead of passing NULL to enable full application support. @@ -11040,14 +11040,14 @@ * A handle to the notification which can be used to attach a "clicked" event if desired, * or NULL if it fails or notifications are not supported by the system. * Remarks: - * This will create a system notification that will show in the notifaction panel + * This will create a system notification that will show in the notifaction panel * on supported systems, which may be clicked to perform another task. */ HWND dw_notification_new(const char *title, HPIXMAP pixmap, const char *description, ...) { #if GLIB_CHECK_VERSION(2,40,0) GNotification *notification = g_notification_new(title); - + if(notification) { if(description) @@ -11083,8 +11083,8 @@ if(notification) { char id[101] = {0}; - - /* Generate a unique ID based on the notification handle, + + /* Generate a unique ID based on the notification handle, * so we can use it to remove the notification in dw_window_destroy(). */ snprintf(id, 100, "dw-notification-%llu", (unsigned long long)notification); @@ -11112,6 +11112,15 @@ strncpy(env->buildDate, __DATE__, sizeof(env->buildDate)-1); strncpy(env->buildTime, __TIME__, sizeof(env->buildTime)-1); +#ifdef USE_WEBKIT +# ifdef USE_WEBKIT2 + strncpy(env->htmlEngine, "WEBKIT2", sizeof(env->htmlEngine)-1); +# else + strncpy(env->htmlEngine, "WEBKIT", sizeof(env->htmlEngine)-1); +# endif +#else + strncpy(env->htmlEngine, "N/A", sizeof(env->htmlEngine)-1); +#endif env->DWMajorVersion = DW_MAJOR_VERSION; env->DWMinorVersion = DW_MINOR_VERSION; #ifdef VER_REV diff -r 8f08d4c9d3fc -r 24875681eec5 mac/dw.m --- a/mac/dw.m Mon May 25 13:03:01 2020 +0000 +++ b/mac/dw.m Sun May 31 05:25:18 2020 +0000 @@ -792,7 +792,7 @@ int (* API htmlresultfunc)(HWND, int, char *, void *, void *) = handler->signalfunction; void **params = (void **)event; NSString *result = params[0]; - + return htmlresultfunc(handler->window, [result length] ? DW_ERROR_NONE : DW_ERROR_UNKNOWN, [result length] ? (char *)[result UTF8String] : NULL, params[1], handler->data); } /* HTML changed event */ @@ -801,7 +801,7 @@ int (* API htmlchangedfunc)(HWND, int, char *, void *) = handler->signalfunction; void **params = (void **)event; NSString *uri = params[1]; - + return htmlchangedfunc(handler->window, DW_POINTER_TO_INT(params[0]), (char *)[uri UTF8String], handler->data); } } @@ -8880,7 +8880,7 @@ { DWWebView *html = handle; DW_LOCAL_POOL_IN; - + #if WK_API_ENABLED [html evaluateJavaScript:[NSString stringWithUTF8String:script] completionHandler:^(NSString *result, NSError *error) { @@ -10762,7 +10762,7 @@ #ifdef BUILDING_FOR_MOUNTAIN_LION char outbuf[1025] = {0}; HWND retval = NULL; - + if(description) { va_list args; @@ -10779,7 +10779,7 @@ if([[NSBundle mainBundle] bundleIdentifier] != nil) { UNMutableNotificationContent* notification = [[UNMutableNotificationContent alloc] init]; - + if(notification) { notification.title = [NSString stringWithUTF8String:title]; @@ -10794,7 +10794,7 @@ { // Fallback on earlier versions NSUserNotification *notification = [[NSUserNotification alloc] init]; - + if(notification) { notification.title = [NSString stringWithUTF8String:title]; @@ -10832,7 +10832,7 @@ NSString *notid = [NSString stringWithFormat:@"dw-notification-%llu", (unsigned long long)notification]; UNNotificationRequest* request = [UNNotificationRequest requestWithIdentifier:notid content:content trigger:nil]; - + UNUserNotificationCenter* center = [UNUserNotificationCenter currentNotificationCenter]; [center addNotificationRequest:request withCompletionHandler:^(NSError * _Nullable error) { _event_handler(notification, nil, 8); @@ -10864,6 +10864,11 @@ strncpy(env->buildDate, __DATE__, sizeof(env->buildDate)-1); strncpy(env->buildTime, __TIME__, sizeof(env->buildTime)-1); +#ifdef WK_API_ENABLED + strncpy(env->htmlEngine, "WEBKIT", sizeof(env->htmlEngine)-1); +#else + strncpy(env->htmlEngine, "WEBVIEW", sizeof(env->htmlEngine)-1); +#endif env->DWMajorVersion = DW_MAJOR_VERSION; env->DWMinorVersion = DW_MINOR_VERSION; #ifdef VER_REV @@ -12049,7 +12054,7 @@ char *pathcopy = strdup(argv[0]); char *app = strstr(pathcopy, ".app/"); char *binname = strrchr(pathcopy, '/'); - + if(binname && (binname++) && !_dw_app_id[0]) { /* If we have a binary name, use that for the Application ID instead. */ diff -r 8f08d4c9d3fc -r 24875681eec5 os2/dw.c --- a/os2/dw.c Mon May 25 13:03:01 2020 +0000 +++ b/os2/dw.c Sun May 31 05:25:18 2020 +0000 @@ -291,7 +291,7 @@ { static HWND lastwindow = 0; HWND redraw = lastwindow; - + if(skip && !window) return; @@ -440,7 +440,7 @@ dw_window_set_data(handle, "_dw_hpixmap", NULL); dw_window_set_data(handle, "_dw_hpixmap_disabled", NULL); dw_window_set_data(handle, "_dw_button_icon", NULL); - + if(icon) WinDestroyPointer(icon); @@ -574,7 +574,7 @@ if(menuid >= 30000) { char buffer[31] = {0}; - + sprintf(buffer, "_dw_id%d", menuid); dw_window_set_data( hwndApp, buffer, NULL ); sprintf(buffer, "_dw_checkable%d", menuid); @@ -584,7 +584,7 @@ sprintf(buffer, "_dw_isdisabled%d", menuid); dw_window_set_data( hwndApp, buffer, NULL ); } - + /* Check any submenus */ if(WinSendMsg(menu, MM_QUERYITEM, MPFROMSHORT(menuid), MPFROMP(&mi)) && mi.hwndSubMenu) @@ -695,9 +695,9 @@ else { int type = _validate_focus(box->items[z].hwnd); - + /* Special case notebook, can focus and contains items */ - if(type == 2 && direction == _DW_DIRECTION_FORWARD && _focus_notebook(box->items[z].hwnd, handle, start, direction, defaultitem)) + if(type == 2 && direction == _DW_DIRECTION_FORWARD && _focus_notebook(box->items[z].hwnd, handle, start, direction, defaultitem)) return 1; if(box->items[z].hwnd == handle) { @@ -729,7 +729,7 @@ } lasthwnd = box->items[z].hwnd; - + if(!firsthwnd) firsthwnd = lasthwnd; } @@ -777,7 +777,7 @@ } } /* Special case notebook, can focus and contains items */ - if(type == 2 && direction == _DW_DIRECTION_BACKWARD && _focus_notebook(box->items[z].hwnd, handle, start, direction, defaultitem)) + if(type == 2 && direction == _DW_DIRECTION_BACKWARD && _focus_notebook(box->items[z].hwnd, handle, start, direction, defaultitem)) return 1; } } @@ -1061,7 +1061,7 @@ */ int uymax = 0, uxmax = 0; int upymax = 0, upxmax = 0; - + /* Reset the box sizes */ thisbox->minwidth = thisbox->minheight = thisbox->usedpadx = thisbox->usedpady = thisbox->pad * 2; @@ -1095,7 +1095,7 @@ thisbox->grouppadx = 6; } - + thisbox->minwidth += thisbox->grouppadx; thisbox->usedpadx += thisbox->grouppadx; thisbox->minheight += thisbox->grouppady; @@ -1106,7 +1106,7 @@ for(z=0;zcount;z++) { int itempad, itemwidth, itemheight; - + if(thisbox->items[z].type == TYPEBOX) { Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER); @@ -1117,38 +1117,38 @@ if(pass == 1) { (*depth)++; - + /* Save the newly calculated values on the box */ _resize_box(tmp, depth, x, y, pass); - + /* Duplicate the values in the item list for use below */ thisbox->items[z].width = tmp->minwidth; thisbox->items[z].height = tmp->minheight; - + /* If the box has no contents but is expandable... default the size to 1 */ if(!thisbox->items[z].width && thisbox->items[z].hsize) thisbox->items[z].width = 1; if(!thisbox->items[z].height && thisbox->items[z].vsize) thisbox->items[z].height = 1; - + (*depth)--; } } } - + /* Precalculate these values, since they will * be used used repeatedly in the next section. */ itempad = thisbox->items[z].pad * 2; itemwidth = thisbox->items[z].width + itempad; itemheight = thisbox->items[z].height + itempad; - + /* Calculate the totals and maximums */ if(thisbox->type == DW_VERT) { if(itemwidth > uxmax) uxmax = itemwidth; - + if(thisbox->items[z].hsize != SIZEEXPAND) { if(itemwidth > upxmax) @@ -1199,7 +1199,7 @@ currentx += 3; currenty += thisbox->grouppady - 3; } - + /* The second pass is for actual placement. */ if(pass > 1) { @@ -1216,7 +1216,7 @@ if(thisbox->type == DW_HORZ) { int expandablex = thisbox->minwidth - thisbox->usedpadx; - + if(expandablex) width = (int)(((float)width / (float)expandablex) * (float)(x - thisbox->usedpadx)); } @@ -1228,7 +1228,7 @@ if(thisbox->type == DW_VERT) { int expandabley = thisbox->minheight - thisbox->usedpady; - + if(expandabley) height = (int)(((float)height / (float)expandabley) * (float)(y - thisbox->usedpady)); } @@ -1242,7 +1242,7 @@ int pad = thisbox->items[z].pad; HWND handle = thisbox->items[z].hwnd; char tmpbuf[100] = {0}; - + WinQueryClassName(handle, 99, (PCH)tmpbuf); if(strncmp(tmpbuf, "#2", 3)==0) @@ -1343,7 +1343,7 @@ /* Everything else */ _MySetWindowPos(handle, thisbox->hwnd, HWND_TOP, currentx + pad, currenty + pad, width, height, SWP_MOVE | SWP_SIZE | SWP_ZORDER); - + /* After placing a box... place its components */ if(thisbox->items[z].type == TYPEBOX) { @@ -1382,10 +1382,10 @@ if(thisbox) { int depth = 0; - + /* Calculate space requirements */ _resize_box(thisbox, &depth, x, y, 1); - + /* Finally place all the boxes and controls */ _resize_box(thisbox, &depth, x, y, 2); } @@ -4197,7 +4197,7 @@ } break; } - + /* Make sure windows are up-to-date */ if(retval != -1) _dw_redraw(0, FALSE); @@ -4325,7 +4325,7 @@ } break; } - + if(oldproc) return oldproc(hwnd, msg, mp1, mp2); @@ -4385,18 +4385,18 @@ if(argc > 0 && argv[0]) { char *pos = strrchr(argv[0], '\\'); - + /* Just to be safe try the unix style */ if(!pos) pos = strrchr(argv[0], '/'); - + if(pos) strncpy(_dw_exec_dir, argv[0], (size_t)(pos - argv[0])); } /* If that failed... just get the current directory */ if(!_dw_exec_dir[0]) _getcwd(_dw_exec_dir, MAX_PATH); - + if(newthread) { #ifdef UNICODE @@ -4502,7 +4502,7 @@ /* Set the running flag to TRUE */ _dw_main_running = TRUE; - + /* Run the loop until the flag is unset... or error */ while(_dw_main_running && WinGetMsg(dwhab, &qmsg, 0, 0, 0)) { @@ -4920,7 +4920,7 @@ return dw_menu_delete_item((HMENUI)menu, handle); return DW_ERROR_UNKNOWN; } - + parent = WinQueryWindow(handle, QW_PARENT); frame = (HWND)dw_window_get_data(handle, "_dw_combo_box"); @@ -5043,7 +5043,7 @@ void API dw_font_set_default(const char *fontname) { char *oldfont = DefaultFont; - + DefaultFont = strdup(fontname); free(oldfont); } @@ -5054,8 +5054,8 @@ Item *_box_item(HWND handle) { HWND parent = WinQueryWindow(handle, QW_PARENT); - Box *thisbox = (Box *)WinQueryWindowPtr(parent, QWP_USER); - + Box *thisbox = (Box *)WinQueryWindowPtr(parent, QWP_USER); + /* If it is a desktop window let WM_DESTROY handle it */ if(parent != HWND_DESKTOP) { @@ -5076,7 +5076,7 @@ /* Internal function to calculate the widget's required size.. * These are the general rules for widget sizes: - * + * * Render/Unspecified: 1x1 * Scrolled(Container,Tree,MLE): Guessed size clamped to min and max in dw.h * Entryfield/Combobox/Spinbutton: 150x(maxfontheight) @@ -5093,7 +5093,7 @@ WinQueryClassName(handle, 99, (PCH)tmpbuf); - /* If we have a string... + /* If we have a string... * calculate the size with the current font. */ if(buf) @@ -5102,7 +5102,7 @@ dw_font_text_extents_get(handle, NULL, buf, &thiswidth, &thisheight); dw_free(buf); } - + /* Combobox */ if(strncmp(tmpbuf, "#2", 3)==0) { @@ -5240,27 +5240,27 @@ char buf[1025] = {0}; int x, count = dw_listbox_count(handle); int basicwidth = thiswidth = WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL) + 8; - + thisheight = 8; - + for(x=0;x thiswidth) thiswidth = width > _DW_SCROLLED_MAX_WIDTH ? _DW_SCROLLED_MAX_WIDTH : width; thisheight += height; } - + if(thiswidth < _DW_SCROLLED_MIN_WIDTH) thiswidth = _DW_SCROLLED_MIN_WIDTH; if(thisheight < _DW_SCROLLED_MIN_HEIGHT) @@ -5386,7 +5386,7 @@ else if(strncmp(tmpbuf, "#3", 3)==0) { ULONG style = WinQueryWindowULong(handle, QWL_STYLE); - + if(style & BS_AUTOCHECKBOX || style & BS_AUTORADIOBUTTON) { extrawidth = 24; @@ -5464,7 +5464,7 @@ } } - /* Set the requested sizes */ + /* Set the requested sizes */ if(width) *width = thiswidth + extrawidth; if(height) @@ -5484,11 +5484,11 @@ if(!WinSetPresParam(group ? group : handle, PP_FONTNAMESIZE, strlen(fontname)+1, (void *)fontname)) { Item *item = _box_item(handle); - + /* Check to see if any of the sizes need to be recalculated */ if(item && (item->origwidth == -1 || item->origheight == -1)) { - _control_size(handle, item->origwidth == -1 ? &item->width : NULL, item->origheight == -1 ? &item->height : NULL); + _control_size(handle, item->origwidth == -1 ? &item->width : NULL, item->origheight == -1 ? &item->height : NULL); /* Queue a redraw on the top-level window */ _dw_redraw(_toplevel_window(handle), TRUE); } @@ -6032,7 +6032,7 @@ while(tmp) { if(tmp->id == id) - return TRUE; + return TRUE; tmp = tmp->next; } return FALSE; @@ -6077,15 +6077,15 @@ if (title && *title) { /* Code to autogenerate a menu ID if not specified or invalid - * First pool is smaller for transient popup menus + * First pool is smaller for transient popup menus */ if(id == (ULONG)-1) { static ULONG tempid = 61000; - + tempid++; id = tempid; - + if(tempid > 65500) tempid = 61000; } @@ -6098,7 +6098,7 @@ else if(!id || id >= 30000) { static ULONG menuid = 30000; - + do { menuid++; @@ -6228,7 +6228,7 @@ * Parameters: * menu: The handle to the menu in which the item was appended. * id: Menuitem id. - * Returns: + * Returns: * DW_ERROR_NONE (0) on success or DW_ERROR_UNKNOWN on failure. */ int API dw_menu_delete_item(HMENUI menux, unsigned long id) @@ -7448,15 +7448,15 @@ WinQueryWindowRect(handle, &rect); WinInvalidateRect(handle, &rect, TRUE); } - + /* If we changed the bitmap... */ { Item *item = _box_item(handle); - + /* Check to see if any of the sizes need to be recalculated */ if(item && (item->origwidth == -1 || item->origheight == -1)) { - _control_size(handle, item->origwidth == -1 ? &item->width : NULL, item->origheight == -1 ? &item->height : NULL); + _control_size(handle, item->origwidth == -1 ? &item->width : NULL, item->origheight == -1 ? &item->height : NULL); /* Queue a redraw on the top-level window */ _dw_redraw(_toplevel_window(handle), TRUE); } @@ -7632,14 +7632,14 @@ /* If we changed the text... */ { Item *item = _box_item(handle); - + /* Check to see if any of the sizes need to be recalculated */ if(item && (item->origwidth == -1 || item->origheight == -1)) { int newwidth, newheight; - - _control_size(handle, &newwidth, &newheight); - + + _control_size(handle, &newwidth, &newheight); + /* Only update the item and redraw the window if it changed */ if((item->origwidth == -1 && item->width != newwidth) || (item->origheight == -1 && item->height != newheight)) @@ -7706,10 +7706,10 @@ { char buffer[30]; HMENUI mymenu; - + sprintf(buffer, "_dw_id%ld", handle); mymenu = (HMENUI)dw_window_get_data(hwndApp, buffer); - + if(mymenu && WinIsWindow(dwhab, mymenu)) dw_menu_item_set_state(mymenu, handle, DW_MIS_DISABLED); return; @@ -7771,10 +7771,10 @@ { char buffer[30]; HMENUI mymenu; - + sprintf(buffer, "_dw_id%ld", handle); mymenu = (HMENUI)dw_window_get_data(hwndApp, buffer); - + if(mymenu && WinIsWindow(dwhab, mymenu)) dw_menu_item_set_state(mymenu, handle, DW_MIS_ENABLED); return; @@ -7830,7 +7830,7 @@ void _dw_box_pack(HWND box, HWND item, int index, int width, int height, int hsize, int vsize, int pad, char *funcname) { Box *thisbox; - + /* * If you try and pack an item into itself VERY bad things can happen; like at least an * infinite loop on GTK! Lets be safe! @@ -7853,7 +7853,7 @@ box = WinWindowFromID(box, FID_CLIENT); } } - + thisbox = WinQueryWindowPtr(box, QWP_USER); if(thisbox) @@ -7870,7 +7870,7 @@ index = 0; if(index > thisbox->count) index = thisbox->count; - + tmpitem = calloc(sizeof(Item), (thisbox->count+1)); for(z=0;zcount;z++) @@ -7906,7 +7906,7 @@ tmpitem[index].pad = pad; tmpitem[index].hsize = hsize ? SIZEEXPAND : SIZESTATIC; tmpitem[index].vsize = vsize ? SIZEEXPAND : SIZESTATIC; - + /* If either of the parameters are -1 ... calculate the size */ if(width == -1 || height == -1) _control_size(item, width == -1 ? &tmpitem[index].width : NULL, height == -1 ? &tmpitem[index].height : NULL); @@ -7942,13 +7942,13 @@ int API dw_box_unpack(HWND handle) { HWND parent = WinQueryWindow(handle, QW_PARENT); - + if(parent != desktop) { Box *thisbox = WinQueryWindowPtr(parent, QWP_USER); - - /* If the parent box has items... - * try to remove it from the layout + + /* If the parent box has items... + * try to remove it from the layout */ if(thisbox && thisbox->count) { @@ -7957,7 +7957,7 @@ if(!thisitem) thisbox->count = 0; - + for(z=0;zcount;z++) { if(thisitem[z].hwnd == handle) @@ -7989,7 +7989,7 @@ thisbox->count--; else thisbox->count = 0; - + /* If it isn't padding, reset the parent */ if(handle) WinSetParent(handle, HWND_OBJECT, FALSE); @@ -8012,7 +8012,7 @@ HWND API dw_box_unpack_at_index(HWND box, int index) { Box *thisbox = WinQueryWindowPtr(box, QWP_USER); - + /* Try to remove it from the layout */ if(thisbox && index > -1 && index < thisbox->count) { @@ -8042,7 +8042,7 @@ thisbox->count--; else thisbox->count = 0; - + /* If it isn't padding, reset the parent */ if(handle) WinSetParent(handle, HWND_OBJECT, FALSE); @@ -8058,7 +8058,7 @@ * Parameters: * box: Window handle of the box to be packed into. * item: Window handle of the item to pack. - * index: 0 based index of packed items. + * index: 0 based index of packed items. * width: Width in pixels of the item or -1 to be self determined. * height: Height in pixels of the item or -1 to be self determined. * hsize: TRUE if the window (widget) should expand horizontally to fill space given. @@ -8083,7 +8083,7 @@ */ void API dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) { - /* 65536 is the table limit on GTK... + /* 65536 is the table limit on GTK... * seems like a high enough value we will never hit it here either. */ _dw_box_pack(box, item, 65536, width, height, hsize, vsize, pad, "dw_box_pack_start()"); @@ -8121,13 +8121,13 @@ /* Calculate space requirements */ _resize_box(thisbox, &depth, *width, *height, 1); - + rect.xRight = thisbox->minwidth; rect.yTop = thisbox->minheight; /* Take into account the window border and menu here */ WinCalcFrameRect(handle, &rect, FALSE); - + if(*width < 1) *width = rect.xRight - rect.xLeft; if(*height < 1) *height = rect.yTop - rect.yBottom; } @@ -8145,7 +8145,7 @@ /* Attempt to auto-size */ if ( width < 1 || height < 1 ) _get_window_for_size(handle, &width, &height); - + /* Finally set the size */ WinSetWindowPos(handle, NULLHANDLE, 0, 0, width, height, SWP_SIZE); } @@ -8166,14 +8166,14 @@ if(strncmp(tmpbuf, "#1", 3)==0) { HWND box = WinWindowFromID(handle, FID_CLIENT); - + if(box) { unsigned long thiswidth = 0, thisheight = 0; - + /* Get the size with the border */ _get_window_for_size(handle, &thiswidth, &thisheight); - + /* Return what was requested */ if(width) *width = (int)thiswidth; if(height) *height = (int)thisheight; @@ -8181,14 +8181,14 @@ else { Box *thisbox = WinQueryWindowPtr(handle, QWP_USER); - + if(thisbox) { int depth = 0; - + /* Calculate space requirements */ _resize_box(thisbox, &depth, 0, 0, 1); - + /* Return what was requested */ if(width) *width = thisbox->minwidth; if(height) *height = thisbox->minheight; @@ -8245,12 +8245,12 @@ { int horz = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_grav_horz")); int vert = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_grav_vert")); - + /* Do any gravity calculations */ if(horz || (vert & 0xf) != DW_GRAV_BOTTOM) { long newx = *x, newy = *y; - + /* Handle horizontal center gravity */ if((horz & 0xf) == DW_GRAV_CENTER) newx += ((dw_screen_width() / 2) - (width / 2)); @@ -8262,11 +8262,11 @@ newy += ((dw_screen_height() / 2) - (height / 2)); else if((vert & 0xf) == DW_GRAV_TOP) newy = dw_screen_height() - height - *y; - + /* Save the new values */ *x = newx; *y = newy; - } + } /* Adjust the values to avoid WarpCenter/XCenter/eCenter if requested */ if(_WinQueryDesktopWorkArea && (horz | vert) & DW_GRAV_OBSTACLES) { @@ -8327,7 +8327,7 @@ /* Attempt to auto-size */ if ( width < 1 || height < 1 ) _get_window_for_size(handle, &width, &height); - + _handle_gravity(handle, &x, &y, width, height); /* Finally set the size */ WinSetWindowPos(handle, NULLHANDLE, x, y, width, height, SWP_MOVE | SWP_SIZE); @@ -8369,10 +8369,10 @@ { char buffer[30]; HMENUI mymenu; - + sprintf(buffer, "_dw_id%ld", handle); mymenu = (HMENUI)dw_window_get_data(hwndApp, buffer); - + if(mymenu && WinIsWindow(dwhab, mymenu)) dw_menu_item_set_state(mymenu, handle, style & mask); } @@ -8895,7 +8895,7 @@ if(mypos >= range) mypos = range - 1; - + _dw_int_set(handle, mypos); WinSendMsg(handle, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), (MPARAM)mypos); } @@ -9806,7 +9806,7 @@ ULONG totalsize, size = 0, *flags = blah ? blah->data : 0; int z, count = 0; char *oldtitle = (char *)temp->pszIcon; - + if(!flags) return; @@ -9817,7 +9817,7 @@ temp->pszIcon = temp->pszText = NULL; if(oldtitle) free(oldtitle); - + /* Figure out the offsets to the items in the struct */ for(z=0;zpszName = pCore->pszIcon = (PSZ)newtitle; WinSendMsg(handle, CM_INVALIDATERECORD, (MPARAM)&pCore, MPFROM2SHORT(1, CMA_NOREPOSITION | CMA_TEXTCHANGED)); - + if(oldtitle) free(oldtitle); return; @@ -11461,7 +11461,7 @@ POINTL ptl[4]; int dheight, sheight; int count = 3; - + /* Do some sanity checks */ if((srcheight == -1 || srcwidth == -1) && srcheight != srcwidth) return DW_ERROR_GENERAL; @@ -11921,7 +11921,7 @@ return 0; } -/* +/* * Generally an internal function called from a newly created * thread to setup the Dynamic Windows environment for the thread. * However it is exported so language bindings can call it when @@ -11935,7 +11935,7 @@ threadinfo[0] = (void *)thishab; threadinfo[1] = (void *)thishmq; - + #ifndef __WATCOMC__ *_threadstore() = (void *)threadinfo; #endif @@ -11952,7 +11952,7 @@ _dw_init_thread2(); } -/* +/* * Generally an internal function called from a terminating * thread to cleanup the Dynamic Windows environment for the thread. * However it is exported so language bindings can call it when @@ -11969,7 +11969,7 @@ { HAB thishab = (HAB)threadinfo[0]; HMQ thishmq = (HMQ)threadinfo[1]; - + WinDestroyMsgQueue(thishmq); WinTerminate(thishab); free(threadinfo); @@ -12403,7 +12403,7 @@ * A handle to the notification which can be used to attach a "clicked" event if desired, * or NULL if it fails or notifications are not supported by the system. * Remarks: - * This will create a system notification that will show in the notifaction panel + * This will create a system notification that will show in the notifaction panel * on supported systems, which may be clicked to perform another task. */ HWND dw_notification_new(const char *title, HPIXMAP pixmap, const char *description, ...) @@ -12458,6 +12458,7 @@ } strcpy(env->buildDate, __DATE__); strcpy(env->buildTime, __TIME__); + strcpy(env->htmlEngine, "N/A"); env->DWMajorVersion = DW_MAJOR_VERSION; env->DWMinorVersion = DW_MINOR_VERSION; #ifdef VER_REV @@ -12925,7 +12926,7 @@ return 0; } -typedef struct _dwprint +typedef struct _dwprint { HDC hdc; char *printername; @@ -13045,7 +13046,7 @@ if(!drawfunc || !(print = calloc(1, sizeof(DWPrint)))) return NULL; - + print->drawfunc = (int (API_FUNC)(HPRINT, HPIXMAP, int, void *))drawfunc; print->drawdata = drawdata; print->jobname = strdup(jobname ? jobname : "Dynamic Windows Print Job"); @@ -13219,10 +13220,10 @@ HPIXMAP pixmap; int x, result = DW_ERROR_UNKNOWN; SIZEL sizl = { 0, 0 }; - + if(!p) return result; - + if (!(pixmap = calloc(1,sizeof(struct _hpixmap)))) return result; @@ -13271,7 +13272,7 @@ void API dw_print_cancel(HPRINT print) { DWPrint *p = print; - + if(p) p->drawfunc = NULL; } @@ -13299,7 +13300,7 @@ /* * Returns a pointer to a static buffer which containes the - * private application data directory. + * private application data directory. */ char * API dw_app_dir(void) { @@ -13616,12 +13617,12 @@ if(((window < 65536 && tmp->id == window) || tmp->window == window) && tmp->message == message) { void (API_FUNC discfunc)(HWND, void *) = (void (API_FUNC)(HWND, void *))tmp->discfunction; - + if(discfunc) { discfunc(tmp->window, tmp->data); } - + if(prev) { prev->next = tmp->next; @@ -13657,12 +13658,12 @@ if((window < 65536 && tmp->id == window) || tmp->window == window) { void (API_FUNC discfunc)(HWND, void *) = (void (API_FUNC)(HWND, void *))tmp->discfunction; - + if(discfunc) { discfunc(tmp->window, tmp->data); } - + if(prev) { prev->next = tmp->next; @@ -13699,12 +13700,12 @@ if(((window < 65536 && tmp->id == window) || tmp->window == window) && tmp->data == data) { void (API_FUNC discfunc)(HWND, void *) = (void (API_FUNC)(HWND, void *))tmp->discfunction; - + if(discfunc) { discfunc(tmp->window, tmp->data); } - + if(prev) { prev->next = tmp->next; diff -r 8f08d4c9d3fc -r 24875681eec5 win/dw.c --- a/win/dw.c Mon May 25 13:03:01 2020 +0000 +++ b/win/dw.c Sun May 31 05:25:18 2020 +0000 @@ -6,7 +6,7 @@ * (C) 2003-2011 Mark Hessling * */ - + #ifdef AEROGLASS #define _WIN32_IE 0x0501 #define WINVER 0x501 @@ -64,7 +64,7 @@ UINT32 GdiplusVersion; void *DebugEventCallback; BOOL SuppressBackgroundThread; - BOOL SuppressExternalCodecs; + BOOL SuppressExternalCodecs; }; typedef enum { @@ -89,7 +89,7 @@ GdiplusNotInitialized = 18, PropertyNotFound = 19, PropertyNotSupported = 20, - ProfileNotFound = 21 + ProfileNotFound = 21 } GpStatus; typedef enum { @@ -104,7 +104,7 @@ typedef enum { FlushIntentionFlush = 0, - FlushIntentionSync = 1 + FlushIntentionSync = 1 } GpFlushIntention; typedef enum { @@ -175,12 +175,12 @@ GpStatus WINAPI GdipFlush(GpGraphics *graphics, GpFlushIntention intention); /* Pixel format information */ -#define PixelFormatIndexed 0x00010000 +#define PixelFormatIndexed 0x00010000 #define PixelFormatGDI 0x00020000 #define PixelFormatAlpha 0x00040000 #define PixelFormatPAlpha 0x00080000 #define PixelFormatExtended 0x00100000 -#define PixelFormatCanonical 0x00200000 +#define PixelFormatCanonical 0x00200000 #define PixelFormatUndefined 0 #define PixelFormatDontCare 0 @@ -202,7 +202,7 @@ #define PixelFormat32bppCMYK (15 | (32 << 8)) /* Token to the GDI+ Instance */ -ULONG_PTR gdiplusToken; +ULONG_PTR gdiplusToken; #endif #ifdef AEROGLASS @@ -222,7 +222,7 @@ /* Aero related but separate functions and handles */ HRESULT (WINAPI *_SetWindowTheme)(HWND hwnd, LPCWSTR pszSubAppName, LPCWSTR pszSubIdList) = 0; HANDLE huxtheme = 0; - + /* Needed for Rich Edit controls */ HANDLE hrichedit = 0; HANDLE hmsftedit = 0; @@ -330,7 +330,7 @@ { static HWND lastwindow = 0; HWND redraw = lastwindow; - + if(skip && !window) return; @@ -499,7 +499,7 @@ LPWSTR _myUTF8toWide(const char *utf8string, void *outbuf) { LPWSTR retbuf = outbuf; - + if(retbuf) MultiByteToWideChar(CP_UTF8, 0, utf8string, -1, retbuf, MultiByteToWideChar(CP_UTF8, 0, utf8string, -1, NULL, 0) * sizeof(WCHAR)); return retbuf; @@ -508,7 +508,7 @@ char *_myWideToUTF8(LPCWSTR widestring, void *outbuf) { char *retbuf = outbuf; - + if(retbuf) WideCharToMultiByte(CP_UTF8, 0, widestring, -1, retbuf, WideCharToMultiByte(CP_UTF8, 0, widestring, -1, NULL, 0, NULL, NULL), NULL, NULL); return retbuf; @@ -743,15 +743,15 @@ SIZE_T cbData; } _WINDOWCOMPOSITIONATTRIBDATA; -HTHEME (WINAPI * _OpenNcThemeData)(HWND, LPCWSTR) = NULL; -VOID (WINAPI * _RefreshImmersiveColorPolicyState)(VOID) = NULL; -BOOL (WINAPI * _GetIsImmersiveColorUsingHighContrast)(IMMERSIVE_HC_CACHE_MODE) = NULL; -BOOL (WINAPI * _ShouldAppsUseDarkMode)(VOID) = NULL; +HTHEME (WINAPI * _OpenNcThemeData)(HWND, LPCWSTR) = NULL; +VOID (WINAPI * _RefreshImmersiveColorPolicyState)(VOID) = NULL; +BOOL (WINAPI * _GetIsImmersiveColorUsingHighContrast)(IMMERSIVE_HC_CACHE_MODE) = NULL; +BOOL (WINAPI * _ShouldAppsUseDarkMode)(VOID) = NULL; BOOL (WINAPI * _AllowDarkModeForWindow)(HWND, BOOL) = NULL; -BOOL (WINAPI * _AllowDarkModeForApp)(BOOL) = NULL; -_PreferredAppMode (WINAPI * _SetPreferredAppMode)(_PreferredAppMode) = NULL; -BOOL (WINAPI * _IsDarkModeAllowedForWindow)(HWND) = NULL; -BOOL (WINAPI * _ShouldSystemUseDarkMode)(VOID) = NULL; +BOOL (WINAPI * _AllowDarkModeForApp)(BOOL) = NULL; +_PreferredAppMode (WINAPI * _SetPreferredAppMode)(_PreferredAppMode) = NULL; +BOOL (WINAPI * _IsDarkModeAllowedForWindow)(HWND) = NULL; +BOOL (WINAPI * _ShouldSystemUseDarkMode)(VOID) = NULL; BOOL (WINAPI* _SetWindowCompositionAttribute)(HWND, _WINDOWCOMPOSITIONATTRIBDATA *) = NULL; BOOL IsHighContrast(VOID) @@ -784,7 +784,7 @@ } /* Make sure we were able to load all the Dark Mode functions */ if(_OpenNcThemeData && _RefreshImmersiveColorPolicyState && _ShouldAppsUseDarkMode && _AllowDarkModeForWindow && - (_AllowDarkModeForApp || _SetPreferredAppMode) && _IsDarkModeAllowedForWindow && + (_AllowDarkModeForApp || _SetPreferredAppMode) && _IsDarkModeAllowedForWindow && (_DwmSetWindowAttribute || _SetWindowCompositionAttribute)) { _DW_DARK_MODE_SUPPORTED = TRUE; @@ -802,11 +802,11 @@ { TCHAR tmpbuf[100] = {0}; LONG_PTR style = GetWindowLongPtr(window, GWL_STYLE); - + GetClassName(window, tmpbuf, 99); /* Some controls don't display properly with visual styles enabled */ - if(_tcsnicmp(tmpbuf, BUTTONCLASSNAME, _tcslen(BUTTONCLASSNAME)+1) == 0 && + if(_tcsnicmp(tmpbuf, BUTTONCLASSNAME, _tcslen(BUTTONCLASSNAME)+1) == 0 && (style & (BS_AUTOCHECKBOX | BS_CHECKBOX | BS_RADIOBUTTON))) return FALSE; #ifdef TOOLBAR @@ -883,7 +883,7 @@ } #endif -/* Special wrappers for GetSysColor*() since they currently don't support +/* Special wrappers for GetSysColor*() since they currently don't support * dark mode, we will have to return modified colors when dark mode is enabled. */ DWORD _DW_GetSysColor(int nIndex) @@ -894,7 +894,7 @@ { const COLORREF darkBkColor = 0x383838; const COLORREF darkTextColor = 0xFFFFFF; - + switch(nIndex) { case COLOR_3DFACE: @@ -915,7 +915,7 @@ HBRUSH retval = GetSysColorBrush(nIndex); #ifdef AEROGLASS static HBRUSH darkBkColorBrush = 0; - + if(_DW_DARK_MODE_ALLOWED == 2 && _DW_DARK_MODE_ENABLED) { if(!darkBkColorBrush) @@ -1000,15 +1000,15 @@ HFONT oldfont = (HFONT)SendMessage(handle, WM_GETFONT, 0, 0); HICON oldicon = (HICON)SendMessage(handle, WM_GETICON, 0, 0); TCHAR tmpbuf[100] = {0}; - + TOOLINFO ti = { 0 }; - + ti.cbSize = sizeof(TOOLINFO); ti.hwnd = handle; ti.hinst = DWInstance; - + SendMessage(hwndTooltip, TTM_DELTOOL, 0, (LPARAM) (LPTOOLINFO) &ti); - + GetClassName(handle, tmpbuf, 99); /* Don't try to free memory from an embedded IE or Edge/Chromium window */ @@ -1039,22 +1039,22 @@ if(oldicon) DestroyIcon(oldicon); } -#ifdef TOOLBAR +#ifdef TOOLBAR /* Bitmap Buttons */ else if(_tcsnicmp(tmpbuf, TOOLBARCLASSNAME, _tcslen(TOOLBARCLASSNAME)+1) == 0) { HIMAGELIST imlist = (HIMAGELIST)SendMessage(handle, TB_GETIMAGELIST, 0, 0); HIMAGELIST dimlist = (HIMAGELIST)SendMessage(handle, TB_GETDISABLEDIMAGELIST, 0, 0); - + SendMessage(handle, TB_SETIMAGELIST, 0, 0); SendMessage(handle, TB_SETDISABLEDIMAGELIST, 0, 0); - + if(imlist) ImageList_Destroy(imlist); if(dimlist) ImageList_Destroy(dimlist); } -#endif +#endif else if(_tcsnicmp(tmpbuf, FRAMECLASSNAME, _tcslen(FRAMECLASSNAME)+1)==0) { Box *box = (Box *)thiscinfo; @@ -1139,12 +1139,12 @@ mii.fMask = MIIM_SUBMENU | MIIM_ID; if ( GetMenuItemInfo( menu, i, TRUE, &mii ) ) - { + { /* Free the data associated with the ID */ if(mii.wID >= 30000) { char buffer[31] = {0}; - + _snprintf(buffer, 30, "_dw_id%u", mii.wID); dw_window_set_data( DW_HWND_OBJECT, buffer, NULL ); _snprintf(buffer, 30, "_dw_checkable%u", mii.wID); @@ -1154,7 +1154,7 @@ _snprintf(buffer, 30, "_dw_isdisabled%u", mii.wID); dw_window_set_data( DW_HWND_OBJECT, buffer, NULL ); } - + /* Check any submenus */ if( mii.hSubMenu ) _free_menu_data(mii.hSubMenu); @@ -1193,9 +1193,9 @@ */ if(_tcsnicmp(tmpbuf, EDITCLASSNAME, _tcslen(EDITCLASSNAME)+1)==0 || /* Entryfield */ _tcsnicmp(tmpbuf, BUTTONCLASSNAME, _tcslen(BUTTONCLASSNAME)+1)==0 || /* Button */ -#ifdef TOOLBAR +#ifdef TOOLBAR _tcsnicmp(tmpbuf, TOOLBARCLASSNAME, _tcslen(TOOLBARCLASSNAME)+1) == 0 || /* Toolbar */ -#endif +#endif _tcsnicmp(tmpbuf, COMBOBOXCLASSNAME, _tcslen(COMBOBOXCLASSNAME)+1)==0 || /* Combobox */ _tcsnicmp(tmpbuf, LISTBOXCLASSNAME, _tcslen(LISTBOXCLASSNAME)+1)==0 || /* List box */ _tcsnicmp(tmpbuf, UPDOWN_CLASS, _tcslen(UPDOWN_CLASS)+1)==0 || /* Spinbutton */ @@ -1307,9 +1307,9 @@ else { int type = _validate_focus(box->items[z].hwnd); - + /* Special case notebook, can focus and contains items */ - if(type == 2 && direction == _DW_DIRECTION_FORWARD && _focus_notebook(box->items[z].hwnd, handle, start, direction, defaultitem)) + if(type == 2 && direction == _DW_DIRECTION_FORWARD && _focus_notebook(box->items[z].hwnd, handle, start, direction, defaultitem)) return 1; if(box->items[z].hwnd == handle) { @@ -1341,7 +1341,7 @@ } lasthwnd = _normalize_handle(box->items[z].hwnd); - + if(!firsthwnd) firsthwnd = lasthwnd; } @@ -1386,7 +1386,7 @@ } } /* Special case notebook, can focus and contains items */ - if(type == 2 && direction == _DW_DIRECTION_BACKWARD && _focus_notebook(box->items[z].hwnd, handle, start, direction, defaultitem)) + if(type == 2 && direction == _DW_DIRECTION_BACKWARD && _focus_notebook(box->items[z].hwnd, handle, start, direction, defaultitem)) return 1; } } @@ -1425,7 +1425,7 @@ if(!lastbox) lastbox = handle; - + /* Find the toplevel window */ while((box = GetParent(lastbox))) { @@ -1437,9 +1437,9 @@ if(lastbox) { TCHAR tmpbuf[100] = {0}; - + GetClassName(lastbox, tmpbuf, 99); - + if(_tcsncmp(tmpbuf, ClassName, _tcslen(ClassName)+1)==0) return lastbox; } @@ -1482,7 +1482,7 @@ */ int uymax = 0, uxmax = 0; int upymax = 0, upxmax = 0; - + /* Reset the box sizes */ thisbox->minwidth = thisbox->minheight = thisbox->usedpadx = thisbox->usedpady = thisbox->pad * 2; @@ -1508,7 +1508,7 @@ */ if(thisbox->grouppady < 9) thisbox->grouppady = 9; - + if(thisbox->grouppady) thisbox->grouppady += 3; else @@ -1527,7 +1527,7 @@ for(z=0;zcount;z++) { int itempad, itemwidth, itemheight; - + if(thisbox->items[z].type == TYPEBOX) { Box *tmp = (Box *)GetWindowLongPtr(thisbox->items[z].hwnd, GWLP_USERDATA); @@ -1538,38 +1538,38 @@ if(pass == 1) { (*depth)++; - + /* Save the newly calculated values on the box */ _resize_box(tmp, depth, x, y, pass); - + /* Duplicate the values in the item list for use below */ thisbox->items[z].width = tmp->minwidth; thisbox->items[z].height = tmp->minheight; - + /* If the box has no contents but is expandable... default the size to 1 */ if(!thisbox->items[z].width && thisbox->items[z].hsize) thisbox->items[z].width = 1; if(!thisbox->items[z].height && thisbox->items[z].vsize) thisbox->items[z].height = 1; - + (*depth)--; } } } - + /* Precalculate these values, since they will * be used used repeatedly in the next section. */ itempad = thisbox->items[z].pad * 2; itemwidth = thisbox->items[z].width + itempad; itemheight = thisbox->items[z].height + itempad; - + /* Calculate the totals and maximums */ if(thisbox->type == DW_VERT) { if(itemwidth > uxmax) uxmax = itemwidth; - + if(thisbox->items[z].hsize != SIZEEXPAND) { if(itemwidth > upxmax) @@ -1637,7 +1637,7 @@ if(thisbox->type == DW_HORZ) { int expandablex = thisbox->minwidth - thisbox->usedpadx; - + if(expandablex) width = (int)(((float)width / (float)expandablex) * (float)(x - thisbox->usedpadx)); } @@ -1649,21 +1649,21 @@ if(thisbox->type == DW_VERT) { int expandabley = thisbox->minheight - thisbox->usedpady; - + if(expandabley) height = (int)(((float)height / (float)expandabley) * (float)(y - thisbox->usedpady)); } else height = y - (itempad + thispad + thisbox->grouppady); } - + /* If the calculated size is valid... */ if(width > 0 && height > 0) { int pad = thisbox->items[z].pad; HWND handle = thisbox->items[z].hwnd; TCHAR tmpbuf[100] = {0}; - + GetClassName(handle, tmpbuf, 99); if(_tcsnicmp(tmpbuf, COMBOBOXCLASSNAME, _tcslen(COMBOBOXCLASSNAME)+1)==0) @@ -1845,9 +1845,9 @@ } /* So does the List View... handle delayed cursoring */ if(_tcsnicmp(tmpbuf, WC_LISTVIEW, _tcslen(WC_LISTVIEW)+1)==0 && width > 10 && height > 10) - { + { int index = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_cursor")); - + if(index > 0) ListView_EnsureVisible(handle, index, TRUE); } @@ -1869,10 +1869,10 @@ if(thisbox) { int depth = 0; - + /* Calculate space requirements */ _resize_box(thisbox, &depth, x, y, 1); - + /* Finally place all the boxes and controls */ _resize_box(thisbox, &depth, x, y, 2); } @@ -2137,13 +2137,13 @@ { int special = 0; char *utf8 = NULL, ch[2] = {0}; -#ifdef UNICODE +#ifdef UNICODE WCHAR uc[2] = { 0 }; - + uc[0] = (WCHAR)mp1; utf8 = WideToUTF8(&uc[0]); -#endif - +#endif + if(GetAsyncKeyState(VK_SHIFT) & 0x8000) special |= KC_SHIFT; if(GetAsyncKeyState(VK_CONTROL) & 0x8000) @@ -2354,7 +2354,7 @@ tmp = NULL; } } -#ifdef TOOLBAR +#ifdef TOOLBAR else if (message == BN_CLICKED && tmp->message == WM_COMMAND && tmp->window == (HWND)mp2) { TCHAR tmpbuf[100] = {0}; @@ -2368,7 +2368,7 @@ tmp = NULL; } } -#endif +#endif else if (tmp->id && passthru == tmp->id) { HMENU hwndmenu = GetMenu(hWnd), menuowner = _menu_owner((HMENU)tmp->window); @@ -2468,19 +2468,19 @@ /* Now that any handlers are done... do normal processing */ switch( msg ) { -#ifdef AEROGLASS +#ifdef AEROGLASS case WM_DWMCOMPOSITIONCHANGED: { LONG_PTR styleex = GetWindowLongPtr(hWnd, GWL_EXSTYLE); - + if(_DwmIsCompositionEnabled) _DwmIsCompositionEnabled(&_dw_composition); - + /* If we are no longer compositing... disable layered windows */ if(!_dw_composition && (styleex & WS_EX_LAYERED)) { MARGINS mar = {0}; - + SetWindowLongPtr(hWnd, GWL_EXSTYLE, styleex & ~WS_EX_LAYERED); if(_DwmExtendFrameIntoClientArea) _DwmExtendFrameIntoClientArea(hWnd, &mar); @@ -2501,15 +2501,15 @@ break; #endif #ifdef AEROGLASS1 - case WM_ERASEBKGND: + case WM_ERASEBKGND: if(_dw_composition && (GetWindowLongPtr(hWnd, GWL_EXSTYLE) & WS_EX_LAYERED)) { static HBRUSH hbrush = 0; RECT rect; - + if(!hbrush) hbrush = CreateSolidBrush(_dw_transparencykey); - + GetClientRect(hWnd, &rect); FillRect((HDC)mp1, &rect, hbrush); return TRUE; @@ -2620,7 +2620,7 @@ else { TCHAR tmpbuf[100] = {0}; - + GetClassName( hWnd, tmpbuf, 99 ); if ( _tcsnicmp(tmpbuf, FRAMECLASSNAME, _tcslen(FRAMECLASSNAME)+1 ) == 0 ) { @@ -2707,21 +2707,21 @@ InvalidateRect(hWnd, NULL, TRUE); } break; - case WM_ERASEBKGND: + case WM_ERASEBKGND: if(_dw_composition && (GetWindowLongPtr(_toplevel_window(hWnd), GWL_EXSTYLE) & WS_EX_LAYERED)) { static HBRUSH hbrush = 0; RECT rect; - + if(!hbrush) hbrush = CreateSolidBrush(_dw_transparencykey); - + GetClientRect(hWnd, &rect); FillRect((HDC)mp1, &rect, hbrush); return TRUE; } break; -#endif +#endif case WM_PAINT: { ColorInfo *thiscinfo = (ColorInfo *)GetWindowLongPtr(hWnd, GWLP_USERDATA); @@ -2948,7 +2948,7 @@ * obtain input focus. */ if (_tcsnicmp(tmpbuf, BUTTONCLASSNAME, _tcslen(BUTTONCLASSNAME)+1)==0 -#ifdef TOOLBAR +#ifdef TOOLBAR || _tcsnicmp(tmpbuf, TOOLBARCLASSNAME, _tcslen(TOOLBARCLASSNAME)+1) == 0 #endif ) @@ -3130,7 +3130,7 @@ case WM_CTLCOLORDLG: { ColorInfo *thiscinfo = (ColorInfo *)GetWindowLongPtr((HWND)mp2, GWLP_USERDATA); - + if(msg == WM_CTLCOLORBTN) { /* Groupbox color info is on the frame window it is attached to */ @@ -3141,11 +3141,11 @@ thiscinfo = &framebox->cinfo; } } - + if(thiscinfo && thiscinfo->fore != -1 && thiscinfo->back != -1) { int thisback = thiscinfo->back; - + /* Handle foreground */ if(thiscinfo->fore != DW_CLR_DEFAULT) { @@ -3163,7 +3163,7 @@ if(thiscinfo->back == DW_RGB_TRANSPARENT) { ColorInfo *parentcinfo = (ColorInfo *)GetWindowLongPtr(hWnd, GWLP_USERDATA); - + if(parentcinfo && parentcinfo->back != -1) thisback = parentcinfo->back; } @@ -3179,7 +3179,7 @@ else if(thisback != -1 && thisback != DW_RGB_TRANSPARENT) { int back = _internal_color(thisback); - + SetBkColor((HDC)mp1, RGB(DW_RED_VALUE(back), DW_GREEN_VALUE(back), DW_BLUE_VALUE(back))); @@ -3200,8 +3200,8 @@ case WM_CTLCOLORBTN: case WM_CTLCOLORDLG: { - - if((_dw_composition && GetWindowLongPtr(_toplevel_window(hWnd), GWL_EXSTYLE) & WS_EX_LAYERED) && + + if((_dw_composition && GetWindowLongPtr(_toplevel_window(hWnd), GWL_EXSTYLE) & WS_EX_LAYERED) && (!thiscinfo || (thiscinfo && (thiscinfo->back == -1 || thiscinfo->back == DW_RGB_TRANSPARENT)))) { if(!(msg == WM_CTLCOLORSTATIC && SendMessage((HWND)mp2, STM_GETIMAGE, IMAGE_BITMAP, 0))) @@ -3231,7 +3231,7 @@ { ColorInfo *parentcinfo = (ColorInfo *)GetWindowLongPtr(hWnd, GWLP_USERDATA); int thisback = thiscinfo ? thiscinfo->back : -1; - + if(thisback == DW_RGB_TRANSPARENT && parentcinfo) thisback = parentcinfo->back; @@ -3299,7 +3299,7 @@ int iItems, iTop, i; COLORREF c, odd, even; unsigned long temp = _internal_color(continfo->odd); - + /* Create the colors based on the current theme */ if(continfo->odd == DW_CLR_DEFAULT) { @@ -3307,10 +3307,10 @@ if(_DW_DARK_MODE_ALLOWED == 2 && _DW_DARK_MODE_ENABLED) odd = RGB(100,100,100); else -#endif +#endif odd = RGB(230, 230, 230); } - else + else odd = RGB(DW_RED_VALUE(temp), DW_GREEN_VALUE(temp), DW_BLUE_VALUE(temp)); temp = _internal_color(continfo->even); if(continfo->even == DW_CLR_DEFAULT) @@ -3329,10 +3329,10 @@ /* first visible row */ iTop = ListView_GetTopIndex(hWnd); - for(i=iTop; i<=(iTop+iItems+1); i++) + for(i=iTop; i<=(iTop+iItems+1); i++) { /* if row rectangle intersects update rectangle then it requires re-drawing */ - if(ListView_GetItemRect(hWnd, i, rect, LVIR_BOUNDS) && IntersectRect(&rectDestin, &rectUpd, rect)) + if(ListView_GetItemRect(hWnd, i, rect, LVIR_BOUNDS) && IntersectRect(&rectDestin, &rectUpd, rect)) { /* change text background colour accordingly */ c = (i % 2) ? odd : even; @@ -3346,7 +3346,7 @@ CallWindowProc(continfo->cinfo.pOldProc, hWnd, msg, 0, 0); } } - } + } } break; case WM_LBUTTONDBLCLK: @@ -3494,7 +3494,7 @@ if(_DW_DARK_MODE_ALLOWED == 2 && _DW_DARK_MODE_SUPPORTED) { ContainerInfo *continfo = (ContainerInfo *)GetWindowLongPtr(hWnd, GWLP_USERDATA); - + if(!continfo || continfo->cinfo.back == -1 || continfo->cinfo.back == DW_CLR_DEFAULT) TreeView_SetBkColor(hWnd, _DW_GetSysColor(COLOR_WINDOW)); if(!continfo || continfo->cinfo.fore == -1 || continfo->cinfo.fore == DW_CLR_DEFAULT) @@ -3796,9 +3796,9 @@ hdcPaint = BeginPaint(hwnd, &ps); if(hfont) oldfont = (HFONT)SelectObject(hdcPaint, hfont); - + SetRect(&rc, 0, 0, cx, cy); - + /* If we are in full dark mode, or we have custom colors selected... * we will draw the status window ourselves... otherwise DrawStatusText() */ @@ -3853,14 +3853,14 @@ /* Need the parent to do the check completely */ parentcinfo = (ColorInfo *)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA); - + /* If we don't require themed drawing */ - if(((cinfo->back != -1 && cinfo->back != DW_RGB_TRANSPARENT) || (parentcinfo && parentcinfo->back != -1)) + if(((cinfo->back != -1 && cinfo->back != DW_RGB_TRANSPARENT) || (parentcinfo && parentcinfo->back != -1)) || !_dw_composition || !(GetWindowLongPtr(_toplevel_window(hwnd), GWL_EXSTYLE) & WS_EX_LAYERED)) return _colorwndproc(hwnd, msg, mp1, mp2); - + pOldProc = cinfo->pOldProc; - + switch(msg) { case WM_PAINT: @@ -3875,15 +3875,15 @@ RECT rcClient; LONG_PTR dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE); LONG_PTR dwStyleEx = GetWindowLongPtr(hwnd, GWL_EXSTYLE); - HTHEME hTheme = _OpenThemeData(NULL, L"ControlPanelStyle"); + HTHEME hTheme = _OpenThemeData(NULL, L"ControlPanelStyle"); GetClientRect(hwnd, &rcClient); - + if(hTheme) { /* Create an in memory image to draw to */ HPAINTBUFFER hBufferedPaint = _BeginBufferedPaint(hdc, &rcClient, BPBF_TOPDOWNDIB, NULL, &hdcPaint); - + if(hdcPaint) { LONG_PTR dwStaticStyle = dwStyle & 0x1F; @@ -3891,37 +3891,37 @@ int iLen = GetWindowTextLength(hwnd), fore = _internal_color(cinfo->fore); DTTOPTS DttOpts = { sizeof(DTTOPTS) }; static HBRUSH hbrush = 0; - + /* Make sure we have a transparency brush */ if(!hbrush) hbrush = CreateSolidBrush(_dw_transparencykey); - + /* Fill the background with the transparency color */ FillRect(hdcPaint, &rcClient, hbrush); _BufferedPaintSetAlpha(hBufferedPaint, &ps.rcPaint, 0x00); - + /* Setup how we will draw the text */ DttOpts.dwFlags = DTT_COMPOSITED | DTT_GLOWSIZE | DTT_TEXTCOLOR; DttOpts.crText = cinfo->fore == -1 ? RGB(255, 255, 255) : RGB(DW_RED_VALUE(fore), DW_GREEN_VALUE(fore), DW_BLUE_VALUE(fore)); DttOpts.iGlowSize = 12; - + SetBkMode(hdcPaint, TRANSPARENT); - if(hFontOld) + if(hFontOld) hFontOld = (HFONT)SelectObject(hdcPaint, hFontOld); /* Make sure there is text to draw */ if(iLen) { LPWSTR szText = (LPWSTR)_alloca(sizeof(WCHAR)*(iLen+5)); - + if(szText) { iLen = GetWindowTextW(hwnd, szText, iLen+5); if(iLen) { DWORD dwFlags = DT_WORDBREAK; - + switch (dwStaticStyle) { case SS_CENTER: @@ -3954,9 +3954,9 @@ if(dwStyle & SS_NOPREFIX) dwFlags |= DT_NOPREFIX; - + /* Draw the text! */ - _DrawThemeTextEx(hTheme, hdcPaint, 0, 0, + _DrawThemeTextEx(hTheme, hdcPaint, 0, 0, szText, -1, dwFlags, &rcClient, &DttOpts); } } @@ -3966,17 +3966,17 @@ if (hFontOld) SelectObject(hdcPaint, hFontOld); _EndBufferedPaint(hBufferedPaint, TRUE); - } + } _CloseThemeData(hTheme); } } - + EndPaint(hwnd, &ps); return TRUE; } break; } - + if ( !pOldProc ) return DefWindowProc(hwnd, msg, mp1, mp2); return CallWindowProc(pOldProc, hwnd, msg, mp1, mp2); @@ -4031,7 +4031,7 @@ if(tmp->window == hwnd) { int checkbox = DW_POINTER_TO_INT(dw_window_get_data(hwnd, "_dw_checkbox")); - + if(checkbox) in_checkbox_handler = 1; @@ -4130,11 +4130,11 @@ void _create_tooltip(HWND handle, const char *text) { TOOLINFO ti = { 0 }; - + ti.cbSize = sizeof(TOOLINFO); ti.hwnd = handle; ti.hinst = DWInstance; - + SendMessage(hwndTooltip, TTM_DELTOOL, 0, (LPARAM) (LPTOOLINFO) &ti); if(text) { @@ -4232,25 +4232,25 @@ INITCOMMONCONTROLSEX icc; char *alttmpdir; #ifdef GDIPLUS - struct GdiplusStartupInput si; + struct GdiplusStartupInput si; #endif /* Setup the private data directory */ if(argc > 0 && argv[0]) { char *pos = strrchr(argv[0], '\\'); - + /* Just to be safe try the unix style */ if(!pos) pos = strrchr(argv[0], '/'); - + if(pos) strncpy(_dw_exec_dir, argv[0], (size_t)(pos - argv[0])); } /* If that failed... just get the current directory */ if(!_dw_exec_dir[0]) GetCurrentDirectoryA(MAX_PATH, _dw_exec_dir); - + /* Initialize our thread local storage */ _foreground = TlsAlloc(); _background = TlsAlloc(); @@ -4259,7 +4259,7 @@ #ifdef GDIPLUS _gpPen = TlsAlloc(); _gpBrush = TlsAlloc(); -#endif +#endif icc.dwSize = sizeof(INITCOMMONCONTROLSEX); icc.dwICC = ICC_WIN95_CLASSES|ICC_DATE_CLASSES; @@ -4396,7 +4396,7 @@ dw_messagebox("Dynamic Windows", DW_MB_OK|DW_MB_ERROR, "Could not initialize the object window. error code %d", GetLastError()); exit(1); } - + #if (defined(BUILD_DLL) || defined(BUILD_HTML)) /* Register HTML renderer class */ memset(&wc, 0, sizeof(WNDCLASS)); @@ -4431,7 +4431,7 @@ SetSecurityDescriptorDacl(&_dwsd, TRUE, (PACL) NULL, FALSE); OleInitialize(NULL); - + /* * Get an alternate temporary directory in case TMP doesn't exist */ @@ -4452,7 +4452,7 @@ si.SuppressExternalCodecs = FALSE; GdiplusStartup(&gdiplusToken, &si, NULL); #endif - + /* GDI+ Needs to be initialized before calling _dw_init_thread(); */ _dw_init_thread(); @@ -4463,7 +4463,7 @@ if(!(hrichedit = LoadLibrary(TEXT("riched20")))) hrichedit = LoadLibrary(TEXT("riched32")); } -#endif +#endif return 0; } @@ -4482,7 +4482,7 @@ /* Set the running flag to TRUE */ _dw_main_running = TRUE; - + /* Run the loop until the flag is unset... or error */ while(_dw_main_running && GetMessage(&msg, NULL, 0, 0)) { @@ -4643,7 +4643,7 @@ va_start(args, format); vsnprintf(outbuf, 1024, format, args); va_end(args); - + OutputDebugString(UTF8toWide(thisbuf)); } @@ -4715,7 +4715,7 @@ { int rc; RECT rect; - + #ifdef AEROGLASS if(_DW_DARK_MODE_SUPPORTED) { @@ -4726,13 +4726,13 @@ RefreshTitleBarThemeColor(handle); } #endif - + GetClientRect(handle, &rect); - + /* If the client area is 0x0 then call the autosize routine */ if((rect.bottom - rect.top) == 0 || (rect.right - rect.left) == 0) dw_window_set_size(handle, 0, 0); - + rc = ShowWindow(handle, SW_SHOW); SetFocus(handle); _initial_focus(handle); @@ -4764,18 +4764,18 @@ { char buffer[31] = {0}; ULONG id = (ULONG)(uintptr_t)handle; - + _snprintf(buffer, 30, "_dw_id%ld", id); menu = (HMENU)dw_window_get_data(DW_HWND_OBJECT, buffer); - + if(menu && IsMenu(menu)) return dw_menu_delete_item((HMENUI)menu, id); return DW_ERROR_UNKNOWN; } - + parent = GetParent(handle); menu = GetMenu(handle); - + if(menu) _free_menu_data(menu); @@ -4918,8 +4918,8 @@ Item *_box_item(HWND handle) { HWND parent = GetParent(handle); - Box *thisbox = (Box *)GetWindowLongPtr(parent, GWLP_USERDATA); - + Box *thisbox = (Box *)GetWindowLongPtr(parent, GWLP_USERDATA); + /* If it is a desktop window let WM_DESTROY handle it */ if(parent != HWND_DESKTOP) { @@ -4940,7 +4940,7 @@ /* Internal function to calculate the widget's required size.. * These are the general rules for widget sizes: - * + * * Render/Unspecified: 1x1 * Scrolled(Container,Tree,MLE): Guessed size clamped to min and max in dw.h * Entryfield/Combobox/Spinbutton: 150x(maxfontheight) @@ -4965,14 +4965,14 @@ hic = (HICON)SendMessage(handle, STM_GETIMAGE, IMAGE_ICON, 0); else if(_tcsnicmp(tmpbuf, BUTTONCLASSNAME, _tcslen(BUTTONCLASSNAME)+1) == 0) hic = (HICON)SendMessage(handle, BM_GETIMAGE, IMAGE_ICON, 0); - + /* If we got an icon, pull out the internal bitmap */ if(hic) { if(GetIconInfo(hic, &ii)) hbm = ii.hbmMask ? ii.hbmMask : ii.hbmColor; } - + /* If we weren't able to get the bitmap from the icon... */ if(!hbm) { @@ -4982,12 +4982,12 @@ else if(_tcsnicmp(tmpbuf, BUTTONCLASSNAME, _tcslen(BUTTONCLASSNAME)+1) == 0) hbm = (HBITMAP)SendMessage(handle, BM_GETIMAGE, IMAGE_BITMAP, 0); } - + /* If we got an image... set the sizes appropriately */ if(hbm) { BITMAP bmi = { 0 }; - + GetObject(hbm, sizeof(BITMAP), &bmi); thiswidth = bmi.bmWidth; thisheight = bmi.bmHeight; @@ -4995,8 +4995,8 @@ else { char *buf = dw_window_get_text(handle); - - /* If we have a string... + + /* If we have a string... * calculate the size with the current font. */ if(buf) @@ -5009,7 +5009,7 @@ dw_free(buf); } } - + /* Combobox */ if(_tcsnicmp(tmpbuf, COMBOBOXCLASSNAME, _tcslen(COMBOBOXCLASSNAME)+1) == 0) { @@ -5020,7 +5020,7 @@ thisheight = 18; } /* Ranged: Percent, Slider, Scrollbar */ - else if(_tcsnicmp(tmpbuf, PROGRESS_CLASS, _tcslen(PROGRESS_CLASS)+1) == 0 || + else if(_tcsnicmp(tmpbuf, PROGRESS_CLASS, _tcslen(PROGRESS_CLASS)+1) == 0 || _tcsnicmp(tmpbuf, TRACKBAR_CLASS, _tcslen(TRACKBAR_CLASS)+1) == 0 || _tcsnicmp(tmpbuf, SCROLLBARCLASSNAME, _tcslen(SCROLLBARCLASSNAME)+1) == 0) { @@ -5045,13 +5045,13 @@ thiswidth = 50; extraheight = 6; } -#ifdef TOOLBAR +#ifdef TOOLBAR /* Bitmap Buttons */ else if(_tcsnicmp(tmpbuf, TOOLBARCLASSNAME, _tcslen(TOOLBARCLASSNAME)+1) == 0) { HIMAGELIST imlist = (HIMAGELIST)SendMessage(handle, TB_GETIMAGELIST, 0, 0); int minsize = 24; - + if(imlist) ImageList_GetIconSize(imlist, &thiswidth, &thisheight); @@ -5063,40 +5063,40 @@ thiswidth += 4; thisheight += 4; } - + if(thiswidth < minsize) thiswidth = minsize; if(thisheight < minsize) thisheight = minsize; } -#endif +#endif /* Listbox */ else if(_tcsnicmp(tmpbuf, LISTBOXCLASSNAME, _tcslen(LISTBOXCLASSNAME)+1) == 0) { char buf[1025] = {0}; int x, count = dw_listbox_count(handle); int basicwidth = thiswidth = GetSystemMetrics(SM_CXVSCROLL) + 8; - + thisheight = 8; - + for(x=0;x thiswidth) thiswidth = width > _DW_SCROLLED_MAX_WIDTH ? _DW_SCROLLED_MAX_WIDTH : width; thisheight += height; } - + if(thiswidth < _DW_SCROLLED_MIN_WIDTH) thiswidth = _DW_SCROLLED_MIN_WIDTH; if(thisheight < _DW_SCROLLED_MIN_HEIGHT) @@ -5116,20 +5116,20 @@ int height, width; char *buf, *ptr; int basicwidth; - + if(style & ES_AUTOHSCROLL) thisheight = GetSystemMetrics(SM_CYHSCROLL) + 8; - else + else thisheight = 8; basicwidth = thiswidth = GetSystemMetrics(SM_CXVSCROLL) + 8; - + dw_mle_get_size(handle, &bytes, NULL); - + ptr = buf = _alloca(bytes + 2); dw_mle_export(handle, buf, 0, (int)bytes); buf[bytes] = 0; strcat(buf, "\n"); - + /* MLE */ while((ptr = strstr(buf, "\n"))) { @@ -5139,9 +5139,9 @@ dw_font_text_extents_get(handle, NULL, buf, &width, &height); else dw_font_text_extents_get(handle, NULL, testtext, NULL, &height); - + width += basicwidth; - + if(!(style & ES_AUTOHSCROLL) && width > _DW_SCROLLED_MAX_WIDTH) { thiswidth = _DW_SCROLLED_MAX_WIDTH; @@ -5155,7 +5155,7 @@ thisheight += height; buf = &ptr[1]; } - + if(thiswidth < _DW_SCROLLED_MIN_WIDTH) thiswidth = _DW_SCROLLED_MIN_WIDTH; if(thisheight < _DW_SCROLLED_MIN_HEIGHT) @@ -5175,10 +5175,10 @@ else if(_tcsnicmp(tmpbuf, WC_LISTVIEW, _tcslen(WC_LISTVIEW)+1)== 0) { DWORD result = ListView_ApproximateViewRect(handle, _DW_SCROLLED_MAX_WIDTH, _DW_SCROLLED_MAX_HEIGHT, -1); - + thiswidth = LOWORD(result); thisheight = HIWORD(result); - + if(thiswidth > _DW_SCROLLED_MAX_WIDTH) thiswidth = _DW_SCROLLED_MAX_WIDTH; if(thiswidth < _DW_SCROLLED_MIN_WIDTH) @@ -5198,7 +5198,7 @@ else if(_tcsnicmp(tmpbuf, BUTTONCLASSNAME, _tcslen(BUTTONCLASSNAME)+1) == 0) { ULONG style = GetWindowLong(handle, GWL_STYLE); - + /* Bitmap buttons */ if(hbm) { @@ -5224,12 +5224,12 @@ extraheight = 2; } - /* Set the requested sizes */ + /* Set the requested sizes */ if(width) *width = thiswidth + extrawidth; if(height) *height = thisheight + extraheight; - + /* Free temporary bitmaps */ if(ii.hbmColor) DeleteObject(ii.hbmColor); @@ -5289,15 +5289,15 @@ if(hfont) { Item *item = _box_item(handle); - + SendMessage(handle, WM_SETFONT, (WPARAM)hfont, (LPARAM)TRUE); if(oldfont) DeleteObject(oldfont); - + /* Check to see if any of the sizes need to be recalculated */ if(item && (item->origwidth == -1 || item->origheight == -1)) { - _control_size(handle, item->origwidth == -1 ? &item->width : NULL, item->origheight == -1 ? &item->height : NULL); + _control_size(handle, item->origwidth == -1 ? &item->width : NULL, item->origheight == -1 ? &item->height : NULL); /* Queue a redraw on the top-level window */ _dw_redraw(_toplevel_window(handle), TRUE); } @@ -5520,7 +5520,7 @@ ULONG flStyleEx = 0; #ifdef AEROGLASS MARGINS mar = {-1}; - + if(_dw_composition && (flStyle & DW_FCF_COMPOSITED)) flStyleEx = WS_EX_LAYERED; #endif @@ -5843,7 +5843,7 @@ return _dw_html_url(handle, url); #else return DW_ERROR_GENERAL; -#endif +#endif } /* @@ -5980,7 +5980,7 @@ while(tmp) { if(tmp->id == id) - return TRUE; + return TRUE; tmp = tmp->next; } return FALSE; @@ -6020,7 +6020,7 @@ if (title) { char *tmp = menutitle = _alloca(strlen(title)+1); - + strcpy(tmp, title); while(*tmp) @@ -6034,15 +6034,15 @@ if (menutitle && *menutitle) { /* Code to autogenerate a menu ID if not specified or invalid - * First pool is smaller for transient popup menus + * First pool is smaller for transient popup menus */ if(id == (ULONG)-1) { static ULONG tempid = 61000; - + tempid++; id = tempid; - + if(tempid > 65500) tempid = 61000; } @@ -6249,7 +6249,7 @@ * Parameters: * menu: The handle to the menu in which the item was appended. * id: Menuitem id. - * Returns: + * Returns: * DW_ERROR_NONE (0) on success or DW_ERROR_UNKNOWN on failure. */ int API dw_menu_delete_item(HMENUI menux, unsigned long id) @@ -6261,11 +6261,11 @@ if ( mymenu == 0 || DeleteMenu(mymenu, id, MF_BYCOMMAND) == 0 ) return DW_ERROR_UNKNOWN; - + /* If the ID was autogenerated it is safe to remove it */ if(id >= 30000) dw_signal_disconnect_by_window((HWND)(uintptr_t)id); - + /* Make sure the menu is redrawn if needed */ if( (HMENU)menux != mymenu ) DrawMenuBar(menux); @@ -6429,7 +6429,7 @@ cinfo->pOldProc = SubclassWindow(tmp, _staticwndproc); SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo); -#endif +#endif dw_window_set_font(tmp, DefaultFont); dw_window_set_color(tmp, DW_CLR_DEFAULT, DW_RGB_TRANSPARENT); return tmp; @@ -6598,7 +6598,7 @@ cinfo2->combo = cinfo->combo = tmp; EnumChildWindows(tmp, _subclass_child, (LPARAM)cinfo2); cinfo->buddy = cinfo2->buddy; - + SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo); dw_window_set_font(tmp, DefaultFont); SetWindowText(tmp, UTF8toWide(text)); @@ -6637,7 +6637,7 @@ void _to_grayscale(HBITMAP hbm, int width, int height) { HDC hdc = CreateCompatibleDC(NULL); - if (hdc) + if (hdc) { HBITMAP hbmPrev = SelectBitmap(hdc, hbm); int x, y; @@ -6664,10 +6664,10 @@ HWND tmp; HIMAGELIST imlist, dimlist; BITMAP bmi = { 0 }; - TBBUTTON tbButtons[] = { + TBBUTTON tbButtons[] = { { MAKELONG(0, 0), id, TBSTATE_ENABLED, TBSTYLE_BUTTON} }; - + /* Get the bitmap from either the icon or bitmap itself */ if(hbitmap) { @@ -6682,7 +6682,7 @@ else if(icon) { ICONINFO iconinfo; - + GetIconInfo(icon, &iconinfo); GetObject(iconinfo.hbmColor, sizeof(BITMAP), &bmi); imlist = ImageList_Create(bmi.bmWidth, bmi.bmHeight, ILC_COLOR32 | ILC_MASK, 1, 0); @@ -6698,7 +6698,7 @@ return 0; /* Create the toolbar */ - tmp = CreateWindowEx(0L, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | TBSTYLE_AUTOSIZE | CCS_NORESIZE | + tmp = CreateWindowEx(0L, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | TBSTYLE_AUTOSIZE | CCS_NORESIZE | CCS_NOPARENTALIGN | CCS_NODIVIDER, 0, 0, 100, 30, DW_HWND_OBJECT, (HMENU)(uintptr_t)id, DWInstance, NULL); /* Disable visual styles by default */ @@ -6712,7 +6712,7 @@ SendMessage(tmp, TB_SETIMAGELIST, 0, (LPARAM)imlist); SendMessage(tmp, TB_SETDISABLEDIMAGELIST, 0, (LPARAM)dimlist); SendMessage(tmp, TB_ADDBUTTONS, 1, (LPARAM) &tbButtons); - + _create_tooltip(tmp, text); return tmp; } @@ -6971,9 +6971,9 @@ cinfo = calloc(1, sizeof(ColorInfo)); cinfo->buddy = buddy; - /* The horrible spinbutton workaround isn't necessary + /* The horrible spinbutton workaround isn't necessary * any more on Vista or 7... but still seems necessary - * for XP, so only enable it if on XP or lower. + * for XP, so only enable it if on XP or lower. */ if(!IS_VISTAPLUS) { @@ -7181,12 +7181,12 @@ HBITMAP oldbitmap = 0; HANDLE oldicon = 0; TCHAR tmpbuf[100] = {0}; - + if (!icon && !hbitmap) return; GetClassName(handle, tmpbuf, 99); - + if(_tcsnicmp(tmpbuf, BUTTONCLASSNAME, _tcslen(BUTTONCLASSNAME)+1)==0) { oldbitmap = (HBITMAP)SendMessage(handle, BM_GETIMAGE, IMAGE_BITMAP, 0); @@ -7195,14 +7195,14 @@ (icon ? (WPARAM)IMAGE_ICON : (WPARAM)IMAGE_BITMAP), (icon ? (LPARAM)icon : (LPARAM)hbitmap)); } -#ifdef TOOLBAR +#ifdef TOOLBAR /* Bitmap Buttons */ else if(_tcsnicmp(tmpbuf, TOOLBARCLASSNAME, _tcslen(TOOLBARCLASSNAME)+1) == 0) { HIMAGELIST imlist = (HIMAGELIST)SendMessage(handle, TB_GETIMAGELIST, 0, 0); HIMAGELIST dimlist = (HIMAGELIST)SendMessage(handle, TB_GETDISABLEDIMAGELIST, 0, 0); BITMAP bmi = { 0 }; - + if(hbitmap) { GetObject(hbitmap, sizeof(BITMAP), &bmi); @@ -7214,7 +7214,7 @@ else if(icon) { ICONINFO iconinfo; - + GetIconInfo(icon, &iconinfo); GetObject(iconinfo.hbmColor, sizeof(BITMAP), &bmi); ImageList_ReplaceIcon(imlist, 0, icon); @@ -7226,7 +7226,7 @@ } InvalidateRect(handle, NULL, FALSE); } -#endif +#endif else { oldbitmap = (HBITMAP)SendMessage(handle, STM_GETIMAGE, IMAGE_BITMAP, 0); @@ -7244,11 +7244,11 @@ /* If we changed the bitmap... */ { Item *item = _box_item(handle); - + /* Check to see if any of the sizes need to be recalculated */ if(item && (item->origwidth == -1 || item->origheight == -1)) { - _control_size(handle, item->origwidth == -1 ? &item->width : NULL, item->origheight == -1 ? &item->height : NULL); + _control_size(handle, item->origwidth == -1 ? &item->width : NULL, item->origheight == -1 ? &item->height : NULL); /* Queue a redraw on the top-level window */ _dw_redraw(_toplevel_window(handle), TRUE); } @@ -7283,7 +7283,7 @@ _dw_get_image_handle(filename, &icon, &hbitmap); #endif } - + _dw_window_set_bitmap(handle, icon, hbitmap); } @@ -7380,14 +7380,14 @@ /* If we changed the text... */ { Item *item = _box_item(handle); - + /* Check to see if any of the sizes need to be recalculated */ if(item && (item->origwidth == -1 || item->origheight == -1)) { int newwidth, newheight; - - _control_size(handle, &newwidth, &newheight); - + + _control_size(handle, &newwidth, &newheight); + /* Only update the item and redraw the window if it changed */ if((item->origwidth == -1 && item->width != newwidth) || (item->origheight == -1 && item->height != newheight)) @@ -7412,7 +7412,7 @@ void API dw_window_set_tooltip(HWND handle, const char *bubbletext) { ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); - + if(cinfo && cinfo->buddy) _create_tooltip(cinfo->buddy, bubbletext); _create_tooltip(handle, bubbletext); @@ -7449,7 +7449,7 @@ len = GetWindowTextLength(handle) + 1; if((tempbuf = _alloca(len * sizeof(TCHAR)))) GetWindowText(handle, tempbuf, len); - + /* Figure out the UTF8 length, allocate a return buffer * and fill it with the UTF8 text and return it. */ @@ -7470,10 +7470,10 @@ char buffer[31] = {0}; HMENU mymenu; ULONG id = (ULONG)(uintptr_t)handle; - + _snprintf(buffer, 30, "_dw_id%ld", id); mymenu = (HMENU)dw_window_get_data(DW_HWND_OBJECT, buffer); - + if(mymenu && IsMenu(mymenu)) dw_menu_item_set_state((HMENUI)mymenu, id, DW_MIS_DISABLED); } @@ -7493,10 +7493,10 @@ char buffer[31] = {0}; HMENU mymenu; ULONG id = (ULONG)(uintptr_t)handle; - + _snprintf(buffer, 30, "_dw_id%ld", id); mymenu = (HMENU)dw_window_get_data(DW_HWND_OBJECT, buffer); - + if(mymenu && IsMenu(mymenu)) dw_menu_item_set_state((HMENUI)mymenu, id, DW_MIS_ENABLED); } @@ -7546,7 +7546,7 @@ } GetClassName(box, tmpbuf, 99); - + /* If we are in a scrolled box... extract the interal box */ if(_tcsnicmp(tmpbuf, ScrollClassName, _tcslen(ScrollClassName)+1)==0) { @@ -7618,7 +7618,7 @@ tmpitem[index].pad = pad; tmpitem[index].hsize = hsize ? SIZEEXPAND : SIZESTATIC; tmpitem[index].vsize = vsize ? SIZEEXPAND : SIZESTATIC; - + /* If either of the parameters are -1 ... calculate the size */ if(width == -1 || height == -1) _control_size(item, width == -1 ? &tmpitem[index].width : NULL, height == -1 ? &tmpitem[index].height : NULL); @@ -7645,18 +7645,18 @@ SendMessage(item, UDM_SETBUDDY, (WPARAM)cinfo->buddy, 0); } } -#ifdef TOOLBAR +#ifdef TOOLBAR else if(_tcsnicmp(tmpbuf, TOOLBARCLASSNAME, _tcslen(TOOLBARCLASSNAME)+1) == 0) { -#ifdef AEROGLASS +#ifdef AEROGLASS if(!(_dw_composition && (GetWindowLongPtr(_toplevel_window(box), GWL_EXSTYLE) & WS_EX_LAYERED))) -#endif - { +#endif + { /* Enable double buffering if our window isn't composited */ SendMessage(item, TB_SETEXTENDEDSTYLE, 0, (LPARAM)TBSTYLE_EX_DOUBLEBUFFER); } } -#endif +#endif /* Queue a redraw on the top-level window */ _dw_redraw(_toplevel_window(box), TRUE); } @@ -7672,13 +7672,13 @@ int API dw_box_unpack(HWND handle) { HWND parent = GetParent(handle); - + if(handle && parent != HWND_DESKTOP) { Box *thisbox = (Box *)GetWindowLongPtr(parent, GWLP_USERDATA); - - /* If the parent box has items... - * try to remove it from the layout + + /* If the parent box has items... + * try to remove it from the layout */ if(thisbox && thisbox->count) { @@ -7740,7 +7740,7 @@ HWND API dw_box_unpack_at_index(HWND box, int index) { Box *thisbox = (Box *)GetWindowLongPtr(box, GWLP_USERDATA); - + /* Try to remove it from the layout */ if(thisbox && index > -1 && index < thisbox->count) { @@ -7840,7 +7840,7 @@ void _get_window_for_size(HWND handle, unsigned long *width, unsigned long *height) { Box *thisbox = (Box *)GetWindowLongPtr(handle, GWLP_USERDATA); - + if(thisbox) { int depth = 0; @@ -7848,16 +7848,16 @@ DWORD dwExStyle = GetWindowLong(handle, GWL_EXSTYLE); HMENU menu = GetMenu(handle) ; RECT rc = { 0 } ; - + /* Calculate space requirements */ _resize_box(thisbox, &depth, *width, *height, 1); - + rc.right = thisbox->minwidth; rc.bottom = thisbox->minheight; - + /* Take into account the window border and menu here */ AdjustWindowRectEx(&rc, dwStyle, menu ? TRUE : FALSE, dwExStyle); - + if ( *width < 1 ) *width = rc.right - rc.left; if ( *height < 1 ) *height = rc.bottom - rc.top; } @@ -7875,7 +7875,7 @@ /* Attempt to auto-size */ if ( width < 1 || height < 1 ) _get_window_for_size(handle, &width, &height); - + /* Finally set the size */ SetWindowPos(handle, (HWND)NULL, 0, 0, width, height, SWP_NOZORDER | SWP_NOMOVE); } @@ -7892,14 +7892,14 @@ TCHAR tmpbuf[100] = {0}; GetClassName(handle, tmpbuf, 99); - + if(_tcsnicmp(tmpbuf, ClassName, _tcslen(ClassName)+1) == 0) { unsigned long thiswidth = 0, thisheight = 0; - + /* Get the size with the border */ _get_window_for_size(handle, &thiswidth, &thisheight); - + /* Return what was requested */ if(width) *width = (int)thiswidth; if(height) *height = (int)thisheight; @@ -7907,14 +7907,14 @@ else if(_tcsnicmp(tmpbuf, FRAMECLASSNAME, _tcslen(FRAMECLASSNAME)+1) == 0) { Box *thisbox = (Box *)GetWindowLongPtr(handle, GWLP_USERDATA); - + if(thisbox) { int depth = 0; - + /* Calculate space requirements */ _resize_box(thisbox, &depth, 0, 0, 1); - + /* Return what was requested */ if(width) *width = thisbox->minwidth; if(height) *height = thisbox->minheight; @@ -7972,12 +7972,12 @@ { int horz = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_grav_horz")); int vert = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_grav_vert")); - + /* Do any gravity calculations */ if(horz || vert) { long newx = *x, newy = *y; - + /* Handle horizontal center gravity */ if((horz & 0xf) == DW_GRAV_CENTER) newx += ((dw_screen_width() / 2) - (width / 2)); @@ -7989,22 +7989,22 @@ newy += ((dw_screen_height() / 2) - (height / 2)); else if((vert & 0xf) == DW_GRAV_BOTTOM) newy = dw_screen_height() - height - *y; - + /* Save the new values */ *x = newx; *y = newy; - + /* Adjust the values to avoid Taskbar if requested */ if((horz | vert) & DW_GRAV_OBSTACLES) { POINT pt = { 0, 0 }; HMONITOR mon = MonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY); MONITORINFO mi; - + mi.cbSize = sizeof(MONITORINFO); - + GetMonitorInfo(mon, &mi); - + if(horz & DW_GRAV_OBSTACLES) { if((horz & 0xf) == DW_GRAV_LEFT) @@ -8020,7 +8020,7 @@ *y -= (mi.rcMonitor.bottom - mi.rcWork.bottom); } } - } + } } /* @@ -8060,7 +8060,7 @@ /* Attempt to auto-size */ if ( width < 1 || height < 1 ) _get_window_for_size(handle, &width, &height); - + _handle_gravity(handle, &x, &y, width, height); /* Finally set the size */ SetWindowPos(handle, (HWND)NULL, x, y, width, height, SWP_NOZORDER | SWP_NOACTIVATE); @@ -8127,15 +8127,15 @@ char buffer[31] = {0}; HMENU mymenu; ULONG id = (ULONG)(uintptr_t)handle; - + _snprintf(buffer, 30, "_dw_id%ld", id); mymenu = (HMENU)dw_window_get_data(DW_HWND_OBJECT, buffer); - + if(mymenu && IsMenu(mymenu)) dw_menu_item_set_state((HMENUI)mymenu, id, style & mask); return; } - + GetClassName(handle, tmpbuf, 99); currentstyle = GetWindowLong(handle, GWL_STYLE); @@ -8146,7 +8146,7 @@ if(_tcsnicmp(tmpbuf, TOOLBARCLASSNAME, _tcslen(TOOLBARCLASSNAME)+1) == 0) { ULONG thisstyle = (TBSTYLE_FLAT | TBSTYLE_TRANSPARENT); - + if(mask & DW_BS_NOBORDER) { SetWindowLong(handle, GWL_STYLE, (style & DW_BS_NOBORDER) ? (currentstyle | thisstyle) : (currentstyle & ~thisstyle)); @@ -8154,12 +8154,12 @@ /* Enable or disable visual themese */ if(_SetWindowTheme) _SetWindowTheme(handle, (style & DW_BS_NOBORDER) ? NULL : L"", (style & DW_BS_NOBORDER) ? NULL : L""); - + return; } } #endif - + tmp = currentstyle | mask; tmp ^= mask; tmp |= style & mask; @@ -8170,15 +8170,15 @@ else if(_tcsnicmp(tmpbuf, ClassName, _tcslen(ClassName)+1)==0) { tmp = tmp & 0xffff0000; -#ifdef AEROGLASS +#ifdef AEROGLASS if(mask & DW_FCF_COMPOSITED && _DwmExtendFrameIntoClientArea && _dw_composition) { LONG_PTR styleex = GetWindowLongPtr(handle, GWL_EXSTYLE); - + if(style & DW_FCF_COMPOSITED) { MARGINS mar = {-1}; - + /* Attempt to enable Aero glass background on the entire window */ SetWindowLongPtr(handle, GWL_EXSTYLE, styleex | WS_EX_LAYERED); SetLayeredWindowAttributes(handle, _dw_transparencykey, 0, LWA_COLORKEY); @@ -8187,20 +8187,20 @@ else { MARGINS mar = {0}; - + /* Remove Aero Glass */ SetWindowLongPtr(handle, GWL_EXSTYLE, styleex & ~WS_EX_LAYERED); _DwmExtendFrameIntoClientArea(handle, &mar); } } -#endif +#endif } else if(_tcsnicmp(tmpbuf, STATICCLASSNAME, _tcslen(STATICCLASSNAME)+1)==0) { ULONG thismask = mask & ~(DW_DT_VCENTER | DW_DT_WORDBREAK); ULONG thisstyle = style & ~(DW_DT_VCENTER | DW_DT_WORDBREAK); ULONG type = style & mask & 0xFL; - + /* Need to filter out bits that shouldn't be set */ tmp = currentstyle | thismask; tmp ^= thismask; @@ -9057,7 +9057,7 @@ if((dwComctlVer >= PACKVERSION(6,0))) { unsigned long style = GetWindowLong(handle, GWL_STYLE); - + if(style & PBS_MARQUEE) { /* Stop the bar */ @@ -9689,7 +9689,7 @@ /* We can't add an invalid handle */ if(!hicon) return -1; - + if(!hSmall || !hLarge) { hSmall = ImageList_Create(16, 16, ILC_COLOR16 | ILC_MASK, ICON_INDEX_LIMIT, 0); @@ -9816,7 +9816,7 @@ { lvi.mask = LVIF_DI_SETITEM | LVIF_IMAGE; lvi.pszText = NULL; - + if(data) { HICON hicon = *((HICON *)data); @@ -10010,15 +10010,15 @@ } memset(&lvi, 0, sizeof(LV_ITEM)); - + lvi.iItem = row + item; lvi.mask = LVIF_PARAM; - + if(ListView_GetItem(handle, &lvi)) { void **params = (void **)lvi.lParam; void *newparam = data; - + /* Make sure we have our pointer array... */ if(!params) { @@ -10033,9 +10033,9 @@ if(type == _DW_DATA_TYPE_STRING) { void *oldparam = params[type]; - + params[type] = NULL; - + if(oldparam) free(oldparam); if(newparam) @@ -10176,7 +10176,7 @@ if(_index == -1) return retval; - + if(flags & DW_CR_RETDATA) type = _DW_DATA_TYPE_POINTER; @@ -10187,7 +10187,7 @@ ListView_GetItem(handle, &lvi); params = (void **)lvi.lParam; - + if(params) { if(type == _DW_DATA_TYPE_STRING && params[type]) @@ -10223,7 +10223,7 @@ if(flags & DW_CR_RETDATA) type = _DW_DATA_TYPE_POINTER; - + memset(&lvi, 0, sizeof(LV_ITEM)); lvi.iItem = _index; @@ -10270,7 +10270,7 @@ if ( params && params[_DW_DATA_TYPE_STRING] && strcmp( (char *)params[_DW_DATA_TYPE_STRING], text ) == 0 ) { unsigned long width, height; - + ListView_SetItemState( handle, index, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED ); dw_window_get_pos_size( handle, NULL, NULL, &width, &height); if(width < 10 || height < 10) @@ -10309,7 +10309,7 @@ if ( params && params[_DW_DATA_TYPE_POINTER] == data ) { unsigned long width, height; - + ListView_SetItemState( handle, index, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED ); dw_window_get_pos_size( handle, NULL, NULL, &width, &height); if(width < 10 || height < 10) @@ -10446,7 +10446,7 @@ for(z=0;zcolumns;z++) { unsigned int width; - + ListView_GetItemText(handle, index, z, text, 1023); width = ListView_GetStringWidth(handle, text); @@ -10462,7 +10462,7 @@ } /* Set the new sizes... Microsoft says we need to add - * padding to the calculated sized but does not give + * padding to the calculated sized but does not give * a value. Trial and error shows that 16 works for us. */ for(z=0;zcolumns;z++) @@ -10564,12 +10564,12 @@ foreground = RGB(DW_RED_VALUE(value), DW_GREEN_VALUE(value), DW_BLUE_VALUE(value)); #ifdef GDIPLUS gpfore = MAKEARGB(255, DW_RED_VALUE(value), DW_GREEN_VALUE(value), DW_BLUE_VALUE(value)); - + GdipDeletePen(pen); GdipCreatePen1(gpfore, 1.0, UnitPixel, &pen); TlsSetValue(_gpPen, (LPVOID)pen); GdipSetSolidFillColor(brush, gpfore); -#endif +#endif DeleteObject(hPen); DeleteObject(hBrush); @@ -10635,11 +10635,11 @@ void API dw_draw_point(HWND handle, HPIXMAP pixmap, int x, int y) { #ifdef GDIPLUS - /* There doesn't seem to be an equivalent to SetPixel in GDI+ ... + /* There doesn't seem to be an equivalent to SetPixel in GDI+ ... * so instead we call dw_draw_rect() with 1 for width and height. */ dw_draw_rect(handle, pixmap, DW_DRAW_FILL | DW_DRAW_NOAA, x, y, 1, 1); -#else +#else HDC hdcPaint; if(handle) @@ -10652,7 +10652,7 @@ SetPixel(hdcPaint, x, y, (COLORREF)TlsGetValue(_foreground)); if(!pixmap) ReleaseDC(handle, hdcPaint); -#endif +#endif } /* Draw a line on a window (preferably a render window). @@ -10669,14 +10669,14 @@ #ifdef GDIPLUS GpGraphics *graphics = NULL; GpPen *pen = TlsGetValue(_gpPen); - + if(handle) GdipCreateFromHWND(handle, &graphics); else if(pixmap) GdipCreateFromHDC(pixmap->hdc, &graphics); else return; - + GdipSetSmoothingMode(graphics, SmoothingModeAntiAlias); GdipDrawLineI(graphics, pen, x1, y1, x2, y2); GdipDeleteGraphics(graphics); @@ -10709,14 +10709,14 @@ { POINT *points; int i; - + /* * Allocate enough space for the number of points supplied plus 1. * Under windows, unless the first and last points are the same * the polygon won't be closed */ points = (POINT *)malloc( ((*npoints)+1) * sizeof(POINT) ); - + if(points) { for ( i = 0 ; i < *npoints ; i++ ) @@ -10749,7 +10749,7 @@ void API dw_draw_polygon(HWND handle, HPIXMAP pixmap, int flags, int npoints, int *x, int *y) { POINT *points = NULL; - + /* Sanity check */ if(npoints < 1) return; @@ -10757,30 +10757,30 @@ #ifdef GDIPLUS { GpGraphics *graphics = NULL; - + if(handle) GdipCreateFromHWND(handle, &graphics); else if(pixmap) GdipCreateFromHDC(pixmap->hdc, &graphics); else return; - + /* Enable antialiasing if the DW_DRAW_NOAA flag isn't set */ if(!(flags & DW_DRAW_NOAA)) GdipSetSmoothingMode(graphics, SmoothingModeAntiAlias); - + if((points = _makePoints(&npoints, x, y))) { if(flags & DW_DRAW_FILL) { GpBrush *brush = TlsGetValue(_gpBrush); - + GdipFillPolygon2I(graphics, brush, points, npoints); } else { GpPen *pen = TlsGetValue(_gpPen); - + GdipDrawPolygonI(graphics, pen, points, npoints); } } @@ -10789,32 +10789,32 @@ #else { HDC hdcPaint; - + if ( handle ) hdcPaint = GetDC( handle ); else if ( pixmap ) hdcPaint = pixmap->hdc; - else + else return; if((points = _makePoints(&npoints, x, y))) { HBRUSH oldBrush = SelectObject( hdcPaint, TlsGetValue(_hBrush) ); HPEN oldPen = SelectObject( hdcPaint, TlsGetValue(_hPen) ); - + if ( flags & DW_DRAW_FILL ) Polygon( hdcPaint, points, npoints ); else Polyline( hdcPaint, points, npoints ); - + SelectObject( hdcPaint, oldBrush ); SelectObject( hdcPaint, oldPen ); } - + if ( !pixmap ) ReleaseDC( handle, hdcPaint ); } -#endif +#endif if(points) free(points); } @@ -10833,28 +10833,28 @@ { #ifdef GDIPLUS GpGraphics *graphics = NULL; - + if(handle) GdipCreateFromHWND(handle, &graphics); else if(pixmap) GdipCreateFromHDC(pixmap->hdc, &graphics); else return; - + /* Enable antialiasing if the DW_DRAW_NOAA flag isn't set */ if(!(flags & DW_DRAW_NOAA)) GdipSetSmoothingMode(graphics, SmoothingModeAntiAlias); - + if(flags & DW_DRAW_FILL) { GpBrush *brush = TlsGetValue(_gpBrush); - + GdipFillRectangleI(graphics, brush, x, y, width, height); } else { GpPen *pen = TlsGetValue(_gpPen); - + GdipDrawRectangleI(graphics, pen, x, y, width, height); } GdipDeleteGraphics(graphics); @@ -10876,7 +10876,7 @@ FrameRect(hdcPaint, &Rect, TlsGetValue(_hBrush)); if(!pixmap) ReleaseDC(handle, hdcPaint); -#endif +#endif } /* Draw an arc on a window (preferably a render window). @@ -10897,24 +10897,24 @@ #ifdef GDIPLUS GpGraphics *graphics = NULL; GpPen *pen = TlsGetValue(_gpPen); - + if(handle) GdipCreateFromHWND(handle, &graphics); else if(pixmap) GdipCreateFromHDC(pixmap->hdc, &graphics); else return; - + /* Enable antialiasing if the DW_DRAW_NOAA flag isn't set */ if(!(flags & DW_DRAW_NOAA)) GdipSetSmoothingMode(graphics, SmoothingModeAntiAlias); - + if(flags & DW_DRAW_FULL) { if(flags & DW_DRAW_FILL) { GpBrush *brush = TlsGetValue(_gpBrush); - + GdipFillEllipseI(graphics, brush, x1 < x2 ? x1 : x2, y1 < y2 ? y1 : y2, abs(x1-x2), abs(y1-y2)); } else @@ -10929,16 +10929,16 @@ double r = sqrt(dx*dx + dy*dy); double sweep; int ri = (int)r; - + /* Convert to degrees */ a1 *= (180.0 / M_PI); a2 *= (180.0 / M_PI); sweep = fabs(a1 - a2); - + GdipDrawArcI(graphics, pen, xorigin-ri, yorigin-ri, ri*2, ri*2, (REAL)a1, (REAL)sweep); } GdipDeleteGraphics(graphics); -#else +#else HDC hdcPaint; HBRUSH oldBrush; HPEN oldPen; @@ -10953,8 +10953,8 @@ hdcPaint = pixmap->hdc; else return; - - if(flags & DW_DRAW_FILL) + + if(flags & DW_DRAW_FILL) oldBrush = SelectObject( hdcPaint, TlsGetValue(_hBrush) ); else oldBrush = SelectObject( hdcPaint, GetStockObject(HOLLOW_BRUSH) ); @@ -10968,7 +10968,7 @@ if(!pixmap) ReleaseDC(handle, hdcPaint); -#endif +#endif } #ifdef GDIPLUS @@ -11415,7 +11415,7 @@ if(pixmap) { HFONT hfont = _acquire_font2(pixmap->hdc, fontname); - + if(hfont) { HFONT oldfont = pixmap->font; @@ -11521,7 +11521,7 @@ _convert_dpi(hdcsrc, &xsrc, &ysrc, TRUE); _convert_dpi(hdcsrc, &swidth, &sheight, TRUE); #endif - + /* If it is a 32bpp bitmap (with alpha) use AlphaBlend unless it fails */ if ( srcp && srcp->depth == 32 && AlphaBlend( hdcdest, xdest, ydest, width, height, hdcsrc, xsrc, ysrc, swidth, sheight, bf ) ) { @@ -11910,7 +11910,7 @@ return 0; } -/* +/* * Generally an internal function called from a newly created * thread to setup the Dynamic Windows environment for the thread. * However it is exported so language bindings can call it when @@ -11924,19 +11924,19 @@ ARGB gpfore = MAKEARGB(255, 128, 128, 128); GpBrush *brush; GpPen *pen; - + GdipCreatePen1(gpfore, 1.0, UnitPixel, &pen); TlsSetValue(_gpPen, (LPVOID)pen); GdipCreateSolidFill(gpfore, &brush); TlsSetValue(_gpBrush, brush); -#endif +#endif TlsSetValue(_foreground, DW_UINT_TO_POINTER(foreground)); TlsSetValue(_background, DW_UINT_TO_POINTER(background)); TlsSetValue(_hPen, CreatePen(PS_SOLID, 1, foreground)); TlsSetValue(_hBrush, CreateSolidBrush(foreground)); } -/* +/* * Generally an internal function called from a terminating * thread to cleanup the Dynamic Windows environment for the thread. * However it is exported so language bindings can call it when @@ -11949,7 +11949,7 @@ #ifdef GDIPLUS GpBrush *brush; GpPen *pen; -#endif +#endif if((hPen = TlsGetValue(_hPen))) DeleteObject(hPen); @@ -11960,7 +11960,7 @@ GdipDeleteBrush(brush); if((pen = TlsGetValue(_gpPen))) GdipDeletePen(pen); -#endif +#endif } /* @@ -12033,7 +12033,7 @@ #ifdef AEROGLASS /* Free any in use libraries */ FreeLibrary(hdwm); -#endif +#endif FreeLibrary(huxtheme); DestroyWindow(hwndTooltip); } @@ -12215,7 +12215,7 @@ { SetFocus(handle); } - + /* * Sets the current focus item for a window/dialog. * Parameters: @@ -12278,7 +12278,7 @@ TCHAR *tmp; #ifdef UNICODE int type = CF_UNICODETEXT; -#else +#else int type = CF_TEXT; #endif @@ -12318,9 +12318,9 @@ buf = UTF8toWide(src); free(src); len = (int)_tcslen(buf); -#else +#else int type = CF_TEXT; - + buf = str; #endif @@ -12355,7 +12355,7 @@ * A handle to the notification which can be used to attach a "clicked" event if desired, * or NULL if it fails or notifications are not supported by the system. * Remarks: - * This will create a system notification that will show in the notifaction panel + * This will create a system notification that will show in the notifaction panel * on supported systems, which may be clicked to perform another task. */ HWND dw_notification_new(const char *title, HPIXMAP pixmap, const char *description, ...) @@ -12421,6 +12421,16 @@ strcpy(env->buildDate, __DATE__); strcpy(env->buildTime, __TIME__); +#if (defined(BUILD_DLL) || defined(BUILD_HTML)) +# ifdef BUILD_EDGE + strcpy(env->htmlEngine, "EDGE"); +# else + strcpy(env->htmlEngine, "IE"); +# endif +#else + strcpy(env->htmlEngine, "N/A"); +#endif + env->DWMajorVersion = DW_MAJOR_VERSION; env->DWMinorVersion = DW_MINOR_VERSION; #ifdef VER_REV @@ -12434,7 +12444,7 @@ void _to_dos(TCHAR *dst, TCHAR *src) { int x = 0; - + while(src[x]) { if(src[x] == TEXT('/')) @@ -12517,7 +12527,7 @@ else { DWORD att = defpath ? GetFileAttributes(UTF8toWide(defpath)) : INVALID_FILE_ATTRIBUTES; - + if (ext) { /* @@ -12596,13 +12606,13 @@ for(z=0;zdrawfunc = drawfunc; print->drawdata = drawdata; print->pd.lStructSize = sizeof(PRINTDLG); @@ -12714,14 +12724,14 @@ DWPrint *p = print; HPIXMAP pixmap; int x, width, height, result = DW_ERROR_UNKNOWN; - + if(!p) return result; - + if (!(pixmap = calloc(1,sizeof(struct _hpixmap)))) return result; - width = GetDeviceCaps(p->pd.hDC, HORZRES); + width = GetDeviceCaps(p->pd.hDC, HORZRES); height = GetDeviceCaps(p->pd.hDC, VERTRES); pixmap->hbm = CreateCompatibleBitmap(p->pd.hDC, width, height); @@ -12740,7 +12750,7 @@ /* Start the job */ StartDoc(p->pd.hDC, &(p->di)); - + /* Cycle through each page */ for(x=p->pd.nFromPage-1; xpd.nToPage && p->drawfunc; x++) { @@ -12769,7 +12779,7 @@ void API dw_print_cancel(HPRINT print) { DWPrint *p = print; - + if(p) p->drawfunc = NULL; } @@ -12808,7 +12818,7 @@ /* * Returns a pointer to a static buffer which containes the - * private application data directory. + * private application data directory. */ char * API dw_app_dir(void) { @@ -13135,12 +13145,12 @@ if(((window < (HWND)65536 && (int)(intptr_t)window == tmp->id) || tmp->window == window) && tmp->message == message) { void (DWSIGNAL *discfunc)(HWND, void *) = (void (*)(HWND, void *))tmp->discfunction; - + if(discfunc) { discfunc(tmp->window, tmp->data); } - + if(prev) { prev->next = tmp->next; @@ -13176,12 +13186,12 @@ if((window < (HWND)65536 && (int)(intptr_t)window == tmp->id) || tmp->window == window) { void (DWSIGNAL *discfunc)(HWND, void *) = (void (*)(HWND, void *))tmp->discfunction; - + if(discfunc) { discfunc(tmp->window, tmp->data); } - + if(prev) { prev->next = tmp->next; @@ -13218,12 +13228,12 @@ if(((window < (HWND)65536 && (int)(intptr_t)window == tmp->id) || tmp->window == window) && tmp->data == data) { void (DWSIGNAL *discfunc)(HWND, void *) = (void (*)(HWND, void *))tmp->discfunction; - + if(discfunc) { discfunc(tmp->window, tmp->data); } - + if(prev) { prev->next = tmp->next; @@ -13259,7 +13269,7 @@ return _myUTF8toWide(utf8string, malloc(MultiByteToWideChar(CP_UTF8, 0, utf8string, -1, NULL, 0) * sizeof(WCHAR))); #else return NULL; -#endif +#endif } /*