[PATCH 1/6] themes/light: Add Classic Blue visual style.

Zhiyi Zhang zzhang at codeweavers.com
Tue Jun 22 21:50:52 CDT 2021


Classic Blue is a visual style that uses blue as the main color and doesn't have bitmaps for UI
controls.

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
 configure.ac             |   1 +
 dlls/setupapi/fakedll.c  |  51 +++++++-------
 loader/wine.inf.in       |   2 +
 themes/light/Makefile.in |   3 +
 themes/light/light.rc    | 140 +++++++++++++++++++++++++++++++++++++++
 themes/light/resources.h |  25 +++++++
 tools/make_makefiles     |   8 +--
 tools/makedep.c          |  14 ++--
 8 files changed, 209 insertions(+), 35 deletions(-)
 create mode 100644 themes/light/Makefile.in
 create mode 100644 themes/light/light.rc
 create mode 100644 themes/light/resources.h

diff --git a/configure.ac b/configure.ac
index f76dd047825..4888b70ae20 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4002,6 +4002,7 @@ WINE_CONFIG_MAKEFILE(programs/wusa)
 WINE_CONFIG_MAKEFILE(programs/xcopy)
 WINE_CONFIG_MAKEFILE(programs/xcopy/tests)
 WINE_CONFIG_MAKEFILE(server)
+WINE_CONFIG_MAKEFILE(themes/light)
 WINE_CONFIG_MAKEFILE(tools,,[test "x$enable_tools" = xno])
 WINE_CONFIG_MAKEFILE(tools/sfnt2fon,,[test "x$enable_tools" = xno])
 WINE_CONFIG_MAKEFILE(tools/widl,,[test "x$enable_tools" = xno])
diff --git a/dlls/setupapi/fakedll.c b/dlls/setupapi/fakedll.c
index 203d7c393ce..416db544303 100644
--- a/dlls/setupapi/fakedll.c
+++ b/dlls/setupapi/fakedll.c
@@ -417,11 +417,22 @@ static const WCHAR *enum_load_path( unsigned int idx )
 /* try to load a pre-compiled fake dll */
 static void *load_fake_dll( const WCHAR *name, SIZE_T *size )
 {
+    static const struct
+    {
+        const WCHAR *suffix;
+        const WCHAR *dir;
+    }
+    search_dirs[] =
+    {
+        {L".dll", L"\\dlls"},
+        {L".exe", L"\\programs"},
+        {L".msstyles", L"\\themes"},
+    };
     const WCHAR *build_dir = _wgetenv( L"WINEBUILDDIR" );
     const WCHAR *path;
     WCHAR *file, *ptr;
     void *data = NULL;
-    unsigned int i, pos, len, namelen, maxlen = 0;
+    unsigned int i, pos, len, namelen, suffixlen, maxlen = 0;
     WCHAR *p;
     int res = 0;
 
@@ -441,29 +452,21 @@ static void *load_fake_dll( const WCHAR *name, SIZE_T *size )
 
     if (build_dir)
     {
-        /* try as a dll */
-        ptr = file + pos;
-        namelen = len + 1;
-        file[pos + len + 1] = 0;
-        if (namelen > 4 && !wcsncmp( ptr + namelen - 4, L".dll", 4 )) namelen -= 4;
-        ptr = prepend( ptr, ptr, namelen );
-        ptr = prepend( ptr, L"\\dlls", 5 );
-        ptr = prepend( ptr, build_dir, lstrlenW(build_dir) );
-        if ((res = read_file( ptr, &data, size ))) goto done;
-        lstrcpyW( file + pos + len + 1, L".fake" );
-        if ((res = read_file( ptr, &data, size ))) goto done;
-
-        /* now as a program */
-        ptr = file + pos;
-        namelen = len + 1;
-        file[pos + len + 1] = 0;
-        if (namelen > 4 && !wcsncmp( ptr + namelen - 4, L".exe", 4 )) namelen -= 4;
-        ptr = prepend( ptr, ptr, namelen );
-        ptr = prepend( ptr, L"\\programs", 9 );
-        ptr = prepend( ptr, build_dir, lstrlenW(build_dir) );
-        if ((res = read_file( ptr, &data, size ))) goto done;
-        lstrcpyW( file + pos + len + 1, L".fake" );
-        if ((res = read_file( ptr, &data, size ))) goto done;
+        for (i = 0; i < ARRAY_SIZE(search_dirs); ++i)
+        {
+            ptr = file + pos;
+            namelen = len + 1;
+            file[pos + len + 1] = 0;
+            suffixlen = lstrlenW( search_dirs[i].suffix );
+            if (namelen > suffixlen && !wcsncmp( ptr + namelen - suffixlen, search_dirs[i].suffix, suffixlen ))
+                namelen -= suffixlen;
+            ptr = prepend( ptr, ptr, namelen );
+            ptr = prepend( ptr, search_dirs[i].dir, lstrlenW( search_dirs[i].dir ));
+            ptr = prepend( ptr, build_dir, lstrlenW( build_dir ) );
+            if ((res = read_file( ptr, &data, size ))) goto done;
+            lstrcpyW( file + pos + len + 1, L".fake" );
+            if ((res = read_file( ptr, &data, size ))) goto done;
+        }
     }
 
     file[pos + len + 1] = 0;
diff --git a/loader/wine.inf.in b/loader/wine.inf.in
index 24da6f3af6b..0eaa75191bd 100644
--- a/loader/wine.inf.in
+++ b/loader/wine.inf.in
@@ -2658,6 +2658,8 @@ HKLM,%CurrentVersion%\Telephony\Country List\998,"SameAreaRule",,"G"
 11,,iexplore.exe
 11,,notepad.exe
 11,,winetest.exe,-
+; Themes
+10,Resources\Themes\light,light.msstyles
 ; skip .NET fake dlls in Wine Mono package
 11,,aspnet_regiis.exe,-
 11,,ngen.exe,-
diff --git a/themes/light/Makefile.in b/themes/light/Makefile.in
new file mode 100644
index 00000000000..d6b7a53d7f8
--- /dev/null
+++ b/themes/light/Makefile.in
@@ -0,0 +1,3 @@
+MODULE = light.msstyles
+
+RC_SRCS = light.rc
diff --git a/themes/light/light.rc b/themes/light/light.rc
new file mode 100644
index 00000000000..e0ace9cb52e
--- /dev/null
+++ b/themes/light/light.rc
@@ -0,0 +1,140 @@
+/*
+ * Copyright 2021 Zhiyi Zhang for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "resources.h"
+
+#pragma makedep po
+
+LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
+
+/* Theme color display names */
+STRINGTABLE
+{
+    IDS_COLOR_DISPLAY_NAME_CLASSIC_BLUE "Classic Blue"
+}
+
+/* Theme color tooltips */
+STRINGTABLE
+{
+    IDS_COLOR_TOOLTIP_CLASSIC_BLUE "Classic Blue"
+}
+
+/* Theme size display names */
+STRINGTABLE
+{
+    IDS_SIZE_DISPLAY_NAME_NORMAL "Normal"
+}
+
+/* Theme size tooltips */
+STRINGTABLE
+{
+    IDS_SIZE_TOOLTIP_NORMAL "Normal"
+}
+
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+
+/* Theme version */
+1 PACKTHEM_VERSION {0x3}
+
+/* Theme color names */
+1 COLORNAMES
+{
+"Classic Blue\0"
+"\0"
+}
+
+/* Theme size names */
+1 SIZENAMES
+{
+"NormalSize\0"
+"\0"
+}
+
+/* Theme ini files */
+1 FILERESNAMES
+{
+"CLASSIC_BLUE_INI\0"
+"\0"
+}
+
+/* Theme definition */
+THEMES_INI TEXTFILE
+{
+"[documentation]\r\n"
+"DisplayName = Light\r\n"
+"ToolTip = Light Visual Style\r\n"
+}
+
+/* Light theme definition */
+/* Classic blue theme, no bitmaps */
+CLASSIC_BLUE_INI TEXTFILE
+{
+"[Globals]\r\n"
+"EdgeLightColor = 255 255 255\r\n"
+"EdgeHighLightColor = 255 255 255\r\n"
+"EdgeShadowColor = 189 189 189\r\n"
+"EdgeDkShadowColor = 158 158 158\r\n"
+"EdgeFillColor = 255 255 255\r\n"
+
+"\r\n[SysMetrics]\r\n"
+"; System colors\r\n"
+"Scrollbar = 255 255 255\r\n"
+"Background = 37 111 149\r\n"
+"ActiveCaption = 50 150 250\r\n"
+"InactiveCaption = 245 245 245\r\n"
+"Menu = 255 255 255\r\n"
+"Window = 255 255 255\r\n"
+"WindowFrame = 158 158 158\r\n"
+"MenuText = 0 0 0\r\n"
+"WindowText = 0 0 0\r\n"
+"CaptionText = 0 0 0\r\n"
+"ActiveBorder = 255 255 255\r\n"
+"InactiveBorder = 255 255 255\r\n"
+"AppWorkSpace = 128 128 128\r\n"
+"Highlight = 48 150 250\r\n"
+"HighlightText = 255 255 255\r\n"
+"BtnFace = 245 245 245\r\n"
+"BtnShadow = 166 166 166\r\n"
+"GrayText = 166 166 166\r\n"
+"BtnText = 0 0 0\r\n"
+"InactiveCaptionText = 100 100 100\r\n"
+"BtnHighlight = 255 255 255\r\n"
+"DkShadow3d = 106 106 106\r\n"
+"Light3d = 227 227 227\r\n"
+"InfoText = 0 0 0\r\n"
+"InfoBk = 255 255 255\r\n"
+"ButtonAlternateFace = 255 255 255\r\n"
+"HotTracking = 224 224 224\r\n"
+"GradientActiveCaption = 50 150 250\r\n"
+"GradientInactiveCaption = 245 245 245\r\n"
+"MenuHilight = 48 150 250\r\n"
+"MenuBar = 255 255 255\r\n"
+
+"\r\n; Flat menus\r\n"
+"FlatMenus = true\r\n"
+}
+
+/* File version */
+#define WINE_FILEDESCRIPTION_STR "Light Theme"
+#define WINE_FILENAME_STR "light.msstyles"
+#define WINE_FILEVERSION 1,0,0,1
+#define WINE_FILEVERSION_STR "1.0.0.1"
+#define WINE_PRODUCTVERSION 1,0,0,1
+#define WINE_PRODUCTVERSION_STR "1.0.0.1"
+
+#include "wine/wine_common_ver.rc"
diff --git a/themes/light/resources.h b/themes/light/resources.h
new file mode 100644
index 00000000000..ef75da9f628
--- /dev/null
+++ b/themes/light/resources.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2021 Zhiyi Zhang for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <winnt.h>
+
+#define IDS_COLOR_DISPLAY_NAME_CLASSIC_BLUE    1000
+#define IDS_COLOR_TOOLTIP_CLASSIC_BLUE         2000
+#define IDS_SIZE_DISPLAY_NAME_NORMAL           3000
+#define IDS_SIZE_TOOLTIP_NORMAL                4000
+
diff --git a/tools/make_makefiles b/tools/make_makefiles
index 3abba2da840..fe337c52196 100755
--- a/tools/make_makefiles
+++ b/tools/make_makefiles
@@ -439,12 +439,12 @@ sub update_makefiles(@)
             die "APPMODE should not be defined in $file" if defined $make{"APPMODE"};
             die "STATICLIB should not be defined in $file" if defined $make{"STATICLIB"};
         }
-        elsif (defined($make{"MODULE"}))  # dll or program
+        elsif (defined($make{"MODULE"}))  # dll or program or theme
         {
-            (my $name = $file) =~ s/^(dlls|programs)\/(.*)\/Makefile/$2/;
+            (my $name = $file) =~ s/^(dlls|programs|themes)\/(.*)\/Makefile/$2/;
             my $dllflags = $make{"EXTRADLLFLAGS"} || "";
             if (defined $make{"APPMODE"}) { $dllflags .= " " . $make{"APPMODE"}; }
-            die "MODULE should not be defined in $file" unless $file =~ /^(dlls|programs)\//;
+            die "MODULE should not be defined in $file" unless $file =~ /^(dlls|programs|themes)\//;
             die "STATICLIB should not be defined in $file" if defined $make{"STATICLIB"};
             if ($file =~ /^programs\//)
             {
@@ -456,7 +456,7 @@ sub update_makefiles(@)
             {
                 die "APPMODE should not be defined in $file" if defined $make{"APPMODE"} ;
                 die "EXTRADLLFLAGS should not contain -mconsole or -mwindows in $file" if $dllflags =~ /-m(console|windows)/;
-                die "Invalid MODULE in $file" unless ($name =~ /\./ && $make{"MODULE"} eq $name) || $make{"MODULE"} eq "$name.dll";
+                die "Invalid MODULE in $file" unless ($name =~ /\./ && $make{"MODULE"} eq $name) || $make{"MODULE"} eq "$name.dll" || $make{"MODULE"} eq "$name.msstyles";
             }
             if (defined $make{"IMPORTLIB"})
             {
diff --git a/tools/makedep.c b/tools/makedep.c
index db076d0c057..0d1cb5166bb 100644
--- a/tools/makedep.c
+++ b/tools/makedep.c
@@ -208,6 +208,7 @@ struct makefile
     int             is_cross;
     int             is_win16;
     int             is_exe;
+    int             is_msstyles;
 
     /* values generated at output time */
     struct strarray in_files;
@@ -3286,7 +3287,8 @@ static void output_module( struct makefile *make )
     char *spec_file = NULL;
     unsigned int i;
 
-    if (!make->is_exe) spec_file = src_dir_path( make, replace_extension( make->module, ".dll", ".spec" ));
+    if (!make->is_exe && !make->is_msstyles)
+        spec_file = src_dir_path( make, replace_extension( make->module, ".dll", ".spec" ));
     strarray_addall( &all_libs, add_import_libs( make, &dep_libs, make->delayimports, 1, 0 ));
     strarray_addall( &all_libs, add_import_libs( make, &dep_libs, make->imports, 0, 0 ));
     add_import_libs( make, &dep_libs, get_default_imports( make ), 0, 0 );  /* dependencies only */
@@ -3319,7 +3321,7 @@ static void output_module( struct makefile *make )
                           strmake( "d%s/%s", pe_dir, make->module ));
         output( "%s%s %s.fake:", module_path, dll_ext, module_path );
     }
-    else
+    else if (!make->is_msstyles)
     {
         strarray_addall( &all_libs, add_unix_libraries( make, &dep_libs ));
         strarray_add( &make->all_targets, make->module );
@@ -3338,11 +3340,8 @@ static void output_module( struct makefile *make )
     output( "\n" );
     output_winegcc_command( make, make->is_cross );
     if (make->is_cross) output_filename( "-Wl,--wine-builtin" );
-    if (spec_file)
-    {
-        output_filename( "-shared" );
-        output_filename( spec_file );
-    }
+    if (make->is_msstyles || spec_file) output_filename( "-shared" );
+    if (spec_file) output_filename( spec_file );
     output_filenames( make->extradllflags );
     output_filenames_obj_dir( make, make->is_cross ? make->crossobj_files : make->object_files );
     output_filenames_obj_dir( make, make->res_files );
@@ -4229,6 +4228,7 @@ static void load_sources( struct makefile *make )
     make->use_msvcrt = strarray_exists( &make->extradllflags, "-mno-cygwin" );
     make->is_exe     = strarray_exists( &make->extradllflags, "-mconsole" ) ||
                        strarray_exists( &make->extradllflags, "-mwindows" );
+    make->is_msstyles = make->module && strendswith( make->module, ".msstyles" );
 
     if (make->module && !make->install_lib.count && !make->install_dev.count)
     {
-- 
2.30.2




More information about the wine-devel mailing list