Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp:~meths/openlp/testing |
Merge into: | lp:openlp |
Diff against target: | None lines |
To merge this branch: | bzr merge lp:~meths/openlp/testing |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Tim Bentley | Approve | ||
Raoul Snyman | Approve | ||
Review via email:
|
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Jon Tibble (meths) wrote : | # |
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Raoul Snyman (raoul-snyman) : | # |
review:
Approve
lp:~meths/openlp/testing
updated
- 536. By Jon Tibble
-
For Jon
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'demo_theme.xml' | |||
2 | --- demo_theme.xml 2008-10-07 19:12:32 +0000 | |||
3 | +++ demo_theme.xml 2009-09-13 15:14:45 +0000 | |||
4 | @@ -1,17 +1,17 @@ | |||
22 | 1 | <?xml version="1.0" encoding="iso-8859-1"?> | 1 | <?xml version="1.0" encoding="iso-8859-1"?> |
23 | 2 | <Theme> | 2 | <Theme> |
24 | 3 | <Name>openlp.org 2.0 Demo Theme</Name> | 3 | <Name>openlp.org 2.0 Demo Theme</Name> |
25 | 4 | <BackgroundType>2</BackgroundType> | 4 | <BackgroundType>2</BackgroundType> |
26 | 5 | <BackgroundParameter1>./openlp/core/test/data_for_tests/treesbig.jpg</BackgroundParameter1> | 5 | <BackgroundParameter1>./openlp/core/test/data_for_tests/treesbig.jpg</BackgroundParameter1> |
27 | 6 | <BackgroundParameter2>clBlack</BackgroundParameter2> | 6 | <BackgroundParameter2>clBlack</BackgroundParameter2> |
28 | 7 | <BackgroundParameter3/> | 7 | <BackgroundParameter3/> |
29 | 8 | <FontName>Tahoma</FontName> | 8 | <FontName>Tahoma</FontName> |
30 | 9 | <FontColor>clWhite</FontColor> | 9 | <FontColor>clWhite</FontColor> |
31 | 10 | <FontProportion>16</FontProportion> | 10 | <FontProportion>16</FontProportion> |
32 | 11 | <Shadow>-1</Shadow> | 11 | <Shadow>-1</Shadow> |
33 | 12 | <ShadowColor>$00000001</ShadowColor> | 12 | <ShadowColor>$00000001</ShadowColor> |
34 | 13 | <Outline>-1</Outline> | 13 | <Outline>-1</Outline> |
35 | 14 | <OutlineColor>clRed</OutlineColor> | 14 | <OutlineColor>clRed</OutlineColor> |
36 | 15 | <HorizontalAlign>2</HorizontalAlign> | 15 | <HorizontalAlign>2</HorizontalAlign> |
37 | 16 | <VerticalAlign>2</VerticalAlign> | 16 | <VerticalAlign>2</VerticalAlign> |
38 | 17 | </Theme> | 17 | </Theme> |
39 | 18 | 18 | ||
40 | === modified file 'documentation/pyqt-sql-py2exe.txt' | |||
41 | --- documentation/pyqt-sql-py2exe.txt 2008-11-27 20:14:38 +0000 | |||
42 | +++ documentation/pyqt-sql-py2exe.txt 2009-09-13 15:14:45 +0000 | |||
43 | @@ -1,58 +1,58 @@ | |||
102 | 1 | This content can be found at this URL: | 1 | This content can be found at this URL: |
103 | 2 | http://netsuperbrain.com/Postmodern%20PostgreSQL%20Application%20Development.pdf | 2 | http://netsuperbrain.com/Postmodern%20PostgreSQL%20Application%20Development.pdf |
104 | 3 | 3 | ||
105 | 4 | Page 11-15: QtDesigner | 4 | Page 11-15: QtDesigner |
106 | 5 | Page 18-20: SQLAlchemy | 5 | Page 18-20: SQLAlchemy |
107 | 6 | Page 21-23: PyQt - widget | 6 | Page 21-23: PyQt - widget |
108 | 7 | Page 24 : main | 7 | Page 24 : main |
109 | 8 | Page 28 : py2exe and release | 8 | Page 28 : py2exe and release |
110 | 9 | 9 | ||
111 | 10 | 10 | ||
112 | 11 | ============================== | 11 | ============================== |
113 | 12 | This is the destilled content. | 12 | This is the destilled content. |
114 | 13 | ============================== | 13 | ============================== |
115 | 14 | 14 | ||
116 | 15 | ---------------- | 15 | ---------------- |
117 | 16 | ** sqlalchemy ** | 16 | ** sqlalchemy ** |
118 | 17 | ---------------- | 17 | ---------------- |
119 | 18 | from sqlalchemy import create_engine, MetaData, Table | 18 | from sqlalchemy import create_engine, MetaData, Table |
120 | 19 | from sqlalchemy.orm import sessionmaker, mapper | 19 | from sqlalchemy.orm import sessionmaker, mapper |
121 | 20 | engine = create_engine( 'postgres://postgres@localhost/customers' ) | 20 | engine = create_engine( 'postgres://postgres@localhost/customers' ) |
122 | 21 | metadata = MetaData( bind=engine, reflect=True) | 21 | metadata = MetaData( bind=engine, reflect=True) |
123 | 22 | Session = sessionmaker(bind=engine, autoflush=True, | 22 | Session = sessionmaker(bind=engine, autoflush=True, |
124 | 23 | transactional=True) | 23 | transactional=True) |
125 | 24 | 24 | ||
126 | 25 | class Customer(object): pass | 25 | class Customer(object): pass |
127 | 26 | mapper( Customer, Table('customers', metadata ) ) | 26 | mapper( Customer, Table('customers', metadata ) ) |
128 | 27 | 27 | ||
129 | 28 | session = Session() | 28 | session = Session() |
130 | 29 | customer = Customer( businessName=“Jamb Safety”, | 29 | customer = Customer( businessName=“Jamb Safety”, |
131 | 30 | website=“www.jamb.com” ) | 30 | website=“www.jamb.com” ) |
132 | 31 | session.save( customer ) | 31 | session.save( customer ) |
133 | 32 | for customer in Session.query(Customer).filter( | 32 | for customer in Session.query(Customer).filter( |
134 | 33 | Customer.businessName.like(“Jamb%”)): | 33 | Customer.businessName.like(“Jamb%”)): |
135 | 34 | print customer.businessName | 34 | print customer.businessName |
136 | 35 | session.commit() | 35 | session.commit() |
137 | 36 | 36 | ||
138 | 37 | ------------------------ | 37 | ------------------------ |
139 | 38 | ** release and py2exe ** | 38 | ** release and py2exe ** |
140 | 39 | ------------------------ | 39 | ------------------------ |
141 | 40 | 40 | ||
142 | 41 | from distutils.core import setup | 41 | from distutils.core import setup |
143 | 42 | import py2exe | 42 | import py2exe |
144 | 43 | import glob | 43 | import glob |
145 | 44 | setup( | 44 | setup( |
146 | 45 | name="Customers", | 45 | name="Customers", |
147 | 46 | author="Sankel Software", | 46 | author="Sankel Software", |
148 | 47 | author_email="david@sankelsoftware.com", | 47 | author_email="david@sankelsoftware.com", |
149 | 48 | url="http://sankelsoftware.com", | 48 | url="http://sankelsoftware.com", |
150 | 49 | license=“GPL", | 49 | license=“GPL", |
151 | 50 | version=“1.0.0", | 50 | version=“1.0.0", |
152 | 51 | windows=[ { "script":"main.py“,}], | 51 | windows=[ { "script":"main.py“,}], |
153 | 52 | options={"py2exe":{"includes":["sip”]}}, | 52 | options={"py2exe":{"includes":["sip”]}}, |
154 | 53 | data_files=[ | 53 | data_files=[ |
155 | 54 | ("forms",glob.glob("forms/*.ui")), | 54 | ("forms",glob.glob("forms/*.ui")), |
156 | 55 | ] ) | 55 | ] ) |
157 | 56 | 56 | ||
158 | 57 | release: | 57 | release: |
159 | 58 | python setup.py py2exe --quiet --dist-dir=dist | 58 | python setup.py py2exe --quiet --dist-dir=dist |
160 | 59 | 59 | ||
161 | === modified file 'openlp/core/test/data_for_tests/render_theme.xml' | |||
162 | --- openlp/core/test/data_for_tests/render_theme.xml 2009-03-12 20:19:24 +0000 | |||
163 | +++ openlp/core/test/data_for_tests/render_theme.xml 2009-09-13 15:14:45 +0000 | |||
164 | @@ -1,19 +1,19 @@ | |||
184 | 1 | <?xml version="1.0" encoding="iso-8859-1"?> | 1 | <?xml version="1.0" encoding="iso-8859-1"?> |
185 | 2 | <Theme> | 2 | <Theme> |
186 | 3 | <Name>openlp.org Packaged Theme</Name> | 3 | <Name>openlp.org Packaged Theme</Name> |
187 | 4 | <BackgroundType>0</BackgroundType> | 4 | <BackgroundType>0</BackgroundType> |
188 | 5 | <BackgroundParameter1>clWhite</BackgroundParameter1> | 5 | <BackgroundParameter1>clWhite</BackgroundParameter1> |
189 | 6 | <BackgroundParameter2/> | 6 | <BackgroundParameter2/> |
190 | 7 | <BackgroundParameter3/> | 7 | <BackgroundParameter3/> |
191 | 8 | <FontName>Tahoma</FontName> | 8 | <FontName>Tahoma</FontName> |
192 | 9 | <FontColor>$00007F</FontColor> | 9 | <FontColor>$00007F</FontColor> |
193 | 10 | <FontProportion>53</FontProportion> | 10 | <FontProportion>53</FontProportion> |
194 | 11 | <FontUnits>pixels</FontUnits> | 11 | <FontUnits>pixels</FontUnits> |
195 | 12 | <Shadow>0</Shadow> | 12 | <Shadow>0</Shadow> |
196 | 13 | <ShadowColor>$000000</ShadowColor> | 13 | <ShadowColor>$000000</ShadowColor> |
197 | 14 | <Outline>0</Outline> | 14 | <Outline>0</Outline> |
198 | 15 | <OutlineColor>$000000</OutlineColor> | 15 | <OutlineColor>$000000</OutlineColor> |
199 | 16 | <HorizontalAlign>0</HorizontalAlign> | 16 | <HorizontalAlign>0</HorizontalAlign> |
200 | 17 | <VerticalAlign>0</VerticalAlign> | 17 | <VerticalAlign>0</VerticalAlign> |
201 | 18 | <WrapStyle>1</WrapStyle> | 18 | <WrapStyle>1</WrapStyle> |
202 | 19 | </Theme> | 19 | </Theme> |
203 | 20 | 20 | ||
204 | === modified file 'openlp/core/theme/test/test_theme.xml' | |||
205 | --- openlp/core/theme/test/test_theme.xml 2009-03-12 20:19:24 +0000 | |||
206 | +++ openlp/core/theme/test/test_theme.xml 2009-09-13 15:14:45 +0000 | |||
207 | @@ -1,18 +1,18 @@ | |||
226 | 1 | <?xml version="1.0" encoding="iso-8859-1"?> | 1 | <?xml version="1.0" encoding="iso-8859-1"?> |
227 | 2 | <Theme> | 2 | <Theme> |
228 | 3 | <Name>openlp.org Packaged Theme</Name> | 3 | <Name>openlp.org Packaged Theme</Name> |
229 | 4 | <BackgroundType>2</BackgroundType> | 4 | <BackgroundType>2</BackgroundType> |
230 | 5 | <BackgroundParameter1>sunset1.jpg</BackgroundParameter1> | 5 | <BackgroundParameter1>sunset1.jpg</BackgroundParameter1> |
231 | 6 | <BackgroundParameter2/> | 6 | <BackgroundParameter2/> |
232 | 7 | <BackgroundParameter3/> | 7 | <BackgroundParameter3/> |
233 | 8 | <FontName>Tahoma</FontName> | 8 | <FontName>Tahoma</FontName> |
234 | 9 | <FontColor>clWhite</FontColor> | 9 | <FontColor>clWhite</FontColor> |
235 | 10 | <FontProportion>16</FontProportion> | 10 | <FontProportion>16</FontProportion> |
236 | 11 | <FontUnits>pixels</FontUnits> | 11 | <FontUnits>pixels</FontUnits> |
237 | 12 | <Shadow>-1</Shadow> | 12 | <Shadow>-1</Shadow> |
238 | 13 | <ShadowColor>$00000001</ShadowColor> | 13 | <ShadowColor>$00000001</ShadowColor> |
239 | 14 | <Outline>-1</Outline> | 14 | <Outline>-1</Outline> |
240 | 15 | <OutlineColor>clRed</OutlineColor> | 15 | <OutlineColor>clRed</OutlineColor> |
241 | 16 | <HorizontalAlign>2</HorizontalAlign> | 16 | <HorizontalAlign>2</HorizontalAlign> |
242 | 17 | <VerticalAlign>0</VerticalAlign> | 17 | <VerticalAlign>0</VerticalAlign> |
243 | 18 | </Theme> | 18 | </Theme> |
244 | 19 | 19 | ||
245 | === modified file 'openlp/core/ui/amendthemeform.py' | |||
246 | --- openlp/core/ui/amendthemeform.py 2009-09-13 14:12:38 +0000 | |||
247 | +++ openlp/core/ui/amendthemeform.py 2009-09-13 15:14:45 +0000 | |||
248 | @@ -1,716 +1,716 @@ | |||
965 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
966 | 2 | # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 | 2 | # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 |
967 | 3 | 3 | ||
968 | 4 | ############################################################################### | 4 | ############################################################################### |
969 | 5 | # OpenLP - Open Source Lyrics Projection # | 5 | # OpenLP - Open Source Lyrics Projection # |
970 | 6 | # --------------------------------------------------------------------------- # | 6 | # --------------------------------------------------------------------------- # |
971 | 7 | # Copyright (c) 2008-2009 Raoul Snyman # | 7 | # Copyright (c) 2008-2009 Raoul Snyman # |
972 | 8 | # Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten # | 8 | # Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten # |
973 | 9 | # Tinggaard, Jon Tibble, Jonathan Corwin, Maikel Stuivenberg, Scott Guerrieri # | 9 | # Tinggaard, Jon Tibble, Jonathan Corwin, Maikel Stuivenberg, Scott Guerrieri # |
974 | 10 | # --------------------------------------------------------------------------- # | 10 | # --------------------------------------------------------------------------- # |
975 | 11 | # This program is free software; you can redistribute it and/or modify it # | 11 | # This program is free software; you can redistribute it and/or modify it # |
976 | 12 | # under the terms of the GNU General Public License as published by the Free # | 12 | # under the terms of the GNU General Public License as published by the Free # |
977 | 13 | # Software Foundation; version 2 of the License. # | 13 | # Software Foundation; version 2 of the License. # |
978 | 14 | # # | 14 | # # |
979 | 15 | # This program is distributed in the hope that it will be useful, but WITHOUT # | 15 | # This program is distributed in the hope that it will be useful, but WITHOUT # |
980 | 16 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # | 16 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # |
981 | 17 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # | 17 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # |
982 | 18 | # more details. # | 18 | # more details. # |
983 | 19 | # # | 19 | # # |
984 | 20 | # You should have received a copy of the GNU General Public License along # | 20 | # You should have received a copy of the GNU General Public License along # |
985 | 21 | # with this program; if not, write to the Free Software Foundation, Inc., 59 # | 21 | # with this program; if not, write to the Free Software Foundation, Inc., 59 # |
986 | 22 | # Temple Place, Suite 330, Boston, MA 02111-1307 USA # | 22 | # Temple Place, Suite 330, Boston, MA 02111-1307 USA # |
987 | 23 | ############################################################################### | 23 | ############################################################################### |
988 | 24 | 24 | ||
989 | 25 | import logging | 25 | import logging |
990 | 26 | import os, os.path | 26 | import os, os.path |
991 | 27 | 27 | ||
992 | 28 | from PyQt4 import QtCore, QtGui | 28 | from PyQt4 import QtCore, QtGui |
993 | 29 | from openlp.core.lib import ThemeXML, Renderer, file_to_xml, str_to_bool, \ | 29 | from openlp.core.lib import ThemeXML, Renderer, file_to_xml, str_to_bool, \ |
994 | 30 | translate | 30 | translate |
995 | 31 | 31 | ||
996 | 32 | from amendthemedialog import Ui_AmendThemeDialog | 32 | from amendthemedialog import Ui_AmendThemeDialog |
997 | 33 | 33 | ||
998 | 34 | log = logging.getLogger(u'AmendThemeForm') | 34 | log = logging.getLogger(u'AmendThemeForm') |
999 | 35 | 35 | ||
1000 | 36 | class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): | 36 | class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): |
1001 | 37 | 37 | ||
1002 | 38 | def __init__(self, thememanager, parent=None): | 38 | def __init__(self, thememanager, parent=None): |
1003 | 39 | QtGui.QDialog.__init__(self, parent) | 39 | QtGui.QDialog.__init__(self, parent) |
1004 | 40 | self.thememanager = thememanager | 40 | self.thememanager = thememanager |
1005 | 41 | self.path = None | 41 | self.path = None |
1006 | 42 | self.theme = ThemeXML() | 42 | self.theme = ThemeXML() |
1007 | 43 | self.setupUi(self) | 43 | self.setupUi(self) |
1008 | 44 | #define signals | 44 | #define signals |
1009 | 45 | #Buttons | 45 | #Buttons |
1010 | 46 | QtCore.QObject.connect(self.Color1PushButton , | 46 | QtCore.QObject.connect(self.Color1PushButton , |
1011 | 47 | QtCore.SIGNAL(u'pressed()'), self.onColor1PushButtonClicked) | 47 | QtCore.SIGNAL(u'pressed()'), self.onColor1PushButtonClicked) |
1012 | 48 | QtCore.QObject.connect(self.Color2PushButton , | 48 | QtCore.QObject.connect(self.Color2PushButton , |
1013 | 49 | QtCore.SIGNAL(u'pressed()'), self.onColor2PushButtonClicked) | 49 | QtCore.SIGNAL(u'pressed()'), self.onColor2PushButtonClicked) |
1014 | 50 | QtCore.QObject.connect(self.FontMainColorPushButton, | 50 | QtCore.QObject.connect(self.FontMainColorPushButton, |
1015 | 51 | QtCore.SIGNAL(u'pressed()'), self.onFontMainColorPushButtonClicked) | 51 | QtCore.SIGNAL(u'pressed()'), self.onFontMainColorPushButtonClicked) |
1016 | 52 | QtCore.QObject.connect(self.FontFooterColorPushButton, | 52 | QtCore.QObject.connect(self.FontFooterColorPushButton, |
1017 | 53 | QtCore.SIGNAL(u'pressed()'), | 53 | QtCore.SIGNAL(u'pressed()'), |
1018 | 54 | self.onFontFooterColorPushButtonClicked) | 54 | self.onFontFooterColorPushButtonClicked) |
1019 | 55 | QtCore.QObject.connect(self.OutlineColorPushButton, | 55 | QtCore.QObject.connect(self.OutlineColorPushButton, |
1020 | 56 | QtCore.SIGNAL(u'pressed()'), self.onOutlineColorPushButtonClicked) | 56 | QtCore.SIGNAL(u'pressed()'), self.onOutlineColorPushButtonClicked) |
1021 | 57 | QtCore.QObject.connect(self.ShadowColorPushButton, | 57 | QtCore.QObject.connect(self.ShadowColorPushButton, |
1022 | 58 | QtCore.SIGNAL(u'pressed()'), self.onShadowColorPushButtonClicked) | 58 | QtCore.SIGNAL(u'pressed()'), self.onShadowColorPushButtonClicked) |
1023 | 59 | QtCore.QObject.connect(self.ImageToolButton, | 59 | QtCore.QObject.connect(self.ImageToolButton, |
1024 | 60 | QtCore.SIGNAL(u'pressed()'), self.onImageToolButtonClicked) | 60 | QtCore.SIGNAL(u'pressed()'), self.onImageToolButtonClicked) |
1025 | 61 | #Combo boxes | 61 | #Combo boxes |
1026 | 62 | QtCore.QObject.connect(self.BackgroundComboBox, | 62 | QtCore.QObject.connect(self.BackgroundComboBox, |
1027 | 63 | QtCore.SIGNAL(u'activated(int)'), self.onBackgroundComboBoxSelected) | 63 | QtCore.SIGNAL(u'activated(int)'), self.onBackgroundComboBoxSelected) |
1028 | 64 | QtCore.QObject.connect(self.BackgroundTypeComboBox, | 64 | QtCore.QObject.connect(self.BackgroundTypeComboBox, |
1029 | 65 | QtCore.SIGNAL(u'activated(int)'), | 65 | QtCore.SIGNAL(u'activated(int)'), |
1030 | 66 | self.onBackgroundTypeComboBoxSelected) | 66 | self.onBackgroundTypeComboBoxSelected) |
1031 | 67 | QtCore.QObject.connect(self.GradientComboBox, | 67 | QtCore.QObject.connect(self.GradientComboBox, |
1032 | 68 | QtCore.SIGNAL(u'activated(int)'), self.onGradientComboBoxSelected) | 68 | QtCore.SIGNAL(u'activated(int)'), self.onGradientComboBoxSelected) |
1033 | 69 | QtCore.QObject.connect(self.FontMainComboBox, | 69 | QtCore.QObject.connect(self.FontMainComboBox, |
1034 | 70 | QtCore.SIGNAL(u'activated(int)'), self.onFontMainComboBoxSelected) | 70 | QtCore.SIGNAL(u'activated(int)'), self.onFontMainComboBoxSelected) |
1035 | 71 | QtCore.QObject.connect(self.FontMainWeightComboBox, | 71 | QtCore.QObject.connect(self.FontMainWeightComboBox, |
1036 | 72 | QtCore.SIGNAL(u'activated(int)'), | 72 | QtCore.SIGNAL(u'activated(int)'), |
1037 | 73 | self.onFontMainWeightComboBoxSelected) | 73 | self.onFontMainWeightComboBoxSelected) |
1038 | 74 | QtCore.QObject.connect(self.FontFooterComboBox, | 74 | QtCore.QObject.connect(self.FontFooterComboBox, |
1039 | 75 | QtCore.SIGNAL(u'activated(int)'), self.onFontFooterComboBoxSelected) | 75 | QtCore.SIGNAL(u'activated(int)'), self.onFontFooterComboBoxSelected) |
1040 | 76 | QtCore.QObject.connect(self.FontFooterWeightComboBox, | 76 | QtCore.QObject.connect(self.FontFooterWeightComboBox, |
1041 | 77 | QtCore.SIGNAL(u'activated(int)'), | 77 | QtCore.SIGNAL(u'activated(int)'), |
1042 | 78 | self.onFontFooterWeightComboBoxSelected) | 78 | self.onFontFooterWeightComboBoxSelected) |
1043 | 79 | QtCore.QObject.connect(self.HorizontalComboBox, | 79 | QtCore.QObject.connect(self.HorizontalComboBox, |
1044 | 80 | QtCore.SIGNAL(u'activated(int)'), self.onHorizontalComboBoxSelected) | 80 | QtCore.SIGNAL(u'activated(int)'), self.onHorizontalComboBoxSelected) |
1045 | 81 | QtCore.QObject.connect(self.VerticalComboBox, | 81 | QtCore.QObject.connect(self.VerticalComboBox, |
1046 | 82 | QtCore.SIGNAL(u'activated(int)'), self.onVerticalComboBoxSelected) | 82 | QtCore.SIGNAL(u'activated(int)'), self.onVerticalComboBoxSelected) |
1047 | 83 | #Spin boxes | 83 | #Spin boxes |
1048 | 84 | QtCore.QObject.connect(self.FontMainSizeSpinBox, | 84 | QtCore.QObject.connect(self.FontMainSizeSpinBox, |
1049 | 85 | QtCore.SIGNAL(u'editingFinished()'), | 85 | QtCore.SIGNAL(u'editingFinished()'), |
1050 | 86 | self.onFontMainSizeSpinBoxChanged) | 86 | self.onFontMainSizeSpinBoxChanged) |
1051 | 87 | QtCore.QObject.connect(self.FontFooterSizeSpinBox, | 87 | QtCore.QObject.connect(self.FontFooterSizeSpinBox, |
1052 | 88 | QtCore.SIGNAL(u'editingFinished()'), | 88 | QtCore.SIGNAL(u'editingFinished()'), |
1053 | 89 | self.onFontFooterSizeSpinBoxChanged) | 89 | self.onFontFooterSizeSpinBoxChanged) |
1054 | 90 | QtCore.QObject.connect(self.FontMainDefaultCheckBox, | 90 | QtCore.QObject.connect(self.FontMainDefaultCheckBox, |
1055 | 91 | QtCore.SIGNAL(u'stateChanged(int)'), | 91 | QtCore.SIGNAL(u'stateChanged(int)'), |
1056 | 92 | self.onFontMainDefaultCheckBoxChanged) | 92 | self.onFontMainDefaultCheckBoxChanged) |
1057 | 93 | QtCore.QObject.connect(self.FontMainXSpinBox, | 93 | QtCore.QObject.connect(self.FontMainXSpinBox, |
1058 | 94 | QtCore.SIGNAL(u'editingFinished()'), self.onFontMainXSpinBoxChanged) | 94 | QtCore.SIGNAL(u'editingFinished()'), self.onFontMainXSpinBoxChanged) |
1059 | 95 | QtCore.QObject.connect(self.FontMainYSpinBox, | 95 | QtCore.QObject.connect(self.FontMainYSpinBox, |
1060 | 96 | QtCore.SIGNAL(u'editingFinished()'), self.onFontMainYSpinBoxChanged) | 96 | QtCore.SIGNAL(u'editingFinished()'), self.onFontMainYSpinBoxChanged) |
1061 | 97 | QtCore.QObject.connect(self.FontMainWidthSpinBox, | 97 | QtCore.QObject.connect(self.FontMainWidthSpinBox, |
1062 | 98 | QtCore.SIGNAL(u'editingFinished()'), | 98 | QtCore.SIGNAL(u'editingFinished()'), |
1063 | 99 | self.onFontMainWidthSpinBoxChanged) | 99 | self.onFontMainWidthSpinBoxChanged) |
1064 | 100 | QtCore.QObject.connect(self.FontMainHeightSpinBox, | 100 | QtCore.QObject.connect(self.FontMainHeightSpinBox, |
1065 | 101 | QtCore.SIGNAL(u'editingFinished()'), | 101 | QtCore.SIGNAL(u'editingFinished()'), |
1066 | 102 | self.onFontMainHeightSpinBoxChanged) | 102 | self.onFontMainHeightSpinBoxChanged) |
1067 | 103 | QtCore.QObject.connect(self.FontFooterDefaultCheckBox, | 103 | QtCore.QObject.connect(self.FontFooterDefaultCheckBox, |
1068 | 104 | QtCore.SIGNAL(u'stateChanged(int)'), | 104 | QtCore.SIGNAL(u'stateChanged(int)'), |
1069 | 105 | self.onFontFooterDefaultCheckBoxChanged) | 105 | self.onFontFooterDefaultCheckBoxChanged) |
1070 | 106 | QtCore.QObject.connect(self.FontFooterXSpinBox, | 106 | QtCore.QObject.connect(self.FontFooterXSpinBox, |
1071 | 107 | QtCore.SIGNAL(u'editingFinished()'), | 107 | QtCore.SIGNAL(u'editingFinished()'), |
1072 | 108 | self.onFontFooterXSpinBoxChanged) | 108 | self.onFontFooterXSpinBoxChanged) |
1073 | 109 | QtCore.QObject.connect(self.FontFooterYSpinBox, | 109 | QtCore.QObject.connect(self.FontFooterYSpinBox, |
1074 | 110 | QtCore.SIGNAL(u'editingFinished()'), | 110 | QtCore.SIGNAL(u'editingFinished()'), |
1075 | 111 | self.onFontFooterYSpinBoxChanged) | 111 | self.onFontFooterYSpinBoxChanged) |
1076 | 112 | QtCore.QObject.connect(self.FontFooterWidthSpinBox, | 112 | QtCore.QObject.connect(self.FontFooterWidthSpinBox, |
1077 | 113 | QtCore.SIGNAL(u'editingFinished()'), | 113 | QtCore.SIGNAL(u'editingFinished()'), |
1078 | 114 | self.onFontFooterWidthSpinBoxChanged) | 114 | self.onFontFooterWidthSpinBoxChanged) |
1079 | 115 | QtCore.QObject.connect(self.FontFooterHeightSpinBox, | 115 | QtCore.QObject.connect(self.FontFooterHeightSpinBox, |
1080 | 116 | QtCore.SIGNAL(u'editingFinished()'), | 116 | QtCore.SIGNAL(u'editingFinished()'), |
1081 | 117 | self.onFontFooterHeightSpinBoxChanged) | 117 | self.onFontFooterHeightSpinBoxChanged) |
1082 | 118 | QtCore.QObject.connect(self.OutlineCheckBox, | 118 | QtCore.QObject.connect(self.OutlineCheckBox, |
1083 | 119 | QtCore.SIGNAL(u'stateChanged(int)'), self.onOutlineCheckBoxChanged) | 119 | QtCore.SIGNAL(u'stateChanged(int)'), self.onOutlineCheckBoxChanged) |
1084 | 120 | QtCore.QObject.connect(self.ShadowCheckBox, | 120 | QtCore.QObject.connect(self.ShadowCheckBox, |
1085 | 121 | QtCore.SIGNAL(u'stateChanged(int)'), self.onShadowCheckBoxChanged) | 121 | QtCore.SIGNAL(u'stateChanged(int)'), self.onShadowCheckBoxChanged) |
1086 | 122 | 122 | ||
1087 | 123 | def accept(self): | 123 | def accept(self): |
1088 | 124 | new_theme = ThemeXML() | 124 | new_theme = ThemeXML() |
1089 | 125 | theme_name = unicode(self.ThemeNameEdit.displayText()) | 125 | theme_name = unicode(self.ThemeNameEdit.displayText()) |
1090 | 126 | new_theme.new_document(theme_name) | 126 | new_theme.new_document(theme_name) |
1091 | 127 | save_from = None | 127 | save_from = None |
1092 | 128 | save_to = None | 128 | save_to = None |
1093 | 129 | if self.theme.background_mode == u'transparent': | 129 | if self.theme.background_mode == u'transparent': |
1094 | 130 | new_theme.add_background_transparent() | 130 | new_theme.add_background_transparent() |
1095 | 131 | else: | 131 | else: |
1096 | 132 | if self.theme.background_type == u'solid': | 132 | if self.theme.background_type == u'solid': |
1097 | 133 | new_theme.add_background_solid( \ | 133 | new_theme.add_background_solid( \ |
1098 | 134 | unicode(self.theme.background_color)) | 134 | unicode(self.theme.background_color)) |
1099 | 135 | elif self.theme.background_type == u'gradient': | 135 | elif self.theme.background_type == u'gradient': |
1100 | 136 | new_theme.add_background_gradient( \ | 136 | new_theme.add_background_gradient( \ |
1101 | 137 | unicode(self.theme.background_startColor), | 137 | unicode(self.theme.background_startColor), |
1102 | 138 | unicode(self.theme.background_endColor), | 138 | unicode(self.theme.background_endColor), |
1103 | 139 | self.theme.background_direction) | 139 | self.theme.background_direction) |
1104 | 140 | else: | 140 | else: |
1105 | 141 | (path, filename) = \ | 141 | (path, filename) = \ |
1106 | 142 | os.path.split(unicode(self.theme.background_filename)) | 142 | os.path.split(unicode(self.theme.background_filename)) |
1107 | 143 | new_theme.add_background_image(filename) | 143 | new_theme.add_background_image(filename) |
1108 | 144 | save_to= os.path.join(self.path, theme_name, filename ) | 144 | save_to= os.path.join(self.path, theme_name, filename ) |
1109 | 145 | save_from = self.theme.background_filename | 145 | save_from = self.theme.background_filename |
1110 | 146 | 146 | ||
1111 | 147 | new_theme.add_font(unicode(self.theme.font_main_name), | 147 | new_theme.add_font(unicode(self.theme.font_main_name), |
1112 | 148 | unicode(self.theme.font_main_color), | 148 | unicode(self.theme.font_main_color), |
1113 | 149 | unicode(self.theme.font_main_proportion), | 149 | unicode(self.theme.font_main_proportion), |
1114 | 150 | unicode(self.theme.font_main_override), u'main', | 150 | unicode(self.theme.font_main_override), u'main', |
1115 | 151 | unicode(self.theme.font_main_weight), | 151 | unicode(self.theme.font_main_weight), |
1116 | 152 | unicode(self.theme.font_main_italics), | 152 | unicode(self.theme.font_main_italics), |
1117 | 153 | unicode(self.theme.font_main_x), | 153 | unicode(self.theme.font_main_x), |
1118 | 154 | unicode(self.theme.font_main_y), | 154 | unicode(self.theme.font_main_y), |
1119 | 155 | unicode(self.theme.font_main_width), | 155 | unicode(self.theme.font_main_width), |
1120 | 156 | unicode(self.theme.font_main_height)) | 156 | unicode(self.theme.font_main_height)) |
1121 | 157 | new_theme.add_font(unicode(self.theme.font_footer_name), | 157 | new_theme.add_font(unicode(self.theme.font_footer_name), |
1122 | 158 | unicode(self.theme.font_footer_color), | 158 | unicode(self.theme.font_footer_color), |
1123 | 159 | unicode(self.theme.font_footer_proportion), | 159 | unicode(self.theme.font_footer_proportion), |
1124 | 160 | unicode(self.theme.font_footer_override), u'footer', | 160 | unicode(self.theme.font_footer_override), u'footer', |
1125 | 161 | unicode(self.theme.font_footer_weight), | 161 | unicode(self.theme.font_footer_weight), |
1126 | 162 | unicode(self.theme.font_footer_italics), | 162 | unicode(self.theme.font_footer_italics), |
1127 | 163 | unicode(self.theme.font_footer_x), | 163 | unicode(self.theme.font_footer_x), |
1128 | 164 | unicode(self.theme.font_footer_y), | 164 | unicode(self.theme.font_footer_y), |
1129 | 165 | unicode(self.theme.font_footer_width), | 165 | unicode(self.theme.font_footer_width), |
1130 | 166 | unicode(self.theme.font_footer_height) ) | 166 | unicode(self.theme.font_footer_height) ) |
1131 | 167 | new_theme.add_display(unicode(self.theme.display_shadow), | 167 | new_theme.add_display(unicode(self.theme.display_shadow), |
1132 | 168 | unicode(self.theme.display_shadow_color), | 168 | unicode(self.theme.display_shadow_color), |
1133 | 169 | unicode(self.theme.display_outline), | 169 | unicode(self.theme.display_outline), |
1134 | 170 | unicode(self.theme.display_outline_color), | 170 | unicode(self.theme.display_outline_color), |
1135 | 171 | unicode(self.theme.display_horizontalAlign), | 171 | unicode(self.theme.display_horizontalAlign), |
1136 | 172 | unicode(self.theme.display_verticalAlign), | 172 | unicode(self.theme.display_verticalAlign), |
1137 | 173 | unicode(self.theme.display_wrapStyle)) | 173 | unicode(self.theme.display_wrapStyle)) |
1138 | 174 | theme = new_theme.extract_xml() | 174 | theme = new_theme.extract_xml() |
1139 | 175 | pretty_theme = new_theme.extract_formatted_xml() | 175 | pretty_theme = new_theme.extract_formatted_xml() |
1140 | 176 | if self.thememanager.saveTheme(theme_name, theme, pretty_theme, | 176 | if self.thememanager.saveTheme(theme_name, theme, pretty_theme, |
1141 | 177 | save_from, save_to) is not False: | 177 | save_from, save_to) is not False: |
1142 | 178 | return QtGui.QDialog.accept(self) | 178 | return QtGui.QDialog.accept(self) |
1143 | 179 | 179 | ||
1144 | 180 | def loadTheme(self, theme): | 180 | def loadTheme(self, theme): |
1145 | 181 | log.debug(u'LoadTheme %s', theme) | 181 | log.debug(u'LoadTheme %s', theme) |
1146 | 182 | if theme == None: | 182 | if theme == None: |
1147 | 183 | self.theme.parse(self.baseTheme()) | 183 | self.theme.parse(self.baseTheme()) |
1148 | 184 | else: | 184 | else: |
1149 | 185 | xml_file = os.path.join(self.path, theme, theme + u'.xml') | 185 | xml_file = os.path.join(self.path, theme, theme + u'.xml') |
1150 | 186 | xml = file_to_xml(xml_file) | 186 | xml = file_to_xml(xml_file) |
1151 | 187 | self.theme.parse(xml) | 187 | self.theme.parse(xml) |
1152 | 188 | self.theme.extend_image_filename(self.path) | 188 | self.theme.extend_image_filename(self.path) |
1153 | 189 | self.cleanTheme(self.theme) | 189 | self.cleanTheme(self.theme) |
1154 | 190 | self.allowPreview = False | 190 | self.allowPreview = False |
1155 | 191 | self.paintUi(self.theme) | 191 | self.paintUi(self.theme) |
1156 | 192 | self.allowPreview = True | 192 | self.allowPreview = True |
1157 | 193 | self.previewTheme(self.theme) | 193 | self.previewTheme(self.theme) |
1158 | 194 | 194 | ||
1159 | 195 | def cleanTheme(self, theme): | 195 | def cleanTheme(self, theme): |
1160 | 196 | self.theme.background_color = theme.background_color.strip() | 196 | self.theme.background_color = theme.background_color.strip() |
1161 | 197 | self.theme.background_direction = theme.background_direction.strip() | 197 | self.theme.background_direction = theme.background_direction.strip() |
1162 | 198 | self.theme.background_endColor = theme.background_endColor.strip() | 198 | self.theme.background_endColor = theme.background_endColor.strip() |
1163 | 199 | if theme.background_filename: | 199 | if theme.background_filename: |
1164 | 200 | self.theme.background_filename = theme.background_filename.strip() | 200 | self.theme.background_filename = theme.background_filename.strip() |
1165 | 201 | #self.theme.background_mode | 201 | #self.theme.background_mode |
1166 | 202 | self.theme.background_startColor = theme.background_startColor.strip() | 202 | self.theme.background_startColor = theme.background_startColor.strip() |
1167 | 203 | #self.theme.background_type | 203 | #self.theme.background_type |
1168 | 204 | if theme.display_display: | 204 | if theme.display_display: |
1169 | 205 | self.theme.display_display = theme.display_display.strip() | 205 | self.theme.display_display = theme.display_display.strip() |
1170 | 206 | self.theme.display_horizontalAlign = \ | 206 | self.theme.display_horizontalAlign = \ |
1171 | 207 | theme.display_horizontalAlign.strip() | 207 | theme.display_horizontalAlign.strip() |
1172 | 208 | self.theme.display_outline = str_to_bool(theme.display_outline) | 208 | self.theme.display_outline = str_to_bool(theme.display_outline) |
1173 | 209 | #self.theme.display_outline_color | 209 | #self.theme.display_outline_color |
1174 | 210 | self.theme.display_shadow = str_to_bool(theme.display_shadow) | 210 | self.theme.display_shadow = str_to_bool(theme.display_shadow) |
1175 | 211 | #self.theme.display_shadow_color | 211 | #self.theme.display_shadow_color |
1176 | 212 | self.theme.display_verticalAlign = \ | 212 | self.theme.display_verticalAlign = \ |
1177 | 213 | theme.display_verticalAlign.strip() | 213 | theme.display_verticalAlign.strip() |
1178 | 214 | self.theme.display_wrapStyle = theme.display_wrapStyle.strip() | 214 | self.theme.display_wrapStyle = theme.display_wrapStyle.strip() |
1179 | 215 | self.theme.font_footer_color = theme.font_footer_color.strip() | 215 | self.theme.font_footer_color = theme.font_footer_color.strip() |
1180 | 216 | self.theme.font_footer_height = theme.font_footer_height.strip() | 216 | self.theme.font_footer_height = theme.font_footer_height.strip() |
1181 | 217 | self.theme.font_footer_italics = str_to_bool(theme.font_footer_italics) | 217 | self.theme.font_footer_italics = str_to_bool(theme.font_footer_italics) |
1182 | 218 | self.theme.font_footer_name = theme.font_footer_name.strip() | 218 | self.theme.font_footer_name = theme.font_footer_name.strip() |
1183 | 219 | #self.theme.font_footer_override | 219 | #self.theme.font_footer_override |
1184 | 220 | self.theme.font_footer_proportion = \ | 220 | self.theme.font_footer_proportion = \ |
1185 | 221 | theme.font_footer_proportion.strip() | 221 | theme.font_footer_proportion.strip() |
1186 | 222 | self.theme.font_footer_weight = theme.font_footer_weight.strip() | 222 | self.theme.font_footer_weight = theme.font_footer_weight.strip() |
1187 | 223 | self.theme.font_footer_width = theme.font_footer_width.strip() | 223 | self.theme.font_footer_width = theme.font_footer_width.strip() |
1188 | 224 | self.theme.font_footer_x = theme.font_footer_x.strip() | 224 | self.theme.font_footer_x = theme.font_footer_x.strip() |
1189 | 225 | self.theme.font_footer_y = theme.font_footer_y.strip() | 225 | self.theme.font_footer_y = theme.font_footer_y.strip() |
1190 | 226 | self.theme.font_main_color = theme.font_main_color.strip() | 226 | self.theme.font_main_color = theme.font_main_color.strip() |
1191 | 227 | self.theme.font_main_height = theme.font_main_height.strip() | 227 | self.theme.font_main_height = theme.font_main_height.strip() |
1192 | 228 | self.theme.font_main_italics = str_to_bool(theme.font_main_italics) | 228 | self.theme.font_main_italics = str_to_bool(theme.font_main_italics) |
1193 | 229 | self.theme.font_main_name = theme.font_main_name.strip() | 229 | self.theme.font_main_name = theme.font_main_name.strip() |
1194 | 230 | #self.theme.font_main_override | 230 | #self.theme.font_main_override |
1195 | 231 | self.theme.font_main_proportion = theme.font_main_proportion.strip() | 231 | self.theme.font_main_proportion = theme.font_main_proportion.strip() |
1196 | 232 | self.theme.font_main_weight = theme.font_main_weight.strip() | 232 | self.theme.font_main_weight = theme.font_main_weight.strip() |
1197 | 233 | self.theme.font_main_x = theme.font_main_x.strip() | 233 | self.theme.font_main_x = theme.font_main_x.strip() |
1198 | 234 | self.theme.font_main_y = theme.font_main_y.strip() | 234 | self.theme.font_main_y = theme.font_main_y.strip() |
1199 | 235 | #self.theme.theme_mode | 235 | #self.theme.theme_mode |
1200 | 236 | self.theme.theme_name = theme.theme_name.strip() | 236 | self.theme.theme_name = theme.theme_name.strip() |
1201 | 237 | #self.theme.theme_version | 237 | #self.theme.theme_version |
1202 | 238 | 238 | ||
1203 | 239 | def onImageToolButtonClicked(self): | 239 | def onImageToolButtonClicked(self): |
1204 | 240 | filename = QtGui.QFileDialog.getOpenFileName(self, 'Open file') | 240 | filename = QtGui.QFileDialog.getOpenFileName(self, 'Open file') |
1205 | 241 | if filename != "": | 241 | if filename != "": |
1206 | 242 | self.ImageLineEdit.setText(filename) | 242 | self.ImageLineEdit.setText(filename) |
1207 | 243 | self.theme.background_filename = filename | 243 | self.theme.background_filename = filename |
1208 | 244 | self.previewTheme(self.theme) | 244 | self.previewTheme(self.theme) |
1209 | 245 | # | 245 | # |
1210 | 246 | #Main Font Tab | 246 | #Main Font Tab |
1211 | 247 | # | 247 | # |
1212 | 248 | def onFontMainComboBoxSelected(self): | 248 | def onFontMainComboBoxSelected(self): |
1213 | 249 | self.theme.font_main_name = self.FontMainComboBox.currentFont().family() | 249 | self.theme.font_main_name = self.FontMainComboBox.currentFont().family() |
1214 | 250 | self.previewTheme(self.theme) | 250 | self.previewTheme(self.theme) |
1215 | 251 | 251 | ||
1216 | 252 | def onFontMainWeightComboBoxSelected(self, value): | 252 | def onFontMainWeightComboBoxSelected(self, value): |
1217 | 253 | if value ==0: | 253 | if value ==0: |
1218 | 254 | self.theme.font_main_weight = u'Normal' | 254 | self.theme.font_main_weight = u'Normal' |
1219 | 255 | self.theme.font_main_italics = False | 255 | self.theme.font_main_italics = False |
1220 | 256 | elif value == 1: | 256 | elif value == 1: |
1221 | 257 | self.theme.font_main_weight = u'Bold' | 257 | self.theme.font_main_weight = u'Bold' |
1222 | 258 | self.theme.font_main_italics = False | 258 | self.theme.font_main_italics = False |
1223 | 259 | elif value == 2: | 259 | elif value == 2: |
1224 | 260 | self.theme.font_main_weight = u'Normal' | 260 | self.theme.font_main_weight = u'Normal' |
1225 | 261 | self.theme.font_main_italics = True | 261 | self.theme.font_main_italics = True |
1226 | 262 | else: | 262 | else: |
1227 | 263 | self.theme.font_main_weight = u'Bold' | 263 | self.theme.font_main_weight = u'Bold' |
1228 | 264 | self.theme.font_main_italics = True | 264 | self.theme.font_main_italics = True |
1229 | 265 | self.previewTheme(self.theme) | 265 | self.previewTheme(self.theme) |
1230 | 266 | 266 | ||
1231 | 267 | def onFontMainColorPushButtonClicked(self): | 267 | def onFontMainColorPushButtonClicked(self): |
1232 | 268 | self.theme.font_main_color = QtGui.QColorDialog.getColor( | 268 | self.theme.font_main_color = QtGui.QColorDialog.getColor( |
1233 | 269 | QtGui.QColor(self.theme.font_main_color), self).name() | 269 | QtGui.QColor(self.theme.font_main_color), self).name() |
1234 | 270 | 270 | ||
1235 | 271 | self.FontMainColorPushButton.setStyleSheet( | 271 | self.FontMainColorPushButton.setStyleSheet( |
1236 | 272 | u'background-color: %s' % unicode(self.theme.font_main_color)) | 272 | u'background-color: %s' % unicode(self.theme.font_main_color)) |
1237 | 273 | self.previewTheme(self.theme) | 273 | self.previewTheme(self.theme) |
1238 | 274 | 274 | ||
1239 | 275 | def onFontMainSizeSpinBoxChanged(self): | 275 | def onFontMainSizeSpinBoxChanged(self): |
1240 | 276 | if self.theme.font_main_proportion != self.FontMainSizeSpinBox.value(): | 276 | if self.theme.font_main_proportion != self.FontMainSizeSpinBox.value(): |
1241 | 277 | self.theme.font_main_proportion = self.FontMainSizeSpinBox.value() | 277 | self.theme.font_main_proportion = self.FontMainSizeSpinBox.value() |
1242 | 278 | self.previewTheme(self.theme) | 278 | self.previewTheme(self.theme) |
1243 | 279 | 279 | ||
1244 | 280 | def onFontMainDefaultCheckBoxChanged(self, value): | 280 | def onFontMainDefaultCheckBoxChanged(self, value): |
1245 | 281 | if value == 2: # checked | 281 | if value == 2: # checked |
1246 | 282 | self.theme.font_main_override = False | 282 | self.theme.font_main_override = False |
1247 | 283 | else: | 283 | else: |
1248 | 284 | self.theme.font_main_override = True | 284 | self.theme.font_main_override = True |
1249 | 285 | 285 | ||
1250 | 286 | if int(self.theme.font_main_x) == 0 and \ | 286 | if int(self.theme.font_main_x) == 0 and \ |
1251 | 287 | int(self.theme.font_main_y) == 0 and \ | 287 | int(self.theme.font_main_y) == 0 and \ |
1252 | 288 | int(self.theme.font_main_width) == 0 and \ | 288 | int(self.theme.font_main_width) == 0 and \ |
1253 | 289 | int(self.theme.font_main_height) == 0: | 289 | int(self.theme.font_main_height) == 0: |
1254 | 290 | self.theme.font_main_x = u'10' | 290 | self.theme.font_main_x = u'10' |
1255 | 291 | self.theme.font_main_y = u'10' | 291 | self.theme.font_main_y = u'10' |
1256 | 292 | self.theme.font_main_width = u'1024' | 292 | self.theme.font_main_width = u'1024' |
1257 | 293 | self.theme.font_main_height = u'730' | 293 | self.theme.font_main_height = u'730' |
1258 | 294 | self.FontMainXSpinBox.setValue(int(self.theme.font_main_x)) | 294 | self.FontMainXSpinBox.setValue(int(self.theme.font_main_x)) |
1259 | 295 | self.FontMainYSpinBox.setValue(int(self.theme.font_main_y)) | 295 | self.FontMainYSpinBox.setValue(int(self.theme.font_main_y)) |
1260 | 296 | self.FontMainWidthSpinBox.setValue(int(self.theme.font_main_width)) | 296 | self.FontMainWidthSpinBox.setValue(int(self.theme.font_main_width)) |
1261 | 297 | self.FontMainHeightSpinBox.setValue(int( \ | 297 | self.FontMainHeightSpinBox.setValue(int( \ |
1262 | 298 | self.theme.font_main_height)) | 298 | self.theme.font_main_height)) |
1263 | 299 | self.stateChanging(self.theme) | 299 | self.stateChanging(self.theme) |
1264 | 300 | self.previewTheme(self.theme) | 300 | self.previewTheme(self.theme) |
1265 | 301 | 301 | ||
1266 | 302 | def onFontMainXSpinBoxChanged(self): | 302 | def onFontMainXSpinBoxChanged(self): |
1267 | 303 | if self.theme.font_main_x != self.FontMainXSpinBox.value(): | 303 | if self.theme.font_main_x != self.FontMainXSpinBox.value(): |
1268 | 304 | self.theme.font_main_x = self.FontMainXSpinBox.value() | 304 | self.theme.font_main_x = self.FontMainXSpinBox.value() |
1269 | 305 | self.previewTheme(self.theme) | 305 | self.previewTheme(self.theme) |
1270 | 306 | 306 | ||
1271 | 307 | def onFontMainYSpinBoxChanged(self): | 307 | def onFontMainYSpinBoxChanged(self): |
1272 | 308 | if self.theme.font_main_y != self.FontMainYSpinBox.value(): | 308 | if self.theme.font_main_y != self.FontMainYSpinBox.value(): |
1273 | 309 | self.theme.font_main_y = self.FontMainYSpinBox.value() | 309 | self.theme.font_main_y = self.FontMainYSpinBox.value() |
1274 | 310 | self.previewTheme(self.theme) | 310 | self.previewTheme(self.theme) |
1275 | 311 | 311 | ||
1276 | 312 | def onFontMainWidthSpinBoxChanged(self): | 312 | def onFontMainWidthSpinBoxChanged(self): |
1277 | 313 | if self.theme.font_main_width != self.FontMainWidthSpinBox.value(): | 313 | if self.theme.font_main_width != self.FontMainWidthSpinBox.value(): |
1278 | 314 | self.theme.font_main_width = self.FontMainWidthSpinBox.value() | 314 | self.theme.font_main_width = self.FontMainWidthSpinBox.value() |
1279 | 315 | self.previewTheme(self.theme) | 315 | self.previewTheme(self.theme) |
1280 | 316 | 316 | ||
1281 | 317 | def onFontMainHeightSpinBoxChanged(self): | 317 | def onFontMainHeightSpinBoxChanged(self): |
1282 | 318 | if self.theme.font_main_height != self.FontMainHeightSpinBox.value(): | 318 | if self.theme.font_main_height != self.FontMainHeightSpinBox.value(): |
1283 | 319 | self.theme.font_main_height = self.FontMainHeightSpinBox.value() | 319 | self.theme.font_main_height = self.FontMainHeightSpinBox.value() |
1284 | 320 | self.previewTheme(self.theme) | 320 | self.previewTheme(self.theme) |
1285 | 321 | # | 321 | # |
1286 | 322 | #Footer Font Tab | 322 | #Footer Font Tab |
1287 | 323 | # | 323 | # |
1288 | 324 | def onFontFooterComboBoxSelected(self): | 324 | def onFontFooterComboBoxSelected(self): |
1289 | 325 | self.theme.font_footer_name = \ | 325 | self.theme.font_footer_name = \ |
1290 | 326 | self.FontFooterComboBox.currentFont().family() | 326 | self.FontFooterComboBox.currentFont().family() |
1291 | 327 | self.previewTheme(self.theme) | 327 | self.previewTheme(self.theme) |
1292 | 328 | 328 | ||
1293 | 329 | def onFontFooterWeightComboBoxSelected(self, value): | 329 | def onFontFooterWeightComboBoxSelected(self, value): |
1294 | 330 | if value == 0: | 330 | if value == 0: |
1295 | 331 | self.theme.font_footer_weight = u'Normal' | 331 | self.theme.font_footer_weight = u'Normal' |
1296 | 332 | self.theme.font_footer_italics = False | 332 | self.theme.font_footer_italics = False |
1297 | 333 | elif value == 1: | 333 | elif value == 1: |
1298 | 334 | self.theme.font_footer_weight = u'Bold' | 334 | self.theme.font_footer_weight = u'Bold' |
1299 | 335 | self.theme.font_footer_italics = False | 335 | self.theme.font_footer_italics = False |
1300 | 336 | elif value == 2: | 336 | elif value == 2: |
1301 | 337 | self.theme.font_footer_weight = u'Normal' | 337 | self.theme.font_footer_weight = u'Normal' |
1302 | 338 | self.theme.font_footer_italics = True | 338 | self.theme.font_footer_italics = True |
1303 | 339 | else: | 339 | else: |
1304 | 340 | self.theme.font_footer_weight = u'Bold' | 340 | self.theme.font_footer_weight = u'Bold' |
1305 | 341 | self.theme.font_footer_italics = True | 341 | self.theme.font_footer_italics = True |
1306 | 342 | self.previewTheme(self.theme) | 342 | self.previewTheme(self.theme) |
1307 | 343 | 343 | ||
1308 | 344 | def onFontFooterColorPushButtonClicked(self): | 344 | def onFontFooterColorPushButtonClicked(self): |
1309 | 345 | self.theme.font_footer_color = QtGui.QColorDialog.getColor( | 345 | self.theme.font_footer_color = QtGui.QColorDialog.getColor( |
1310 | 346 | QtGui.QColor(self.theme.font_footer_color), self).name() | 346 | QtGui.QColor(self.theme.font_footer_color), self).name() |
1311 | 347 | 347 | ||
1312 | 348 | self.FontFooterColorPushButton.setStyleSheet( | 348 | self.FontFooterColorPushButton.setStyleSheet( |
1313 | 349 | 'background-color: %s' % unicode(self.theme.font_footer_color)) | 349 | 'background-color: %s' % unicode(self.theme.font_footer_color)) |
1314 | 350 | self.previewTheme(self.theme) | 350 | self.previewTheme(self.theme) |
1315 | 351 | 351 | ||
1316 | 352 | def onFontFooterSizeSpinBoxChanged(self): | 352 | def onFontFooterSizeSpinBoxChanged(self): |
1317 | 353 | if self.theme.font_footer_proportion != \ | 353 | if self.theme.font_footer_proportion != \ |
1318 | 354 | self.FontFooterSizeSpinBox.value(): | 354 | self.FontFooterSizeSpinBox.value(): |
1319 | 355 | self.theme.font_footer_proportion = \ | 355 | self.theme.font_footer_proportion = \ |
1320 | 356 | self.FontFooterSizeSpinBox.value() | 356 | self.FontFooterSizeSpinBox.value() |
1321 | 357 | self.previewTheme(self.theme) | 357 | self.previewTheme(self.theme) |
1322 | 358 | 358 | ||
1323 | 359 | def onFontFooterDefaultCheckBoxChanged(self, value): | 359 | def onFontFooterDefaultCheckBoxChanged(self, value): |
1324 | 360 | if value == 2: # checked | 360 | if value == 2: # checked |
1325 | 361 | self.theme.font_footer_override = False | 361 | self.theme.font_footer_override = False |
1326 | 362 | else: | 362 | else: |
1327 | 363 | self.theme.font_footer_override = True | 363 | self.theme.font_footer_override = True |
1328 | 364 | 364 | ||
1329 | 365 | if int(self.theme.font_footer_x) == 0 and \ | 365 | if int(self.theme.font_footer_x) == 0 and \ |
1330 | 366 | int(self.theme.font_footer_y) == 0 and \ | 366 | int(self.theme.font_footer_y) == 0 and \ |
1331 | 367 | int(self.theme.font_footer_width) == 0 and \ | 367 | int(self.theme.font_footer_width) == 0 and \ |
1332 | 368 | int(self.theme.font_footer_height) == 0: | 368 | int(self.theme.font_footer_height) == 0: |
1333 | 369 | self.theme.font_footer_x = u'10' | 369 | self.theme.font_footer_x = u'10' |
1334 | 370 | self.theme.font_footer_y = u'730' | 370 | self.theme.font_footer_y = u'730' |
1335 | 371 | self.theme.font_footer_width = u'1024' | 371 | self.theme.font_footer_width = u'1024' |
1336 | 372 | self.theme.font_footer_height = u'38' | 372 | self.theme.font_footer_height = u'38' |
1337 | 373 | 373 | ||
1338 | 374 | self.FontFooterXSpinBox.setValue(int(self.theme.font_footer_x)) | 374 | self.FontFooterXSpinBox.setValue(int(self.theme.font_footer_x)) |
1339 | 375 | self.FontFooterYSpinBox.setValue(int(self.theme.font_footer_y)) | 375 | self.FontFooterYSpinBox.setValue(int(self.theme.font_footer_y)) |
1340 | 376 | self.FontFooterWidthSpinBox.setValue(int( \ | 376 | self.FontFooterWidthSpinBox.setValue(int( \ |
1341 | 377 | self.theme.font_footer_width)) | 377 | self.theme.font_footer_width)) |
1342 | 378 | self.FontFooterHeightSpinBox.setValue(int( \ | 378 | self.FontFooterHeightSpinBox.setValue(int( \ |
1343 | 379 | self.theme.font_footer_height)) | 379 | self.theme.font_footer_height)) |
1344 | 380 | 380 | ||
1345 | 381 | self.stateChanging(self.theme) | 381 | self.stateChanging(self.theme) |
1346 | 382 | self.previewTheme(self.theme) | 382 | self.previewTheme(self.theme) |
1347 | 383 | 383 | ||
1348 | 384 | def onFontFooterXSpinBoxChanged(self): | 384 | def onFontFooterXSpinBoxChanged(self): |
1349 | 385 | if self.theme.font_footer_x != self.FontFooterXSpinBox.value(): | 385 | if self.theme.font_footer_x != self.FontFooterXSpinBox.value(): |
1350 | 386 | self.theme.font_footer_x = self.FontFooterXSpinBox.value() | 386 | self.theme.font_footer_x = self.FontFooterXSpinBox.value() |
1351 | 387 | self.previewTheme(self.theme) | 387 | self.previewTheme(self.theme) |
1352 | 388 | 388 | ||
1353 | 389 | def onFontFooterYSpinBoxChanged(self): | 389 | def onFontFooterYSpinBoxChanged(self): |
1354 | 390 | if self.theme.font_footer_y != self.FontFooterYSpinBox.value(): | 390 | if self.theme.font_footer_y != self.FontFooterYSpinBox.value(): |
1355 | 391 | self.theme.font_footer_y = self.FontFooterYSpinBox.value() | 391 | self.theme.font_footer_y = self.FontFooterYSpinBox.value() |
1356 | 392 | self.previewTheme(self.theme) | 392 | self.previewTheme(self.theme) |
1357 | 393 | 393 | ||
1358 | 394 | def onFontFooterWidthSpinBoxChanged(self): | 394 | def onFontFooterWidthSpinBoxChanged(self): |
1359 | 395 | if self.theme.font_footer_width != self.FontFooterWidthSpinBox.value(): | 395 | if self.theme.font_footer_width != self.FontFooterWidthSpinBox.value(): |
1360 | 396 | self.theme.font_footer_width = self.FontFooterWidthSpinBox.value() | 396 | self.theme.font_footer_width = self.FontFooterWidthSpinBox.value() |
1361 | 397 | self.previewTheme(self.theme) | 397 | self.previewTheme(self.theme) |
1362 | 398 | 398 | ||
1363 | 399 | def onFontFooterHeightSpinBoxChanged(self): | 399 | def onFontFooterHeightSpinBoxChanged(self): |
1364 | 400 | if self.theme.font_footer_height != \ | 400 | if self.theme.font_footer_height != \ |
1365 | 401 | self.FontFooterHeightSpinBox.value(): | 401 | self.FontFooterHeightSpinBox.value(): |
1366 | 402 | self.theme.font_footer_height = self.FontFooterHeightSpinBox.value() | 402 | self.theme.font_footer_height = self.FontFooterHeightSpinBox.value() |
1367 | 403 | self.previewTheme(self.theme) | 403 | self.previewTheme(self.theme) |
1368 | 404 | # | 404 | # |
1369 | 405 | #Background Tab | 405 | #Background Tab |
1370 | 406 | # | 406 | # |
1371 | 407 | def onGradientComboBoxSelected(self, currentIndex): | 407 | def onGradientComboBoxSelected(self, currentIndex): |
1372 | 408 | self.setBackground(self.BackgroundTypeComboBox.currentIndex(), | 408 | self.setBackground(self.BackgroundTypeComboBox.currentIndex(), |
1373 | 409 | currentIndex) | 409 | currentIndex) |
1374 | 410 | 410 | ||
1375 | 411 | def onBackgroundComboBoxSelected(self, currentIndex): | 411 | def onBackgroundComboBoxSelected(self, currentIndex): |
1376 | 412 | if currentIndex == 0: # Opaque | 412 | if currentIndex == 0: # Opaque |
1377 | 413 | self.theme.background_mode = u'opaque' | 413 | self.theme.background_mode = u'opaque' |
1378 | 414 | else: | 414 | else: |
1379 | 415 | self.theme.background_mode = u'transparent' | 415 | self.theme.background_mode = u'transparent' |
1380 | 416 | self.stateChanging(self.theme) | 416 | self.stateChanging(self.theme) |
1381 | 417 | self.previewTheme(self.theme) | 417 | self.previewTheme(self.theme) |
1382 | 418 | 418 | ||
1383 | 419 | def onBackgroundTypeComboBoxSelected(self, currentIndex): | 419 | def onBackgroundTypeComboBoxSelected(self, currentIndex): |
1384 | 420 | self.setBackground(currentIndex, self.GradientComboBox.currentIndex()) | 420 | self.setBackground(currentIndex, self.GradientComboBox.currentIndex()) |
1385 | 421 | 421 | ||
1386 | 422 | def setBackground(self, background, gradient): | 422 | def setBackground(self, background, gradient): |
1387 | 423 | if background == 0: # Solid | 423 | if background == 0: # Solid |
1388 | 424 | self.theme.background_type = u'solid' | 424 | self.theme.background_type = u'solid' |
1389 | 425 | if self.theme.background_color is None : | 425 | if self.theme.background_color is None : |
1390 | 426 | self.theme.background_color = u'#000000' | 426 | self.theme.background_color = u'#000000' |
1391 | 427 | elif background == 1: # Gradient | 427 | elif background == 1: # Gradient |
1392 | 428 | self.theme.background_type = u'gradient' | 428 | self.theme.background_type = u'gradient' |
1393 | 429 | if gradient == 0: # Horizontal | 429 | if gradient == 0: # Horizontal |
1394 | 430 | self.theme.background_direction = u'horizontal' | 430 | self.theme.background_direction = u'horizontal' |
1395 | 431 | elif gradient == 1: # vertical | 431 | elif gradient == 1: # vertical |
1396 | 432 | self.theme.background_direction = u'vertical' | 432 | self.theme.background_direction = u'vertical' |
1397 | 433 | else: | 433 | else: |
1398 | 434 | self.theme.background_direction = u'circular' | 434 | self.theme.background_direction = u'circular' |
1399 | 435 | if self.theme.background_startColor is None : | 435 | if self.theme.background_startColor is None : |
1400 | 436 | self.theme.background_startColor = u'#000000' | 436 | self.theme.background_startColor = u'#000000' |
1401 | 437 | if self.theme.background_endColor is None : | 437 | if self.theme.background_endColor is None : |
1402 | 438 | self.theme.background_endColor = u'#ff0000' | 438 | self.theme.background_endColor = u'#ff0000' |
1403 | 439 | else: | 439 | else: |
1404 | 440 | self.theme.background_type = u'image' | 440 | self.theme.background_type = u'image' |
1405 | 441 | self.stateChanging(self.theme) | 441 | self.stateChanging(self.theme) |
1406 | 442 | self.previewTheme(self.theme) | 442 | self.previewTheme(self.theme) |
1407 | 443 | 443 | ||
1408 | 444 | def onColor1PushButtonClicked(self): | 444 | def onColor1PushButtonClicked(self): |
1409 | 445 | if self.theme.background_type == u'solid': | 445 | if self.theme.background_type == u'solid': |
1410 | 446 | self.theme.background_color = QtGui.QColorDialog.getColor( | 446 | self.theme.background_color = QtGui.QColorDialog.getColor( |
1411 | 447 | QtGui.QColor(self.theme.background_color), self).name() | 447 | QtGui.QColor(self.theme.background_color), self).name() |
1412 | 448 | self.Color1PushButton.setStyleSheet( | 448 | self.Color1PushButton.setStyleSheet( |
1413 | 449 | u'background-color: %s' % unicode(self.theme.background_color)) | 449 | u'background-color: %s' % unicode(self.theme.background_color)) |
1414 | 450 | else: | 450 | else: |
1415 | 451 | self.theme.background_startColor = QtGui.QColorDialog.getColor( | 451 | self.theme.background_startColor = QtGui.QColorDialog.getColor( |
1416 | 452 | QtGui.QColor(self.theme.background_startColor), self).name() | 452 | QtGui.QColor(self.theme.background_startColor), self).name() |
1417 | 453 | self.Color1PushButton.setStyleSheet( | 453 | self.Color1PushButton.setStyleSheet( |
1418 | 454 | u'background-color: %s' % \ | 454 | u'background-color: %s' % \ |
1419 | 455 | unicode(self.theme.background_startColor)) | 455 | unicode(self.theme.background_startColor)) |
1420 | 456 | 456 | ||
1421 | 457 | self.previewTheme(self.theme) | 457 | self.previewTheme(self.theme) |
1422 | 458 | 458 | ||
1423 | 459 | def onColor2PushButtonClicked(self): | 459 | def onColor2PushButtonClicked(self): |
1424 | 460 | self.theme.background_endColor = QtGui.QColorDialog.getColor( | 460 | self.theme.background_endColor = QtGui.QColorDialog.getColor( |
1425 | 461 | QtGui.QColor(self.theme.background_endColor), self).name() | 461 | QtGui.QColor(self.theme.background_endColor), self).name() |
1426 | 462 | self.Color2PushButton.setStyleSheet( | 462 | self.Color2PushButton.setStyleSheet( |
1427 | 463 | u'background-color: %s' % unicode(self.theme.background_endColor)) | 463 | u'background-color: %s' % unicode(self.theme.background_endColor)) |
1428 | 464 | 464 | ||
1429 | 465 | self.previewTheme(self.theme) | 465 | self.previewTheme(self.theme) |
1430 | 466 | # | 466 | # |
1431 | 467 | #Other Tab | 467 | #Other Tab |
1432 | 468 | # | 468 | # |
1433 | 469 | def onOutlineCheckBoxChanged(self, value): | 469 | def onOutlineCheckBoxChanged(self, value): |
1434 | 470 | if value == 2: # checked | 470 | if value == 2: # checked |
1435 | 471 | self.theme.display_outline = True | 471 | self.theme.display_outline = True |
1436 | 472 | else: | 472 | else: |
1437 | 473 | self.theme.display_outline = False | 473 | self.theme.display_outline = False |
1438 | 474 | self.stateChanging(self.theme) | 474 | self.stateChanging(self.theme) |
1439 | 475 | self.previewTheme(self.theme) | 475 | self.previewTheme(self.theme) |
1440 | 476 | 476 | ||
1441 | 477 | def onOutlineColorPushButtonClicked(self): | 477 | def onOutlineColorPushButtonClicked(self): |
1442 | 478 | self.theme.display_outline_color = QtGui.QColorDialog.getColor( | 478 | self.theme.display_outline_color = QtGui.QColorDialog.getColor( |
1443 | 479 | QtGui.QColor(self.theme.display_outline_color), self).name() | 479 | QtGui.QColor(self.theme.display_outline_color), self).name() |
1444 | 480 | self.OutlineColorPushButton.setStyleSheet( | 480 | self.OutlineColorPushButton.setStyleSheet( |
1445 | 481 | u'background-color: %s' % unicode(self.theme.display_outline_color)) | 481 | u'background-color: %s' % unicode(self.theme.display_outline_color)) |
1446 | 482 | self.previewTheme(self.theme) | 482 | self.previewTheme(self.theme) |
1447 | 483 | 483 | ||
1448 | 484 | def onShadowCheckBoxChanged(self, value): | 484 | def onShadowCheckBoxChanged(self, value): |
1449 | 485 | if value == 2: # checked | 485 | if value == 2: # checked |
1450 | 486 | self.theme.display_shadow = True | 486 | self.theme.display_shadow = True |
1451 | 487 | else: | 487 | else: |
1452 | 488 | self.theme.display_shadow = False | 488 | self.theme.display_shadow = False |
1453 | 489 | self.stateChanging(self.theme) | 489 | self.stateChanging(self.theme) |
1454 | 490 | self.previewTheme(self.theme) | 490 | self.previewTheme(self.theme) |
1455 | 491 | 491 | ||
1456 | 492 | def onShadowColorPushButtonClicked(self): | 492 | def onShadowColorPushButtonClicked(self): |
1457 | 493 | self.theme.display_shadow_color = QtGui.QColorDialog.getColor( | 493 | self.theme.display_shadow_color = QtGui.QColorDialog.getColor( |
1458 | 494 | QtGui.QColor(self.theme.display_shadow_color), self).name() | 494 | QtGui.QColor(self.theme.display_shadow_color), self).name() |
1459 | 495 | self.ShadowColorPushButton.setStyleSheet( | 495 | self.ShadowColorPushButton.setStyleSheet( |
1460 | 496 | u'background-color: %s' % unicode(self.theme.display_shadow_color)) | 496 | u'background-color: %s' % unicode(self.theme.display_shadow_color)) |
1461 | 497 | self.previewTheme(self.theme) | 497 | self.previewTheme(self.theme) |
1462 | 498 | 498 | ||
1463 | 499 | def onHorizontalComboBoxSelected(self, currentIndex): | 499 | def onHorizontalComboBoxSelected(self, currentIndex): |
1464 | 500 | self.theme.display_horizontalAlign = currentIndex | 500 | self.theme.display_horizontalAlign = currentIndex |
1465 | 501 | self.stateChanging(self.theme) | 501 | self.stateChanging(self.theme) |
1466 | 502 | self.previewTheme(self.theme) | 502 | self.previewTheme(self.theme) |
1467 | 503 | 503 | ||
1468 | 504 | def onVerticalComboBoxSelected(self, currentIndex): | 504 | def onVerticalComboBoxSelected(self, currentIndex): |
1469 | 505 | self.theme.display_verticalAlign = currentIndex | 505 | self.theme.display_verticalAlign = currentIndex |
1470 | 506 | self.stateChanging(self.theme) | 506 | self.stateChanging(self.theme) |
1471 | 507 | self.previewTheme(self.theme) | 507 | self.previewTheme(self.theme) |
1472 | 508 | # | 508 | # |
1473 | 509 | #Local Methods | 509 | #Local Methods |
1474 | 510 | # | 510 | # |
1475 | 511 | def baseTheme(self): | 511 | def baseTheme(self): |
1476 | 512 | log.debug(u'base theme created') | 512 | log.debug(u'base theme created') |
1477 | 513 | newtheme = ThemeXML() | 513 | newtheme = ThemeXML() |
1478 | 514 | newtheme.new_document(u'New Theme') | 514 | newtheme.new_document(u'New Theme') |
1479 | 515 | newtheme.add_background_solid(unicode(u'#000000')) | 515 | newtheme.add_background_solid(unicode(u'#000000')) |
1480 | 516 | newtheme.add_font(unicode(QtGui.QFont().family()), unicode(u'#FFFFFF'), | 516 | newtheme.add_font(unicode(QtGui.QFont().family()), unicode(u'#FFFFFF'), |
1481 | 517 | unicode(30), u'False') | 517 | unicode(30), u'False') |
1482 | 518 | newtheme.add_font(unicode(QtGui.QFont().family()), unicode(u'#FFFFFF'), | 518 | newtheme.add_font(unicode(QtGui.QFont().family()), unicode(u'#FFFFFF'), |
1483 | 519 | unicode(12), u'False', u'footer') | 519 | unicode(12), u'False', u'footer') |
1484 | 520 | newtheme.add_display(u'False', unicode(u'#FFFFFF'), u'False', | 520 | newtheme.add_display(u'False', unicode(u'#FFFFFF'), u'False', |
1485 | 521 | unicode(u'#FFFFFF'), | 521 | unicode(u'#FFFFFF'), |
1486 | 522 | unicode(0), unicode(0), unicode(0)) | 522 | unicode(0), unicode(0), unicode(0)) |
1487 | 523 | 523 | ||
1488 | 524 | return newtheme.extract_xml() | 524 | return newtheme.extract_xml() |
1489 | 525 | 525 | ||
1490 | 526 | def paintUi(self, theme): | 526 | def paintUi(self, theme): |
1491 | 527 | self.stateChanging(theme) | 527 | self.stateChanging(theme) |
1492 | 528 | self.ThemeNameEdit.setText(self.theme.theme_name) | 528 | self.ThemeNameEdit.setText(self.theme.theme_name) |
1493 | 529 | if self.theme.background_mode == u'opaque': | 529 | if self.theme.background_mode == u'opaque': |
1494 | 530 | self.BackgroundComboBox.setCurrentIndex(0) | 530 | self.BackgroundComboBox.setCurrentIndex(0) |
1495 | 531 | else: | 531 | else: |
1496 | 532 | self.BackgroundComboBox.setCurrentIndex(1) | 532 | self.BackgroundComboBox.setCurrentIndex(1) |
1497 | 533 | 533 | ||
1498 | 534 | if theme.background_type == u'solid': | 534 | if theme.background_type == u'solid': |
1499 | 535 | self.BackgroundTypeComboBox.setCurrentIndex(0) | 535 | self.BackgroundTypeComboBox.setCurrentIndex(0) |
1500 | 536 | elif theme.background_type == u'gradient': | 536 | elif theme.background_type == u'gradient': |
1501 | 537 | self.BackgroundTypeComboBox.setCurrentIndex(1) | 537 | self.BackgroundTypeComboBox.setCurrentIndex(1) |
1502 | 538 | else: | 538 | else: |
1503 | 539 | self.BackgroundTypeComboBox.setCurrentIndex(2) | 539 | self.BackgroundTypeComboBox.setCurrentIndex(2) |
1504 | 540 | 540 | ||
1505 | 541 | if self.theme.background_direction == u'horizontal': | 541 | if self.theme.background_direction == u'horizontal': |
1506 | 542 | self.GradientComboBox.setCurrentIndex(0) | 542 | self.GradientComboBox.setCurrentIndex(0) |
1507 | 543 | elif self.theme.background_direction == u'vertical': | 543 | elif self.theme.background_direction == u'vertical': |
1508 | 544 | self.GradientComboBox.setCurrentIndex(1) | 544 | self.GradientComboBox.setCurrentIndex(1) |
1509 | 545 | else: | 545 | else: |
1510 | 546 | self.GradientComboBox.setCurrentIndex(2) | 546 | self.GradientComboBox.setCurrentIndex(2) |
1511 | 547 | 547 | ||
1512 | 548 | self.FontMainSizeSpinBox.setValue(int(self.theme.font_main_proportion)) | 548 | self.FontMainSizeSpinBox.setValue(int(self.theme.font_main_proportion)) |
1513 | 549 | if not self.theme.font_main_italics and \ | 549 | if not self.theme.font_main_italics and \ |
1514 | 550 | self.theme.font_main_weight == u'Normal': | 550 | self.theme.font_main_weight == u'Normal': |
1515 | 551 | self.FontMainWeightComboBox.setCurrentIndex(0) | 551 | self.FontMainWeightComboBox.setCurrentIndex(0) |
1516 | 552 | elif not self.theme.font_main_italics and \ | 552 | elif not self.theme.font_main_italics and \ |
1517 | 553 | self.theme.font_main_weight == u'Bold': | 553 | self.theme.font_main_weight == u'Bold': |
1518 | 554 | self.FontMainWeightComboBox.setCurrentIndex(1) | 554 | self.FontMainWeightComboBox.setCurrentIndex(1) |
1519 | 555 | elif self.theme.font_main_italics and \ | 555 | elif self.theme.font_main_italics and \ |
1520 | 556 | self.theme.font_main_weight == u'Normal': | 556 | self.theme.font_main_weight == u'Normal': |
1521 | 557 | self.FontMainWeightComboBox.setCurrentIndex(2) | 557 | self.FontMainWeightComboBox.setCurrentIndex(2) |
1522 | 558 | else: | 558 | else: |
1523 | 559 | self.FontMainWeightComboBox.setCurrentIndex(3) | 559 | self.FontMainWeightComboBox.setCurrentIndex(3) |
1524 | 560 | 560 | ||
1525 | 561 | self.FontMainXSpinBox.setValue(int(self.theme.font_main_x)) | 561 | self.FontMainXSpinBox.setValue(int(self.theme.font_main_x)) |
1526 | 562 | self.FontMainYSpinBox.setValue(int(self.theme.font_main_y)) | 562 | self.FontMainYSpinBox.setValue(int(self.theme.font_main_y)) |
1527 | 563 | self.FontMainWidthSpinBox.setValue(int(self.theme.font_main_width)) | 563 | self.FontMainWidthSpinBox.setValue(int(self.theme.font_main_width)) |
1528 | 564 | self.FontMainHeightSpinBox.setValue(int(self.theme.font_main_height)) | 564 | self.FontMainHeightSpinBox.setValue(int(self.theme.font_main_height)) |
1529 | 565 | self.FontFooterSizeSpinBox.setValue( | 565 | self.FontFooterSizeSpinBox.setValue( |
1530 | 566 | int(self.theme.font_footer_proportion)) | 566 | int(self.theme.font_footer_proportion)) |
1531 | 567 | if not self.theme.font_footer_italics and \ | 567 | if not self.theme.font_footer_italics and \ |
1532 | 568 | self.theme.font_footer_weight == u'Normal': | 568 | self.theme.font_footer_weight == u'Normal': |
1533 | 569 | self.FontFooterWeightComboBox.setCurrentIndex(0) | 569 | self.FontFooterWeightComboBox.setCurrentIndex(0) |
1534 | 570 | elif not self.theme.font_footer_italics and \ | 570 | elif not self.theme.font_footer_italics and \ |
1535 | 571 | self.theme.font_footer_weight == u'Bold': | 571 | self.theme.font_footer_weight == u'Bold': |
1536 | 572 | self.FontFooterWeightComboBox.setCurrentIndex(1) | 572 | self.FontFooterWeightComboBox.setCurrentIndex(1) |
1537 | 573 | elif self.theme.font_footer_italics and \ | 573 | elif self.theme.font_footer_italics and \ |
1538 | 574 | self.theme.font_footer_weight == u'Normal': | 574 | self.theme.font_footer_weight == u'Normal': |
1539 | 575 | self.FontFooterWeightComboBox.setCurrentIndex(2) | 575 | self.FontFooterWeightComboBox.setCurrentIndex(2) |
1540 | 576 | else: | 576 | else: |
1541 | 577 | self.FontFooterWeightComboBox.setCurrentIndex(3) | 577 | self.FontFooterWeightComboBox.setCurrentIndex(3) |
1542 | 578 | self.FontFooterXSpinBox.setValue(int(self.theme.font_footer_x)) | 578 | self.FontFooterXSpinBox.setValue(int(self.theme.font_footer_x)) |
1543 | 579 | self.FontFooterYSpinBox.setValue(int(self.theme.font_footer_y)) | 579 | self.FontFooterYSpinBox.setValue(int(self.theme.font_footer_y)) |
1544 | 580 | self.FontFooterWidthSpinBox.setValue(int(self.theme.font_footer_width)) | 580 | self.FontFooterWidthSpinBox.setValue(int(self.theme.font_footer_width)) |
1545 | 581 | self.FontFooterHeightSpinBox.setValue( | 581 | self.FontFooterHeightSpinBox.setValue( |
1546 | 582 | int(self.theme.font_footer_height)) | 582 | int(self.theme.font_footer_height)) |
1547 | 583 | self.FontMainColorPushButton.setStyleSheet( | 583 | self.FontMainColorPushButton.setStyleSheet( |
1548 | 584 | u'background-color: %s' % unicode(theme.font_main_color)) | 584 | u'background-color: %s' % unicode(theme.font_main_color)) |
1549 | 585 | self.FontFooterColorPushButton.setStyleSheet( | 585 | self.FontFooterColorPushButton.setStyleSheet( |
1550 | 586 | u'background-color: %s' % unicode(theme.font_footer_color)) | 586 | u'background-color: %s' % unicode(theme.font_footer_color)) |
1551 | 587 | 587 | ||
1552 | 588 | if self.theme.font_main_override == False: | 588 | if self.theme.font_main_override == False: |
1553 | 589 | self.FontMainDefaultCheckBox.setChecked(True) | 589 | self.FontMainDefaultCheckBox.setChecked(True) |
1554 | 590 | else: | 590 | else: |
1555 | 591 | self.FontMainDefaultCheckBox.setChecked(False) | 591 | self.FontMainDefaultCheckBox.setChecked(False) |
1556 | 592 | 592 | ||
1557 | 593 | if self.theme.font_footer_override == False: | 593 | if self.theme.font_footer_override == False: |
1558 | 594 | self.FontFooterDefaultCheckBox.setChecked(True) | 594 | self.FontFooterDefaultCheckBox.setChecked(True) |
1559 | 595 | else: | 595 | else: |
1560 | 596 | self.FontFooterDefaultCheckBox.setChecked(False) | 596 | self.FontFooterDefaultCheckBox.setChecked(False) |
1561 | 597 | 597 | ||
1562 | 598 | self.OutlineColorPushButton.setStyleSheet( | 598 | self.OutlineColorPushButton.setStyleSheet( |
1563 | 599 | u'background-color: %s' % unicode(theme.display_outline_color)) | 599 | u'background-color: %s' % unicode(theme.display_outline_color)) |
1564 | 600 | self.ShadowColorPushButton.setStyleSheet( | 600 | self.ShadowColorPushButton.setStyleSheet( |
1565 | 601 | u'background-color: %s' % unicode(theme.display_shadow_color)) | 601 | u'background-color: %s' % unicode(theme.display_shadow_color)) |
1566 | 602 | 602 | ||
1567 | 603 | if self.theme.display_outline: | 603 | if self.theme.display_outline: |
1568 | 604 | self.OutlineCheckBox.setChecked(True) | 604 | self.OutlineCheckBox.setChecked(True) |
1569 | 605 | self.OutlineColorPushButton.setEnabled(True) | 605 | self.OutlineColorPushButton.setEnabled(True) |
1570 | 606 | else: | 606 | else: |
1571 | 607 | self.OutlineCheckBox.setChecked(False) | 607 | self.OutlineCheckBox.setChecked(False) |
1572 | 608 | self.OutlineColorPushButton.setEnabled(False) | 608 | self.OutlineColorPushButton.setEnabled(False) |
1573 | 609 | 609 | ||
1574 | 610 | if self.theme.display_shadow: | 610 | if self.theme.display_shadow: |
1575 | 611 | self.ShadowCheckBox.setChecked(True) | 611 | self.ShadowCheckBox.setChecked(True) |
1576 | 612 | self.ShadowColorPushButton.setEnabled(True) | 612 | self.ShadowColorPushButton.setEnabled(True) |
1577 | 613 | else: | 613 | else: |
1578 | 614 | self.ShadowCheckBox.setChecked(False) | 614 | self.ShadowCheckBox.setChecked(False) |
1579 | 615 | self.ShadowColorPushButton.setEnabled(False) | 615 | self.ShadowColorPushButton.setEnabled(False) |
1580 | 616 | 616 | ||
1581 | 617 | self.HorizontalComboBox.setCurrentIndex( | 617 | self.HorizontalComboBox.setCurrentIndex( |
1582 | 618 | int(self.theme.display_horizontalAlign)) | 618 | int(self.theme.display_horizontalAlign)) |
1583 | 619 | self.VerticalComboBox.setCurrentIndex( | 619 | self.VerticalComboBox.setCurrentIndex( |
1584 | 620 | int(self.theme.display_verticalAlign)) | 620 | int(self.theme.display_verticalAlign)) |
1585 | 621 | 621 | ||
1586 | 622 | def stateChanging(self, theme): | 622 | def stateChanging(self, theme): |
1587 | 623 | if theme.background_mode == u'transparent': | 623 | if theme.background_mode == u'transparent': |
1588 | 624 | self.Color1Label.setVisible(False) | 624 | self.Color1Label.setVisible(False) |
1589 | 625 | self.Color1PushButton.setVisible(False) | 625 | self.Color1PushButton.setVisible(False) |
1590 | 626 | self.Color2Label.setVisible(False) | 626 | self.Color2Label.setVisible(False) |
1591 | 627 | self.Color2PushButton.setVisible(False) | 627 | self.Color2PushButton.setVisible(False) |
1592 | 628 | self.ImageLabel.setVisible(False) | 628 | self.ImageLabel.setVisible(False) |
1593 | 629 | self.ImageLineEdit.setVisible(False) | 629 | self.ImageLineEdit.setVisible(False) |
1594 | 630 | self.ImageFilenameWidget.setVisible(False) | 630 | self.ImageFilenameWidget.setVisible(False) |
1595 | 631 | self.GradientLabel.setVisible(False) | 631 | self.GradientLabel.setVisible(False) |
1596 | 632 | self.GradientComboBox.setVisible(False) | 632 | self.GradientComboBox.setVisible(False) |
1597 | 633 | self.BackgroundTypeComboBox.setVisible(False) | 633 | self.BackgroundTypeComboBox.setVisible(False) |
1598 | 634 | self.BackgroundTypeLabel.setVisible(False) | 634 | self.BackgroundTypeLabel.setVisible(False) |
1599 | 635 | else: | 635 | else: |
1600 | 636 | self.BackgroundTypeComboBox.setVisible(True) | 636 | self.BackgroundTypeComboBox.setVisible(True) |
1601 | 637 | self.BackgroundTypeLabel.setVisible(True) | 637 | self.BackgroundTypeLabel.setVisible(True) |
1602 | 638 | if theme.background_type == u'solid': | 638 | if theme.background_type == u'solid': |
1603 | 639 | self.Color1PushButton.setStyleSheet( | 639 | self.Color1PushButton.setStyleSheet( |
1604 | 640 | u'background-color: %s' % unicode(theme.background_color)) | 640 | u'background-color: %s' % unicode(theme.background_color)) |
1605 | 641 | self.Color1Label.setText(translate(u'ThemeManager', | 641 | self.Color1Label.setText(translate(u'ThemeManager', |
1606 | 642 | u'Background Color:')) | 642 | u'Background Color:')) |
1607 | 643 | self.Color1Label.setVisible(True) | 643 | self.Color1Label.setVisible(True) |
1608 | 644 | self.Color1PushButton.setVisible(True) | 644 | self.Color1PushButton.setVisible(True) |
1609 | 645 | self.Color2Label.setVisible(False) | 645 | self.Color2Label.setVisible(False) |
1610 | 646 | self.Color2PushButton.setVisible(False) | 646 | self.Color2PushButton.setVisible(False) |
1611 | 647 | self.ImageLabel.setVisible(False) | 647 | self.ImageLabel.setVisible(False) |
1612 | 648 | self.ImageLineEdit.setVisible(False) | 648 | self.ImageLineEdit.setVisible(False) |
1613 | 649 | self.ImageFilenameWidget.setVisible(False) | 649 | self.ImageFilenameWidget.setVisible(False) |
1614 | 650 | self.GradientLabel.setVisible(False) | 650 | self.GradientLabel.setVisible(False) |
1615 | 651 | self.GradientComboBox.setVisible(False) | 651 | self.GradientComboBox.setVisible(False) |
1616 | 652 | elif theme.background_type == u'gradient': | 652 | elif theme.background_type == u'gradient': |
1617 | 653 | self.Color1PushButton.setStyleSheet(u'background-color: %s' \ | 653 | self.Color1PushButton.setStyleSheet(u'background-color: %s' \ |
1618 | 654 | % unicode(theme.background_startColor)) | 654 | % unicode(theme.background_startColor)) |
1619 | 655 | self.Color2PushButton.setStyleSheet(u'background-color: %s' \ | 655 | self.Color2PushButton.setStyleSheet(u'background-color: %s' \ |
1620 | 656 | % unicode(theme.background_endColor)) | 656 | % unicode(theme.background_endColor)) |
1621 | 657 | self.Color1Label.setText(translate(u'ThemeManager', | 657 | self.Color1Label.setText(translate(u'ThemeManager', |
1622 | 658 | u'First Color:')) | 658 | u'First Color:')) |
1623 | 659 | self.Color2Label.setText(translate(u'ThemeManager', | 659 | self.Color2Label.setText(translate(u'ThemeManager', |
1624 | 660 | u'Second Color:')) | 660 | u'Second Color:')) |
1625 | 661 | self.Color1Label.setVisible(True) | 661 | self.Color1Label.setVisible(True) |
1626 | 662 | self.Color1PushButton.setVisible(True) | 662 | self.Color1PushButton.setVisible(True) |
1627 | 663 | self.Color2Label.setVisible(True) | 663 | self.Color2Label.setVisible(True) |
1628 | 664 | self.Color2PushButton.setVisible(True) | 664 | self.Color2PushButton.setVisible(True) |
1629 | 665 | self.ImageLabel.setVisible(False) | 665 | self.ImageLabel.setVisible(False) |
1630 | 666 | self.ImageLineEdit.setVisible(False) | 666 | self.ImageLineEdit.setVisible(False) |
1631 | 667 | self.ImageFilenameWidget.setVisible(False) | 667 | self.ImageFilenameWidget.setVisible(False) |
1632 | 668 | self.GradientLabel.setVisible(True) | 668 | self.GradientLabel.setVisible(True) |
1633 | 669 | self.GradientComboBox.setVisible(True) | 669 | self.GradientComboBox.setVisible(True) |
1634 | 670 | else: # must be image | 670 | else: # must be image |
1635 | 671 | self.Color1Label.setVisible(False) | 671 | self.Color1Label.setVisible(False) |
1636 | 672 | self.Color1PushButton.setVisible(False) | 672 | self.Color1PushButton.setVisible(False) |
1637 | 673 | self.Color2Label.setVisible(False) | 673 | self.Color2Label.setVisible(False) |
1638 | 674 | self.Color2PushButton.setVisible(False) | 674 | self.Color2PushButton.setVisible(False) |
1639 | 675 | self.ImageLabel.setVisible(True) | 675 | self.ImageLabel.setVisible(True) |
1640 | 676 | self.ImageLineEdit.setVisible(True) | 676 | self.ImageLineEdit.setVisible(True) |
1641 | 677 | self.ImageFilenameWidget.setVisible(True) | 677 | self.ImageFilenameWidget.setVisible(True) |
1642 | 678 | self.GradientLabel.setVisible(False) | 678 | self.GradientLabel.setVisible(False) |
1643 | 679 | self.GradientComboBox.setVisible(False) | 679 | self.GradientComboBox.setVisible(False) |
1644 | 680 | 680 | ||
1645 | 681 | if theme.font_main_override == False: | 681 | if theme.font_main_override == False: |
1646 | 682 | self.FontMainXSpinBox.setEnabled(False) | 682 | self.FontMainXSpinBox.setEnabled(False) |
1647 | 683 | self.FontMainYSpinBox.setEnabled(False) | 683 | self.FontMainYSpinBox.setEnabled(False) |
1648 | 684 | self.FontMainWidthSpinBox.setEnabled(False) | 684 | self.FontMainWidthSpinBox.setEnabled(False) |
1649 | 685 | self.FontMainHeightSpinBox.setEnabled(False) | 685 | self.FontMainHeightSpinBox.setEnabled(False) |
1650 | 686 | else: | 686 | else: |
1651 | 687 | self.FontMainXSpinBox.setEnabled(True) | 687 | self.FontMainXSpinBox.setEnabled(True) |
1652 | 688 | self.FontMainYSpinBox.setEnabled(True) | 688 | self.FontMainYSpinBox.setEnabled(True) |
1653 | 689 | self.FontMainWidthSpinBox.setEnabled(True) | 689 | self.FontMainWidthSpinBox.setEnabled(True) |
1654 | 690 | self.FontMainHeightSpinBox.setEnabled(True) | 690 | self.FontMainHeightSpinBox.setEnabled(True) |
1655 | 691 | 691 | ||
1656 | 692 | if theme.font_footer_override == False: | 692 | if theme.font_footer_override == False: |
1657 | 693 | self.FontFooterXSpinBox.setEnabled(False) | 693 | self.FontFooterXSpinBox.setEnabled(False) |
1658 | 694 | self.FontFooterYSpinBox.setEnabled(False) | 694 | self.FontFooterYSpinBox.setEnabled(False) |
1659 | 695 | self.FontFooterWidthSpinBox.setEnabled(False) | 695 | self.FontFooterWidthSpinBox.setEnabled(False) |
1660 | 696 | self.FontFooterHeightSpinBox.setEnabled(False) | 696 | self.FontFooterHeightSpinBox.setEnabled(False) |
1661 | 697 | else: | 697 | else: |
1662 | 698 | self.FontFooterXSpinBox.setEnabled(True) | 698 | self.FontFooterXSpinBox.setEnabled(True) |
1663 | 699 | self.FontFooterYSpinBox.setEnabled(True) | 699 | self.FontFooterYSpinBox.setEnabled(True) |
1664 | 700 | self.FontFooterWidthSpinBox.setEnabled(True) | 700 | self.FontFooterWidthSpinBox.setEnabled(True) |
1665 | 701 | self.FontFooterHeightSpinBox.setEnabled(True) | 701 | self.FontFooterHeightSpinBox.setEnabled(True) |
1666 | 702 | 702 | ||
1667 | 703 | if self.theme.display_outline: | 703 | if self.theme.display_outline: |
1668 | 704 | self.OutlineColorPushButton.setEnabled(True) | 704 | self.OutlineColorPushButton.setEnabled(True) |
1669 | 705 | else: | 705 | else: |
1670 | 706 | self.OutlineColorPushButton.setEnabled(False) | 706 | self.OutlineColorPushButton.setEnabled(False) |
1671 | 707 | 707 | ||
1672 | 708 | if self.theme.display_shadow: | 708 | if self.theme.display_shadow: |
1673 | 709 | self.ShadowColorPushButton.setEnabled(True) | 709 | self.ShadowColorPushButton.setEnabled(True) |
1674 | 710 | else: | 710 | else: |
1675 | 711 | self.ShadowColorPushButton.setEnabled(False) | 711 | self.ShadowColorPushButton.setEnabled(False) |
1676 | 712 | 712 | ||
1677 | 713 | def previewTheme(self, theme): | 713 | def previewTheme(self, theme): |
1678 | 714 | if self.allowPreview: | 714 | if self.allowPreview: |
1679 | 715 | frame = self.thememanager.generateImage(theme) | 715 | frame = self.thememanager.generateImage(theme) |
1680 | 716 | self.ThemePreview.setPixmap(QtGui.QPixmap.fromImage(frame)) | 716 | self.ThemePreview.setPixmap(QtGui.QPixmap.fromImage(frame)) |
1681 | 717 | 717 | ||
1682 | === modified file 'openlp/core/ui/thememanager.py' | |||
1683 | --- openlp/core/ui/thememanager.py 2009-09-13 14:12:38 +0000 | |||
1684 | +++ openlp/core/ui/thememanager.py 2009-09-13 15:14:45 +0000 | |||
1685 | @@ -1,462 +1,462 @@ | |||
2148 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
2149 | 2 | # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 | 2 | # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 |
2150 | 3 | 3 | ||
2151 | 4 | ############################################################################### | 4 | ############################################################################### |
2152 | 5 | # OpenLP - Open Source Lyrics Projection # | 5 | # OpenLP - Open Source Lyrics Projection # |
2153 | 6 | # --------------------------------------------------------------------------- # | 6 | # --------------------------------------------------------------------------- # |
2154 | 7 | # Copyright (c) 2008-2009 Raoul Snyman # | 7 | # Copyright (c) 2008-2009 Raoul Snyman # |
2155 | 8 | # Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten # | 8 | # Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten # |
2156 | 9 | # Tinggaard, Jon Tibble, Jonathan Corwin, Maikel Stuivenberg, Scott Guerrieri # | 9 | # Tinggaard, Jon Tibble, Jonathan Corwin, Maikel Stuivenberg, Scott Guerrieri # |
2157 | 10 | # --------------------------------------------------------------------------- # | 10 | # --------------------------------------------------------------------------- # |
2158 | 11 | # This program is free software; you can redistribute it and/or modify it # | 11 | # This program is free software; you can redistribute it and/or modify it # |
2159 | 12 | # under the terms of the GNU General Public License as published by the Free # | 12 | # under the terms of the GNU General Public License as published by the Free # |
2160 | 13 | # Software Foundation; version 2 of the License. # | 13 | # Software Foundation; version 2 of the License. # |
2161 | 14 | # # | 14 | # # |
2162 | 15 | # This program is distributed in the hope that it will be useful, but WITHOUT # | 15 | # This program is distributed in the hope that it will be useful, but WITHOUT # |
2163 | 16 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # | 16 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # |
2164 | 17 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # | 17 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # |
2165 | 18 | # more details. # | 18 | # more details. # |
2166 | 19 | # # | 19 | # # |
2167 | 20 | # You should have received a copy of the GNU General Public License along # | 20 | # You should have received a copy of the GNU General Public License along # |
2168 | 21 | # with this program; if not, write to the Free Software Foundation, Inc., 59 # | 21 | # with this program; if not, write to the Free Software Foundation, Inc., 59 # |
2169 | 22 | # Temple Place, Suite 330, Boston, MA 02111-1307 USA # | 22 | # Temple Place, Suite 330, Boston, MA 02111-1307 USA # |
2170 | 23 | ############################################################################### | 23 | ############################################################################### |
2171 | 24 | 24 | ||
2172 | 25 | import os | 25 | import os |
2173 | 26 | import sys | 26 | import sys |
2174 | 27 | import zipfile | 27 | import zipfile |
2175 | 28 | import shutil | 28 | import shutil |
2176 | 29 | import logging | 29 | import logging |
2177 | 30 | 30 | ||
2178 | 31 | from xml.etree.ElementTree import ElementTree, XML | 31 | from xml.etree.ElementTree import ElementTree, XML |
2179 | 32 | from PyQt4 import QtCore, QtGui | 32 | from PyQt4 import QtCore, QtGui |
2180 | 33 | 33 | ||
2181 | 34 | from openlp.core.ui import AmendThemeForm, ServiceManager | 34 | from openlp.core.ui import AmendThemeForm, ServiceManager |
2182 | 35 | from openlp.core.theme import Theme | 35 | from openlp.core.theme import Theme |
2183 | 36 | from openlp.core.lib import PluginConfig, OpenLPToolbar, ThemeXML, Renderer, \ | 36 | from openlp.core.lib import PluginConfig, OpenLPToolbar, ThemeXML, Renderer, \ |
2184 | 37 | translate, str_to_bool, file_to_xml, buildIcon, Receiver | 37 | translate, str_to_bool, file_to_xml, buildIcon, Receiver |
2185 | 38 | from openlp.core.utils import ConfigHelper | 38 | from openlp.core.utils import ConfigHelper |
2186 | 39 | 39 | ||
2187 | 40 | class ThemeManager(QtGui.QWidget): | 40 | class ThemeManager(QtGui.QWidget): |
2188 | 41 | """ | 41 | """ |
2189 | 42 | Manages the orders of Theme. | 42 | Manages the orders of Theme. |
2190 | 43 | """ | 43 | """ |
2191 | 44 | global log | 44 | global log |
2192 | 45 | log = logging.getLogger(u'ThemeManager') | 45 | log = logging.getLogger(u'ThemeManager') |
2193 | 46 | 46 | ||
2194 | 47 | def __init__(self, parent): | 47 | def __init__(self, parent): |
2195 | 48 | QtGui.QWidget.__init__(self, parent) | 48 | QtGui.QWidget.__init__(self, parent) |
2196 | 49 | self.parent = parent | 49 | self.parent = parent |
2197 | 50 | self.Layout = QtGui.QVBoxLayout(self) | 50 | self.Layout = QtGui.QVBoxLayout(self) |
2198 | 51 | self.Layout.setSpacing(0) | 51 | self.Layout.setSpacing(0) |
2199 | 52 | self.Layout.setMargin(0) | 52 | self.Layout.setMargin(0) |
2200 | 53 | self.amendThemeForm = AmendThemeForm(self) | 53 | self.amendThemeForm = AmendThemeForm(self) |
2201 | 54 | self.Toolbar = OpenLPToolbar(self) | 54 | self.Toolbar = OpenLPToolbar(self) |
2202 | 55 | self.Toolbar.addToolbarButton( | 55 | self.Toolbar.addToolbarButton( |
2203 | 56 | translate(u'ThemeManager', u'New Theme'), u':/themes/theme_new.png', | 56 | translate(u'ThemeManager', u'New Theme'), u':/themes/theme_new.png', |
2204 | 57 | translate(u'ThemeManager', u'Create a new theme'), self.onAddTheme) | 57 | translate(u'ThemeManager', u'Create a new theme'), self.onAddTheme) |
2205 | 58 | self.Toolbar.addToolbarButton( | 58 | self.Toolbar.addToolbarButton( |
2206 | 59 | translate(u'ThemeManager', u'Edit Theme'), | 59 | translate(u'ThemeManager', u'Edit Theme'), |
2207 | 60 | u':/themes/theme_edit.png', | 60 | u':/themes/theme_edit.png', |
2208 | 61 | translate(u'ThemeManager', u'Edit a theme'), self.onEditTheme) | 61 | translate(u'ThemeManager', u'Edit a theme'), self.onEditTheme) |
2209 | 62 | self.Toolbar.addToolbarButton( | 62 | self.Toolbar.addToolbarButton( |
2210 | 63 | translate(u'ThemeManager', u'Delete Theme'), | 63 | translate(u'ThemeManager', u'Delete Theme'), |
2211 | 64 | u':/themes/theme_delete.png', | 64 | u':/themes/theme_delete.png', |
2212 | 65 | translate(u'ThemeManager', u'Delete a theme'), self.onDeleteTheme) | 65 | translate(u'ThemeManager', u'Delete a theme'), self.onDeleteTheme) |
2213 | 66 | self.Toolbar.addSeparator() | 66 | self.Toolbar.addSeparator() |
2214 | 67 | self.Toolbar.addToolbarButton( | 67 | self.Toolbar.addToolbarButton( |
2215 | 68 | translate(u'ThemeManager', u'Import Theme'), | 68 | translate(u'ThemeManager', u'Import Theme'), |
2216 | 69 | u':/themes/theme_import.png', | 69 | u':/themes/theme_import.png', |
2217 | 70 | translate(u'ThemeManager', u'Import a theme'), self.onImportTheme) | 70 | translate(u'ThemeManager', u'Import a theme'), self.onImportTheme) |
2218 | 71 | self.Toolbar.addToolbarButton( | 71 | self.Toolbar.addToolbarButton( |
2219 | 72 | translate(u'ThemeManager', u'Export Theme'), | 72 | translate(u'ThemeManager', u'Export Theme'), |
2220 | 73 | u':/themes/theme_export.png', | 73 | u':/themes/theme_export.png', |
2221 | 74 | translate(u'ThemeManager', u'Export a theme'), self.onExportTheme) | 74 | translate(u'ThemeManager', u'Export a theme'), self.onExportTheme) |
2222 | 75 | self.ThemeWidget = QtGui.QWidgetAction(self.Toolbar) | 75 | self.ThemeWidget = QtGui.QWidgetAction(self.Toolbar) |
2223 | 76 | self.Layout.addWidget(self.Toolbar) | 76 | self.Layout.addWidget(self.Toolbar) |
2224 | 77 | self.ThemeListWidget = QtGui.QListWidget(self) | 77 | self.ThemeListWidget = QtGui.QListWidget(self) |
2225 | 78 | self.ThemeListWidget.setAlternatingRowColors(True) | 78 | self.ThemeListWidget.setAlternatingRowColors(True) |
2226 | 79 | self.ThemeListWidget.setIconSize(QtCore.QSize(88,50)) | 79 | self.ThemeListWidget.setIconSize(QtCore.QSize(88,50)) |
2227 | 80 | self.Layout.addWidget(self.ThemeListWidget) | 80 | self.Layout.addWidget(self.ThemeListWidget) |
2228 | 81 | #Signals | 81 | #Signals |
2229 | 82 | QtCore.QObject.connect(self.ThemeListWidget, | 82 | QtCore.QObject.connect(self.ThemeListWidget, |
2230 | 83 | QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), | 83 | QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), |
2231 | 84 | self.changeGlobalFromScreen) | 84 | self.changeGlobalFromScreen) |
2232 | 85 | QtCore.QObject.connect(Receiver.get_receiver(), | 85 | QtCore.QObject.connect(Receiver.get_receiver(), |
2233 | 86 | QtCore.SIGNAL(u'update_global_theme'), self.changeGlobalFromTab) | 86 | QtCore.SIGNAL(u'update_global_theme'), self.changeGlobalFromTab) |
2234 | 87 | #Variables | 87 | #Variables |
2235 | 88 | self.themelist = [] | 88 | self.themelist = [] |
2236 | 89 | self.path = os.path.join(ConfigHelper.get_data_path(), u'themes') | 89 | self.path = os.path.join(ConfigHelper.get_data_path(), u'themes') |
2237 | 90 | self.checkThemesExists(self.path) | 90 | self.checkThemesExists(self.path) |
2238 | 91 | self.amendThemeForm.path = self.path | 91 | self.amendThemeForm.path = self.path |
2239 | 92 | # Last little bits of setting up | 92 | # Last little bits of setting up |
2240 | 93 | self.config = PluginConfig(u'themes') | 93 | self.config = PluginConfig(u'themes') |
2241 | 94 | self.servicePath = self.config.get_data_path() | 94 | self.servicePath = self.config.get_data_path() |
2242 | 95 | self.global_theme = unicode( | 95 | self.global_theme = unicode( |
2243 | 96 | self.config.get_config(u'theme global theme', u'')) | 96 | self.config.get_config(u'theme global theme', u'')) |
2244 | 97 | 97 | ||
2245 | 98 | def changeGlobalFromTab(self, themeName): | 98 | def changeGlobalFromTab(self, themeName): |
2246 | 99 | log.debug(u'changeGlobalFromTab %s', themeName) | 99 | log.debug(u'changeGlobalFromTab %s', themeName) |
2247 | 100 | for count in range (0, self.ThemeListWidget.count()): | 100 | for count in range (0, self.ThemeListWidget.count()): |
2248 | 101 | #reset the old name | 101 | #reset the old name |
2249 | 102 | item = self.ThemeListWidget.item(count) | 102 | item = self.ThemeListWidget.item(count) |
2250 | 103 | oldName = item.text() | 103 | oldName = item.text() |
2251 | 104 | newName = unicode(item.data(QtCore.Qt.UserRole).toString()) | 104 | newName = unicode(item.data(QtCore.Qt.UserRole).toString()) |
2252 | 105 | if oldName != newName: | 105 | if oldName != newName: |
2253 | 106 | self.ThemeListWidget.item(count).setText(newName) | 106 | self.ThemeListWidget.item(count).setText(newName) |
2254 | 107 | #Set the new name | 107 | #Set the new name |
2255 | 108 | if themeName == newName: | 108 | if themeName == newName: |
2256 | 109 | name = u'%s (%s)' % (newName, translate(u'ThemeManager', | 109 | name = u'%s (%s)' % (newName, translate(u'ThemeManager', |
2257 | 110 | u'default')) | 110 | u'default')) |
2258 | 111 | self.ThemeListWidget.item(count).setText(name) | 111 | self.ThemeListWidget.item(count).setText(name) |
2259 | 112 | 112 | ||
2260 | 113 | def changeGlobalFromScreen(self, index): | 113 | def changeGlobalFromScreen(self, index): |
2261 | 114 | log.debug(u'changeGlobalFromScreen %s', index) | 114 | log.debug(u'changeGlobalFromScreen %s', index) |
2262 | 115 | for count in range (0, self.ThemeListWidget.count()): | 115 | for count in range (0, self.ThemeListWidget.count()): |
2263 | 116 | item = self.ThemeListWidget.item(count) | 116 | item = self.ThemeListWidget.item(count) |
2264 | 117 | oldName = item.text() | 117 | oldName = item.text() |
2265 | 118 | #reset the old name | 118 | #reset the old name |
2266 | 119 | if oldName != unicode(item.data(QtCore.Qt.UserRole).toString()): | 119 | if oldName != unicode(item.data(QtCore.Qt.UserRole).toString()): |
2267 | 120 | self.ThemeListWidget.item(count).setText( | 120 | self.ThemeListWidget.item(count).setText( |
2268 | 121 | unicode(item.data(QtCore.Qt.UserRole).toString())) | 121 | unicode(item.data(QtCore.Qt.UserRole).toString())) |
2269 | 122 | #Set the new name | 122 | #Set the new name |
2270 | 123 | if count == index.row(): | 123 | if count == index.row(): |
2271 | 124 | self.global_theme = unicode( | 124 | self.global_theme = unicode( |
2272 | 125 | self.ThemeListWidget.item(count).text()) | 125 | self.ThemeListWidget.item(count).text()) |
2273 | 126 | name = u'%s (%s)' % (self.global_theme, | 126 | name = u'%s (%s)' % (self.global_theme, |
2274 | 127 | translate(u'ThemeManager', u'default')) | 127 | translate(u'ThemeManager', u'default')) |
2275 | 128 | self.ThemeListWidget.item(count).setText(name) | 128 | self.ThemeListWidget.item(count).setText(name) |
2276 | 129 | self.config.set_config(u'theme global theme', self.global_theme) | 129 | self.config.set_config(u'theme global theme', self.global_theme) |
2277 | 130 | Receiver().send_message(u'update_global_theme', | 130 | Receiver().send_message(u'update_global_theme', |
2278 | 131 | self.global_theme) | 131 | self.global_theme) |
2279 | 132 | self.pushThemes() | 132 | self.pushThemes() |
2280 | 133 | 133 | ||
2281 | 134 | def onAddTheme(self): | 134 | def onAddTheme(self): |
2282 | 135 | self.amendThemeForm.theme.parse(self.baseTheme()) | 135 | self.amendThemeForm.theme.parse(self.baseTheme()) |
2283 | 136 | self.amendThemeForm.loadTheme(None) | 136 | self.amendThemeForm.loadTheme(None) |
2284 | 137 | self.amendThemeForm.exec_() | 137 | self.amendThemeForm.exec_() |
2285 | 138 | 138 | ||
2286 | 139 | def onEditTheme(self): | 139 | def onEditTheme(self): |
2287 | 140 | item = self.ThemeListWidget.currentItem() | 140 | item = self.ThemeListWidget.currentItem() |
2288 | 141 | if item is not None: | 141 | if item is not None: |
2289 | 142 | self.amendThemeForm.loadTheme( | 142 | self.amendThemeForm.loadTheme( |
2290 | 143 | unicode(item.data(QtCore.Qt.UserRole).toString())) | 143 | unicode(item.data(QtCore.Qt.UserRole).toString())) |
2291 | 144 | self.amendThemeForm.exec_() | 144 | self.amendThemeForm.exec_() |
2292 | 145 | 145 | ||
2293 | 146 | def onDeleteTheme(self): | 146 | def onDeleteTheme(self): |
2294 | 147 | self.global_theme = unicode( | 147 | self.global_theme = unicode( |
2295 | 148 | self.config.get_config(u'theme global theme', u'')) | 148 | self.config.get_config(u'theme global theme', u'')) |
2296 | 149 | item = self.ThemeListWidget.currentItem() | 149 | item = self.ThemeListWidget.currentItem() |
2297 | 150 | if item is not None: | 150 | if item is not None: |
2298 | 151 | theme = unicode(item.text()) | 151 | theme = unicode(item.text()) |
2299 | 152 | # should be the same unless default | 152 | # should be the same unless default |
2300 | 153 | if theme != unicode(item.data(QtCore.Qt.UserRole).toString()): | 153 | if theme != unicode(item.data(QtCore.Qt.UserRole).toString()): |
2301 | 154 | QtGui.QMessageBox.critical(self, | 154 | QtGui.QMessageBox.critical(self, |
2302 | 155 | translate(u'ThemeManager', u'Error'), | 155 | translate(u'ThemeManager', u'Error'), |
2303 | 156 | translate(u'ThemeManager', | 156 | translate(u'ThemeManager', |
2304 | 157 | u'You are unable to delete the default theme!'), | 157 | u'You are unable to delete the default theme!'), |
2305 | 158 | QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) | 158 | QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) |
2306 | 159 | else: | 159 | else: |
2307 | 160 | self.themelist.remove(theme) | 160 | self.themelist.remove(theme) |
2308 | 161 | th = theme + u'.png' | 161 | th = theme + u'.png' |
2309 | 162 | row = self.ThemeListWidget.row(item) | 162 | row = self.ThemeListWidget.row(item) |
2310 | 163 | self.ThemeListWidget.takeItem(row) | 163 | self.ThemeListWidget.takeItem(row) |
2311 | 164 | try: | 164 | try: |
2312 | 165 | os.remove(os.path.join(self.path, th)) | 165 | os.remove(os.path.join(self.path, th)) |
2313 | 166 | except: | 166 | except: |
2314 | 167 | #if not present do not worry | 167 | #if not present do not worry |
2315 | 168 | pass | 168 | pass |
2316 | 169 | try: | 169 | try: |
2317 | 170 | shutil.rmtree(os.path.join(self.path, theme)) | 170 | shutil.rmtree(os.path.join(self.path, theme)) |
2318 | 171 | except: | 171 | except: |
2319 | 172 | #if not present do not worry | 172 | #if not present do not worry |
2320 | 173 | pass | 173 | pass |
2321 | 174 | # As we do not reload the themes push out the change | 174 | # As we do not reload the themes push out the change |
2322 | 175 | # Reaload the list as the internal lists and events need | 175 | # Reaload the list as the internal lists and events need |
2323 | 176 | # to be triggered | 176 | # to be triggered |
2324 | 177 | self.pushThemes() | 177 | self.pushThemes() |
2325 | 178 | 178 | ||
2326 | 179 | def onExportTheme(self): | 179 | def onExportTheme(self): |
2327 | 180 | pass | 180 | pass |
2328 | 181 | 181 | ||
2329 | 182 | def onImportTheme(self): | 182 | def onImportTheme(self): |
2330 | 183 | files = QtGui.QFileDialog.getOpenFileNames(None, | 183 | files = QtGui.QFileDialog.getOpenFileNames(None, |
2331 | 184 | translate(u'ThemeManager', u'Select Theme Import File'), | 184 | translate(u'ThemeManager', u'Select Theme Import File'), |
2332 | 185 | self.path, u'Theme (*.*)') | 185 | self.path, u'Theme (*.*)') |
2333 | 186 | log.info(u'New Themes %s', unicode(files)) | 186 | log.info(u'New Themes %s', unicode(files)) |
2334 | 187 | if len(files) > 0: | 187 | if len(files) > 0: |
2335 | 188 | for file in files: | 188 | for file in files: |
2336 | 189 | self.unzipTheme(file, self.path) | 189 | self.unzipTheme(file, self.path) |
2337 | 190 | self.loadThemes() | 190 | self.loadThemes() |
2338 | 191 | 191 | ||
2339 | 192 | def loadThemes(self): | 192 | def loadThemes(self): |
2340 | 193 | """ | 193 | """ |
2341 | 194 | Loads the theme lists and triggers updates accross | 194 | Loads the theme lists and triggers updates accross |
2342 | 195 | the whole system using direct calls or core functions | 195 | the whole system using direct calls or core functions |
2343 | 196 | and events for the plugins. | 196 | and events for the plugins. |
2344 | 197 | The plugins will call back in to get the real list if they want it. | 197 | The plugins will call back in to get the real list if they want it. |
2345 | 198 | """ | 198 | """ |
2346 | 199 | log.debug(u'Load themes from dir') | 199 | log.debug(u'Load themes from dir') |
2347 | 200 | self.themelist = [] | 200 | self.themelist = [] |
2348 | 201 | self.ThemeListWidget.clear() | 201 | self.ThemeListWidget.clear() |
2349 | 202 | for root, dirs, files in os.walk(self.path): | 202 | for root, dirs, files in os.walk(self.path): |
2350 | 203 | for name in files: | 203 | for name in files: |
2351 | 204 | if name.endswith(u'.png'): | 204 | if name.endswith(u'.png'): |
2352 | 205 | #check to see file is in theme root directory | 205 | #check to see file is in theme root directory |
2353 | 206 | theme = os.path.join(self.path, name) | 206 | theme = os.path.join(self.path, name) |
2354 | 207 | if os.path.exists(theme): | 207 | if os.path.exists(theme): |
2355 | 208 | (path, filename) = os.path.split(unicode(file)) | 208 | (path, filename) = os.path.split(unicode(file)) |
2356 | 209 | textName = os.path.splitext(name)[0] | 209 | textName = os.path.splitext(name)[0] |
2357 | 210 | if textName == self.global_theme: | 210 | if textName == self.global_theme: |
2358 | 211 | name = u'%s (%s)' % (textName, | 211 | name = u'%s (%s)' % (textName, |
2359 | 212 | translate(u'ThemeManager', u'default')) | 212 | translate(u'ThemeManager', u'default')) |
2360 | 213 | else: | 213 | else: |
2361 | 214 | name = textName | 214 | name = textName |
2362 | 215 | item_name = QtGui.QListWidgetItem(name) | 215 | item_name = QtGui.QListWidgetItem(name) |
2363 | 216 | item_name.setIcon(buildIcon(theme)) | 216 | item_name.setIcon(buildIcon(theme)) |
2364 | 217 | item_name.setData(QtCore.Qt.UserRole, | 217 | item_name.setData(QtCore.Qt.UserRole, |
2365 | 218 | QtCore.QVariant(textName)) | 218 | QtCore.QVariant(textName)) |
2366 | 219 | self.ThemeListWidget.addItem(item_name) | 219 | self.ThemeListWidget.addItem(item_name) |
2367 | 220 | self.themelist.append(textName) | 220 | self.themelist.append(textName) |
2368 | 221 | self.pushThemes() | 221 | self.pushThemes() |
2369 | 222 | 222 | ||
2370 | 223 | def pushThemes(self): | 223 | def pushThemes(self): |
2371 | 224 | Receiver().send_message(u'update_themes', self.getThemes() ) | 224 | Receiver().send_message(u'update_themes', self.getThemes() ) |
2372 | 225 | 225 | ||
2373 | 226 | def getThemes(self): | 226 | def getThemes(self): |
2374 | 227 | return self.themelist | 227 | return self.themelist |
2375 | 228 | 228 | ||
2376 | 229 | def getThemeData(self, themename): | 229 | def getThemeData(self, themename): |
2377 | 230 | log.debug(u'getthemedata for theme %s', themename) | 230 | log.debug(u'getthemedata for theme %s', themename) |
2378 | 231 | xml_file = os.path.join(self.path, unicode(themename), | 231 | xml_file = os.path.join(self.path, unicode(themename), |
2379 | 232 | unicode(themename) + u'.xml') | 232 | unicode(themename) + u'.xml') |
2380 | 233 | try: | 233 | try: |
2381 | 234 | xml = file_to_xml(xml_file) | 234 | xml = file_to_xml(xml_file) |
2382 | 235 | except: | 235 | except: |
2383 | 236 | newtheme = ThemeXML() | 236 | newtheme = ThemeXML() |
2384 | 237 | newtheme.new_document(u'New Theme') | 237 | newtheme.new_document(u'New Theme') |
2385 | 238 | newtheme.add_background_solid(unicode(u'#000000')) | 238 | newtheme.add_background_solid(unicode(u'#000000')) |
2386 | 239 | newtheme.add_font(unicode(QtGui.QFont().family()), | 239 | newtheme.add_font(unicode(QtGui.QFont().family()), |
2387 | 240 | unicode(u'#FFFFFF'), unicode(30), u'False') | 240 | unicode(u'#FFFFFF'), unicode(30), u'False') |
2388 | 241 | newtheme.add_font(unicode(QtGui.QFont().family()), | 241 | newtheme.add_font(unicode(QtGui.QFont().family()), |
2389 | 242 | unicode(u'#FFFFFF'), unicode(12), u'False', u'footer') | 242 | unicode(u'#FFFFFF'), unicode(12), u'False', u'footer') |
2390 | 243 | newtheme.add_display(u'False', unicode(u'#FFFFFF'), u'False', | 243 | newtheme.add_display(u'False', unicode(u'#FFFFFF'), u'False', |
2391 | 244 | unicode(u'#FFFFFF'), unicode(0), unicode(0), unicode(0)) | 244 | unicode(u'#FFFFFF'), unicode(0), unicode(0), unicode(0)) |
2392 | 245 | xml = newtheme.extract_xml() | 245 | xml = newtheme.extract_xml() |
2393 | 246 | theme = ThemeXML() | 246 | theme = ThemeXML() |
2394 | 247 | theme.parse(xml) | 247 | theme.parse(xml) |
2395 | 248 | theme.extend_image_filename(self.path) | 248 | theme.extend_image_filename(self.path) |
2396 | 249 | self.cleanTheme(theme) | 249 | self.cleanTheme(theme) |
2397 | 250 | return theme | 250 | return theme |
2398 | 251 | 251 | ||
2399 | 252 | def checkThemesExists(self, dir): | 252 | def checkThemesExists(self, dir): |
2400 | 253 | log.debug(u'check themes') | 253 | log.debug(u'check themes') |
2401 | 254 | if os.path.exists(dir) == False: | 254 | if os.path.exists(dir) == False: |
2402 | 255 | os.mkdir(dir) | 255 | os.mkdir(dir) |
2403 | 256 | 256 | ||
2404 | 257 | def unzipTheme(self, filename, dir): | 257 | def unzipTheme(self, filename, dir): |
2405 | 258 | """ | 258 | """ |
2406 | 259 | Unzip the theme, remove the preview file if stored | 259 | Unzip the theme, remove the preview file if stored |
2407 | 260 | Generate a new preview fileCheck the XML theme version and upgrade if | 260 | Generate a new preview fileCheck the XML theme version and upgrade if |
2408 | 261 | necessary. | 261 | necessary. |
2409 | 262 | """ | 262 | """ |
2410 | 263 | log.debug(u'Unzipping theme %s', filename) | 263 | log.debug(u'Unzipping theme %s', filename) |
2411 | 264 | zip = zipfile.ZipFile(unicode(filename)) | 264 | zip = zipfile.ZipFile(unicode(filename)) |
2412 | 265 | filexml = None | 265 | filexml = None |
2413 | 266 | themename = None | 266 | themename = None |
2414 | 267 | for file in zip.namelist(): | 267 | for file in zip.namelist(): |
2415 | 268 | if file.endswith(os.path.sep): | 268 | if file.endswith(os.path.sep): |
2416 | 269 | theme_dir = os.path.join(dir, file) | 269 | theme_dir = os.path.join(dir, file) |
2417 | 270 | if os.path.exists(theme_dir) == False: | 270 | if os.path.exists(theme_dir) == False: |
2418 | 271 | os.mkdir(os.path.join(dir, file)) | 271 | os.mkdir(os.path.join(dir, file)) |
2419 | 272 | else: | 272 | else: |
2420 | 273 | fullpath = os.path.join(dir, file) | 273 | fullpath = os.path.join(dir, file) |
2421 | 274 | names = file.split(os.path.sep) | 274 | names = file.split(os.path.sep) |
2422 | 275 | if len(names) > 1: | 275 | if len(names) > 1: |
2423 | 276 | # not preview file | 276 | # not preview file |
2424 | 277 | if themename is None: | 277 | if themename is None: |
2425 | 278 | themename = names[0] | 278 | themename = names[0] |
2426 | 279 | xml_data = zip.read(file) | 279 | xml_data = zip.read(file) |
2427 | 280 | if os.path.splitext(file)[1].lower() in [u'.xml']: | 280 | if os.path.splitext(file)[1].lower() in [u'.xml']: |
2428 | 281 | if self.checkVersion1(xml_data): | 281 | if self.checkVersion1(xml_data): |
2429 | 282 | # upgrade theme xml | 282 | # upgrade theme xml |
2430 | 283 | filexml = self.migrateVersion122(filename, | 283 | filexml = self.migrateVersion122(filename, |
2431 | 284 | fullpath, xml_data) | 284 | fullpath, xml_data) |
2432 | 285 | else: | 285 | else: |
2433 | 286 | filexml = xml_data | 286 | filexml = xml_data |
2434 | 287 | outfile = open(fullpath, u'w') | 287 | outfile = open(fullpath, u'w') |
2435 | 288 | outfile.write(filexml) | 288 | outfile.write(filexml) |
2436 | 289 | outfile.close() | 289 | outfile.close() |
2437 | 290 | else: | 290 | else: |
2438 | 291 | outfile = open(fullpath, u'w') | 291 | outfile = open(fullpath, u'w') |
2439 | 292 | outfile.write(zip.read(file)) | 292 | outfile.write(zip.read(file)) |
2440 | 293 | outfile.close() | 293 | outfile.close() |
2441 | 294 | self.generateAndSaveImage(dir, themename, filexml) | 294 | self.generateAndSaveImage(dir, themename, filexml) |
2442 | 295 | 295 | ||
2443 | 296 | def checkVersion1(self, xmlfile): | 296 | def checkVersion1(self, xmlfile): |
2444 | 297 | """ | 297 | """ |
2445 | 298 | Am I a version 1 theme | 298 | Am I a version 1 theme |
2446 | 299 | """ | 299 | """ |
2447 | 300 | log.debug(u'checkVersion1 ') | 300 | log.debug(u'checkVersion1 ') |
2448 | 301 | theme = xmlfile | 301 | theme = xmlfile |
2449 | 302 | tree = ElementTree(element=XML(theme)).getroot() | 302 | tree = ElementTree(element=XML(theme)).getroot() |
2450 | 303 | if tree.find(u'BackgroundType') is None: | 303 | if tree.find(u'BackgroundType') is None: |
2451 | 304 | return False | 304 | return False |
2452 | 305 | else: | 305 | else: |
2453 | 306 | return True | 306 | return True |
2454 | 307 | 307 | ||
2455 | 308 | def migrateVersion122(self, filename, fullpath, xml_data): | 308 | def migrateVersion122(self, filename, fullpath, xml_data): |
2456 | 309 | """ | 309 | """ |
2457 | 310 | Called by convert the xml data from version 1 format | 310 | Called by convert the xml data from version 1 format |
2458 | 311 | to the current format. | 311 | to the current format. |
2459 | 312 | New fields are defaulted but the new theme is useable | 312 | New fields are defaulted but the new theme is useable |
2460 | 313 | """ | 313 | """ |
2461 | 314 | log.debug(u'migrateVersion122 %s %s', filename, fullpath) | 314 | log.debug(u'migrateVersion122 %s %s', filename, fullpath) |
2462 | 315 | theme = Theme(xml_data) | 315 | theme = Theme(xml_data) |
2463 | 316 | newtheme = ThemeXML() | 316 | newtheme = ThemeXML() |
2464 | 317 | newtheme.new_document(theme.Name) | 317 | newtheme.new_document(theme.Name) |
2465 | 318 | if theme.BackgroundType == 0: | 318 | if theme.BackgroundType == 0: |
2466 | 319 | newtheme.add_background_solid(unicode( | 319 | newtheme.add_background_solid(unicode( |
2467 | 320 | theme.BackgroundParameter1.name())) | 320 | theme.BackgroundParameter1.name())) |
2468 | 321 | elif theme.BackgroundType == 1: | 321 | elif theme.BackgroundType == 1: |
2469 | 322 | direction = u'vertical' | 322 | direction = u'vertical' |
2470 | 323 | if theme.BackgroundParameter3.name() == 1: | 323 | if theme.BackgroundParameter3.name() == 1: |
2471 | 324 | direction = u'horizontal' | 324 | direction = u'horizontal' |
2472 | 325 | newtheme.add_background_gradient( | 325 | newtheme.add_background_gradient( |
2473 | 326 | unicode(theme.BackgroundParameter1.name()), | 326 | unicode(theme.BackgroundParameter1.name()), |
2474 | 327 | unicode(theme.BackgroundParameter2.name()), direction) | 327 | unicode(theme.BackgroundParameter2.name()), direction) |
2475 | 328 | else: | 328 | else: |
2476 | 329 | newtheme.add_background_image(unicode(theme.BackgroundParameter1)) | 329 | newtheme.add_background_image(unicode(theme.BackgroundParameter1)) |
2477 | 330 | 330 | ||
2478 | 331 | newtheme.add_font(unicode(theme.FontName), | 331 | newtheme.add_font(unicode(theme.FontName), |
2479 | 332 | unicode(theme.FontColor.name()), | 332 | unicode(theme.FontColor.name()), |
2480 | 333 | unicode(theme.FontProportion * 2), u'False') | 333 | unicode(theme.FontProportion * 2), u'False') |
2481 | 334 | newtheme.add_font(unicode(theme.FontName), | 334 | newtheme.add_font(unicode(theme.FontName), |
2482 | 335 | unicode(theme.FontColor.name()), | 335 | unicode(theme.FontColor.name()), |
2483 | 336 | unicode(12), u'False', u'footer') | 336 | unicode(12), u'False', u'footer') |
2484 | 337 | outline = False | 337 | outline = False |
2485 | 338 | shadow = False | 338 | shadow = False |
2486 | 339 | if theme.Shadow == 1: | 339 | if theme.Shadow == 1: |
2487 | 340 | shadow = True | 340 | shadow = True |
2488 | 341 | if theme.Outline == 1: | 341 | if theme.Outline == 1: |
2489 | 342 | outline = True | 342 | outline = True |
2490 | 343 | newtheme.add_display(unicode(shadow), unicode(theme.ShadowColor.name()), | 343 | newtheme.add_display(unicode(shadow), unicode(theme.ShadowColor.name()), |
2491 | 344 | unicode(outline), unicode(theme.OutlineColor.name()), | 344 | unicode(outline), unicode(theme.OutlineColor.name()), |
2492 | 345 | unicode(theme.HorizontalAlign), unicode(theme.VerticalAlign), | 345 | unicode(theme.HorizontalAlign), unicode(theme.VerticalAlign), |
2493 | 346 | unicode(theme.WrapStyle)) | 346 | unicode(theme.WrapStyle)) |
2494 | 347 | return newtheme.extract_xml() | 347 | return newtheme.extract_xml() |
2495 | 348 | 348 | ||
2496 | 349 | def saveTheme(self, name, theme_xml, theme_pretty_xml, image_from, | 349 | def saveTheme(self, name, theme_xml, theme_pretty_xml, image_from, |
2497 | 350 | image_to) : | 350 | image_to) : |
2498 | 351 | """ | 351 | """ |
2499 | 352 | Called by thememaintenance Dialog to save the theme | 352 | Called by thememaintenance Dialog to save the theme |
2500 | 353 | and to trigger the reload of the theme list | 353 | and to trigger the reload of the theme list |
2501 | 354 | """ | 354 | """ |
2502 | 355 | log.debug(u'saveTheme %s %s', name, theme_xml) | 355 | log.debug(u'saveTheme %s %s', name, theme_xml) |
2503 | 356 | theme_dir = os.path.join(self.path, name) | 356 | theme_dir = os.path.join(self.path, name) |
2504 | 357 | if os.path.exists(theme_dir) == False: | 357 | if os.path.exists(theme_dir) == False: |
2505 | 358 | os.mkdir(os.path.join(self.path, name)) | 358 | os.mkdir(os.path.join(self.path, name)) |
2506 | 359 | theme_file = os.path.join(theme_dir, name + u'.xml') | 359 | theme_file = os.path.join(theme_dir, name + u'.xml') |
2507 | 360 | log.debug(theme_file) | 360 | log.debug(theme_file) |
2508 | 361 | 361 | ||
2509 | 362 | result = QtGui.QMessageBox.Yes | 362 | result = QtGui.QMessageBox.Yes |
2510 | 363 | if os.path.exists(theme_file): | 363 | if os.path.exists(theme_file): |
2511 | 364 | result = QtGui.QMessageBox.question( | 364 | result = QtGui.QMessageBox.question( |
2512 | 365 | self, | 365 | self, |
2513 | 366 | translate(u'ThemeManager', u'Theme Exists'), | 366 | translate(u'ThemeManager', u'Theme Exists'), |
2514 | 367 | translate(u'ThemeManager', u'A theme with this name already exists, would you like to overwrite it?'), | 367 | translate(u'ThemeManager', u'A theme with this name already exists, would you like to overwrite it?'), |
2515 | 368 | (QtGui.QMessageBox.Yes | QtGui.QMessageBox.No), | 368 | (QtGui.QMessageBox.Yes | QtGui.QMessageBox.No), |
2516 | 369 | QtGui.QMessageBox.No) | 369 | QtGui.QMessageBox.No) |
2517 | 370 | if result == QtGui.QMessageBox.Yes: | 370 | if result == QtGui.QMessageBox.Yes: |
2518 | 371 | # Save the theme, overwriting the existing theme if necessary. | 371 | # Save the theme, overwriting the existing theme if necessary. |
2519 | 372 | outfile = open(theme_file, u'w') | 372 | outfile = open(theme_file, u'w') |
2520 | 373 | outfile.write(theme_pretty_xml) | 373 | outfile.write(theme_pretty_xml) |
2521 | 374 | outfile.close() | 374 | outfile.close() |
2522 | 375 | if image_from is not None and image_from != image_to: | 375 | if image_from is not None and image_from != image_to: |
2523 | 376 | shutil.copyfile(image_from, image_to) | 376 | shutil.copyfile(image_from, image_to) |
2524 | 377 | 377 | ||
2525 | 378 | self.generateAndSaveImage(self.path, name, theme_xml) | 378 | self.generateAndSaveImage(self.path, name, theme_xml) |
2526 | 379 | self.loadThemes() | 379 | self.loadThemes() |
2527 | 380 | else: | 380 | else: |
2528 | 381 | # Don't close the dialog - allow the user to change the name of | 381 | # Don't close the dialog - allow the user to change the name of |
2529 | 382 | # the theme or to cancel the theme dialog completely. | 382 | # the theme or to cancel the theme dialog completely. |
2530 | 383 | return False | 383 | return False |
2531 | 384 | 384 | ||
2532 | 385 | def generateAndSaveImage(self, dir, name, theme_xml): | 385 | def generateAndSaveImage(self, dir, name, theme_xml): |
2533 | 386 | log.debug(u'generateAndSaveImage %s %s %s', dir, name, theme_xml) | 386 | log.debug(u'generateAndSaveImage %s %s %s', dir, name, theme_xml) |
2534 | 387 | theme = ThemeXML() | 387 | theme = ThemeXML() |
2535 | 388 | theme.parse(theme_xml) | 388 | theme.parse(theme_xml) |
2536 | 389 | theme.extend_image_filename(dir) | 389 | theme.extend_image_filename(dir) |
2537 | 390 | frame = self.generateImage(theme) | 390 | frame = self.generateImage(theme) |
2538 | 391 | samplepathname = os.path.join(self.path, name + u'.png') | 391 | samplepathname = os.path.join(self.path, name + u'.png') |
2539 | 392 | if os.path.exists(samplepathname): | 392 | if os.path.exists(samplepathname): |
2540 | 393 | os.unlink(samplepathname) | 393 | os.unlink(samplepathname) |
2541 | 394 | frame.save(samplepathname, u'png') | 394 | frame.save(samplepathname, u'png') |
2542 | 395 | log.debug(u'Theme image written to %s', samplepathname) | 395 | log.debug(u'Theme image written to %s', samplepathname) |
2543 | 396 | 396 | ||
2544 | 397 | def generateImage(self, themedata): | 397 | def generateImage(self, themedata): |
2545 | 398 | """ | 398 | """ |
2546 | 399 | Call the RenderManager to build a Sample Image | 399 | Call the RenderManager to build a Sample Image |
2547 | 400 | """ | 400 | """ |
2548 | 401 | log.debug(u'generateImage %s ', themedata) | 401 | log.debug(u'generateImage %s ', themedata) |
2549 | 402 | frame = self.parent.RenderManager.generate_preview(themedata) | 402 | frame = self.parent.RenderManager.generate_preview(themedata) |
2550 | 403 | return frame | 403 | return frame |
2551 | 404 | 404 | ||
2552 | 405 | def getPreviewImage(self, theme): | 405 | def getPreviewImage(self, theme): |
2553 | 406 | log.debug(u'getPreviewImage %s ', theme) | 406 | log.debug(u'getPreviewImage %s ', theme) |
2554 | 407 | image = os.path.join(self.path, theme + u'.png') | 407 | image = os.path.join(self.path, theme + u'.png') |
2555 | 408 | return image | 408 | return image |
2556 | 409 | 409 | ||
2557 | 410 | def baseTheme(self): | 410 | def baseTheme(self): |
2558 | 411 | log.debug(u'base theme created') | 411 | log.debug(u'base theme created') |
2559 | 412 | newtheme = ThemeXML() | 412 | newtheme = ThemeXML() |
2560 | 413 | newtheme.new_document(u'New Theme') | 413 | newtheme.new_document(u'New Theme') |
2561 | 414 | newtheme.add_background_solid(unicode(u'#000000')) | 414 | newtheme.add_background_solid(unicode(u'#000000')) |
2562 | 415 | newtheme.add_font(unicode(QtGui.QFont().family()), unicode(u'#FFFFFF'), | 415 | newtheme.add_font(unicode(QtGui.QFont().family()), unicode(u'#FFFFFF'), |
2563 | 416 | unicode(30), u'False') | 416 | unicode(30), u'False') |
2564 | 417 | newtheme.add_font(unicode(QtGui.QFont().family()), unicode(u'#FFFFFF'), | 417 | newtheme.add_font(unicode(QtGui.QFont().family()), unicode(u'#FFFFFF'), |
2565 | 418 | unicode(12), u'False', u'footer') | 418 | unicode(12), u'False', u'footer') |
2566 | 419 | newtheme.add_display(u'False', unicode(u'#FFFFFF'), u'False', | 419 | newtheme.add_display(u'False', unicode(u'#FFFFFF'), u'False', |
2567 | 420 | unicode(u'#FFFFFF'), unicode(0), unicode(0), unicode(0)) | 420 | unicode(u'#FFFFFF'), unicode(0), unicode(0), unicode(0)) |
2568 | 421 | return newtheme.extract_xml() | 421 | return newtheme.extract_xml() |
2569 | 422 | 422 | ||
2570 | 423 | def cleanTheme(self, theme): | 423 | def cleanTheme(self, theme): |
2571 | 424 | theme.background_color = theme.background_color.strip() | 424 | theme.background_color = theme.background_color.strip() |
2572 | 425 | theme.background_direction = theme.background_direction.strip() | 425 | theme.background_direction = theme.background_direction.strip() |
2573 | 426 | theme.background_endColor = theme.background_endColor.strip() | 426 | theme.background_endColor = theme.background_endColor.strip() |
2574 | 427 | if theme.background_filename: | 427 | if theme.background_filename: |
2575 | 428 | theme.background_filename = theme.background_filename.strip() | 428 | theme.background_filename = theme.background_filename.strip() |
2576 | 429 | #theme.background_mode | 429 | #theme.background_mode |
2577 | 430 | theme.background_startColor = theme.background_startColor.strip() | 430 | theme.background_startColor = theme.background_startColor.strip() |
2578 | 431 | #theme.background_type | 431 | #theme.background_type |
2579 | 432 | if theme.display_display: | 432 | if theme.display_display: |
2580 | 433 | theme.display_display = theme.display_display.strip() | 433 | theme.display_display = theme.display_display.strip() |
2581 | 434 | theme.display_horizontalAlign = theme.display_horizontalAlign.strip() | 434 | theme.display_horizontalAlign = theme.display_horizontalAlign.strip() |
2582 | 435 | theme.display_outline = str_to_bool(theme.display_outline) | 435 | theme.display_outline = str_to_bool(theme.display_outline) |
2583 | 436 | #theme.display_outline_color | 436 | #theme.display_outline_color |
2584 | 437 | theme.display_shadow = str_to_bool(theme.display_shadow) | 437 | theme.display_shadow = str_to_bool(theme.display_shadow) |
2585 | 438 | #theme.display_shadow_color | 438 | #theme.display_shadow_color |
2586 | 439 | theme.display_verticalAlign = theme.display_verticalAlign.strip() | 439 | theme.display_verticalAlign = theme.display_verticalAlign.strip() |
2587 | 440 | theme.display_wrapStyle = theme.display_wrapStyle.strip() | 440 | theme.display_wrapStyle = theme.display_wrapStyle.strip() |
2588 | 441 | theme.font_footer_color = theme.font_footer_color.strip() | 441 | theme.font_footer_color = theme.font_footer_color.strip() |
2589 | 442 | theme.font_footer_height = theme.font_footer_height.strip() | 442 | theme.font_footer_height = theme.font_footer_height.strip() |
2590 | 443 | theme.font_footer_italics = str_to_bool(theme.font_footer_italics) | 443 | theme.font_footer_italics = str_to_bool(theme.font_footer_italics) |
2591 | 444 | theme.font_footer_name = theme.font_footer_name.strip() | 444 | theme.font_footer_name = theme.font_footer_name.strip() |
2592 | 445 | #theme.font_footer_override | 445 | #theme.font_footer_override |
2593 | 446 | theme.font_footer_proportion = theme.font_footer_proportion.strip() | 446 | theme.font_footer_proportion = theme.font_footer_proportion.strip() |
2594 | 447 | theme.font_footer_weight = theme.font_footer_weight.strip() | 447 | theme.font_footer_weight = theme.font_footer_weight.strip() |
2595 | 448 | theme.font_footer_width = theme.font_footer_width.strip() | 448 | theme.font_footer_width = theme.font_footer_width.strip() |
2596 | 449 | theme.font_footer_x = theme.font_footer_x.strip() | 449 | theme.font_footer_x = theme.font_footer_x.strip() |
2597 | 450 | theme.font_footer_y = theme.font_footer_y.strip() | 450 | theme.font_footer_y = theme.font_footer_y.strip() |
2598 | 451 | theme.font_main_color = theme.font_main_color.strip() | 451 | theme.font_main_color = theme.font_main_color.strip() |
2599 | 452 | theme.font_main_height = theme.font_main_height.strip() | 452 | theme.font_main_height = theme.font_main_height.strip() |
2600 | 453 | theme.font_main_italics = str_to_bool(theme.font_main_italics) | 453 | theme.font_main_italics = str_to_bool(theme.font_main_italics) |
2601 | 454 | theme.font_main_name = theme.font_main_name.strip() | 454 | theme.font_main_name = theme.font_main_name.strip() |
2602 | 455 | #theme.font_main_override | 455 | #theme.font_main_override |
2603 | 456 | theme.font_main_proportion = theme.font_main_proportion.strip() | 456 | theme.font_main_proportion = theme.font_main_proportion.strip() |
2604 | 457 | theme.font_main_weight = theme.font_main_weight.strip() | 457 | theme.font_main_weight = theme.font_main_weight.strip() |
2605 | 458 | theme.font_main_x = theme.font_main_x.strip() | 458 | theme.font_main_x = theme.font_main_x.strip() |
2606 | 459 | theme.font_main_y = theme.font_main_y.strip() | 459 | theme.font_main_y = theme.font_main_y.strip() |
2607 | 460 | #theme.theme_mode | 460 | #theme.theme_mode |
2608 | 461 | theme.theme_name = theme.theme_name.strip() | 461 | theme.theme_name = theme.theme_name.strip() |
2609 | 462 | #theme.theme_version | 462 | #theme.theme_version |
2610 | 463 | 463 | ||
2611 | === modified file 'openlp/plugins/bibles/test/biblebooks_msg_short.csv' | |||
2612 | --- openlp/plugins/bibles/test/biblebooks_msg_short.csv 2008-12-10 19:11:00 +0000 | |||
2613 | +++ openlp/plugins/bibles/test/biblebooks_msg_short.csv 2009-09-13 15:14:45 +0000 | |||
2614 | @@ -1,8 +1,8 @@ | |||
2623 | 1 | 1,1,"Genesis","GEN" | 1 | 1,1,"Genesis","GEN" |
2624 | 2 | 2,1,"Exodus","EXOD" | 2 | 2,1,"Exodus","EXOD" |
2625 | 3 | 3,1,"Leviticus","LEV" | 3 | 3,1,"Leviticus","LEV" |
2626 | 4 | 4,1,"Numbers","NUM" | 4 | 4,1,"Numbers","NUM" |
2627 | 5 | 47,2,"Matthew","MATT" | 5 | 47,2,"Matthew","MATT" |
2628 | 6 | 48,2,"Mark","MARK" | 6 | 48,2,"Mark","MARK" |
2629 | 7 | 49,2,"Luke","LUKE" | 7 | 49,2,"Luke","LUKE" |
2630 | 8 | 50,2,"John","JOHN" | 8 | 50,2,"John","JOHN" |
2631 | 9 | 9 | ||
2632 | === modified file 'openlp/plugins/bibles/test/biblebooks_niv_short.csv' | |||
2633 | --- openlp/plugins/bibles/test/biblebooks_niv_short.csv 2008-12-10 19:11:00 +0000 | |||
2634 | +++ openlp/plugins/bibles/test/biblebooks_niv_short.csv 2009-09-13 15:14:45 +0000 | |||
2635 | @@ -1,9 +1,9 @@ | |||
2645 | 1 | 1,1,"Genesis","GEN" | 1 | 1,1,"Genesis","GEN" |
2646 | 2 | 2,1,"Exodus","EXOD" | 2 | 2,1,"Exodus","EXOD" |
2647 | 3 | 3,1,"Leviticus","LEV" | 3 | 3,1,"Leviticus","LEV" |
2648 | 4 | 4,1,"Numbers","NUM" | 4 | 4,1,"Numbers","NUM" |
2649 | 5 | 46,1,"Malachi","MAL" | 5 | 46,1,"Malachi","MAL" |
2650 | 6 | 47,2,"Matthew","MATT" | 6 | 47,2,"Matthew","MATT" |
2651 | 7 | 48,2,"Mark","MARK" | 7 | 48,2,"Mark","MARK" |
2652 | 8 | 49,2,"Luke","LUKE" | 8 | 49,2,"Luke","LUKE" |
2653 | 9 | 50,2,"John","JOHN" | 9 | 50,2,"John","JOHN" |
2654 | 10 | 10 | ||
2655 | === modified file 'openlp/plugins/bibles/test/bibleverses_msg_short.csv' | |||
2656 | --- openlp/plugins/bibles/test/bibleverses_msg_short.csv 2008-12-10 19:11:00 +0000 | |||
2657 | +++ openlp/plugins/bibles/test/bibleverses_msg_short.csv 2009-09-13 15:14:45 +0000 | |||
2658 | @@ -1,35 +1,35 @@ | |||
2694 | 1 | "Genesis",1,1,"First this: God created the Heavens and Earth - all you see, all you don't see." | 1 | "Genesis",1,1,"First this: God created the Heavens and Earth - all you see, all you don't see." |
2695 | 2 | "Genesis",1,2,"Earth was a soup of nothingness, a bottomless emptiness, an inky blackness. God's Spirit brooded like a bird above the watery abyss." | 2 | "Genesis",1,2,"Earth was a soup of nothingness, a bottomless emptiness, an inky blackness. God's Spirit brooded like a bird above the watery abyss." |
2696 | 3 | "Exodus",1,1,"These are the names of the Israelites who went to Egypt with Jacob, each bringing his family members:" | 3 | "Exodus",1,1,"These are the names of the Israelites who went to Egypt with Jacob, each bringing his family members:" |
2697 | 4 | "Exodus",1,2,"Reuben, Simeon, Levi, and Judah," | 4 | "Exodus",1,2,"Reuben, Simeon, Levi, and Judah," |
2698 | 5 | "Exodus",2,1,"A man from the family of Levi married a Levite woman." | 5 | "Exodus",2,1,"A man from the family of Levi married a Levite woman." |
2699 | 6 | "Exodus",2,2,"The woman became pregnant and had a son. She saw there was something special about him and hid him. She hid him for three months." | 6 | "Exodus",2,2,"The woman became pregnant and had a son. She saw there was something special about him and hid him. She hid him for three months." |
2700 | 7 | "Leviticus",1,1,"God called Moses and spoke to him from the Tent of Meeting:" | 7 | "Leviticus",1,1,"God called Moses and spoke to him from the Tent of Meeting:" |
2701 | 8 | "Leviticus",1,2,"""Speak to the People of Israel. Tell them, When anyone presents an offering to God, present an animal from either the herd or the flock." | 8 | "Leviticus",1,2,"""Speak to the People of Israel. Tell them, When anyone presents an offering to God, present an animal from either the herd or the flock." |
2702 | 9 | "Leviticus",1,3,"""If the offering is a Whole-Burnt-Offering from the herd, present a male without a defect at the entrance to the Tent of Meeting that it may be accepted by God." | 9 | "Leviticus",1,3,"""If the offering is a Whole-Burnt-Offering from the herd, present a male without a defect at the entrance to the Tent of Meeting that it may be accepted by God." |
2703 | 10 | "Numbers",1,1,"God spoke to Moses in the Wilderness of Sinai at the Tent of Meeting on the first day of the second month in the second year after they had left Egypt. He said," | 10 | "Numbers",1,1,"God spoke to Moses in the Wilderness of Sinai at the Tent of Meeting on the first day of the second month in the second year after they had left Egypt. He said," |
2704 | 11 | "Numbers",1,2,"""Number the congregation of the People of Israel by clans and families, writing down the names of every male." | 11 | "Numbers",1,2,"""Number the congregation of the People of Israel by clans and families, writing down the names of every male." |
2705 | 12 | "Matthew",1,1,"The family tree of Jesus Christ, David's son, Abraham's son:" | 12 | "Matthew",1,1,"The family tree of Jesus Christ, David's son, Abraham's son:" |
2706 | 13 | "Matthew",1,2,"Abraham had Isaac, Isaac had Jacob, Jacob had Judah and his brothers," | 13 | "Matthew",1,2,"Abraham had Isaac, Isaac had Jacob, Jacob had Judah and his brothers," |
2707 | 14 | "Matthew",1,3,"Judah had Perez and Zerah (the mother was Tamar), Perez had Hezron, Hezron had Aram," | 14 | "Matthew",1,3,"Judah had Perez and Zerah (the mother was Tamar), Perez had Hezron, Hezron had Aram," |
2708 | 15 | "Matthew",1,4,"Aram had Amminadab, Amminadab had Nahshon, Nahshon had Salmon," | 15 | "Matthew",1,4,"Aram had Amminadab, Amminadab had Nahshon, Nahshon had Salmon," |
2709 | 16 | "Matthew",1,5,"Salmon had Boaz (his mother was Rahab), Boaz had Obed (Ruth was the mother), Obed had Jesse," | 16 | "Matthew",1,5,"Salmon had Boaz (his mother was Rahab), Boaz had Obed (Ruth was the mother), Obed had Jesse," |
2710 | 17 | "Matthew",1,6,"Jesse had David, and David became king. David had Solomon (Uriah's wife was the mother)," | 17 | "Matthew",1,6,"Jesse had David, and David became king. David had Solomon (Uriah's wife was the mother)," |
2711 | 18 | "Matthew",1,7,"Solomon had Rehoboam, Rehoboam had Abijah, Abijah had Asa," | 18 | "Matthew",1,7,"Solomon had Rehoboam, Rehoboam had Abijah, Abijah had Asa," |
2712 | 19 | "Matthew",1,8,"Asa had Jehoshaphat, Jehoshaphat had Joram, Joram had Uzziah," | 19 | "Matthew",1,8,"Asa had Jehoshaphat, Jehoshaphat had Joram, Joram had Uzziah," |
2713 | 20 | "Matthew",2,1,"After Jesus was born in Bethlehem village, Judah territory - this was during Herod's kingship - a band of scholars arrived in Jerusalem from the East." | 20 | "Matthew",2,1,"After Jesus was born in Bethlehem village, Judah territory - this was during Herod's kingship - a band of scholars arrived in Jerusalem from the East." |
2714 | 21 | "Matthew",2,2,"They asked around, ""Where can we find and pay homage to the newborn King of the Jews? We observed a star in the eastern sky that "Matthew",3,1,"While Jesus was living in the Galilean hills, John, called ""the Baptizer,"" was preaching in the desert country of Judea." | 21 | "Matthew",2,2,"They asked around, ""Where can we find and pay homage to the newborn King of the Jews? We observed a star in the eastern sky that "Matthew",3,1,"While Jesus was living in the Galilean hills, John, called ""the Baptizer,"" was preaching in the desert country of Judea." |
2715 | 22 | "Matthew",3,2,"His message was simple and austere, like his desert surroundings: ""Change your life. God's kingdom is here.""" | 22 | "Matthew",3,2,"His message was simple and austere, like his desert surroundings: ""Change your life. God's kingdom is here.""" |
2716 | 23 | "Matthew",3,3,"John and his message were authorized by Isaiah's prophecy: Thunder in the desert! Prepare for God's arrival! Make the road smooth and straight!" | 23 | "Matthew",3,3,"John and his message were authorized by Isaiah's prophecy: Thunder in the desert! Prepare for God's arrival! Make the road smooth and straight!" |
2717 | 24 | "Mark",1,1,"The good news of Jesus Christ - the Message! - begins here," | 24 | "Mark",1,1,"The good news of Jesus Christ - the Message! - begins here," |
2718 | 25 | "Mark",1,2,"following to the letter the scroll of the prophet Isaiah. Watch closely: I'm sending my preacher ahead of you; He'll make the road smooth for you." | 25 | "Mark",1,2,"following to the letter the scroll of the prophet Isaiah. Watch closely: I'm sending my preacher ahead of you; He'll make the road smooth for you." |
2719 | 26 | "Mark",1,3,"Thunder in the desert! Prepare for God's arrival! Make the road smooth and straight!" | 26 | "Mark",1,3,"Thunder in the desert! Prepare for God's arrival! Make the road smooth and straight!" |
2720 | 27 | "Luke",1,1,"So many others have tried their hand at putting together a story of the wonderful harvest of Scripture and history that took place among us," | 27 | "Luke",1,1,"So many others have tried their hand at putting together a story of the wonderful harvest of Scripture and history that took place among us," |
2721 | 28 | "Luke",1,2,"using reports handed down by the original eyewitnesses who served this Word with their very lives." | 28 | "Luke",1,2,"using reports handed down by the original eyewitnesses who served this Word with their very lives." |
2722 | 29 | "Luke",1,3,"Since I have investigated all the reports in close detail, starting from the story's beginning, I decided to write it all out for you, most honorable Theophilus," | 29 | "Luke",1,3,"Since I have investigated all the reports in close detail, starting from the story's beginning, I decided to write it all out for you, most honorable Theophilus," |
2723 | 30 | "John",1,1,"The Word was first, the Word present to God, God present to the Word. The Word was God," | 30 | "John",1,1,"The Word was first, the Word present to God, God present to the Word. The Word was God," |
2724 | 31 | "John",1,2,"in readiness for God from day one." | 31 | "John",1,2,"in readiness for God from day one." |
2725 | 32 | "John",1,3,"Everything was created through him; nothing - not one thing! - came into being without him." | 32 | "John",1,3,"Everything was created through him; nothing - not one thing! - came into being without him." |
2726 | 33 | "John",2,1,"Three days later there was a wedding in the village of Cana in Galilee. Jesus' mother was there." | 33 | "John",2,1,"Three days later there was a wedding in the village of Cana in Galilee. Jesus' mother was there." |
2727 | 34 | "John",2,2,"Jesus and his disciples were guests also." | 34 | "John",2,2,"Jesus and his disciples were guests also." |
2728 | 35 | "John",2,3,"When they started running low on wine at the wedding banquet, Jesus' mother told him, ""They're just about out of wine.""" | 35 | "John",2,3,"When they started running low on wine at the wedding banquet, Jesus' mother told him, ""They're just about out of wine.""" |
2729 | 36 | 36 | ||
2730 | === modified file 'openlp/plugins/presentations/lib/pptviewlib/README.TXT' | |||
2731 | --- openlp/plugins/presentations/lib/pptviewlib/README.TXT 2008-12-10 20:40:18 +0000 | |||
2732 | +++ openlp/plugins/presentations/lib/pptviewlib/README.TXT 2009-09-13 15:14:45 +0000 | |||
2733 | @@ -1,116 +1,116 @@ | |||
2850 | 1 | 1 | ||
2851 | 2 | PPTVIEWLIB - Control PowerPoint Viewer 2003/2007 (for openlp.org) | 2 | PPTVIEWLIB - Control PowerPoint Viewer 2003/2007 (for openlp.org) |
2852 | 3 | Copyright (C) 2008 Jonathan Corwin (j@corwin.co.uk) | 3 | Copyright (C) 2008 Jonathan Corwin (j@corwin.co.uk) |
2853 | 4 | 4 | ||
2854 | 5 | This library wrappers the free Microsoft PowerPoint Viewer (2003/2007) program, | 5 | This library wrappers the free Microsoft PowerPoint Viewer (2003/2007) program, |
2855 | 6 | allowing it to be more easily controlled from another program. | 6 | allowing it to be more easily controlled from another program. |
2856 | 7 | 7 | ||
2857 | 8 | The PowerPoint Viewer must already be installed on the destination machine, and is | 8 | The PowerPoint Viewer must already be installed on the destination machine, and is |
2858 | 9 | freely available at microsoft.com. | 9 | freely available at microsoft.com. |
2859 | 10 | 10 | ||
2860 | 11 | The full Microsoft Office PowerPoint and PowerPoint Viewer 97 have a COM interface allowing | 11 | The full Microsoft Office PowerPoint and PowerPoint Viewer 97 have a COM interface allowing |
2861 | 12 | automation. This ability was removed from the 2003+ viewer offerings. | 12 | automation. This ability was removed from the 2003+ viewer offerings. |
2862 | 13 | 13 | ||
2863 | 14 | To developers: I am not a C/C++ or Win32 API programmer as you can probably tell. | 14 | To developers: I am not a C/C++ or Win32 API programmer as you can probably tell. |
2864 | 15 | The code and API of this DLL could certainly do with some tidying up, and the | 15 | The code and API of this DLL could certainly do with some tidying up, and the |
2865 | 16 | error trapping, where it exists, is very basic. I'll happily accept patches! | 16 | error trapping, where it exists, is very basic. I'll happily accept patches! |
2866 | 17 | 17 | ||
2867 | 18 | This library is covered by the GPL (http://www.gnu.org/licenses/) | 18 | This library is covered by the GPL (http://www.gnu.org/licenses/) |
2868 | 19 | It is NOT covered by the LGPL, so can only be used in GPL compatable programs. | 19 | It is NOT covered by the LGPL, so can only be used in GPL compatable programs. |
2869 | 20 | (http://www.gnu.org/licenses/why-not-lgpl.html) | 20 | (http://www.gnu.org/licenses/why-not-lgpl.html) |
2870 | 21 | 21 | ||
2871 | 22 | This README.TXT must be distributed with the pptviewlib.dll | 22 | This README.TXT must be distributed with the pptviewlib.dll |
2872 | 23 | 23 | ||
2873 | 24 | This library has a limit of 50 PowerPoints which can be opened simultaneously. | 24 | This library has a limit of 50 PowerPoints which can be opened simultaneously. |
2874 | 25 | 25 | ||
2875 | 26 | USAGE | 26 | USAGE |
2876 | 27 | ----- | 27 | ----- |
2877 | 28 | int OpenPPT(char *filename, HWND hParentWnd, RECT rect, char *previewpath); | 28 | int OpenPPT(char *filename, HWND hParentWnd, RECT rect, char *previewpath); |
2878 | 29 | 29 | ||
2879 | 30 | Opens the PowerPoint file, counts the number of slides, sizes and positions accordingly | 30 | Opens the PowerPoint file, counts the number of slides, sizes and positions accordingly |
2880 | 31 | and creates preview images of each slide. Note PowerPoint Viewer only allows the | 31 | and creates preview images of each slide. Note PowerPoint Viewer only allows the |
2881 | 32 | slideshow to be resized whilst it is being loaded. It can be moved at any time however. | 32 | slideshow to be resized whilst it is being loaded. It can be moved at any time however. |
2882 | 33 | 33 | ||
2883 | 34 | The only way to count the number of slides is to step through the entire show. Therefore | 34 | The only way to count the number of slides is to step through the entire show. Therefore |
2884 | 35 | there will be a delay whilst opening large presentations for the first time. | 35 | there will be a delay whilst opening large presentations for the first time. |
2885 | 36 | For pre XP/2003 systems, the slideshow will flicker as the screen snapshots are taken. | 36 | For pre XP/2003 systems, the slideshow will flicker as the screen snapshots are taken. |
2886 | 37 | 37 | ||
2887 | 38 | filename: The PowerPoint file to be opened. Full path | 38 | filename: The PowerPoint file to be opened. Full path |
2888 | 39 | hParentWnd: The window which will become the parent of the slideshow window. | 39 | hParentWnd: The window which will become the parent of the slideshow window. |
2889 | 40 | Can be NULL. | 40 | Can be NULL. |
2890 | 41 | rect: The location/dimensions of the slideshow window. | 41 | rect: The location/dimensions of the slideshow window. |
2891 | 42 | If all properties of this structure are zero, the dimensions of the hParentWnd | 42 | If all properties of this structure are zero, the dimensions of the hParentWnd |
2892 | 43 | are used. | 43 | are used. |
2893 | 44 | previewpath If specified, the prefix to use for snapshot images of each slide, in the | 44 | previewpath If specified, the prefix to use for snapshot images of each slide, in the |
2894 | 45 | form: previewpath + n + ".bmp", where n is the slide number. | 45 | form: previewpath + n + ".bmp", where n is the slide number. |
2895 | 46 | A file called previewpath + "info.txt" will also be created containing information | 46 | A file called previewpath + "info.txt" will also be created containing information |
2896 | 47 | about the PPT file, to speed up future openings of the unmodified file. | 47 | about the PPT file, to speed up future openings of the unmodified file. |
2897 | 48 | Note it is up the calling program to directly access these images if they | 48 | Note it is up the calling program to directly access these images if they |
2898 | 49 | are required. | 49 | are required. |
2899 | 50 | 50 | ||
2900 | 51 | RETURNS: An unique identifier to pass to other methods in this library. | 51 | RETURNS: An unique identifier to pass to other methods in this library. |
2901 | 52 | If < 0, then the PPT failed to open. | 52 | If < 0, then the PPT failed to open. |
2902 | 53 | If >=0, ClosePPT must be called when the PPT is no longer being used | 53 | If >=0, ClosePPT must be called when the PPT is no longer being used |
2903 | 54 | or when the calling program is closed to release resources/hooks. | 54 | or when the calling program is closed to release resources/hooks. |
2904 | 55 | 55 | ||
2905 | 56 | void ClosePPT(int id); | 56 | void ClosePPT(int id); |
2906 | 57 | Closes the presentation, releasing any resources and hooks. | 57 | Closes the presentation, releasing any resources and hooks. |
2907 | 58 | 58 | ||
2908 | 59 | id: The value returned from OpenPPT. | 59 | id: The value returned from OpenPPT. |
2909 | 60 | 60 | ||
2910 | 61 | int GetCurrentSlide(int id); | 61 | int GetCurrentSlide(int id); |
2911 | 62 | Returns the current slide number (from 1) | 62 | Returns the current slide number (from 1) |
2912 | 63 | 63 | ||
2913 | 64 | id: The value returned from OpenPPT. | 64 | id: The value returned from OpenPPT. |
2914 | 65 | 65 | ||
2915 | 66 | int GetSlideCount(int id); | 66 | int GetSlideCount(int id); |
2916 | 67 | Returns the total number of slides. | 67 | Returns the total number of slides. |
2917 | 68 | 68 | ||
2918 | 69 | id: The value returned from OpenPPT. | 69 | id: The value returned from OpenPPT. |
2919 | 70 | 70 | ||
2920 | 71 | void NextStep(int id); | 71 | void NextStep(int id); |
2921 | 72 | Advances one step (animation) through the slideshow. | 72 | Advances one step (animation) through the slideshow. |
2922 | 73 | 73 | ||
2923 | 74 | id: The value returned from OpenPPT. | 74 | id: The value returned from OpenPPT. |
2924 | 75 | 75 | ||
2925 | 76 | void PrevStep(int id); | 76 | void PrevStep(int id); |
2926 | 77 | Goes backwards one step (animation) through the slideshow. | 77 | Goes backwards one step (animation) through the slideshow. |
2927 | 78 | 78 | ||
2928 | 79 | id: The value returned from OpenPPT. | 79 | id: The value returned from OpenPPT. |
2929 | 80 | 80 | ||
2930 | 81 | void GotoSlide(int id, int slideno); | 81 | void GotoSlide(int id, int slideno); |
2931 | 82 | Goes directly to a specific slide in the slideshow | 82 | Goes directly to a specific slide in the slideshow |
2932 | 83 | 83 | ||
2933 | 84 | id: The value returned from OpenPPT. | 84 | id: The value returned from OpenPPT. |
2934 | 85 | slideno: The number of the slide (from 1) to go directly to. | 85 | slideno: The number of the slide (from 1) to go directly to. |
2935 | 86 | 86 | ||
2936 | 87 | If the slide has already been displayed, then the completed slide with animations performed | 87 | If the slide has already been displayed, then the completed slide with animations performed |
2937 | 88 | will be shown. This is how the PowerPoint Viewer works so have no control over this. | 88 | will be shown. This is how the PowerPoint Viewer works so have no control over this. |
2938 | 89 | 89 | ||
2939 | 90 | void RestartShow(int id); | 90 | void RestartShow(int id); |
2940 | 91 | Restarts the show from the beginning. To reset animations, behind the scenes it | 91 | Restarts the show from the beginning. To reset animations, behind the scenes it |
2941 | 92 | has to travel to the end and step backwards though the entire show. Therefore | 92 | has to travel to the end and step backwards though the entire show. Therefore |
2942 | 93 | for large presentations there might be a delay. | 93 | for large presentations there might be a delay. |
2943 | 94 | 94 | ||
2944 | 95 | id: The value returned from OpenPPT. | 95 | id: The value returned from OpenPPT. |
2945 | 96 | 96 | ||
2946 | 97 | void Blank(int id); | 97 | void Blank(int id); |
2947 | 98 | Blanks the screen, colour black. | 98 | Blanks the screen, colour black. |
2948 | 99 | 99 | ||
2949 | 100 | id: The value returned from OpenPPT. | 100 | id: The value returned from OpenPPT. |
2950 | 101 | 101 | ||
2951 | 102 | void Unblank(int id) | 102 | void Unblank(int id) |
2952 | 103 | Unblanks the screen, restoring it to it's pre-blank state. | 103 | Unblanks the screen, restoring it to it's pre-blank state. |
2953 | 104 | 104 | ||
2954 | 105 | id: The value returned from OpenPPT. | 105 | id: The value returned from OpenPPT. |
2955 | 106 | 106 | ||
2956 | 107 | void Stop(int id) | 107 | void Stop(int id) |
2957 | 108 | Moves the slideshow off the screen. (There is no concept of stop show in the PowerPoint Viewer) | 108 | Moves the slideshow off the screen. (There is no concept of stop show in the PowerPoint Viewer) |
2958 | 109 | 109 | ||
2959 | 110 | id: The value returned from OpenPPT. | 110 | id: The value returned from OpenPPT. |
2960 | 111 | 111 | ||
2961 | 112 | void Resume(int id) | 112 | void Resume(int id) |
2962 | 113 | Moves the slideshow display back onto the screen following a Stop() | 113 | Moves the slideshow display back onto the screen following a Stop() |
2963 | 114 | 114 | ||
2964 | 115 | id: The value returned from OpenPPT. | 115 | id: The value returned from OpenPPT. |
2965 | 116 | 116 | ||
2966 | 117 | 117 | ||
2967 | === modified file 'openlp/plugins/presentations/lib/pptviewlib/pptviewlib.cpp' | |||
2968 | --- openlp/plugins/presentations/lib/pptviewlib/pptviewlib.cpp 2008-12-10 20:40:18 +0000 | |||
2969 | +++ openlp/plugins/presentations/lib/pptviewlib/pptviewlib.cpp 2009-09-13 15:14:45 +0000 | |||
2970 | @@ -1,753 +1,753 @@ | |||
3724 | 1 | /* | 1 | /* |
3725 | 2 | * PPTVIEWLIB - Control PowerPoint Viewer 2003/2007 (for openlp.org) | 2 | * PPTVIEWLIB - Control PowerPoint Viewer 2003/2007 (for openlp.org) |
3726 | 3 | * Copyright (C) 2008 Jonathan Corwin | 3 | * Copyright (C) 2008 Jonathan Corwin |
3727 | 4 | * | 4 | * |
3728 | 5 | * This program is free software: you can redistribute it and/or modify | 5 | * This program is free software: you can redistribute it and/or modify |
3729 | 6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
3730 | 7 | * the Free Software Foundation, either version 2 of the License, or | 7 | * the Free Software Foundation, either version 2 of the License, or |
3731 | 8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
3732 | 9 | * | 9 | * |
3733 | 10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
3734 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3735 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3736 | 13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
3737 | 14 | * | 14 | * |
3738 | 15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
3739 | 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3740 | 17 | */ | 17 | */ |
3741 | 18 | 18 | ||
3742 | 19 | 19 | ||
3743 | 20 | #define WIN32_LEAN_AND_MEAN | 20 | #define WIN32_LEAN_AND_MEAN |
3744 | 21 | #include <windows.h> | 21 | #include <windows.h> |
3745 | 22 | #include <string.h> | 22 | #include <string.h> |
3746 | 23 | #include <stdlib.h> | 23 | #include <stdlib.h> |
3747 | 24 | #include <stdio.h> | 24 | #include <stdio.h> |
3748 | 25 | #include <time.h> | 25 | #include <time.h> |
3749 | 26 | #include <sys/types.h> | 26 | #include <sys/types.h> |
3750 | 27 | #include <sys/stat.h> | 27 | #include <sys/stat.h> |
3751 | 28 | #include "pptviewlib.h" | 28 | #include "pptviewlib.h" |
3752 | 29 | 29 | ||
3753 | 30 | // Because of the callbacks used by SetWindowsHookEx, the memory used needs to be | 30 | // Because of the callbacks used by SetWindowsHookEx, the memory used needs to be |
3754 | 31 | // sharable across processes (the callbacks are done from a different process) | 31 | // sharable across processes (the callbacks are done from a different process) |
3755 | 32 | // Therefore use data_seg with RWS memory. | 32 | // Therefore use data_seg with RWS memory. |
3756 | 33 | // | 33 | // |
3757 | 34 | // See http://msdn.microsoft.com/en-us/library/aa366551(VS.85).aspx for alternative | 34 | // See http://msdn.microsoft.com/en-us/library/aa366551(VS.85).aspx for alternative |
3758 | 35 | // method of holding memory, removing fixed limits which would allow dynamic number | 35 | // method of holding memory, removing fixed limits which would allow dynamic number |
3759 | 36 | // of items, rather than a fixed number. Use a Local\ mapping, since global has UAC | 36 | // of items, rather than a fixed number. Use a Local\ mapping, since global has UAC |
3760 | 37 | // issues in Vista. | 37 | // issues in Vista. |
3761 | 38 | #pragma data_seg(".PPTVIEWLIB") | 38 | #pragma data_seg(".PPTVIEWLIB") |
3762 | 39 | PPTVIEWOBJ pptviewobj[MAX_PPTOBJS] = {NULL}; | 39 | PPTVIEWOBJ pptviewobj[MAX_PPTOBJS] = {NULL}; |
3763 | 40 | HHOOK globalhook = NULL; | 40 | HHOOK globalhook = NULL; |
3764 | 41 | BOOL debug = FALSE; | 41 | BOOL debug = FALSE; |
3765 | 42 | #pragma data_seg() | 42 | #pragma data_seg() |
3766 | 43 | #pragma comment(linker, "/SECTION:.PPTVIEWLIB,RWS") | 43 | #pragma comment(linker, "/SECTION:.PPTVIEWLIB,RWS") |
3767 | 44 | 44 | ||
3768 | 45 | #define DEBUG(...) if(debug) printf(__VA_ARGS__) | 45 | #define DEBUG(...) if(debug) printf(__VA_ARGS__) |
3769 | 46 | 46 | ||
3770 | 47 | 47 | ||
3771 | 48 | HINSTANCE hInstance = NULL; | 48 | HINSTANCE hInstance = NULL; |
3772 | 49 | 49 | ||
3773 | 50 | BOOL APIENTRY DllMain( HMODULE hModule, | 50 | BOOL APIENTRY DllMain( HMODULE hModule, |
3774 | 51 | DWORD ul_reason_for_call, | 51 | DWORD ul_reason_for_call, |
3775 | 52 | LPVOID lpReserved | 52 | LPVOID lpReserved |
3776 | 53 | ) | 53 | ) |
3777 | 54 | { | 54 | { |
3778 | 55 | hInstance = (HINSTANCE)hModule; | 55 | hInstance = (HINSTANCE)hModule; |
3779 | 56 | switch (ul_reason_for_call) | 56 | switch (ul_reason_for_call) |
3780 | 57 | { | 57 | { |
3781 | 58 | case DLL_PROCESS_ATTACH: | 58 | case DLL_PROCESS_ATTACH: |
3782 | 59 | DEBUG("PROCESS_ATTACH\n"); | 59 | DEBUG("PROCESS_ATTACH\n"); |
3783 | 60 | break; | 60 | break; |
3784 | 61 | case DLL_THREAD_ATTACH: | 61 | case DLL_THREAD_ATTACH: |
3785 | 62 | DEBUG("THREAD_ATTACH\n"); | 62 | DEBUG("THREAD_ATTACH\n"); |
3786 | 63 | break; | 63 | break; |
3787 | 64 | case DLL_THREAD_DETACH: | 64 | case DLL_THREAD_DETACH: |
3788 | 65 | DEBUG("THREAD_DETACH\n"); | 65 | DEBUG("THREAD_DETACH\n"); |
3789 | 66 | break; | 66 | break; |
3790 | 67 | case DLL_PROCESS_DETACH: | 67 | case DLL_PROCESS_DETACH: |
3791 | 68 | // Clean up... hopefully there is only the one process attached? | 68 | // Clean up... hopefully there is only the one process attached? |
3792 | 69 | // We'll find out soon enough during tests! | 69 | // We'll find out soon enough during tests! |
3793 | 70 | DEBUG("PROCESS_DETACH\n"); | 70 | DEBUG("PROCESS_DETACH\n"); |
3794 | 71 | for(int i = 0; i<MAX_PPTOBJS; i++) | 71 | for(int i = 0; i<MAX_PPTOBJS; i++) |
3795 | 72 | ClosePPT(i); | 72 | ClosePPT(i); |
3796 | 73 | break; | 73 | break; |
3797 | 74 | } | 74 | } |
3798 | 75 | return TRUE; | 75 | return TRUE; |
3799 | 76 | } | 76 | } |
3800 | 77 | DllExport void SetDebug(BOOL onoff) | 77 | DllExport void SetDebug(BOOL onoff) |
3801 | 78 | { | 78 | { |
3802 | 79 | printf("SetDebug\n"); | 79 | printf("SetDebug\n"); |
3803 | 80 | debug = onoff; | 80 | debug = onoff; |
3804 | 81 | DEBUG("enabled\n"); | 81 | DEBUG("enabled\n"); |
3805 | 82 | } | 82 | } |
3806 | 83 | 83 | ||
3807 | 84 | // Open the PointPoint, count the slides and take a snapshot of each slide | 84 | // Open the PointPoint, count the slides and take a snapshot of each slide |
3808 | 85 | // for use in previews | 85 | // for use in previews |
3809 | 86 | // previewpath is a prefix for the location to put preview images of each slide. | 86 | // previewpath is a prefix for the location to put preview images of each slide. |
3810 | 87 | // "<n>.bmp" will be appended to complete the path. E.g. "c:\temp\slide" would | 87 | // "<n>.bmp" will be appended to complete the path. E.g. "c:\temp\slide" would |
3811 | 88 | // create "c:\temp\slide1.bmp" slide2.bmp, slide3.bmp etc. | 88 | // create "c:\temp\slide1.bmp" slide2.bmp, slide3.bmp etc. |
3812 | 89 | // It will also create a *info.txt containing information about the ppt | 89 | // It will also create a *info.txt containing information about the ppt |
3813 | 90 | DllExport int OpenPPT(char *filename, HWND hParentWnd, RECT rect, char *previewpath) | 90 | DllExport int OpenPPT(char *filename, HWND hParentWnd, RECT rect, char *previewpath) |
3814 | 91 | { | 91 | { |
3815 | 92 | STARTUPINFO si; | 92 | STARTUPINFO si; |
3816 | 93 | PROCESS_INFORMATION pi; | 93 | PROCESS_INFORMATION pi; |
3817 | 94 | char cmdline[MAX_PATH * 2]; | 94 | char cmdline[MAX_PATH * 2]; |
3818 | 95 | int id; | 95 | int id; |
3819 | 96 | 96 | ||
3820 | 97 | DEBUG("OpenPPT start: %s; %s\n", filename, previewpath); | 97 | DEBUG("OpenPPT start: %s; %s\n", filename, previewpath); |
3821 | 98 | DEBUG("OpenPPT start: %u; %i, %i, %i, %i\n", hParentWnd, rect.top, rect.left, rect.bottom, rect.right); | 98 | DEBUG("OpenPPT start: %u; %i, %i, %i, %i\n", hParentWnd, rect.top, rect.left, rect.bottom, rect.right); |
3822 | 99 | if(GetPPTViewerPath(cmdline, sizeof(cmdline))==FALSE) | 99 | if(GetPPTViewerPath(cmdline, sizeof(cmdline))==FALSE) |
3823 | 100 | { | 100 | { |
3824 | 101 | DEBUG("OpenPPT: GetPPTViewerPath failed\n"); | 101 | DEBUG("OpenPPT: GetPPTViewerPath failed\n"); |
3825 | 102 | return -1; | 102 | return -1; |
3826 | 103 | } | 103 | } |
3827 | 104 | id = -1; | 104 | id = -1; |
3828 | 105 | for(int i = 0; i<MAX_PPTOBJS; i++) | 105 | for(int i = 0; i<MAX_PPTOBJS; i++) |
3829 | 106 | { | 106 | { |
3830 | 107 | if(pptviewobj[i].state==PPT_CLOSED) | 107 | if(pptviewobj[i].state==PPT_CLOSED) |
3831 | 108 | { | 108 | { |
3832 | 109 | id=i; | 109 | id=i; |
3833 | 110 | break; | 110 | break; |
3834 | 111 | } | 111 | } |
3835 | 112 | } | 112 | } |
3836 | 113 | if(id<0) | 113 | if(id<0) |
3837 | 114 | { | 114 | { |
3838 | 115 | DEBUG("OpenPPT: Too many PPTs\n"); | 115 | DEBUG("OpenPPT: Too many PPTs\n"); |
3839 | 116 | return -1; | 116 | return -1; |
3840 | 117 | } | 117 | } |
3841 | 118 | memset(&pptviewobj[id], 0, sizeof(PPTVIEWOBJ)); | 118 | memset(&pptviewobj[id], 0, sizeof(PPTVIEWOBJ)); |
3842 | 119 | strcpy_s(pptviewobj[id].filename, MAX_PATH, filename); | 119 | strcpy_s(pptviewobj[id].filename, MAX_PATH, filename); |
3843 | 120 | strcpy_s(pptviewobj[id].previewpath, MAX_PATH, previewpath); | 120 | strcpy_s(pptviewobj[id].previewpath, MAX_PATH, previewpath); |
3844 | 121 | pptviewobj[id].state = PPT_CLOSED; | 121 | pptviewobj[id].state = PPT_CLOSED; |
3845 | 122 | pptviewobj[id].slideCount = 0; | 122 | pptviewobj[id].slideCount = 0; |
3846 | 123 | pptviewobj[id].currentSlide = 0; | 123 | pptviewobj[id].currentSlide = 0; |
3847 | 124 | pptviewobj[id].firstSlideSteps = 0; | 124 | pptviewobj[id].firstSlideSteps = 0; |
3848 | 125 | pptviewobj[id].hParentWnd = hParentWnd; | 125 | pptviewobj[id].hParentWnd = hParentWnd; |
3849 | 126 | pptviewobj[id].hWnd = NULL; | 126 | pptviewobj[id].hWnd = NULL; |
3850 | 127 | pptviewobj[id].hWnd2 = NULL; | 127 | pptviewobj[id].hWnd2 = NULL; |
3851 | 128 | if(hParentWnd!=NULL&&rect.top==0&&rect.bottom==0&&rect.left==0&&rect.right==0) | 128 | if(hParentWnd!=NULL&&rect.top==0&&rect.bottom==0&&rect.left==0&&rect.right==0) |
3852 | 129 | { | 129 | { |
3853 | 130 | LPRECT wndrect = NULL; | 130 | LPRECT wndrect = NULL; |
3854 | 131 | GetWindowRect(hParentWnd, wndrect); | 131 | GetWindowRect(hParentWnd, wndrect); |
3855 | 132 | pptviewobj[id].rect.top = 0; | 132 | pptviewobj[id].rect.top = 0; |
3856 | 133 | pptviewobj[id].rect.left = 0; | 133 | pptviewobj[id].rect.left = 0; |
3857 | 134 | pptviewobj[id].rect.bottom = wndrect->bottom-wndrect->top; | 134 | pptviewobj[id].rect.bottom = wndrect->bottom-wndrect->top; |
3858 | 135 | pptviewobj[id].rect.right = wndrect->right-wndrect->left; | 135 | pptviewobj[id].rect.right = wndrect->right-wndrect->left; |
3859 | 136 | } | 136 | } |
3860 | 137 | else | 137 | else |
3861 | 138 | { | 138 | { |
3862 | 139 | pptviewobj[id].rect.top = rect.top; | 139 | pptviewobj[id].rect.top = rect.top; |
3863 | 140 | pptviewobj[id].rect.left = rect.left; | 140 | pptviewobj[id].rect.left = rect.left; |
3864 | 141 | pptviewobj[id].rect.bottom = rect.bottom; | 141 | pptviewobj[id].rect.bottom = rect.bottom; |
3865 | 142 | pptviewobj[id].rect.right = rect.right; | 142 | pptviewobj[id].rect.right = rect.right; |
3866 | 143 | } | 143 | } |
3867 | 144 | strcat_s(cmdline, MAX_PATH * 2, "/S \""); | 144 | strcat_s(cmdline, MAX_PATH * 2, "/S \""); |
3868 | 145 | strcat_s(cmdline, MAX_PATH * 2, filename); | 145 | strcat_s(cmdline, MAX_PATH * 2, filename); |
3869 | 146 | strcat_s(cmdline, MAX_PATH * 2, "\""); | 146 | strcat_s(cmdline, MAX_PATH * 2, "\""); |
3870 | 147 | memset(&si, 0, sizeof(si)); | 147 | memset(&si, 0, sizeof(si)); |
3871 | 148 | memset(&pi, 0, sizeof(pi)); | 148 | memset(&pi, 0, sizeof(pi)); |
3872 | 149 | BOOL gotinfo = GetPPTInfo(id); | 149 | BOOL gotinfo = GetPPTInfo(id); |
3873 | 150 | /* | 150 | /* |
3874 | 151 | * I'd really like to just hook on the new threadid. However this always gives | 151 | * I'd really like to just hook on the new threadid. However this always gives |
3875 | 152 | * error 87. Perhaps I'm hooking to soon? No idea... however can't wait | 152 | * error 87. Perhaps I'm hooking to soon? No idea... however can't wait |
3876 | 153 | * since I need to ensure I pick up the WM_CREATE as this is the only | 153 | * since I need to ensure I pick up the WM_CREATE as this is the only |
3877 | 154 | * time the window can be resized in such away the content scales correctly | 154 | * time the window can be resized in such away the content scales correctly |
3878 | 155 | * | 155 | * |
3879 | 156 | * hook = SetWindowsHookEx(WH_CBT,CbtProc,hInstance,pi.dwThreadId); | 156 | * hook = SetWindowsHookEx(WH_CBT,CbtProc,hInstance,pi.dwThreadId); |
3880 | 157 | */ | 157 | */ |
3881 | 158 | if(globalhook!=NULL) | 158 | if(globalhook!=NULL) |
3882 | 159 | UnhookWindowsHookEx(globalhook); | 159 | UnhookWindowsHookEx(globalhook); |
3883 | 160 | globalhook = SetWindowsHookEx(WH_CBT,CbtProc,hInstance,NULL); | 160 | globalhook = SetWindowsHookEx(WH_CBT,CbtProc,hInstance,NULL); |
3884 | 161 | if(globalhook==0) | 161 | if(globalhook==0) |
3885 | 162 | { | 162 | { |
3886 | 163 | DEBUG("OpenPPT: SetWindowsHookEx failed\n"); | 163 | DEBUG("OpenPPT: SetWindowsHookEx failed\n"); |
3887 | 164 | ClosePPT(id); | 164 | ClosePPT(id); |
3888 | 165 | return -1; | 165 | return -1; |
3889 | 166 | } | 166 | } |
3890 | 167 | pptviewobj[id].state = PPT_STARTED; | 167 | pptviewobj[id].state = PPT_STARTED; |
3891 | 168 | Sleep(10); | 168 | Sleep(10); |
3892 | 169 | if(!CreateProcess(NULL, cmdline, NULL, NULL, FALSE, 0, 0, NULL, &si, &pi)) | 169 | if(!CreateProcess(NULL, cmdline, NULL, NULL, FALSE, 0, 0, NULL, &si, &pi)) |
3893 | 170 | { | 170 | { |
3894 | 171 | DEBUG("OpenPPT: CreateProcess failed\n"); | 171 | DEBUG("OpenPPT: CreateProcess failed\n"); |
3895 | 172 | ClosePPT(id); | 172 | ClosePPT(id); |
3896 | 173 | return -1; | 173 | return -1; |
3897 | 174 | } | 174 | } |
3898 | 175 | pptviewobj[id].dwProcessId = pi.dwProcessId; | 175 | pptviewobj[id].dwProcessId = pi.dwProcessId; |
3899 | 176 | pptviewobj[id].dwThreadId = pi.dwThreadId; | 176 | pptviewobj[id].dwThreadId = pi.dwThreadId; |
3900 | 177 | pptviewobj[id].hThread = pi.hThread; | 177 | pptviewobj[id].hThread = pi.hThread; |
3901 | 178 | pptviewobj[id].hProcess = pi.hProcess; | 178 | pptviewobj[id].hProcess = pi.hProcess; |
3902 | 179 | while(pptviewobj[id].state==PPT_STARTED) | 179 | while(pptviewobj[id].state==PPT_STARTED) |
3903 | 180 | Sleep(10); | 180 | Sleep(10); |
3904 | 181 | if(gotinfo) | 181 | if(gotinfo) |
3905 | 182 | { | 182 | { |
3906 | 183 | DEBUG("OpenPPT: Info loaded, no refresh\n"); | 183 | DEBUG("OpenPPT: Info loaded, no refresh\n"); |
3907 | 184 | pptviewobj[id].state = PPT_LOADED; | 184 | pptviewobj[id].state = PPT_LOADED; |
3908 | 185 | Resume(id); | 185 | Resume(id); |
3909 | 186 | } | 186 | } |
3910 | 187 | else | 187 | else |
3911 | 188 | { | 188 | { |
3912 | 189 | DEBUG("OpenPPT: Get info\n"); | 189 | DEBUG("OpenPPT: Get info\n"); |
3913 | 190 | pptviewobj[id].steps = 0; | 190 | pptviewobj[id].steps = 0; |
3914 | 191 | int steps = 0; | 191 | int steps = 0; |
3915 | 192 | while(pptviewobj[id].state==PPT_OPENED) | 192 | while(pptviewobj[id].state==PPT_OPENED) |
3916 | 193 | { | 193 | { |
3917 | 194 | if(steps<=pptviewobj[id].steps) | 194 | if(steps<=pptviewobj[id].steps) |
3918 | 195 | { | 195 | { |
3919 | 196 | Sleep(20); | 196 | Sleep(20); |
3920 | 197 | DEBUG("OpenPPT: Step %d/%d\n",steps,pptviewobj[id].steps); | 197 | DEBUG("OpenPPT: Step %d/%d\n",steps,pptviewobj[id].steps); |
3921 | 198 | steps++; | 198 | steps++; |
3922 | 199 | NextStep(id); | 199 | NextStep(id); |
3923 | 200 | } | 200 | } |
3924 | 201 | Sleep(10); | 201 | Sleep(10); |
3925 | 202 | } | 202 | } |
3926 | 203 | DEBUG("OpenPPT: Steps %d, first slide steps %d\n",pptviewobj[id].steps,pptviewobj[id].firstSlideSteps); | 203 | DEBUG("OpenPPT: Steps %d, first slide steps %d\n",pptviewobj[id].steps,pptviewobj[id].firstSlideSteps); |
3927 | 204 | SavePPTInfo(id); | 204 | SavePPTInfo(id); |
3928 | 205 | if(pptviewobj[id].state==PPT_CLOSING){ | 205 | if(pptviewobj[id].state==PPT_CLOSING){ |
3929 | 206 | ClosePPT(id); | 206 | ClosePPT(id); |
3930 | 207 | id=-1; | 207 | id=-1; |
3931 | 208 | } | 208 | } |
3932 | 209 | else | 209 | else |
3933 | 210 | RestartShow(id); | 210 | RestartShow(id); |
3934 | 211 | } | 211 | } |
3935 | 212 | if(id>=0) | 212 | if(id>=0) |
3936 | 213 | { | 213 | { |
3937 | 214 | if(pptviewobj[id].mhook!=NULL) | 214 | if(pptviewobj[id].mhook!=NULL) |
3938 | 215 | UnhookWindowsHookEx(pptviewobj[id].mhook); | 215 | UnhookWindowsHookEx(pptviewobj[id].mhook); |
3939 | 216 | pptviewobj[id].mhook = NULL; | 216 | pptviewobj[id].mhook = NULL; |
3940 | 217 | } | 217 | } |
3941 | 218 | DEBUG("OpenPPT: Exit: id=%i\n", id); | 218 | DEBUG("OpenPPT: Exit: id=%i\n", id); |
3942 | 219 | return id; | 219 | return id; |
3943 | 220 | } | 220 | } |
3944 | 221 | // Load information about the ppt from an info.txt file. | 221 | // Load information about the ppt from an info.txt file. |
3945 | 222 | // Format: | 222 | // Format: |
3946 | 223 | // version | 223 | // version |
3947 | 224 | // filedate | 224 | // filedate |
3948 | 225 | // filesize | 225 | // filesize |
3949 | 226 | // slidecount | 226 | // slidecount |
3950 | 227 | // first slide steps | 227 | // first slide steps |
3951 | 228 | BOOL GetPPTInfo(int id) | 228 | BOOL GetPPTInfo(int id) |
3952 | 229 | { | 229 | { |
3953 | 230 | struct _stat filestats; | 230 | struct _stat filestats; |
3954 | 231 | char info[MAX_PATH]; | 231 | char info[MAX_PATH]; |
3955 | 232 | FILE* pFile; | 232 | FILE* pFile; |
3956 | 233 | char buf[100]; | 233 | char buf[100]; |
3957 | 234 | 234 | ||
3958 | 235 | DEBUG("GetPPTInfo: start\n"); | 235 | DEBUG("GetPPTInfo: start\n"); |
3959 | 236 | if(_stat(pptviewobj[id].filename, &filestats)!=0) | 236 | if(_stat(pptviewobj[id].filename, &filestats)!=0) |
3960 | 237 | return FALSE; | 237 | return FALSE; |
3961 | 238 | sprintf_s(info, MAX_PATH, "%sinfo.txt", pptviewobj[id].previewpath); | 238 | sprintf_s(info, MAX_PATH, "%sinfo.txt", pptviewobj[id].previewpath); |
3962 | 239 | int err = fopen_s(&pFile, info, "r"); | 239 | int err = fopen_s(&pFile, info, "r"); |
3963 | 240 | if(err!=0) | 240 | if(err!=0) |
3964 | 241 | { | 241 | { |
3965 | 242 | DEBUG("GetPPTInfo: file open failed - %d\n", err); | 242 | DEBUG("GetPPTInfo: file open failed - %d\n", err); |
3966 | 243 | return FALSE; | 243 | return FALSE; |
3967 | 244 | } | 244 | } |
3968 | 245 | fgets(buf, 100, pFile); // version == 1 | 245 | fgets(buf, 100, pFile); // version == 1 |
3969 | 246 | fgets(buf, 100, pFile); | 246 | fgets(buf, 100, pFile); |
3970 | 247 | if(filestats.st_mtime!=atoi(buf)) | 247 | if(filestats.st_mtime!=atoi(buf)) |
3971 | 248 | { | 248 | { |
3972 | 249 | fclose (pFile); | 249 | fclose (pFile); |
3973 | 250 | return FALSE; | 250 | return FALSE; |
3974 | 251 | } | 251 | } |
3975 | 252 | fgets(buf, 100, pFile); | 252 | fgets(buf, 100, pFile); |
3976 | 253 | if(filestats.st_size!=atoi(buf)) | 253 | if(filestats.st_size!=atoi(buf)) |
3977 | 254 | { | 254 | { |
3978 | 255 | fclose (pFile); | 255 | fclose (pFile); |
3979 | 256 | return FALSE; | 256 | return FALSE; |
3980 | 257 | } | 257 | } |
3981 | 258 | fgets(buf, 100, pFile); // slidecount | 258 | fgets(buf, 100, pFile); // slidecount |
3982 | 259 | int slidecount = atoi(buf); | 259 | int slidecount = atoi(buf); |
3983 | 260 | fgets(buf, 100, pFile); // first slide steps | 260 | fgets(buf, 100, pFile); // first slide steps |
3984 | 261 | int firstslidesteps = atoi(buf); | 261 | int firstslidesteps = atoi(buf); |
3985 | 262 | // check all the preview images still exist | 262 | // check all the preview images still exist |
3986 | 263 | for(int i = 1; i<=slidecount; i++) | 263 | for(int i = 1; i<=slidecount; i++) |
3987 | 264 | { | 264 | { |
3988 | 265 | sprintf_s(info, MAX_PATH, "%s%i.bmp", pptviewobj[id].previewpath, i); | 265 | sprintf_s(info, MAX_PATH, "%s%i.bmp", pptviewobj[id].previewpath, i); |
3989 | 266 | if(GetFileAttributes(info)==INVALID_FILE_ATTRIBUTES) | 266 | if(GetFileAttributes(info)==INVALID_FILE_ATTRIBUTES) |
3990 | 267 | return FALSE; | 267 | return FALSE; |
3991 | 268 | } | 268 | } |
3992 | 269 | fclose(pFile); | 269 | fclose(pFile); |
3993 | 270 | pptviewobj[id].slideCount = slidecount; | 270 | pptviewobj[id].slideCount = slidecount; |
3994 | 271 | pptviewobj[id].firstSlideSteps = firstslidesteps; | 271 | pptviewobj[id].firstSlideSteps = firstslidesteps; |
3995 | 272 | DEBUG("GetPPTInfo: exit ok\n"); | 272 | DEBUG("GetPPTInfo: exit ok\n"); |
3996 | 273 | return TRUE; | 273 | return TRUE; |
3997 | 274 | } | 274 | } |
3998 | 275 | 275 | ||
3999 | 276 | BOOL SavePPTInfo(int id) | 276 | BOOL SavePPTInfo(int id) |
4000 | 277 | { | 277 | { |
4001 | 278 | struct _stat filestats; | 278 | struct _stat filestats; |
4002 | 279 | char info[MAX_PATH]; | 279 | char info[MAX_PATH]; |
4003 | 280 | FILE* pFile; | 280 | FILE* pFile; |
4004 | 281 | 281 | ||
4005 | 282 | DEBUG("SavePPTInfo: start\n"); | 282 | DEBUG("SavePPTInfo: start\n"); |
4006 | 283 | if(_stat(pptviewobj[id].filename, &filestats)!=0) | 283 | if(_stat(pptviewobj[id].filename, &filestats)!=0) |
4007 | 284 | { | 284 | { |
4008 | 285 | DEBUG("SavePPTInfo: stat of %s failed\n", pptviewobj[id].filename); | 285 | DEBUG("SavePPTInfo: stat of %s failed\n", pptviewobj[id].filename); |
4009 | 286 | return FALSE; | 286 | return FALSE; |
4010 | 287 | } | 287 | } |
4011 | 288 | sprintf_s(info, MAX_PATH, "%sinfo.txt", pptviewobj[id].previewpath); | 288 | sprintf_s(info, MAX_PATH, "%sinfo.txt", pptviewobj[id].previewpath); |
4012 | 289 | int err = fopen_s(&pFile, info, "w"); | 289 | int err = fopen_s(&pFile, info, "w"); |
4013 | 290 | if(err!=0) | 290 | if(err!=0) |
4014 | 291 | { | 291 | { |
4015 | 292 | DEBUG("SavePPTInfo: fopen of %s failed%i\n", info, err); | 292 | DEBUG("SavePPTInfo: fopen of %s failed%i\n", info, err); |
4016 | 293 | return FALSE; | 293 | return FALSE; |
4017 | 294 | } | 294 | } |
4018 | 295 | fprintf(pFile, "1\n"); | 295 | fprintf(pFile, "1\n"); |
4019 | 296 | fprintf(pFile, "%u\n", filestats.st_mtime); | 296 | fprintf(pFile, "%u\n", filestats.st_mtime); |
4020 | 297 | fprintf(pFile, "%u\n", filestats.st_size); | 297 | fprintf(pFile, "%u\n", filestats.st_size); |
4021 | 298 | fprintf(pFile, "%u\n", pptviewobj[id].slideCount); | 298 | fprintf(pFile, "%u\n", pptviewobj[id].slideCount); |
4022 | 299 | fprintf(pFile, "%u\n", pptviewobj[id].firstSlideSteps); | 299 | fprintf(pFile, "%u\n", pptviewobj[id].firstSlideSteps); |
4023 | 300 | fclose (pFile); | 300 | fclose (pFile); |
4024 | 301 | DEBUG("SavePPTInfo: exit ok\n"); | 301 | DEBUG("SavePPTInfo: exit ok\n"); |
4025 | 302 | return TRUE; | 302 | return TRUE; |
4026 | 303 | } | 303 | } |
4027 | 304 | 304 | ||
4028 | 305 | // Get the path of the PowerPoint viewer from the registry | 305 | // Get the path of the PowerPoint viewer from the registry |
4029 | 306 | BOOL GetPPTViewerPath(char *pptviewerpath, int strsize) | 306 | BOOL GetPPTViewerPath(char *pptviewerpath, int strsize) |
4030 | 307 | { | 307 | { |
4031 | 308 | HKEY hkey; | 308 | HKEY hkey; |
4032 | 309 | DWORD dwtype, dwsize; | 309 | DWORD dwtype, dwsize; |
4033 | 310 | LRESULT lresult; | 310 | LRESULT lresult; |
4034 | 311 | 311 | ||
4035 | 312 | DEBUG("GetPPTViewerPath: start\n"); | 312 | DEBUG("GetPPTViewerPath: start\n"); |
4036 | 313 | if(RegOpenKeyEx(HKEY_CLASSES_ROOT, "Applications\\PPTVIEW.EXE\\shell\\open\\command", 0, KEY_READ, &hkey)!=ERROR_SUCCESS) | 313 | if(RegOpenKeyEx(HKEY_CLASSES_ROOT, "Applications\\PPTVIEW.EXE\\shell\\open\\command", 0, KEY_READ, &hkey)!=ERROR_SUCCESS) |
4037 | 314 | if(RegOpenKeyEx(HKEY_CLASSES_ROOT, "Applications\\PPTVIEW.EXE\\shell\\Show\\command", 0, KEY_READ, &hkey)!=ERROR_SUCCESS) | 314 | if(RegOpenKeyEx(HKEY_CLASSES_ROOT, "Applications\\PPTVIEW.EXE\\shell\\Show\\command", 0, KEY_READ, &hkey)!=ERROR_SUCCESS) |
4038 | 315 | return FALSE; | 315 | return FALSE; |
4039 | 316 | dwtype = REG_SZ; | 316 | dwtype = REG_SZ; |
4040 | 317 | dwsize = (DWORD)strsize; | 317 | dwsize = (DWORD)strsize; |
4041 | 318 | lresult = RegQueryValueEx(hkey, NULL, NULL, &dwtype, (LPBYTE)pptviewerpath, &dwsize ); | 318 | lresult = RegQueryValueEx(hkey, NULL, NULL, &dwtype, (LPBYTE)pptviewerpath, &dwsize ); |
4042 | 319 | RegCloseKey(hkey); | 319 | RegCloseKey(hkey); |
4043 | 320 | if(lresult!=ERROR_SUCCESS) | 320 | if(lresult!=ERROR_SUCCESS) |
4044 | 321 | return FALSE; | 321 | return FALSE; |
4045 | 322 | pptviewerpath[strlen(pptviewerpath)-4] = '\0'; // remove "%1" from end of key value | 322 | pptviewerpath[strlen(pptviewerpath)-4] = '\0'; // remove "%1" from end of key value |
4046 | 323 | DEBUG("GetPPTViewerPath: exit ok\n"); | 323 | DEBUG("GetPPTViewerPath: exit ok\n"); |
4047 | 324 | return TRUE; | 324 | return TRUE; |
4048 | 325 | } | 325 | } |
4049 | 326 | 326 | ||
4050 | 327 | // Unhook the Windows hook | 327 | // Unhook the Windows hook |
4051 | 328 | void Unhook(int id) | 328 | void Unhook(int id) |
4052 | 329 | { | 329 | { |
4053 | 330 | DEBUG("Unhook: start %d\n", id); | 330 | DEBUG("Unhook: start %d\n", id); |
4054 | 331 | if(pptviewobj[id].hook!=NULL) | 331 | if(pptviewobj[id].hook!=NULL) |
4055 | 332 | UnhookWindowsHookEx(pptviewobj[id].hook); | 332 | UnhookWindowsHookEx(pptviewobj[id].hook); |
4056 | 333 | if(pptviewobj[id].mhook!=NULL) | 333 | if(pptviewobj[id].mhook!=NULL) |
4057 | 334 | UnhookWindowsHookEx(pptviewobj[id].mhook); | 334 | UnhookWindowsHookEx(pptviewobj[id].mhook); |
4058 | 335 | pptviewobj[id].hook = NULL; | 335 | pptviewobj[id].hook = NULL; |
4059 | 336 | pptviewobj[id].mhook = NULL; | 336 | pptviewobj[id].mhook = NULL; |
4060 | 337 | DEBUG("Unhook: exit ok\n"); | 337 | DEBUG("Unhook: exit ok\n"); |
4061 | 338 | } | 338 | } |
4062 | 339 | 339 | ||
4063 | 340 | // Close the PowerPoint viewer, release resources | 340 | // Close the PowerPoint viewer, release resources |
4064 | 341 | DllExport void ClosePPT(int id) | 341 | DllExport void ClosePPT(int id) |
4065 | 342 | { | 342 | { |
4066 | 343 | DEBUG("ClosePPT: start%d\n", id); | 343 | DEBUG("ClosePPT: start%d\n", id); |
4067 | 344 | pptviewobj[id].state = PPT_CLOSED; | 344 | pptviewobj[id].state = PPT_CLOSED; |
4068 | 345 | Unhook(id); | 345 | Unhook(id); |
4069 | 346 | if(pptviewobj[id].hWnd==0) | 346 | if(pptviewobj[id].hWnd==0) |
4070 | 347 | TerminateThread(pptviewobj[id].hThread, 0); | 347 | TerminateThread(pptviewobj[id].hThread, 0); |
4071 | 348 | else | 348 | else |
4072 | 349 | PostMessage(pptviewobj[id].hWnd, WM_CLOSE, 0, 0); | 349 | PostMessage(pptviewobj[id].hWnd, WM_CLOSE, 0, 0); |
4073 | 350 | CloseHandle(pptviewobj[id].hThread); | 350 | CloseHandle(pptviewobj[id].hThread); |
4074 | 351 | CloseHandle(pptviewobj[id].hProcess); | 351 | CloseHandle(pptviewobj[id].hProcess); |
4075 | 352 | memset(&pptviewobj[id], 0, sizeof(PPTVIEWOBJ)); | 352 | memset(&pptviewobj[id], 0, sizeof(PPTVIEWOBJ)); |
4076 | 353 | DEBUG("ClosePPT: exit ok\n"); | 353 | DEBUG("ClosePPT: exit ok\n"); |
4077 | 354 | return; | 354 | return; |
4078 | 355 | } | 355 | } |
4079 | 356 | // Moves the show back onto the display | 356 | // Moves the show back onto the display |
4080 | 357 | DllExport void Resume(int id) | 357 | DllExport void Resume(int id) |
4081 | 358 | { | 358 | { |
4082 | 359 | DEBUG("Resume: %d\n", id); | 359 | DEBUG("Resume: %d\n", id); |
4083 | 360 | MoveWindow(pptviewobj[id].hWnd, pptviewobj[id].rect.left, pptviewobj[id].rect.top, | 360 | MoveWindow(pptviewobj[id].hWnd, pptviewobj[id].rect.left, pptviewobj[id].rect.top, |
4084 | 361 | pptviewobj[id].rect.right - pptviewobj[id].rect.left, | 361 | pptviewobj[id].rect.right - pptviewobj[id].rect.left, |
4085 | 362 | pptviewobj[id].rect.bottom - pptviewobj[id].rect.top, TRUE); | 362 | pptviewobj[id].rect.bottom - pptviewobj[id].rect.top, TRUE); |
4086 | 363 | Unblank(id); | 363 | Unblank(id); |
4087 | 364 | } | 364 | } |
4088 | 365 | // Moves the show off the screen so it can't be seen | 365 | // Moves the show off the screen so it can't be seen |
4089 | 366 | DllExport void Stop(int id) | 366 | DllExport void Stop(int id) |
4090 | 367 | { | 367 | { |
4091 | 368 | DEBUG("Stop:%d\n", id); | 368 | DEBUG("Stop:%d\n", id); |
4092 | 369 | MoveWindow(pptviewobj[id].hWnd, -32000, -32000, | 369 | MoveWindow(pptviewobj[id].hWnd, -32000, -32000, |
4093 | 370 | pptviewobj[id].rect.right - pptviewobj[id].rect.left, | 370 | pptviewobj[id].rect.right - pptviewobj[id].rect.left, |
4094 | 371 | pptviewobj[id].rect.bottom - pptviewobj[id].rect.top, TRUE); | 371 | pptviewobj[id].rect.bottom - pptviewobj[id].rect.top, TRUE); |
4095 | 372 | } | 372 | } |
4096 | 373 | 373 | ||
4097 | 374 | // Return the total number of slides | 374 | // Return the total number of slides |
4098 | 375 | DllExport int GetSlideCount(int id) | 375 | DllExport int GetSlideCount(int id) |
4099 | 376 | { | 376 | { |
4100 | 377 | DEBUG("GetSlideCount:%d\n", id); | 377 | DEBUG("GetSlideCount:%d\n", id); |
4101 | 378 | if(pptviewobj[id].state==0) | 378 | if(pptviewobj[id].state==0) |
4102 | 379 | return -1; | 379 | return -1; |
4103 | 380 | else | 380 | else |
4104 | 381 | return pptviewobj[id].slideCount; | 381 | return pptviewobj[id].slideCount; |
4105 | 382 | } | 382 | } |
4106 | 383 | 383 | ||
4107 | 384 | // Return the number of the slide currently viewing | 384 | // Return the number of the slide currently viewing |
4108 | 385 | DllExport int GetCurrentSlide(int id) | 385 | DllExport int GetCurrentSlide(int id) |
4109 | 386 | { | 386 | { |
4110 | 387 | DEBUG("GetCurrentSlide:%d\n", id); | 387 | DEBUG("GetCurrentSlide:%d\n", id); |
4111 | 388 | if(pptviewobj[id].state==0) | 388 | if(pptviewobj[id].state==0) |
4112 | 389 | return -1; | 389 | return -1; |
4113 | 390 | else | 390 | else |
4114 | 391 | return pptviewobj[id].currentSlide; | 391 | return pptviewobj[id].currentSlide; |
4115 | 392 | } | 392 | } |
4116 | 393 | 393 | ||
4117 | 394 | // Take a step forwards through the show | 394 | // Take a step forwards through the show |
4118 | 395 | DllExport void NextStep(int id) | 395 | DllExport void NextStep(int id) |
4119 | 396 | { | 396 | { |
4120 | 397 | DEBUG("NextStep:%d\n", id); | 397 | DEBUG("NextStep:%d\n", id); |
4121 | 398 | if(pptviewobj[id].currentSlide>pptviewobj[id].slideCount) | 398 | if(pptviewobj[id].currentSlide>pptviewobj[id].slideCount) |
4122 | 399 | return; | 399 | return; |
4123 | 400 | PostMessage(pptviewobj[id].hWnd2, WM_MOUSEWHEEL, MAKEWPARAM(0, -WHEEL_DELTA), 0); | 400 | PostMessage(pptviewobj[id].hWnd2, WM_MOUSEWHEEL, MAKEWPARAM(0, -WHEEL_DELTA), 0); |
4124 | 401 | } | 401 | } |
4125 | 402 | 402 | ||
4126 | 403 | // Take a step backwards through the show | 403 | // Take a step backwards through the show |
4127 | 404 | DllExport void PrevStep(int id) | 404 | DllExport void PrevStep(int id) |
4128 | 405 | { | 405 | { |
4129 | 406 | DEBUG("PrevStep:%d\n", id); | 406 | DEBUG("PrevStep:%d\n", id); |
4130 | 407 | PostMessage(pptviewobj[id].hWnd2, WM_MOUSEWHEEL, MAKEWPARAM(0, WHEEL_DELTA), 0); | 407 | PostMessage(pptviewobj[id].hWnd2, WM_MOUSEWHEEL, MAKEWPARAM(0, WHEEL_DELTA), 0); |
4131 | 408 | } | 408 | } |
4132 | 409 | 409 | ||
4133 | 410 | // Blank the show (black screen) | 410 | // Blank the show (black screen) |
4134 | 411 | DllExport void Blank(int id) | 411 | DllExport void Blank(int id) |
4135 | 412 | { | 412 | { |
4136 | 413 | // B just toggles blank on/off. However pressing any key unblanks. | 413 | // B just toggles blank on/off. However pressing any key unblanks. |
4137 | 414 | // So send random unmapped letter first (say 'A'), then we can | 414 | // So send random unmapped letter first (say 'A'), then we can |
4138 | 415 | // better guarantee B will blank instead of trying to guess | 415 | // better guarantee B will blank instead of trying to guess |
4139 | 416 | // whether it was already blank or not. | 416 | // whether it was already blank or not. |
4140 | 417 | DEBUG("Blank:%d\n", id); | 417 | DEBUG("Blank:%d\n", id); |
4141 | 418 | HWND h1 = GetForegroundWindow(); | 418 | HWND h1 = GetForegroundWindow(); |
4142 | 419 | HWND h2 = GetFocus(); | 419 | HWND h2 = GetFocus(); |
4143 | 420 | SetForegroundWindow(pptviewobj[id].hWnd); | 420 | SetForegroundWindow(pptviewobj[id].hWnd); |
4144 | 421 | SetFocus(pptviewobj[id].hWnd); | 421 | SetFocus(pptviewobj[id].hWnd); |
4145 | 422 | Sleep(50); // slight pause, otherwise event triggering this call may grab focus back! | 422 | Sleep(50); // slight pause, otherwise event triggering this call may grab focus back! |
4146 | 423 | keybd_event((int)'A', 0, 0, 0); | 423 | keybd_event((int)'A', 0, 0, 0); |
4147 | 424 | keybd_event((int)'A', 0, KEYEVENTF_KEYUP, 0); | 424 | keybd_event((int)'A', 0, KEYEVENTF_KEYUP, 0); |
4148 | 425 | keybd_event((int)'B', 0, 0, 0); | 425 | keybd_event((int)'B', 0, 0, 0); |
4149 | 426 | keybd_event((int)'B', 0, KEYEVENTF_KEYUP, 0); | 426 | keybd_event((int)'B', 0, KEYEVENTF_KEYUP, 0); |
4150 | 427 | SetForegroundWindow(h1); | 427 | SetForegroundWindow(h1); |
4151 | 428 | SetFocus(h2); | 428 | SetFocus(h2); |
4152 | 429 | //PostMessage(pptviewobj[id].hWnd2, WM_KEYDOWN, 'B', 0x00300001); | 429 | //PostMessage(pptviewobj[id].hWnd2, WM_KEYDOWN, 'B', 0x00300001); |
4153 | 430 | //PostMessage(pptviewobj[id].hWnd2, WM_CHAR, 'b', 0x00300001); | 430 | //PostMessage(pptviewobj[id].hWnd2, WM_CHAR, 'b', 0x00300001); |
4154 | 431 | //PostMessage(pptviewobj[id].hWnd2, WM_KEYUP, 'B', 0xC0300001); | 431 | //PostMessage(pptviewobj[id].hWnd2, WM_KEYUP, 'B', 0xC0300001); |
4155 | 432 | } | 432 | } |
4156 | 433 | // Unblank the show | 433 | // Unblank the show |
4157 | 434 | DllExport void Unblank(int id) | 434 | DllExport void Unblank(int id) |
4158 | 435 | { | 435 | { |
4159 | 436 | DEBUG("Unblank:%d\n", id); | 436 | DEBUG("Unblank:%d\n", id); |
4160 | 437 | // Pressing any key resumes. | 437 | // Pressing any key resumes. |
4161 | 438 | // For some reason SendMessage works for unblanking, but not blanking. | 438 | // For some reason SendMessage works for unblanking, but not blanking. |
4162 | 439 | // SendMessage(pptviewobj[id].hWnd2, WM_KEYDOWN, 'A', 0); | 439 | // SendMessage(pptviewobj[id].hWnd2, WM_KEYDOWN, 'A', 0); |
4163 | 440 | SendMessage(pptviewobj[id].hWnd2, WM_CHAR, 'A', 0); | 440 | SendMessage(pptviewobj[id].hWnd2, WM_CHAR, 'A', 0); |
4164 | 441 | // SendMessage(pptviewobj[id].hWnd2, WM_KEYUP, 'A', 0); | 441 | // SendMessage(pptviewobj[id].hWnd2, WM_KEYUP, 'A', 0); |
4165 | 442 | // HWND h1 = GetForegroundWindow(); | 442 | // HWND h1 = GetForegroundWindow(); |
4166 | 443 | // HWND h2 = GetFocus(); | 443 | // HWND h2 = GetFocus(); |
4167 | 444 | // Sleep(50); // slight pause, otherwise event triggering this call may grab focus back! | 444 | // Sleep(50); // slight pause, otherwise event triggering this call may grab focus back! |
4168 | 445 | // SetForegroundWindow(pptviewobj[id].hWnd); | 445 | // SetForegroundWindow(pptviewobj[id].hWnd); |
4169 | 446 | // SetFocus(pptviewobj[id].hWnd); | 446 | // SetFocus(pptviewobj[id].hWnd); |
4170 | 447 | // keybd_event((int)'A', 0, 0, 0); | 447 | // keybd_event((int)'A', 0, 0, 0); |
4171 | 448 | // SetForegroundWindow(h1); | 448 | // SetForegroundWindow(h1); |
4172 | 449 | // SetFocus(h2); | 449 | // SetFocus(h2); |
4173 | 450 | } | 450 | } |
4174 | 451 | 451 | ||
4175 | 452 | // Go directly to a slide | 452 | // Go directly to a slide |
4176 | 453 | DllExport void GotoSlide(int id, int slideno) | 453 | DllExport void GotoSlide(int id, int slideno) |
4177 | 454 | { | 454 | { |
4178 | 455 | DEBUG("GotoSlide %i %i:\n", id, slideno); | 455 | DEBUG("GotoSlide %i %i:\n", id, slideno); |
4179 | 456 | // Did try WM_KEYDOWN/WM_CHAR/WM_KEYUP with SendMessage but didn't work | 456 | // Did try WM_KEYDOWN/WM_CHAR/WM_KEYUP with SendMessage but didn't work |
4180 | 457 | // perhaps I was sending to the wrong window? No idea. | 457 | // perhaps I was sending to the wrong window? No idea. |
4181 | 458 | // Anyway fall back to keybd_event, which is OK as long we makesure | 458 | // Anyway fall back to keybd_event, which is OK as long we makesure |
4182 | 459 | // the slideshow has focus first | 459 | // the slideshow has focus first |
4183 | 460 | char ch[10]; | 460 | char ch[10]; |
4184 | 461 | 461 | ||
4185 | 462 | if(slideno<0) return; | 462 | if(slideno<0) return; |
4186 | 463 | _itoa_s(slideno, ch, 10, 10); | 463 | _itoa_s(slideno, ch, 10, 10); |
4187 | 464 | HWND h1 = GetForegroundWindow(); | 464 | HWND h1 = GetForegroundWindow(); |
4188 | 465 | HWND h2 = GetFocus(); | 465 | HWND h2 = GetFocus(); |
4189 | 466 | SetForegroundWindow(pptviewobj[id].hWnd); | 466 | SetForegroundWindow(pptviewobj[id].hWnd); |
4190 | 467 | SetFocus(pptviewobj[id].hWnd); | 467 | SetFocus(pptviewobj[id].hWnd); |
4191 | 468 | Sleep(50); // slight pause, otherwise event triggering this call may grab focus back! | 468 | Sleep(50); // slight pause, otherwise event triggering this call may grab focus back! |
4192 | 469 | for(int i=0;i<10;i++) | 469 | for(int i=0;i<10;i++) |
4193 | 470 | { | 470 | { |
4194 | 471 | if(ch[i]=='\0') break; | 471 | if(ch[i]=='\0') break; |
4195 | 472 | keybd_event((BYTE)ch[i], 0, 0, 0); | 472 | keybd_event((BYTE)ch[i], 0, 0, 0); |
4196 | 473 | keybd_event((BYTE)ch[i], 0, KEYEVENTF_KEYUP, 0); | 473 | keybd_event((BYTE)ch[i], 0, KEYEVENTF_KEYUP, 0); |
4197 | 474 | } | 474 | } |
4198 | 475 | keybd_event(VK_RETURN, 0, 0, 0); | 475 | keybd_event(VK_RETURN, 0, 0, 0); |
4199 | 476 | keybd_event(VK_RETURN, 0, KEYEVENTF_KEYUP, 0); | 476 | keybd_event(VK_RETURN, 0, KEYEVENTF_KEYUP, 0); |
4200 | 477 | SetForegroundWindow(h1); | 477 | SetForegroundWindow(h1); |
4201 | 478 | SetFocus(h2); | 478 | SetFocus(h2); |
4202 | 479 | 479 | ||
4203 | 480 | //for(int i=0;i<10;i++) | 480 | //for(int i=0;i<10;i++) |
4204 | 481 | //{ | 481 | //{ |
4205 | 482 | // if(ch[i]=='\0') break; | 482 | // if(ch[i]=='\0') break; |
4206 | 483 | // SendMessage(pptviewobj[id].hWnd2, WM_KEYDOWN, ch[i], 0); | 483 | // SendMessage(pptviewobj[id].hWnd2, WM_KEYDOWN, ch[i], 0); |
4207 | 484 | // SendMessage(pptviewobj[id].hWnd2, WM_CHAR, ch[i], 0); | 484 | // SendMessage(pptviewobj[id].hWnd2, WM_CHAR, ch[i], 0); |
4208 | 485 | // SendMessage(pptviewobj[id].hWnd2, WM_KEYUP, ch[i], 0); | 485 | // SendMessage(pptviewobj[id].hWnd2, WM_KEYUP, ch[i], 0); |
4209 | 486 | //} | 486 | //} |
4210 | 487 | //SendMessage(pptviewobj[id].hWnd2, WM_KEYDOWN, VK_RETURN, 0); | 487 | //SendMessage(pptviewobj[id].hWnd2, WM_KEYDOWN, VK_RETURN, 0); |
4211 | 488 | //SendMessage(pptviewobj[id].hWnd2, WM_CHAR, VK_RETURN, 0); | 488 | //SendMessage(pptviewobj[id].hWnd2, WM_CHAR, VK_RETURN, 0); |
4212 | 489 | //SendMessage(pptviewobj[id].hWnd2, WM_KEYUP, VK_RETURN, 0); | 489 | //SendMessage(pptviewobj[id].hWnd2, WM_KEYUP, VK_RETURN, 0); |
4213 | 490 | //keybd_event(VK_RETURN, 0, 0, 0); | 490 | //keybd_event(VK_RETURN, 0, 0, 0); |
4214 | 491 | } | 491 | } |
4215 | 492 | 492 | ||
4216 | 493 | // Restart the show from the beginning | 493 | // Restart the show from the beginning |
4217 | 494 | DllExport void RestartShow(int id) | 494 | DllExport void RestartShow(int id) |
4218 | 495 | { | 495 | { |
4219 | 496 | // If we just go direct to slide one, then it remembers that all other slides have | 496 | // If we just go direct to slide one, then it remembers that all other slides have |
4220 | 497 | // been animated, so ends up just showing the completed slides of those slides that | 497 | // been animated, so ends up just showing the completed slides of those slides that |
4221 | 498 | // have been animated next time we advance. | 498 | // have been animated next time we advance. |
4222 | 499 | // Only way I've found to get around this is to step backwards all the way through. | 499 | // Only way I've found to get around this is to step backwards all the way through. |
4223 | 500 | // Lets move the window out of the way first so the audience doesn't see this. | 500 | // Lets move the window out of the way first so the audience doesn't see this. |
4224 | 501 | DEBUG("RestartShow:%d\n", id); | 501 | DEBUG("RestartShow:%d\n", id); |
4225 | 502 | Stop(id); | 502 | Stop(id); |
4226 | 503 | GotoSlide(id, pptviewobj[id].slideCount); | 503 | GotoSlide(id, pptviewobj[id].slideCount); |
4227 | 504 | while(pptviewobj[id].currentSlide>1) | 504 | while(pptviewobj[id].currentSlide>1) |
4228 | 505 | { | 505 | { |
4229 | 506 | PrevStep(id); | 506 | PrevStep(id); |
4230 | 507 | Sleep(10); | 507 | Sleep(10); |
4231 | 508 | } | 508 | } |
4232 | 509 | for(int i=0;i<=pptviewobj[id].firstSlideSteps;i++) | 509 | for(int i=0;i<=pptviewobj[id].firstSlideSteps;i++) |
4233 | 510 | { | 510 | { |
4234 | 511 | PrevStep(id); | 511 | PrevStep(id); |
4235 | 512 | Sleep(10); | 512 | Sleep(10); |
4236 | 513 | } | 513 | } |
4237 | 514 | Resume(id); | 514 | Resume(id); |
4238 | 515 | } | 515 | } |
4239 | 516 | 516 | ||
4240 | 517 | // This hook is started with the PPTVIEW.EXE process and waits for the | 517 | // This hook is started with the PPTVIEW.EXE process and waits for the |
4241 | 518 | // WM_CREATEWND message. At this point (and only this point) can the | 518 | // WM_CREATEWND message. At this point (and only this point) can the |
4242 | 519 | // window be resized to the correct size. | 519 | // window be resized to the correct size. |
4243 | 520 | // Release the hook as soon as we're complete to free up resources | 520 | // Release the hook as soon as we're complete to free up resources |
4244 | 521 | LRESULT CALLBACK CbtProc(int nCode, WPARAM wParam, LPARAM lParam) | 521 | LRESULT CALLBACK CbtProc(int nCode, WPARAM wParam, LPARAM lParam) |
4245 | 522 | { | 522 | { |
4246 | 523 | HHOOK hook = globalhook; | 523 | HHOOK hook = globalhook; |
4247 | 524 | if(nCode==HCBT_CREATEWND) | 524 | if(nCode==HCBT_CREATEWND) |
4248 | 525 | { | 525 | { |
4249 | 526 | char csClassName[16]; | 526 | char csClassName[16]; |
4250 | 527 | HWND hCurrWnd = (HWND)wParam; | 527 | HWND hCurrWnd = (HWND)wParam; |
4251 | 528 | DWORD retProcId = NULL; | 528 | DWORD retProcId = NULL; |
4252 | 529 | GetClassName(hCurrWnd, csClassName, sizeof(csClassName)); | 529 | GetClassName(hCurrWnd, csClassName, sizeof(csClassName)); |
4253 | 530 | if((strcmp(csClassName, "paneClassDC")==0) | 530 | if((strcmp(csClassName, "paneClassDC")==0) |
4254 | 531 | ||(strcmp(csClassName, "screenClass")==0)) | 531 | ||(strcmp(csClassName, "screenClass")==0)) |
4255 | 532 | { | 532 | { |
4256 | 533 | int id=-1; | 533 | int id=-1; |
4257 | 534 | DWORD windowthread = GetWindowThreadProcessId(hCurrWnd,NULL); | 534 | DWORD windowthread = GetWindowThreadProcessId(hCurrWnd,NULL); |
4258 | 535 | for(int i=0; i<MAX_PPTOBJS; i++) | 535 | for(int i=0; i<MAX_PPTOBJS; i++) |
4259 | 536 | { | 536 | { |
4260 | 537 | if(pptviewobj[i].dwThreadId==windowthread) | 537 | if(pptviewobj[i].dwThreadId==windowthread) |
4261 | 538 | { | 538 | { |
4262 | 539 | id=i; | 539 | id=i; |
4263 | 540 | break; | 540 | break; |
4264 | 541 | } | 541 | } |
4265 | 542 | } | 542 | } |
4266 | 543 | if(id>=0) | 543 | if(id>=0) |
4267 | 544 | { | 544 | { |
4268 | 545 | if(strcmp(csClassName, "paneClassDC")==0) | 545 | if(strcmp(csClassName, "paneClassDC")==0) |
4269 | 546 | pptviewobj[id].hWnd2=hCurrWnd; | 546 | pptviewobj[id].hWnd2=hCurrWnd; |
4270 | 547 | else | 547 | else |
4271 | 548 | { | 548 | { |
4272 | 549 | pptviewobj[id].hWnd=hCurrWnd; | 549 | pptviewobj[id].hWnd=hCurrWnd; |
4273 | 550 | CBT_CREATEWND* cw = (CBT_CREATEWND*)lParam; | 550 | CBT_CREATEWND* cw = (CBT_CREATEWND*)lParam; |
4274 | 551 | if(pptviewobj[id].hParentWnd!=NULL) | 551 | if(pptviewobj[id].hParentWnd!=NULL) |
4275 | 552 | cw->lpcs->hwndParent = pptviewobj[id].hParentWnd; | 552 | cw->lpcs->hwndParent = pptviewobj[id].hParentWnd; |
4276 | 553 | cw->lpcs->cy=(pptviewobj[id].rect.bottom-pptviewobj[id].rect.top); | 553 | cw->lpcs->cy=(pptviewobj[id].rect.bottom-pptviewobj[id].rect.top); |
4277 | 554 | cw->lpcs->cx=(pptviewobj[id].rect.right-pptviewobj[id].rect.left); | 554 | cw->lpcs->cx=(pptviewobj[id].rect.right-pptviewobj[id].rect.left); |
4278 | 555 | cw->lpcs->y=-32000; | 555 | cw->lpcs->y=-32000; |
4279 | 556 | cw->lpcs->x=-32000; | 556 | cw->lpcs->x=-32000; |
4280 | 557 | } | 557 | } |
4281 | 558 | if((pptviewobj[id].hWnd!=NULL)&&(pptviewobj[id].hWnd2!=NULL)) | 558 | if((pptviewobj[id].hWnd!=NULL)&&(pptviewobj[id].hWnd2!=NULL)) |
4282 | 559 | { | 559 | { |
4283 | 560 | UnhookWindowsHookEx(globalhook); | 560 | UnhookWindowsHookEx(globalhook); |
4284 | 561 | globalhook=NULL; | 561 | globalhook=NULL; |
4285 | 562 | pptviewobj[id].hook = SetWindowsHookEx(WH_CALLWNDPROC,CwpProc,hInstance,pptviewobj[id].dwThreadId); | 562 | pptviewobj[id].hook = SetWindowsHookEx(WH_CALLWNDPROC,CwpProc,hInstance,pptviewobj[id].dwThreadId); |
4286 | 563 | pptviewobj[id].mhook = SetWindowsHookEx(WH_GETMESSAGE,GetMsgProc,hInstance,pptviewobj[id].dwThreadId); | 563 | pptviewobj[id].mhook = SetWindowsHookEx(WH_GETMESSAGE,GetMsgProc,hInstance,pptviewobj[id].dwThreadId); |
4287 | 564 | Sleep(10); | 564 | Sleep(10); |
4288 | 565 | pptviewobj[id].state = PPT_OPENED; | 565 | pptviewobj[id].state = PPT_OPENED; |
4289 | 566 | } | 566 | } |
4290 | 567 | } | 567 | } |
4291 | 568 | } | 568 | } |
4292 | 569 | } | 569 | } |
4293 | 570 | return CallNextHookEx(hook,nCode,wParam,lParam); | 570 | return CallNextHookEx(hook,nCode,wParam,lParam); |
4294 | 571 | } | 571 | } |
4295 | 572 | 572 | ||
4296 | 573 | // This hook exists whilst the slideshow is loading but only listens on the | 573 | // This hook exists whilst the slideshow is loading but only listens on the |
4297 | 574 | // slideshows thread. It listens out for mousewheel events | 574 | // slideshows thread. It listens out for mousewheel events |
4298 | 575 | LRESULT CALLBACK GetMsgProc(int nCode, WPARAM wParam, LPARAM lParam) | 575 | LRESULT CALLBACK GetMsgProc(int nCode, WPARAM wParam, LPARAM lParam) |
4299 | 576 | { | 576 | { |
4300 | 577 | HHOOK hook = NULL; | 577 | HHOOK hook = NULL; |
4301 | 578 | MSG *pMSG = (MSG *)lParam; | 578 | MSG *pMSG = (MSG *)lParam; |
4302 | 579 | DWORD windowthread = GetWindowThreadProcessId(pMSG->hwnd,NULL); | 579 | DWORD windowthread = GetWindowThreadProcessId(pMSG->hwnd,NULL); |
4303 | 580 | int id=-1; | 580 | int id=-1; |
4304 | 581 | for(int i=0; i<MAX_PPTOBJS; i++) | 581 | for(int i=0; i<MAX_PPTOBJS; i++) |
4305 | 582 | { | 582 | { |
4306 | 583 | if(pptviewobj[i].dwThreadId==windowthread) | 583 | if(pptviewobj[i].dwThreadId==windowthread) |
4307 | 584 | { | 584 | { |
4308 | 585 | id=i; | 585 | id=i; |
4309 | 586 | hook = pptviewobj[id].mhook; | 586 | hook = pptviewobj[id].mhook; |
4310 | 587 | break; | 587 | break; |
4311 | 588 | } | 588 | } |
4312 | 589 | } | 589 | } |
4313 | 590 | if(id>=0&&nCode==HC_ACTION&&wParam==PM_REMOVE&&pMSG->message==WM_MOUSEWHEEL) | 590 | if(id>=0&&nCode==HC_ACTION&&wParam==PM_REMOVE&&pMSG->message==WM_MOUSEWHEEL) |
4314 | 591 | { | 591 | { |
4315 | 592 | if(pptviewobj[id].state!=PPT_LOADED) | 592 | if(pptviewobj[id].state!=PPT_LOADED) |
4316 | 593 | { | 593 | { |
4317 | 594 | if(pptviewobj[id].currentSlide==1) | 594 | if(pptviewobj[id].currentSlide==1) |
4318 | 595 | pptviewobj[id].firstSlideSteps++; | 595 | pptviewobj[id].firstSlideSteps++; |
4319 | 596 | pptviewobj[id].steps++; | 596 | pptviewobj[id].steps++; |
4320 | 597 | } | 597 | } |
4321 | 598 | } | 598 | } |
4322 | 599 | return CallNextHookEx(hook, nCode, wParam, lParam); | 599 | return CallNextHookEx(hook, nCode, wParam, lParam); |
4323 | 600 | } | 600 | } |
4324 | 601 | // This hook exists whilst the slideshow is running but only listens on the | 601 | // This hook exists whilst the slideshow is running but only listens on the |
4325 | 602 | // slideshows thread. It listens out for slide changes, message WM_USER+22. | 602 | // slideshows thread. It listens out for slide changes, message WM_USER+22. |
4326 | 603 | LRESULT CALLBACK CwpProc(int nCode, WPARAM wParam, LPARAM lParam){ | 603 | LRESULT CALLBACK CwpProc(int nCode, WPARAM wParam, LPARAM lParam){ |
4327 | 604 | CWPSTRUCT *cwp; | 604 | CWPSTRUCT *cwp; |
4328 | 605 | cwp = (CWPSTRUCT *)lParam; | 605 | cwp = (CWPSTRUCT *)lParam; |
4329 | 606 | HHOOK hook = NULL; | 606 | HHOOK hook = NULL; |
4330 | 607 | char filename[MAX_PATH]; | 607 | char filename[MAX_PATH]; |
4331 | 608 | 608 | ||
4332 | 609 | DWORD windowthread = GetWindowThreadProcessId(cwp->hwnd,NULL); | 609 | DWORD windowthread = GetWindowThreadProcessId(cwp->hwnd,NULL); |
4333 | 610 | int id=-1; | 610 | int id=-1; |
4334 | 611 | for(int i=0; i<MAX_PPTOBJS; i++) | 611 | for(int i=0; i<MAX_PPTOBJS; i++) |
4335 | 612 | { | 612 | { |
4336 | 613 | if(pptviewobj[i].dwThreadId==windowthread) | 613 | if(pptviewobj[i].dwThreadId==windowthread) |
4337 | 614 | { | 614 | { |
4338 | 615 | id=i; | 615 | id=i; |
4339 | 616 | hook = pptviewobj[id].hook; | 616 | hook = pptviewobj[id].hook; |
4340 | 617 | break; | 617 | break; |
4341 | 618 | } | 618 | } |
4342 | 619 | } | 619 | } |
4343 | 620 | if((id>=0)&&(nCode==HC_ACTION)) | 620 | if((id>=0)&&(nCode==HC_ACTION)) |
4344 | 621 | { | 621 | { |
4345 | 622 | if(cwp->message==WM_USER+22) | 622 | if(cwp->message==WM_USER+22) |
4346 | 623 | { | 623 | { |
4347 | 624 | if(pptviewobj[id].state != PPT_LOADED) | 624 | if(pptviewobj[id].state != PPT_LOADED) |
4348 | 625 | { | 625 | { |
4349 | 626 | if((pptviewobj[id].currentSlide>0) | 626 | if((pptviewobj[id].currentSlide>0) |
4350 | 627 | && (pptviewobj[id].previewpath!=NULL&&strlen(pptviewobj[id].previewpath)>0)) | 627 | && (pptviewobj[id].previewpath!=NULL&&strlen(pptviewobj[id].previewpath)>0)) |
4351 | 628 | { | 628 | { |
4352 | 629 | sprintf_s(filename, MAX_PATH, "%s%i.bmp", pptviewobj[id].previewpath, pptviewobj[id].currentSlide); | 629 | sprintf_s(filename, MAX_PATH, "%s%i.bmp", pptviewobj[id].previewpath, pptviewobj[id].currentSlide); |
4353 | 630 | CaptureAndSaveWindow(cwp->hwnd, filename); | 630 | CaptureAndSaveWindow(cwp->hwnd, filename); |
4354 | 631 | } | 631 | } |
4355 | 632 | } | 632 | } |
4356 | 633 | if(cwp->wParam==0) | 633 | if(cwp->wParam==0) |
4357 | 634 | { | 634 | { |
4358 | 635 | if(pptviewobj[id].currentSlide>0) | 635 | if(pptviewobj[id].currentSlide>0) |
4359 | 636 | { | 636 | { |
4360 | 637 | pptviewobj[id].state = PPT_LOADED; | 637 | pptviewobj[id].state = PPT_LOADED; |
4361 | 638 | pptviewobj[id].currentSlide = pptviewobj[id].slideCount+1; | 638 | pptviewobj[id].currentSlide = pptviewobj[id].slideCount+1; |
4362 | 639 | } | 639 | } |
4363 | 640 | } | 640 | } |
4364 | 641 | else | 641 | else |
4365 | 642 | { | 642 | { |
4366 | 643 | pptviewobj[id].currentSlide = cwp->wParam - 255; | 643 | pptviewobj[id].currentSlide = cwp->wParam - 255; |
4367 | 644 | if(pptviewobj[id].currentSlide>pptviewobj[id].slideCount) | 644 | if(pptviewobj[id].currentSlide>pptviewobj[id].slideCount) |
4368 | 645 | pptviewobj[id].slideCount = pptviewobj[id].currentSlide; | 645 | pptviewobj[id].slideCount = pptviewobj[id].currentSlide; |
4369 | 646 | } | 646 | } |
4370 | 647 | } | 647 | } |
4371 | 648 | if((pptviewobj[id].state != PPT_CLOSED)&&(cwp->message==WM_CLOSE||cwp->message==WM_QUIT)) | 648 | if((pptviewobj[id].state != PPT_CLOSED)&&(cwp->message==WM_CLOSE||cwp->message==WM_QUIT)) |
4372 | 649 | pptviewobj[id].state = PPT_CLOSING; | 649 | pptviewobj[id].state = PPT_CLOSING; |
4373 | 650 | } | 650 | } |
4374 | 651 | return CallNextHookEx(hook,nCode,wParam,lParam); | 651 | return CallNextHookEx(hook,nCode,wParam,lParam); |
4375 | 652 | } | 652 | } |
4376 | 653 | 653 | ||
4377 | 654 | VOID CaptureAndSaveWindow(HWND hWnd, CHAR* filename) | 654 | VOID CaptureAndSaveWindow(HWND hWnd, CHAR* filename) |
4378 | 655 | { | 655 | { |
4379 | 656 | HBITMAP hBmp; | 656 | HBITMAP hBmp; |
4380 | 657 | if ((hBmp = CaptureWindow(hWnd)) == NULL) | 657 | if ((hBmp = CaptureWindow(hWnd)) == NULL) |
4381 | 658 | return; | 658 | return; |
4382 | 659 | 659 | ||
4383 | 660 | RECT client; | 660 | RECT client; |
4384 | 661 | GetClientRect (hWnd, &client); | 661 | GetClientRect (hWnd, &client); |
4385 | 662 | UINT uiBytesPerRow = 3 * client.right; // RGB takes 24 bits | 662 | UINT uiBytesPerRow = 3 * client.right; // RGB takes 24 bits |
4386 | 663 | UINT uiRemainderForPadding; | 663 | UINT uiRemainderForPadding; |
4387 | 664 | 664 | ||
4388 | 665 | if ((uiRemainderForPadding = uiBytesPerRow % sizeof (DWORD)) > 0) | 665 | if ((uiRemainderForPadding = uiBytesPerRow % sizeof (DWORD)) > 0) |
4389 | 666 | uiBytesPerRow += (sizeof (DWORD) - uiRemainderForPadding); | 666 | uiBytesPerRow += (sizeof (DWORD) - uiRemainderForPadding); |
4390 | 667 | 667 | ||
4391 | 668 | UINT uiBytesPerAllRows = uiBytesPerRow * client.bottom; | 668 | UINT uiBytesPerAllRows = uiBytesPerRow * client.bottom; |
4392 | 669 | PBYTE pDataBits; | 669 | PBYTE pDataBits; |
4393 | 670 | 670 | ||
4394 | 671 | if ((pDataBits = new BYTE [uiBytesPerAllRows]) != NULL) | 671 | if ((pDataBits = new BYTE [uiBytesPerAllRows]) != NULL) |
4395 | 672 | { | 672 | { |
4396 | 673 | BITMAPINFOHEADER bmi = {0}; | 673 | BITMAPINFOHEADER bmi = {0}; |
4397 | 674 | BITMAPFILEHEADER bmf = {0}; | 674 | BITMAPFILEHEADER bmf = {0}; |
4398 | 675 | 675 | ||
4399 | 676 | // Prepare to get the data out of HBITMAP: | 676 | // Prepare to get the data out of HBITMAP: |
4400 | 677 | bmi.biSize = sizeof (bmi); | 677 | bmi.biSize = sizeof (bmi); |
4401 | 678 | bmi.biPlanes = 1; | 678 | bmi.biPlanes = 1; |
4402 | 679 | bmi.biBitCount = 24; | 679 | bmi.biBitCount = 24; |
4403 | 680 | bmi.biHeight = client.bottom; | 680 | bmi.biHeight = client.bottom; |
4404 | 681 | bmi.biWidth = client.right; | 681 | bmi.biWidth = client.right; |
4405 | 682 | 682 | ||
4406 | 683 | // Get it: | 683 | // Get it: |
4407 | 684 | HDC hDC = GetDC (hWnd); | 684 | HDC hDC = GetDC (hWnd); |
4408 | 685 | GetDIBits (hDC, hBmp, 0, client.bottom, pDataBits, | 685 | GetDIBits (hDC, hBmp, 0, client.bottom, pDataBits, |
4409 | 686 | (BITMAPINFO*) &bmi, DIB_RGB_COLORS); | 686 | (BITMAPINFO*) &bmi, DIB_RGB_COLORS); |
4410 | 687 | ReleaseDC (hWnd, hDC); | 687 | ReleaseDC (hWnd, hDC); |
4411 | 688 | 688 | ||
4412 | 689 | // Fill the file header: | 689 | // Fill the file header: |
4413 | 690 | bmf.bfOffBits = sizeof (bmf) + sizeof (bmi); | 690 | bmf.bfOffBits = sizeof (bmf) + sizeof (bmi); |
4414 | 691 | bmf.bfSize = bmf.bfOffBits + uiBytesPerAllRows; | 691 | bmf.bfSize = bmf.bfOffBits + uiBytesPerAllRows; |
4415 | 692 | bmf.bfType = 0x4D42; | 692 | bmf.bfType = 0x4D42; |
4416 | 693 | 693 | ||
4417 | 694 | // Writing: | 694 | // Writing: |
4418 | 695 | FILE* pFile; | 695 | FILE* pFile; |
4419 | 696 | int err = fopen_s(&pFile, filename, "wb"); | 696 | int err = fopen_s(&pFile, filename, "wb"); |
4420 | 697 | if (err == 0) | 697 | if (err == 0) |
4421 | 698 | { | 698 | { |
4422 | 699 | fwrite (&bmf, sizeof (bmf), 1, pFile); | 699 | fwrite (&bmf, sizeof (bmf), 1, pFile); |
4423 | 700 | fwrite (&bmi, sizeof (bmi), 1, pFile); | 700 | fwrite (&bmi, sizeof (bmi), 1, pFile); |
4424 | 701 | fwrite (pDataBits, sizeof (BYTE), uiBytesPerAllRows, pFile); | 701 | fwrite (pDataBits, sizeof (BYTE), uiBytesPerAllRows, pFile); |
4425 | 702 | fclose (pFile); | 702 | fclose (pFile); |
4426 | 703 | } | 703 | } |
4427 | 704 | delete [] pDataBits; | 704 | delete [] pDataBits; |
4428 | 705 | } | 705 | } |
4429 | 706 | DeleteObject (hBmp); | 706 | DeleteObject (hBmp); |
4430 | 707 | } | 707 | } |
4431 | 708 | HBITMAP CaptureWindow (HWND hWnd) { | 708 | HBITMAP CaptureWindow (HWND hWnd) { |
4432 | 709 | HDC hDC; | 709 | HDC hDC; |
4433 | 710 | BOOL bOk = FALSE; | 710 | BOOL bOk = FALSE; |
4434 | 711 | HBITMAP hImage = NULL; | 711 | HBITMAP hImage = NULL; |
4435 | 712 | 712 | ||
4436 | 713 | hDC = GetDC (hWnd); | 713 | hDC = GetDC (hWnd); |
4437 | 714 | RECT rcClient; | 714 | RECT rcClient; |
4438 | 715 | GetClientRect (hWnd, &rcClient); | 715 | GetClientRect (hWnd, &rcClient); |
4439 | 716 | if ((hImage = CreateCompatibleBitmap (hDC, rcClient.right, rcClient.bottom)) != NULL) | 716 | if ((hImage = CreateCompatibleBitmap (hDC, rcClient.right, rcClient.bottom)) != NULL) |
4440 | 717 | { | 717 | { |
4441 | 718 | HDC hMemDC; | 718 | HDC hMemDC; |
4442 | 719 | HBITMAP hDCBmp; | 719 | HBITMAP hDCBmp; |
4443 | 720 | 720 | ||
4444 | 721 | if ((hMemDC = CreateCompatibleDC (hDC)) != NULL) | 721 | if ((hMemDC = CreateCompatibleDC (hDC)) != NULL) |
4445 | 722 | { | 722 | { |
4446 | 723 | hDCBmp = (HBITMAP) SelectObject (hMemDC, hImage); | 723 | hDCBmp = (HBITMAP) SelectObject (hMemDC, hImage); |
4447 | 724 | HMODULE hLib = LoadLibrary("User32"); | 724 | HMODULE hLib = LoadLibrary("User32"); |
4448 | 725 | // PrintWindow works for windows outside displayable area | 725 | // PrintWindow works for windows outside displayable area |
4449 | 726 | // but was only introduced in WinXP. BitBlt requires the window to be topmost | 726 | // but was only introduced in WinXP. BitBlt requires the window to be topmost |
4450 | 727 | // and within the viewable area of the display | 727 | // and within the viewable area of the display |
4451 | 728 | if(GetProcAddress(hLib, "PrintWindow")==NULL) | 728 | if(GetProcAddress(hLib, "PrintWindow")==NULL) |
4452 | 729 | { | 729 | { |
4453 | 730 | SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE); | 730 | SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE); |
4454 | 731 | BitBlt (hMemDC, 0, 0, rcClient.right, rcClient.bottom, hDC, 0, 0, SRCCOPY); | 731 | BitBlt (hMemDC, 0, 0, rcClient.right, rcClient.bottom, hDC, 0, 0, SRCCOPY); |
4455 | 732 | SetWindowPos(hWnd, HWND_NOTOPMOST, -32000, -32000, 0, 0, SWP_NOSIZE); | 732 | SetWindowPos(hWnd, HWND_NOTOPMOST, -32000, -32000, 0, 0, SWP_NOSIZE); |
4456 | 733 | } | 733 | } |
4457 | 734 | else | 734 | else |
4458 | 735 | { | 735 | { |
4459 | 736 | PrintWindow(hWnd, hMemDC, 0); | 736 | PrintWindow(hWnd, hMemDC, 0); |
4460 | 737 | } | 737 | } |
4461 | 738 | SelectObject (hMemDC, hDCBmp); | 738 | SelectObject (hMemDC, hDCBmp); |
4462 | 739 | DeleteDC (hMemDC); | 739 | DeleteDC (hMemDC); |
4463 | 740 | bOk = TRUE; | 740 | bOk = TRUE; |
4464 | 741 | } | 741 | } |
4465 | 742 | } | 742 | } |
4466 | 743 | ReleaseDC (hWnd, hDC); | 743 | ReleaseDC (hWnd, hDC); |
4467 | 744 | if (! bOk) | 744 | if (! bOk) |
4468 | 745 | { | 745 | { |
4469 | 746 | if (hImage) | 746 | if (hImage) |
4470 | 747 | { | 747 | { |
4471 | 748 | DeleteObject (hImage); | 748 | DeleteObject (hImage); |
4472 | 749 | hImage = NULL; | 749 | hImage = NULL; |
4473 | 750 | } | 750 | } |
4474 | 751 | } | 751 | } |
4475 | 752 | return hImage; | 752 | return hImage; |
4476 | 753 | } | 753 | } |
4477 | 754 | 754 | ||
4478 | === modified file 'openlp/plugins/presentations/lib/pptviewlib/pptviewlib.h' | |||
4479 | --- openlp/plugins/presentations/lib/pptviewlib/pptviewlib.h 2008-12-10 20:40:18 +0000 | |||
4480 | +++ openlp/plugins/presentations/lib/pptviewlib/pptviewlib.h 2009-09-13 15:14:45 +0000 | |||
4481 | @@ -1,54 +1,54 @@ | |||
4535 | 1 | 1 | ||
4536 | 2 | #define DllExport extern "C" __declspec( dllexport ) | 2 | #define DllExport extern "C" __declspec( dllexport ) |
4537 | 3 | 3 | ||
4538 | 4 | enum PPTVIEWSTATE { PPT_CLOSED, PPT_STARTED, PPT_OPENED, PPT_LOADED, PPT_CLOSING}; | 4 | enum PPTVIEWSTATE { PPT_CLOSED, PPT_STARTED, PPT_OPENED, PPT_LOADED, PPT_CLOSING}; |
4539 | 5 | 5 | ||
4540 | 6 | DllExport int OpenPPT(char *filename, HWND hParentWnd, RECT rect, char *previewpath); | 6 | DllExport int OpenPPT(char *filename, HWND hParentWnd, RECT rect, char *previewpath); |
4541 | 7 | DllExport void ClosePPT(int id); | 7 | DllExport void ClosePPT(int id); |
4542 | 8 | DllExport int GetCurrentSlide(int id); | 8 | DllExport int GetCurrentSlide(int id); |
4543 | 9 | DllExport int GetSlideCount(int id); | 9 | DllExport int GetSlideCount(int id); |
4544 | 10 | DllExport void NextStep(int id); | 10 | DllExport void NextStep(int id); |
4545 | 11 | DllExport void PrevStep(int id); | 11 | DllExport void PrevStep(int id); |
4546 | 12 | DllExport void GotoSlide(int id, int slideno); | 12 | DllExport void GotoSlide(int id, int slideno); |
4547 | 13 | DllExport void RestartShow(int id); | 13 | DllExport void RestartShow(int id); |
4548 | 14 | DllExport void Blank(int id); | 14 | DllExport void Blank(int id); |
4549 | 15 | DllExport void Unblank(int id); | 15 | DllExport void Unblank(int id); |
4550 | 16 | DllExport void Stop(int id); | 16 | DllExport void Stop(int id); |
4551 | 17 | DllExport void Resume(int id); | 17 | DllExport void Resume(int id); |
4552 | 18 | DllExport void SetDebug(BOOL onoff); | 18 | DllExport void SetDebug(BOOL onoff); |
4553 | 19 | 19 | ||
4554 | 20 | LRESULT CALLBACK CbtProc(int nCode, WPARAM wParam, LPARAM lParam); | 20 | LRESULT CALLBACK CbtProc(int nCode, WPARAM wParam, LPARAM lParam); |
4555 | 21 | LRESULT CALLBACK CwpProc(int nCode, WPARAM wParam, LPARAM lParam); | 21 | LRESULT CALLBACK CwpProc(int nCode, WPARAM wParam, LPARAM lParam); |
4556 | 22 | LRESULT CALLBACK GetMsgProc(int nCode, WPARAM wParam, LPARAM lParam); | 22 | LRESULT CALLBACK GetMsgProc(int nCode, WPARAM wParam, LPARAM lParam); |
4557 | 23 | BOOL GetPPTViewerPath(char *pptviewerpath, int strsize); | 23 | BOOL GetPPTViewerPath(char *pptviewerpath, int strsize); |
4558 | 24 | HBITMAP CaptureWindow (HWND hWnd); | 24 | HBITMAP CaptureWindow (HWND hWnd); |
4559 | 25 | VOID SaveBitmap (CHAR* filename, HBITMAP hBmp) ; | 25 | VOID SaveBitmap (CHAR* filename, HBITMAP hBmp) ; |
4560 | 26 | VOID CaptureAndSaveWindow(HWND hWnd, CHAR* filename); | 26 | VOID CaptureAndSaveWindow(HWND hWnd, CHAR* filename); |
4561 | 27 | BOOL GetPPTInfo(int id); | 27 | BOOL GetPPTInfo(int id); |
4562 | 28 | BOOL SavePPTInfo(int id); | 28 | BOOL SavePPTInfo(int id); |
4563 | 29 | 29 | ||
4564 | 30 | 30 | ||
4565 | 31 | void Unhook(int id); | 31 | void Unhook(int id); |
4566 | 32 | 32 | ||
4567 | 33 | #define MAX_PPTOBJS 50 | 33 | #define MAX_PPTOBJS 50 |
4568 | 34 | 34 | ||
4569 | 35 | struct PPTVIEWOBJ | 35 | struct PPTVIEWOBJ |
4570 | 36 | { | 36 | { |
4571 | 37 | HHOOK hook; | 37 | HHOOK hook; |
4572 | 38 | HHOOK mhook; | 38 | HHOOK mhook; |
4573 | 39 | HWND hWnd; | 39 | HWND hWnd; |
4574 | 40 | HWND hWnd2; | 40 | HWND hWnd2; |
4575 | 41 | HWND hParentWnd; | 41 | HWND hParentWnd; |
4576 | 42 | HANDLE hProcess; | 42 | HANDLE hProcess; |
4577 | 43 | HANDLE hThread; | 43 | HANDLE hThread; |
4578 | 44 | DWORD dwProcessId; | 44 | DWORD dwProcessId; |
4579 | 45 | DWORD dwThreadId; | 45 | DWORD dwThreadId; |
4580 | 46 | RECT rect; | 46 | RECT rect; |
4581 | 47 | int slideCount; | 47 | int slideCount; |
4582 | 48 | int currentSlide; | 48 | int currentSlide; |
4583 | 49 | int firstSlideSteps; | 49 | int firstSlideSteps; |
4584 | 50 | int steps; | 50 | int steps; |
4585 | 51 | char filename[MAX_PATH]; | 51 | char filename[MAX_PATH]; |
4586 | 52 | char previewpath[MAX_PATH]; | 52 | char previewpath[MAX_PATH]; |
4587 | 53 | PPTVIEWSTATE state; | 53 | PPTVIEWSTATE state; |
4588 | 54 | }; | 54 | }; |
4589 | 55 | \ No newline at end of file | 55 | \ No newline at end of file |
4590 | 56 | 56 | ||
4591 | === modified file 'openlp/plugins/presentations/lib/pptviewlib/pptviewlib.vcproj' | |||
4592 | --- openlp/plugins/presentations/lib/pptviewlib/pptviewlib.vcproj 2008-12-10 20:40:18 +0000 | |||
4593 | +++ openlp/plugins/presentations/lib/pptviewlib/pptviewlib.vcproj 2009-09-13 15:14:45 +0000 | |||
4594 | @@ -1,203 +1,203 @@ | |||
4798 | 1 | <?xml version="1.0" encoding="Windows-1252"?> | 1 | <?xml version="1.0" encoding="Windows-1252"?> |
4799 | 2 | <VisualStudioProject | 2 | <VisualStudioProject |
4800 | 3 | ProjectType="Visual C++" | 3 | ProjectType="Visual C++" |
4801 | 4 | Version="9.00" | 4 | Version="9.00" |
4802 | 5 | Name="pptviewlib" | 5 | Name="pptviewlib" |
4803 | 6 | ProjectGUID="{04CC20D1-DC5A-4189-8181-4011E3C21DCF}" | 6 | ProjectGUID="{04CC20D1-DC5A-4189-8181-4011E3C21DCF}" |
4804 | 7 | RootNamespace="pptviewlib" | 7 | RootNamespace="pptviewlib" |
4805 | 8 | Keyword="Win32Proj" | 8 | Keyword="Win32Proj" |
4806 | 9 | TargetFrameworkVersion="196613" | 9 | TargetFrameworkVersion="196613" |
4807 | 10 | > | 10 | > |
4808 | 11 | <Platforms> | 11 | <Platforms> |
4809 | 12 | <Platform | 12 | <Platform |
4810 | 13 | Name="Win32" | 13 | Name="Win32" |
4811 | 14 | /> | 14 | /> |
4812 | 15 | </Platforms> | 15 | </Platforms> |
4813 | 16 | <ToolFiles> | 16 | <ToolFiles> |
4814 | 17 | </ToolFiles> | 17 | </ToolFiles> |
4815 | 18 | <Configurations> | 18 | <Configurations> |
4816 | 19 | <Configuration | 19 | <Configuration |
4817 | 20 | Name="Debug|Win32" | 20 | Name="Debug|Win32" |
4818 | 21 | OutputDirectory="$(SolutionDir)$(ConfigurationName)" | 21 | OutputDirectory="$(SolutionDir)$(ConfigurationName)" |
4819 | 22 | IntermediateDirectory="$(ConfigurationName)" | 22 | IntermediateDirectory="$(ConfigurationName)" |
4820 | 23 | ConfigurationType="2" | 23 | ConfigurationType="2" |
4821 | 24 | CharacterSet="2" | 24 | CharacterSet="2" |
4822 | 25 | > | 25 | > |
4823 | 26 | <Tool | 26 | <Tool |
4824 | 27 | Name="VCPreBuildEventTool" | 27 | Name="VCPreBuildEventTool" |
4825 | 28 | /> | 28 | /> |
4826 | 29 | <Tool | 29 | <Tool |
4827 | 30 | Name="VCCustomBuildTool" | 30 | Name="VCCustomBuildTool" |
4828 | 31 | /> | 31 | /> |
4829 | 32 | <Tool | 32 | <Tool |
4830 | 33 | Name="VCXMLDataGeneratorTool" | 33 | Name="VCXMLDataGeneratorTool" |
4831 | 34 | /> | 34 | /> |
4832 | 35 | <Tool | 35 | <Tool |
4833 | 36 | Name="VCWebServiceProxyGeneratorTool" | 36 | Name="VCWebServiceProxyGeneratorTool" |
4834 | 37 | /> | 37 | /> |
4835 | 38 | <Tool | 38 | <Tool |
4836 | 39 | Name="VCMIDLTool" | 39 | Name="VCMIDLTool" |
4837 | 40 | /> | 40 | /> |
4838 | 41 | <Tool | 41 | <Tool |
4839 | 42 | Name="VCCLCompilerTool" | 42 | Name="VCCLCompilerTool" |
4840 | 43 | Optimization="0" | 43 | Optimization="0" |
4841 | 44 | PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PPTVIEWLIB_EXPORTS" | 44 | PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PPTVIEWLIB_EXPORTS" |
4842 | 45 | MinimalRebuild="true" | 45 | MinimalRebuild="true" |
4843 | 46 | BasicRuntimeChecks="3" | 46 | BasicRuntimeChecks="3" |
4844 | 47 | RuntimeLibrary="3" | 47 | RuntimeLibrary="3" |
4845 | 48 | UsePrecompiledHeader="0" | 48 | UsePrecompiledHeader="0" |
4846 | 49 | WarningLevel="3" | 49 | WarningLevel="3" |
4847 | 50 | DebugInformationFormat="4" | 50 | DebugInformationFormat="4" |
4848 | 51 | /> | 51 | /> |
4849 | 52 | <Tool | 52 | <Tool |
4850 | 53 | Name="VCManagedResourceCompilerTool" | 53 | Name="VCManagedResourceCompilerTool" |
4851 | 54 | /> | 54 | /> |
4852 | 55 | <Tool | 55 | <Tool |
4853 | 56 | Name="VCResourceCompilerTool" | 56 | Name="VCResourceCompilerTool" |
4854 | 57 | /> | 57 | /> |
4855 | 58 | <Tool | 58 | <Tool |
4856 | 59 | Name="VCPreLinkEventTool" | 59 | Name="VCPreLinkEventTool" |
4857 | 60 | /> | 60 | /> |
4858 | 61 | <Tool | 61 | <Tool |
4859 | 62 | Name="VCLinkerTool" | 62 | Name="VCLinkerTool" |
4860 | 63 | LinkIncremental="2" | 63 | LinkIncremental="2" |
4861 | 64 | ModuleDefinitionFile="" | 64 | ModuleDefinitionFile="" |
4862 | 65 | GenerateDebugInformation="true" | 65 | GenerateDebugInformation="true" |
4863 | 66 | SubSystem="2" | 66 | SubSystem="2" |
4864 | 67 | TargetMachine="1" | 67 | TargetMachine="1" |
4865 | 68 | /> | 68 | /> |
4866 | 69 | <Tool | 69 | <Tool |
4867 | 70 | Name="VCALinkTool" | 70 | Name="VCALinkTool" |
4868 | 71 | /> | 71 | /> |
4869 | 72 | <Tool | 72 | <Tool |
4870 | 73 | Name="VCManifestTool" | 73 | Name="VCManifestTool" |
4871 | 74 | /> | 74 | /> |
4872 | 75 | <Tool | 75 | <Tool |
4873 | 76 | Name="VCXDCMakeTool" | 76 | Name="VCXDCMakeTool" |
4874 | 77 | /> | 77 | /> |
4875 | 78 | <Tool | 78 | <Tool |
4876 | 79 | Name="VCBscMakeTool" | 79 | Name="VCBscMakeTool" |
4877 | 80 | /> | 80 | /> |
4878 | 81 | <Tool | 81 | <Tool |
4879 | 82 | Name="VCFxCopTool" | 82 | Name="VCFxCopTool" |
4880 | 83 | /> | 83 | /> |
4881 | 84 | <Tool | 84 | <Tool |
4882 | 85 | Name="VCAppVerifierTool" | 85 | Name="VCAppVerifierTool" |
4883 | 86 | /> | 86 | /> |
4884 | 87 | <Tool | 87 | <Tool |
4885 | 88 | Name="VCPostBuildEventTool" | 88 | Name="VCPostBuildEventTool" |
4886 | 89 | /> | 89 | /> |
4887 | 90 | </Configuration> | 90 | </Configuration> |
4888 | 91 | <Configuration | 91 | <Configuration |
4889 | 92 | Name="Release|Win32" | 92 | Name="Release|Win32" |
4890 | 93 | OutputDirectory="$(SolutionDir)$(ConfigurationName)" | 93 | OutputDirectory="$(SolutionDir)$(ConfigurationName)" |
4891 | 94 | IntermediateDirectory="$(ConfigurationName)" | 94 | IntermediateDirectory="$(ConfigurationName)" |
4892 | 95 | ConfigurationType="2" | 95 | ConfigurationType="2" |
4893 | 96 | CharacterSet="1" | 96 | CharacterSet="1" |
4894 | 97 | WholeProgramOptimization="1" | 97 | WholeProgramOptimization="1" |
4895 | 98 | > | 98 | > |
4896 | 99 | <Tool | 99 | <Tool |
4897 | 100 | Name="VCPreBuildEventTool" | 100 | Name="VCPreBuildEventTool" |
4898 | 101 | /> | 101 | /> |
4899 | 102 | <Tool | 102 | <Tool |
4900 | 103 | Name="VCCustomBuildTool" | 103 | Name="VCCustomBuildTool" |
4901 | 104 | /> | 104 | /> |
4902 | 105 | <Tool | 105 | <Tool |
4903 | 106 | Name="VCXMLDataGeneratorTool" | 106 | Name="VCXMLDataGeneratorTool" |
4904 | 107 | /> | 107 | /> |
4905 | 108 | <Tool | 108 | <Tool |
4906 | 109 | Name="VCWebServiceProxyGeneratorTool" | 109 | Name="VCWebServiceProxyGeneratorTool" |
4907 | 110 | /> | 110 | /> |
4908 | 111 | <Tool | 111 | <Tool |
4909 | 112 | Name="VCMIDLTool" | 112 | Name="VCMIDLTool" |
4910 | 113 | /> | 113 | /> |
4911 | 114 | <Tool | 114 | <Tool |
4912 | 115 | Name="VCCLCompilerTool" | 115 | Name="VCCLCompilerTool" |
4913 | 116 | Optimization="2" | 116 | Optimization="2" |
4914 | 117 | EnableIntrinsicFunctions="true" | 117 | EnableIntrinsicFunctions="true" |
4915 | 118 | PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PPTVIEWLIB_EXPORTS" | 118 | PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PPTVIEWLIB_EXPORTS" |
4916 | 119 | RuntimeLibrary="2" | 119 | RuntimeLibrary="2" |
4917 | 120 | EnableFunctionLevelLinking="true" | 120 | EnableFunctionLevelLinking="true" |
4918 | 121 | UsePrecompiledHeader="2" | 121 | UsePrecompiledHeader="2" |
4919 | 122 | WarningLevel="3" | 122 | WarningLevel="3" |
4920 | 123 | DebugInformationFormat="3" | 123 | DebugInformationFormat="3" |
4921 | 124 | /> | 124 | /> |
4922 | 125 | <Tool | 125 | <Tool |
4923 | 126 | Name="VCManagedResourceCompilerTool" | 126 | Name="VCManagedResourceCompilerTool" |
4924 | 127 | /> | 127 | /> |
4925 | 128 | <Tool | 128 | <Tool |
4926 | 129 | Name="VCResourceCompilerTool" | 129 | Name="VCResourceCompilerTool" |
4927 | 130 | /> | 130 | /> |
4928 | 131 | <Tool | 131 | <Tool |
4929 | 132 | Name="VCPreLinkEventTool" | 132 | Name="VCPreLinkEventTool" |
4930 | 133 | /> | 133 | /> |
4931 | 134 | <Tool | 134 | <Tool |
4932 | 135 | Name="VCLinkerTool" | 135 | Name="VCLinkerTool" |
4933 | 136 | LinkIncremental="1" | 136 | LinkIncremental="1" |
4934 | 137 | ModuleDefinitionFile="pptviewlib.def" | 137 | ModuleDefinitionFile="pptviewlib.def" |
4935 | 138 | GenerateDebugInformation="true" | 138 | GenerateDebugInformation="true" |
4936 | 139 | SubSystem="2" | 139 | SubSystem="2" |
4937 | 140 | OptimizeReferences="2" | 140 | OptimizeReferences="2" |
4938 | 141 | EnableCOMDATFolding="2" | 141 | EnableCOMDATFolding="2" |
4939 | 142 | TargetMachine="1" | 142 | TargetMachine="1" |
4940 | 143 | /> | 143 | /> |
4941 | 144 | <Tool | 144 | <Tool |
4942 | 145 | Name="VCALinkTool" | 145 | Name="VCALinkTool" |
4943 | 146 | /> | 146 | /> |
4944 | 147 | <Tool | 147 | <Tool |
4945 | 148 | Name="VCManifestTool" | 148 | Name="VCManifestTool" |
4946 | 149 | /> | 149 | /> |
4947 | 150 | <Tool | 150 | <Tool |
4948 | 151 | Name="VCXDCMakeTool" | 151 | Name="VCXDCMakeTool" |
4949 | 152 | /> | 152 | /> |
4950 | 153 | <Tool | 153 | <Tool |
4951 | 154 | Name="VCBscMakeTool" | 154 | Name="VCBscMakeTool" |
4952 | 155 | /> | 155 | /> |
4953 | 156 | <Tool | 156 | <Tool |
4954 | 157 | Name="VCFxCopTool" | 157 | Name="VCFxCopTool" |
4955 | 158 | /> | 158 | /> |
4956 | 159 | <Tool | 159 | <Tool |
4957 | 160 | Name="VCAppVerifierTool" | 160 | Name="VCAppVerifierTool" |
4958 | 161 | /> | 161 | /> |
4959 | 162 | <Tool | 162 | <Tool |
4960 | 163 | Name="VCPostBuildEventTool" | 163 | Name="VCPostBuildEventTool" |
4961 | 164 | /> | 164 | /> |
4962 | 165 | </Configuration> | 165 | </Configuration> |
4963 | 166 | </Configurations> | 166 | </Configurations> |
4964 | 167 | <References> | 167 | <References> |
4965 | 168 | </References> | 168 | </References> |
4966 | 169 | <Files> | 169 | <Files> |
4967 | 170 | <Filter | 170 | <Filter |
4968 | 171 | Name="Source Files" | 171 | Name="Source Files" |
4969 | 172 | Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" | 172 | Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" |
4970 | 173 | UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" | 173 | UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" |
4971 | 174 | > | 174 | > |
4972 | 175 | <File | 175 | <File |
4973 | 176 | RelativePath=".\pptviewlib.cpp" | 176 | RelativePath=".\pptviewlib.cpp" |
4974 | 177 | > | 177 | > |
4975 | 178 | </File> | 178 | </File> |
4976 | 179 | <File | 179 | <File |
4977 | 180 | RelativePath=".\README.TXT" | 180 | RelativePath=".\README.TXT" |
4978 | 181 | > | 181 | > |
4979 | 182 | </File> | 182 | </File> |
4980 | 183 | </Filter> | 183 | </Filter> |
4981 | 184 | <Filter | 184 | <Filter |
4982 | 185 | Name="Header Files" | 185 | Name="Header Files" |
4983 | 186 | Filter="h;hpp;hxx;hm;inl;inc;xsd" | 186 | Filter="h;hpp;hxx;hm;inl;inc;xsd" |
4984 | 187 | UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" | 187 | UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" |
4985 | 188 | > | 188 | > |
4986 | 189 | <File | 189 | <File |
4987 | 190 | RelativePath=".\pptviewlib.h" | 190 | RelativePath=".\pptviewlib.h" |
4988 | 191 | > | 191 | > |
4989 | 192 | </File> | 192 | </File> |
4990 | 193 | </Filter> | 193 | </Filter> |
4991 | 194 | <Filter | 194 | <Filter |
4992 | 195 | Name="Resource Files" | 195 | Name="Resource Files" |
4993 | 196 | Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" | 196 | Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" |
4994 | 197 | UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" | 197 | UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" |
4995 | 198 | > | 198 | > |
4996 | 199 | </Filter> | 199 | </Filter> |
4997 | 200 | </Files> | 200 | </Files> |
4998 | 201 | <Globals> | 201 | <Globals> |
4999 | 202 | </Globals> | 202 | </Globals> |
5000 | 203 | </VisualStudioProject> | 203 | </VisualStudioProject> |
The diff has been truncated for viewing.
dos2unix