Mike McCormack : Clock: Load license text from resources.

Alexandre Julliard julliard at wine.codeweavers.com
Sat Feb 4 11:14:56 CST 2006


Module: wine
Branch: refs/heads/master
Commit: cbe8ea0517de9981b3c74f29a65b2f6059b7107f
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=cbe8ea0517de9981b3c74f29a65b2f6059b7107f

Author: Mike McCormack <mike at codeweavers.com>
Date:   Sat Feb  4 16:59:19 2006 +0100

Clock: Load license text from resources.

---

 programs/clock/En.rc        |   24 +++++++++++++++++
 programs/clock/License_En.c |   29 --------------------
 programs/clock/Makefile.in  |    6 +---
 programs/clock/clock_res.h  |    5 +++
 programs/clock/license.c    |   40 ----------------------------
 programs/clock/license.h    |   62 -------------------------------------------
 programs/clock/main.c       |   17 +++++++++++-
 7 files changed, 46 insertions(+), 137 deletions(-)
 delete mode 100644 programs/clock/License_En.c
 delete mode 100644 programs/clock/license.c
 delete mode 100644 programs/clock/license.h

diff --git a/programs/clock/En.rc b/programs/clock/En.rc
index ee6738c..fe7c5bc 100644
--- a/programs/clock/En.rc
+++ b/programs/clock/En.rc
@@ -47,3 +47,27 @@ STRINGTABLE DISCARDABLE
 {
 IDS_CLOCK, "Clock"
 }
+
+STRINGTABLE DISCARDABLE LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
+{
+IDS_LICENSE_CAPTION,            "LICENSE"
+IDS_LICENSE,
+"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.\n\
+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.\n\
+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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA"
+
+IDS_WARRANTY_CAPTION, "NO WARRANTY"
+IDS_WARRANTY,
+"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."
+}
diff --git a/programs/clock/License_En.c b/programs/clock/License_En.c
deleted file mode 100644
index 654d523..0000000
--- a/programs/clock/License_En.c
+++ /dev/null
@@ -1,29 +0,0 @@
-#include "windows.h"
-#include "license.h"
-
-static CHAR LicenseCaption_En[] = "LICENSE";
-static CHAR License_En[] =
-"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.\n"
-
-"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.\n"
-
-"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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA";
-
-static CHAR NoWarrantyCaption_En[] = "NO WARRANTY";
-static CHAR NoWarranty_En[] =
-"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.";
-
-LICENSE WineLicense_En = {License_En, LicenseCaption_En,
-                          NoWarranty_En, NoWarrantyCaption_En};
-
diff --git a/programs/clock/Makefile.in b/programs/clock/Makefile.in
index 91822e5..72a2fd8 100644
--- a/programs/clock/Makefile.in
+++ b/programs/clock/Makefile.in
@@ -6,13 +6,9 @@ MODULE    = clock.exe
 APPMODE   = -mwindows
 IMPORTS   = comdlg32 shell32 user32 gdi32 kernel32
 
-LICENSELANG = En
-
 C_SRCS = \
-	license.c \
 	main.c \
-	winclock.c \
-	$(LICENSELANG:%=License_%.c)
+	winclock.c
 
 RC_SRCS = rsrc.rc
 
diff --git a/programs/clock/clock_res.h b/programs/clock/clock_res.h
index 1667f6b..2c92918 100644
--- a/programs/clock/clock_res.h
+++ b/programs/clock/clock_res.h
@@ -31,3 +31,8 @@
 #define IDM_ONTOP                 0x113
 
 #define IDS_CLOCK                 0x10C
+
+#define IDS_LICENSE_CAPTION       0x120
+#define IDS_LICENSE               0x121
+#define IDS_WARRANTY_CAPTION      0x122
+#define IDS_WARRANTY              0x123
diff --git a/programs/clock/license.c b/programs/clock/license.c
deleted file mode 100644
index 6de507b..0000000
--- a/programs/clock/license.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Clock (license.c)
- *
- * Copyright 1998 by Marcel Baur <mbaur at g26.ethz.ch>
- * Adapted from Program Manager (Original by Ulrich Schmied)
- *
- * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include "windows.h"
-#include "license.h"
-
-VOID WineLicense(HWND Wnd)
-{
-  /* FIXME: should load strings from resources */
-  LICENSE *License = &WineLicense_En;
-  MessageBox(Wnd, License->License, License->LicenseCaption,
-             MB_ICONINFORMATION | MB_OK);
-}
-
-
-VOID WineWarranty(HWND Wnd)
-{
-  /* FIXME: should load strings from resources */
-  LICENSE *License = &WineLicense_En;
-  MessageBox(Wnd, License->Warranty, License->WarrantyCaption,
-             MB_ICONEXCLAMATION | MB_OK);
-}
diff --git a/programs/clock/license.h b/programs/clock/license.h
deleted file mode 100644
index 94dd3e8..0000000
--- a/programs/clock/license.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Clock (license.h)
- *
- * Copyright 1998 by Marcel Baur <mbaur at g26.ethz.ch>
- * Adapted from Program Manager (Original by Ulrich Schmied)
- *
- * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-/* function prototypes */
-
-VOID WineLicense(HWND hWnd);
-VOID WineWarranty(HWND hWnd);
-
-
-/* typedefs */
-
-typedef struct
-{
-  LPCSTR License, LicenseCaption;
-  LPCSTR Warranty, WarrantyCaption;
-} LICENSE;
-
-
-/* external references */
-
-/*
-extern LICENSE WineLicense_Ca;
-extern LICENSE WineLicense_Cz;
-extern LICENSE WineLicense_Da;
-extern LICENSE WineLicense_De;
-*/
-
-extern LICENSE WineLicense_En;
-
-/*
-extern LICENSE WineLicense_Eo;
-extern LICENSE WineLicense_Es;
-extern LICENSE WineLicense_Fi;
-extern LICENSE WineLicense_Fr;
-extern LICENSE WineLicense_Hu;
-extern LICENSE WineLicense_It;
-extern LICENSE WineLicense_Ko;
-extern LICENSE WineLicense_No;
-extern LICENSE WineLicense_Pl;
-extern LICENSE WineLicense_Po;
-extern LICENSE WineLicense_Sw;
-extern LICENSE WineLicense_Va;
-*/
diff --git a/programs/clock/main.c b/programs/clock/main.c
index 754c1e9..cd6a772 100644
--- a/programs/clock/main.c
+++ b/programs/clock/main.c
@@ -29,7 +29,6 @@
 #include "commdlg.h"
 
 #include "main.h"
-#include "license.h"
 #include "winclock.h"
 
 #define INITIAL_WINDOW_SIZE 200
@@ -37,6 +36,22 @@
 
 CLOCK_GLOBALS Globals;
 
+static VOID WineLicense(HWND Wnd)
+{
+  char cap[20], text[1024];
+  LoadString(Globals.hInstance, IDS_LICENSE, text, sizeof text);
+  LoadString(Globals.hInstance, IDS_LICENSE_CAPTION, cap, sizeof cap);
+  MessageBox(Wnd, text, cap, MB_ICONINFORMATION | MB_OK);
+}
+
+static VOID WineWarranty(HWND Wnd)
+{
+  char cap[20], text[1024];
+  LoadString(Globals.hInstance, IDS_WARRANTY, text, sizeof text);
+  LoadString(Globals.hInstance, IDS_WARRANTY_CAPTION, cap, sizeof cap);
+  MessageBox(Wnd, text, cap, MB_ICONEXCLAMATION | MB_OK);
+}
+
 static VOID CLOCK_UpdateMenuCheckmarks(VOID)
 {
     HMENU hPropertiesMenu;




More information about the wine-cvs mailing list