about.c
上传用户:wstnjxml
上传日期:2014-04-03
资源大小:7248k
文件大小:5k
源码类别:

Windows CE

开发平台:

C/C++

  1. /*****************************************************************************
  2.  *
  3.  * This program is free software ; you can redistribute it and/or modify
  4.  * it under the terms of the GNU General Public License as published by
  5.  * the Free Software Foundation; either version 2 of the License, or
  6.  * (at your option) any later version.
  7.  *
  8.  * This program is distributed in the hope that it will be useful,
  9.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11.  * GNU General Public License for more details.
  12.  *
  13.  * You should have received a copy of the GNU General Public License
  14.  * along with this program; if not, write to the Free Software
  15.  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  16.  *
  17.  * $Id: about.c 603 2006-01-19 13:00:33Z picard $
  18.  *
  19.  * The Core Pocket Media Player
  20.  * Copyright (c) 2004-2005 Gabor Kovacs
  21.  *
  22.  ****************************************************************************/
  23. #include "../common/common.h"
  24. #include "win.h"
  25. #include "about.h"
  26. #include "../config.h"
  27. typedef struct about
  28. {
  29. win Win;
  30. tchar_t Title[64];
  31. tchar_t Head[64];
  32. } about;
  33. static int Command(about* p,int Cmd)
  34. {
  35. stream* File;
  36. tchar_t Path[MAXPATH];
  37. switch (Cmd)
  38. {
  39. #ifdef WINSHOWHTML
  40. case ABOUT_COPYRIGHT:
  41. WinShowHTML(T("tcpmp.htm"));
  42. break;
  43. #endif
  44. case ABOUT_DUMP:
  45. GetDebugPath(Path,TSIZEOF(Path),T("dump.txt"));
  46. File = StreamOpen(Path,1);
  47. if (File)
  48. {
  49. NodeDump(File);
  50. StreamClose(File);
  51. ShowMessage(LangStr(PLATFORM_ID,PLATFORM_DUMP_TITLE),
  52. LangStr(PLATFORM_ID,PLATFORM_DUMP_MESSAGE));
  53. }
  54. return ERR_NONE;
  55. }
  56. return ERR_INVALID_PARAM;
  57. }
  58. static int Init(about* p)
  59. {
  60. const tchar_t* Translate;
  61. winunit y = 4;
  62. WinTitle(&p->Win,p->Title);
  63. WinLabel(&p->Win,&y,-1,-1,T("The Core Pocket Media Player"),12,LABEL_BOLD|LABEL_CENTER,NULL);
  64. WinLabel(&p->Win,&y,-1,-1,p->Head,11,LABEL_CENTER,NULL);
  65. #if defined(CONFIG_DEMO)
  66. y+=7;
  67. WinLabel(&p->Win,&y,-1,-1,T("FOR DEMONSTRATION PURPOSES ONLY"),11,LABEL_BOLD|LABEL_CENTER,NULL);
  68. y+=3;
  69. #endif
  70. y+=4;
  71. WinLabel(&p->Win,&y,-1,-1,T("Copyright (C) 2002-2006, CoreCodec, Inc."),10,LABEL_CENTER,NULL);
  72. WinLabel(&p->Win,&y,-1,-1,T("All Rights Reserved."),10,LABEL_CENTER,NULL);
  73. WinLabel(&p->Win,&y,-1,-1,T("http://www.tcpmp.com"),11,LABEL_BOLD|LABEL_CENTER,NULL);
  74. y+=7;
  75. WinLabel(&p->Win,&y,-1,-1,T("CoreCodec Audio / Video Project"),11,LABEL_CENTER,NULL);
  76. WinLabel(&p->Win,&y,-1,-1,T("http://www.corecodec.org"),11,LABEL_BOLD|LABEL_CENTER,NULL);
  77. y+=7;
  78. Translate = LangStr(ABOUT_ID,ABOUT_TRANSLATION);
  79. if (Translate[0])
  80. {
  81. y += 6;
  82. WinLabel(&p->Win,&y,-1,-1,Translate,11,LABEL_CENTER|LABEL_BOLD,NULL);
  83. }
  84. #if defined(CONFIG_GPL)
  85. y+=7;
  86. WinLabel(&p->Win,&y,-1,-1,LangStr(ABOUT_ID,ABOUT_LICENSE),11,0,NULL);
  87. y+=7;
  88. WinLabel(&p->Win,&y,-1,-1,LangStr(ABOUT_ID,ABOUT_LICENSE2),11,0,NULL);
  89. y+=7;
  90. WinLabel(&p->Win,&y,-1,-1,LangStr(ABOUT_ID,ABOUT_LIBSUSED),11,0,NULL);
  91. WinLabel(&p->Win,&y,-1,-1,LangStr(ABOUT_ID,ABOUT_LIBS),11,LABEL_BOLD,NULL);
  92. y+=7;
  93. WinLabel(&p->Win,&y,-1,-1,LangStr(ABOUT_ID,ABOUT_THANKS),11,0,NULL);
  94. WinLabel(&p->Win,&y,-1,-1,LangStr(ABOUT_ID,ABOUT_THANKSLIBS),11,LABEL_BOLD,NULL);
  95. #endif
  96. y+=7;
  97. WinLabel(&p->Win,&y,-1,-1,LangStr(ABOUT_ID,ABOUT_FORUM),11,0,NULL);
  98. return ERR_NONE;
  99. }
  100. static const menudef MenuDef[] =
  101. {
  102. { 0, PLATFORM_ID, PLATFORM_DONE },
  103. { 0, ABOUT_ID, ABOUT_DUMP },
  104. #ifdef WINSHOWHTML
  105. { 0, ABOUT_ID, ABOUT_COPYRIGHT },
  106. #endif
  107. MENUDEF_END
  108. };
  109. #ifdef WINSHOWHTML
  110. static const menudef MenuDef2[] =
  111. {
  112. { 0, PLATFORM_ID, PLATFORM_DONE },
  113. { 0, ABOUT_ID, ABOUT_OPTIONS },
  114. { 1, ABOUT_ID, ABOUT_DUMP },
  115. { 1, ABOUT_ID, ABOUT_COPYRIGHT },
  116. MENUDEF_END
  117. };
  118. #endif
  119. WINCREATE(About)
  120. static int Create(about* p)
  121. {
  122. context* c = Context();
  123. AboutCreate(&p->Win);
  124. p->Win.WinWidth = 180;
  125. p->Win.WinHeight = 240;
  126. p->Win.Flags |= WIN_DIALOG;
  127. #ifdef WINSHOWHTML
  128. p->Win.MenuDef = (p->Win.Flags & WIN_2BUTTON) ? MenuDef2 : MenuDef;
  129. #else
  130. p->Win.MenuDef = MenuDef;
  131. #endif
  132. p->Win.Init = (nodefunc)Init;
  133. p->Win.Command = (wincommand)Command;
  134. stprintf_s(p->Title,TSIZEOF(p->Title),LangStr(ABOUT_ID,ABOUT_TITLE),c->ProgramName);
  135. stprintf_s(p->Head,TSIZEOF(p->Head),LangStr(ABOUT_ID,ABOUT_HEAD),c->ProgramName,c->ProgramVersion);
  136. return ERR_NONE;
  137. }
  138. static const nodedef About =
  139. {
  140. sizeof(about),
  141. ABOUT_ID,
  142. WIN_CLASS,
  143. PRI_DEFAULT,
  144. (nodecreate)Create
  145. };
  146. void About_Init()
  147. {
  148. NodeRegisterClass(&About);
  149. }
  150. void About_Done()
  151. {
  152. NodeUnRegisterClass(ABOUT_ID);
  153. }