forked from openlp/openlp
Extra location checks for pptview.exe. Remove dll from bzr and change windows build to create it (without debug)
bzr-revno: 1480
This commit is contained in:
commit
e352635511
@ -27,6 +27,8 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <io.h>
|
||||
#include <direct.h>
|
||||
#include <time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
@ -88,7 +90,12 @@ DllExport BOOL CheckInstalled()
|
||||
char cmdLine[MAX_PATH * 2];
|
||||
|
||||
DEBUG("CheckInstalled\n");
|
||||
return GetPPTViewerPath(cmdLine, sizeof(cmdLine));
|
||||
BOOL found = GetPPTViewerPath(cmdLine, sizeof(cmdLine));
|
||||
if(found)
|
||||
{
|
||||
DEBUG("Exe: %s\n", cmdLine);
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
// Open the PointPoint, count the slides and take a snapshot of each slide
|
||||
@ -160,7 +167,7 @@ DllExport int OpenPPT(char *filename, HWND hParentWnd, RECT rect,
|
||||
pptView[id].rect.bottom = rect.bottom;
|
||||
pptView[id].rect.right = rect.right;
|
||||
}
|
||||
strcat_s(cmdLine, MAX_PATH * 2, "/F /S \"");
|
||||
strcat_s(cmdLine, MAX_PATH * 2, " /F /S \"");
|
||||
strcat_s(cmdLine, MAX_PATH * 2, filename);
|
||||
strcat_s(cmdLine, MAX_PATH * 2, "\"");
|
||||
memset(&si, 0, sizeof(si));
|
||||
@ -189,7 +196,7 @@ DllExport int OpenPPT(char *filename, HWND hParentWnd, RECT rect,
|
||||
Sleep(10);
|
||||
if (!CreateProcess(NULL, cmdLine, NULL, NULL, FALSE, 0, 0, NULL, &si, &pi))
|
||||
{
|
||||
DEBUG("OpenPPT: CreateProcess failed\n");
|
||||
DEBUG("OpenPPT: CreateProcess failed: %s\n", cmdLine);
|
||||
ClosePPT(id);
|
||||
return -1;
|
||||
}
|
||||
@ -344,16 +351,71 @@ BOOL SavePPTInfo(int id)
|
||||
|
||||
// Get the path of the PowerPoint viewer from the registry
|
||||
BOOL GetPPTViewerPath(char *pptViewerPath, int stringSize)
|
||||
{
|
||||
char cwd[MAX_PATH];
|
||||
|
||||
DEBUG("GetPPTViewerPath: start\n");
|
||||
if(GetPPTViewerPathFromReg(pptViewerPath, stringSize))
|
||||
{
|
||||
if(_access(pptViewerPath, 0) != -1)
|
||||
{
|
||||
DEBUG("GetPPTViewerPath: exit registry\n");
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
// This is where it gets ugly. PPT2007 it seems no longer stores its
|
||||
// location in the registry. So we have to use the defaults which will
|
||||
// upset those who like to put things somewhere else
|
||||
|
||||
// Viewer 2007 in 64bit Windows:
|
||||
if(_access("C:\\Program Files (x86)\\Microsoft Office\\Office12\\PPTVIEW.EXE",
|
||||
0) != -1)
|
||||
{
|
||||
strcpy_s(
|
||||
"C:\\Program Files (x86)\\Microsoft Office\\Office12\\PPTVIEW.EXE",
|
||||
stringSize, pptViewerPath);
|
||||
DEBUG("GetPPTViewerPath: exit 64bit 2007\n");
|
||||
return TRUE;
|
||||
}
|
||||
// Viewer 2007 in 32bit Windows:
|
||||
if(_access("C:\\Program Files\\Microsoft Office\\Office12\\PPTVIEW.EXE", 0)
|
||||
!= -1)
|
||||
{
|
||||
strcpy_s("C:\\Program Files\\Microsoft Office\\Office12\\PPTVIEW.EXE",
|
||||
stringSize, pptViewerPath);
|
||||
DEBUG("GetPPTViewerPath: exit 32bit 2007\n");
|
||||
return TRUE;
|
||||
}
|
||||
// Give them the opportunity to place it in the same folder as the app
|
||||
_getcwd(cwd, MAX_PATH);
|
||||
strcat_s(cwd, MAX_PATH, "\\PPTVIEW.EXE");
|
||||
if(_access(cwd, 0) != -1)
|
||||
{
|
||||
strcpy_s(pptViewerPath, stringSize, cwd);
|
||||
DEBUG("GetPPTViewerPath: exit local\n");
|
||||
return TRUE;
|
||||
}
|
||||
DEBUG("GetPPTViewerPath: exit fail\n");
|
||||
return FALSE;
|
||||
}
|
||||
BOOL GetPPTViewerPathFromReg(char *pptViewerPath, int stringSize)
|
||||
{
|
||||
HKEY hKey;
|
||||
DWORD dwType, dwSize;
|
||||
LRESULT lResult;
|
||||
|
||||
DEBUG("GetPPTViewerPath: start\n");
|
||||
// The following registry settings are for, respectively, (I think)
|
||||
// PPT Viewer 2007 (older versions. Latest not in registry) & PPT Viewer 2010
|
||||
// PPT Viewer 2003 (recent versions)
|
||||
// PPT Viewer 2003 (older versions)
|
||||
// PPT Viewer 97
|
||||
if ((RegOpenKeyEx(HKEY_CLASSES_ROOT,
|
||||
"PowerPointViewer.Show.12\\shell\\Show\\command", 0, KEY_READ, &hKey)
|
||||
!= ERROR_SUCCESS)
|
||||
&& (RegOpenKeyEx(HKEY_CLASSES_ROOT,
|
||||
"PowerPointViewer.Show.11\\shell\\Show\\command", 0, KEY_READ, &hKey)
|
||||
!= ERROR_SUCCESS)
|
||||
&& (RegOpenKeyEx(HKEY_CLASSES_ROOT,
|
||||
"Applications\\PPTVIEW.EXE\\shell\\open\\command", 0, KEY_READ, &hKey)
|
||||
!= ERROR_SUCCESS)
|
||||
&& (RegOpenKeyEx(HKEY_CLASSES_ROOT,
|
||||
@ -373,7 +435,6 @@ BOOL GetPPTViewerPath(char *pptViewerPath, int stringSize)
|
||||
}
|
||||
// remove "%1" from end of key value
|
||||
pptViewerPath[strlen(pptViewerPath) - 4] = '\0';
|
||||
DEBUG("GetPPTViewerPath: exit ok\n");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
Binary file not shown.
@ -49,6 +49,7 @@ LRESULT CALLBACK CbtProc(int nCode, WPARAM wParam, LPARAM lParam);
|
||||
LRESULT CALLBACK CwpProc(int nCode, WPARAM wParam, LPARAM lParam);
|
||||
LRESULT CALLBACK GetMsgProc(int nCode, WPARAM wParam, LPARAM lParam);
|
||||
BOOL GetPPTViewerPath(char *pptViewerPath, int stringSize);
|
||||
BOOL GetPPTViewerPathFromReg(char *pptViewerPath, int stringSize);
|
||||
HBITMAP CaptureWindow(HWND hWnd);
|
||||
VOID SaveBitmap(CHAR* filename, HBITMAP hBmp) ;
|
||||
VOID CaptureAndSaveWindow(HWND hWnd, CHAR* filename);
|
||||
|
@ -52,6 +52,12 @@ UPX
|
||||
http://upx.sourceforge.net/, extract it into C:\%PROGRAMFILES%\UPX, and then
|
||||
add that directory to your PATH environment variable.
|
||||
|
||||
Sphinx
|
||||
This is used to build the documentation
|
||||
|
||||
HTML Help Workshop
|
||||
This is used to create the help file
|
||||
|
||||
PyInstaller
|
||||
PyInstaller should be a checkout of revision 844 of trunk, and in a
|
||||
directory called, "pyinstaller" on the same level as OpenLP's Bazaar shared
|
||||
@ -81,6 +87,10 @@ OpenLP
|
||||
shared repository directory. This means your code should be in a directory
|
||||
structure like this: "openlp\branch-name".
|
||||
|
||||
Visual C++ 2008 Express Edition
|
||||
This is to build pptviewlib.dll, the library for controlling the
|
||||
PowerPointViewer
|
||||
|
||||
windows-builder.py
|
||||
This script, of course. It should be in the "scripts" directory of OpenLP.
|
||||
|
||||
@ -98,6 +108,8 @@ sphinx_exe = os.path.join(os.path.split(python_exe)[0], u'Scripts',
|
||||
u'sphinx-build.exe')
|
||||
hhc_exe = os.path.join(os.getenv(u'PROGRAMFILES'), 'HTML Help Workshop',
|
||||
u'hhc.exe')
|
||||
vcbuild_exe = os.path.join(os.getenv(u'PROGRAMFILES'),
|
||||
u'Microsoft Visual Studio 9.0', u'VC', u'vcpackages', u'vcbuild.exe')
|
||||
|
||||
# Base paths
|
||||
script_path = os.path.split(os.path.abspath(__file__))[0]
|
||||
@ -119,6 +131,8 @@ winres_path = os.path.join(branch_path, u'resources', u'windows')
|
||||
build_path = os.path.join(branch_path, u'build', u'pyi.win32', u'OpenLP')
|
||||
dist_path = os.path.join(branch_path, u'dist', u'OpenLP')
|
||||
enchant_path = os.path.join(site_packages, u'enchant')
|
||||
pptviewlib_path = os.path.join(source_path, u'plugins', u'presentations',
|
||||
u'lib', u'pptviewlib')
|
||||
|
||||
def update_code():
|
||||
os.chdir(branch_path)
|
||||
@ -264,17 +278,40 @@ def run_innosetup():
|
||||
if code != 0:
|
||||
raise Exception(u'Error running Inno Setup')
|
||||
|
||||
def build_pptviewlib():
|
||||
print u'Building PPTVIEWLIB.DLL...'
|
||||
vcbuild = Popen((vcbuild_exe, u'/rebuild',
|
||||
os.path.join(pptviewlib_path, u'pptviewlib.vcproj'), u'Release|Win32'))
|
||||
code = vcbuild.wait()
|
||||
if code != 0:
|
||||
raise Exception(u'Error building pptviewlib.dll')
|
||||
copy(os.path.join(pptviewlib_path, u'Release', u'pptviewlib.dll'),
|
||||
pptviewlib_path)
|
||||
|
||||
def main():
|
||||
skip_update = False
|
||||
import sys
|
||||
if len(sys.argv) > 1 and (sys.argv[1] == u'-v' or sys.argv[1] == u'--verbose'):
|
||||
print "Script path:", script_path
|
||||
print "Branch path:", branch_path
|
||||
print "Source path:", source_path
|
||||
print "\"dist\" path:", dist_path
|
||||
print "PyInstaller:", pyi_build
|
||||
print "Inno Setup path:", innosetup_path
|
||||
print "Windows resources:", winres_path
|
||||
update_code()
|
||||
for arg in sys.argv:
|
||||
if arg == u'-v' or arg == u'--verbose':
|
||||
print "Script path:", script_path
|
||||
print "Branch path:", branch_path
|
||||
print "Source path:", source_path
|
||||
print "\"dist\" path:", dist_path
|
||||
print "PyInstaller:", pyi_build
|
||||
print "Inno Setup path:", innosetup_exe
|
||||
print "Windows resources:", winres_path
|
||||
print "VCBuild path:", vcbuild_exe
|
||||
print "PPTVIEWLIB path:", pptviewlib_path
|
||||
elif arg == u'--skip-update':
|
||||
skip_update = True
|
||||
elif arg == u'/?' or arg == u'-h' or arg == u'--help':
|
||||
print u'Command options:'
|
||||
print u' -v --verbose : More verbose output'
|
||||
print u' --skip-update : Do not update or revert current branch'
|
||||
exit()
|
||||
if not skip_update:
|
||||
update_code()
|
||||
build_pptviewlib()
|
||||
run_pyinstaller()
|
||||
write_version_file()
|
||||
copy_enchant()
|
||||
|
Loading…
Reference in New Issue
Block a user