Commit 40e7ef3a authored by Marcus Meissner's avatar Marcus Meissner Committed by Alexandre Julliard

gphoto.ds: Implemented a libgphoto2 import driver, based on the sane.ds driver.

Wrote a GUI import dialog. With help from Aric Stewart.
parent 125efed8
......@@ -565,6 +565,37 @@ then
CPPFLAGS="$ac_save_CPPFLAGS"
fi
dnl **** Check for libgphoto2 ****
AC_CHECK_PROG(gphoto2_devel,gphoto2-config,gphoto2-config,no)
AC_CHECK_PROG(gphoto2port_devel,gphoto2-port-config,gphoto2-port-config,no)
AC_SUBST(GPHOTO2LIBS,"")
AC_SUBST(GPHOTO2INCL,"")
if test "$gphoto2_devel" != "no" -a "$gphoto2port_devel" != "no"
then
GPHOTO2INCL="`$gphoto2_devel --cflags` `$gphoto2port_devel --cflags`"
GPHOTO2LIBS=""
for i in `$gphoto2_devel --libs` `$gphoto2port_devel --libs`
do
case "$i" in
-L/usr/lib|-L/usr/lib64) ;;
-L*|-l*) GPHOTO2LIBS="$GPHOTO2LIBS $i";;
esac
done
ac_save_CPPFLAGS="$CPPFLAGS"
ac_save_LIBS="$LIBS"
CPPFLAGS="$CPPFLAGS $GPHOTO2INCL"
LIBS="$LIBS $GPHOTO2LIBS"
AC_CHECK_HEADER(gphoto2-camera.h,
[AC_CHECK_LIB(gphoto2,gp_camera_new,
[AC_DEFINE(HAVE_GPHOTO2, 1, [Define if we have libgphoto2 development environment])],
[GPHOTO2LIBS=""
GPHOTO2INCL=""])],
[GPHOTO2LIBS=""
GPHOTO2INCL=""])
LIBS="$ac_save_LIBS"
CPPFLAGS="$ac_save_CPPFLAGS"
fi
dnl **** Check for the ICU library ****
if test "$ac_cv_header_unicode_ubidi_h" = "yes"
then
......@@ -1549,6 +1580,7 @@ dlls/gdi/Makefile
dlls/gdi/tests/Makefile
dlls/glu32/Makefile
dlls/glut32/Makefile
dlls/gphoto2.ds/Makefile
dlls/hhctrl.ocx/Makefile
dlls/iccvid/Makefile
dlls/icmp/Makefile
......
......@@ -60,6 +60,7 @@ BASEDIRS = \
dswave \
dxdiagn \
gdi \
gphoto2.ds \
hhctrl.ocx \
iccvid \
icmp \
......
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = gphoto2.ds
IMPORTS = comctl32 user32 gdi32 kernel32 ntdll
EXTRALIBS = @GPHOTO2LIBS@
EXTRAINCL = @GPHOTO2INCL@
C_SRCS = \
capability.c \
ds_ctrl.c \
ds_image.c \
gphoto2_main.c \
ui.c
RC_SRCS = \
rsrc.rc
@MAKE_DLL_RULES@
### Dependencies:
@ stdcall DS_Entry(ptr long long long ptr)
/*
* English resources for Twain
*
* Copyright 2006 CodeWeavers, Aric Stewart
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
IDD_CAMERAUI DIALOG DISCARDABLE 0, 0, 372, 273
STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | WS_VISIBLE |
WS_CAPTION | WS_SYSMENU
CAPTION "Files on Camera"
MENU 20545
FONT 8, "MS Sans Serif"
BEGIN
CONTROL "List1",IDC_LIST1,"SysListView32", LVS_ICON | WS_BORDER |
WS_TABSTOP,7,7,358,229
DEFPUSHBUTTON "Import Selected",IDC_IMPORT,225,252,56,14
PUSHBUTTON "Import All",IDC_IMPORTALL,7,252,52,14
PUSHBUTTON "Exit",IDC_EXIT,295,252,50,14
END
IDD_DIALOG1 DIALOG DISCARDABLE 0, 0, 186, 46
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE | DS_CENTER | DS_SETFOREGROUND
CAPTION "Transferring"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "Transferring.... Please Wait",IDC_STATIC,53,19,85,8
END
IDD_CONNECTING DIALOG DISCARDABLE 0, 0, 280, 116
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU| WS_VISIBLE | DS_CENTER
CAPTION "Connecting to camera"
FONT 8, "MS Sans Serif"
BEGIN
CONTROL "",IDC_BITMAP,"Static",SS_BITMAP|SS_CENTERIMAGE,4,4,110,110
LTEXT "Connecting to camera... Please Wait",IDC_STATIC,128,58,
116,8
END
/*
* Copyright 2000 Corel Corporation
* Copyright 2006 Marcus Meissner
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _TWAIN32_H
#define _TWAIN32_H
#ifndef __WINE_CONFIG_H
# error You must include config.h first
#endif
#if !defined(HAVE_JPEGLIB_H)
# warning "ghoto2 in twain needs jpeg development headers"
# undef HAVE_GPHOTO2
#endif
#ifdef HAVE_GPHOTO2
/* Hack for gphoto2, who changes behaviour when WIN32 is set. */
#undef WIN32
#include <gphoto2/gphoto2-camera.h>
#define WIN32
#endif
#include <stdio.h>
#ifdef HAVE_JPEGLIB_H
/* This is a hack, so jpeglib.h does not redefine INT32 and the like*/
# define XMD_H
# define UINT8 JPEG_UINT8
# define UINT16 JPEG_UINT16
# undef FAR
# include <jpeglib.h>
# undef UINT16
# ifndef SONAME_LIBJPEG
# define SONAME_LIBJPEG "libjpeg.so"
# endif
#endif
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "twain.h"
#include "wine/list.h"
extern HINSTANCE GPHOTO2_instance;
struct gphoto2_file {
struct list entry;
char *folder;
char *filename;
BOOL download; /* flag for downloading, set by GUI or so */
};
/* internal information about an active data source */
struct tagActiveDS
{
TW_IDENTITY identity; /* identity */
TW_UINT16 currentState; /* current state */
TW_EVENT pendingEvent; /* pending event to be sent to
application */
TW_UINT16 twCC; /* condition code */
HWND hwndOwner; /* window handle of the app */
HWND progressWnd; /* window handle of the scanning window */
#ifdef HAVE_GPHOTO2
Camera *camera;
GPContext *context;
#endif
/* Capabiblities */
TW_UINT32 capXferMech; /* ICAP_XFERMECH */
TW_UINT16 pixeltype; /* ICAP_PIXELTYPE */
TW_UINT16 pixelflavor; /* ICAP_PIXELFLAVOR */
struct list files;
/* Download and decode JPEG STATE */
#ifdef HAVE_GPHOTO2
CameraFile *file;
#endif
#ifdef HAVE_JPEGLIB_H
struct jpeg_source_mgr xjsm;
struct jpeg_decompress_struct jd;
struct jpeg_error_mgr jerr;
#endif
} activeDS;
/* Helper functions */
extern TW_UINT16 GPHOTO2_SaneCapability (pTW_CAPABILITY pCapability, TW_UINT16 action);
/* */
extern TW_UINT16 GPHOTO2_ControlGroupHandler (
pTW_IDENTITY pOrigin, TW_UINT16 DAT, TW_UINT16 MSG, TW_MEMREF pData);
extern TW_UINT16 GPHOTO2_ImageGroupHandler (
pTW_IDENTITY pOrigin, TW_UINT16 DAT, TW_UINT16 MSG, TW_MEMREF pData);
extern TW_UINT16 GPHOTO2_AudioGroupHandler (
pTW_IDENTITY pOrigin, TW_UINT16 DAT, TW_UINT16 MSG, TW_MEMREF pData);
extern TW_UINT16 GPHOTO2_SourceManagerHandler (
pTW_IDENTITY pOrigin, TW_UINT16 DAT, TW_UINT16 MSG, TW_MEMREF pData);
/* Implementation of operation triplets
* From Application to Source (Control Information) */
TW_UINT16 GPHOTO2_CapabilityGet (pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_CapabilityGetCurrent
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_CapabilityGetDefault
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_CapabilityQuerySupport
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_CapabilityReset
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_CapabilitySet
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_CustomDSDataGet
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_CustomDSDataSet
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_AutomaticCaptureDirectory
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_ChangeDirectory
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_FileSystemCopy
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_CreateDirectory
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_FileSystemDelete
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_FormatMedia
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_FileSystemGetClose
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_FileSystemGetFirstFile
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_FileSystemGetInfo
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_FileSystemGetNextFile
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_FileSystemRename
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_ProcessEvent
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_PassThrough
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_PendingXfersEndXfer
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_PendingXfersGet
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_PendingXfersReset
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_PendingXfersStopFeeder
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_SetupFileXferGet
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_SetupFileXferGetDefault
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_SetupFileXferReset
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_SetupFileXferSet
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_SetupFileXfer2Get
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_SetupFileXfer2GetDefault
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_SetupFileXfer2Reset
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_SetupFileXfer2Set
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_SetupMemXferGet
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_GetDSStatus
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_DisableDSUserInterface
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_EnableDSUserInterface
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_EnableDSUIOnly
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_XferGroupGet
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_XferGroupSet
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
/* Implementation of operation triplets
* From Application to Source (Image Information) */
TW_UINT16 GPHOTO2_CIEColorGet
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_ExtImageInfoGet
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_GrayResponseReset
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_GrayResponseSet
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_ImageFileXferGet
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_ImageInfoGet
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_ImageLayoutGet
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_ImageLayoutGetDefault
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_ImageLayoutReset
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_ImageLayoutSet
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_ImageMemXferGet
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_ImageNativeXferGet
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_JPEGCompressionGet
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_JPEGCompressionGetDefault
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_JPEGCompressionReset
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_JPEGCompressionSet
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_Palette8Get
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_Palette8GetDefault
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_Palette8Reset
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_Palette8Set
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_RGBResponseReset
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
TW_UINT16 GPHOTO2_RGBResponseSet
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
/* UI function */
BOOL DoCameraUI();
HWND TransferingDialogBox(HWND dialog, DWORD progress);
#ifdef HAVE_GPHOTO2
/* Helper function for GUI */
TW_UINT16
_get_gphoto2_file_as_DIB(
const char *folder, const char *filename, CameraFileType type,
HWND hwnd, HBITMAP *hDIB
);
#endif
#endif
/*
* Twain resource definitions
*
* Copyright 2006 CodeWeavers, Aric Stewart
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define IDD_DIALOG1 0x400
#define IDD_CAMERAUI 0x401
#define IDD_CONNECTING 0x402
#define IDC_STATIC 999
#define IDC_LIST1 1000
#define IDC_IMPORT 1001
#define IDC_IMPORTALL 1002
#define IDC_EXIT 1003
#define IDC_BITMAP 1004
/*
* Top level resource file for Twain
*
* Copyright 2006 CodeWeavers, Aric Stewart
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winnls.h"
#include "commctrl.h"
#include "resource.h"
#include "gphoto2_En.rc"
/*
* TWAIN32 Options UI
*
* Copyright 2006 CodeWeavers, Aric Stewart
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winnls.h"
#include "wingdi.h"
#include "commctrl.h"
#include "prsht.h"
#include "twain.h"
#include "gphoto2_i.h"
#include "wine/debug.h"
#include "resource.h"
WINE_DEFAULT_DEBUG_CHANNEL(twain);
static HBITMAP static_bitmap;
static INT_PTR CALLBACK ConnectingProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
return FALSE;
}
static void PopulateListView(HWND List)
{
struct gphoto2_file *file;
LVITEMA item;
int index = 0;
LIST_FOR_EACH_ENTRY( file, &activeDS.files, struct gphoto2_file, entry)
{
if (strstr(file->filename,".JPG") || strstr(file->filename,".jpg"))
{
memset(&item,0,sizeof(item));
item.mask = LVIF_PARAM | LVIF_TEXT | LVIF_IMAGE ;
item.iItem = index;
item.pszText = file->filename;
item.iImage = index;
item.lParam= (LPARAM)file;
SendMessageA(List, LVM_INSERTITEMA,0,(LPARAM)&item);
index ++;
}
}
}
static void PopulateImageList(HIMAGELIST *iList, HWND list)
{
struct gphoto2_file *file;
INT rc;
HWND progress_dialog;
progress_dialog =
CreateDialogW(GPHOTO2_instance,(LPWSTR)MAKEINTRESOURCE(IDD_CONNECTING),
NULL, ConnectingProc);
LIST_FOR_EACH_ENTRY( file, &activeDS.files, struct gphoto2_file, entry)
{
if (strstr(file->filename,".JPG") || strstr(file->filename,".jpg"))
{
HBITMAP bitmap;
BITMAP bmpInfo;
#ifdef HAVE_GPHOTO2
_get_gphoto2_file_as_DIB(file->folder, file->filename,
GP_FILE_TYPE_PREVIEW, 0, &bitmap);
#else
bitmap = 0;
#endif
GetObjectA(bitmap,sizeof(BITMAP),(LPVOID)&bmpInfo);
if (*iList == 0)
{
*iList = ImageList_Create(bmpInfo.bmWidth,
bmpInfo.bmHeight,ILC_COLOR24, 10,10);
SendMessageW(list, LVM_SETICONSPACING, 0,
MAKELONG(bmpInfo.bmWidth+6, bmpInfo.bmHeight+15) ); }
rc = ImageList_Add(*iList, bitmap, 0);
DeleteObject(static_bitmap);
static_bitmap = bitmap;
SendMessageW(GetDlgItem(progress_dialog,IDC_BITMAP),STM_SETIMAGE,
IMAGE_BITMAP, (LPARAM)static_bitmap);
RedrawWindow(progress_dialog,NULL,NULL,RDW_INTERNALPAINT|RDW_UPDATENOW|RDW_ALLCHILDREN);
}
}
EndDialog(progress_dialog,0);
}
static INT_PTR CALLBACK DialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_INITDIALOG:
{
HIMAGELIST ilist = 0;
HWND list = GetDlgItem(hwnd,IDC_LIST1);
EnableWindow(GetDlgItem(hwnd,IDC_IMPORT),FALSE);
PopulateImageList(&ilist,list);
SendMessageA(list, LVM_SETIMAGELIST,LVSIL_NORMAL,(LPARAM)ilist);
PopulateListView(list);
}
break;
case WM_NOTIFY:
if (((LPNMHDR)lParam)->code == LVN_ITEMCHANGED)
{
HWND list = GetDlgItem(hwnd,IDC_LIST1);
int count = SendMessageA(list,LVM_GETSELECTEDCOUNT,0,0);
if (count > 0)
EnableWindow(GetDlgItem(hwnd,IDC_IMPORT),TRUE);
else
EnableWindow(GetDlgItem(hwnd,IDC_IMPORT),FALSE);
}
break;
case WM_COMMAND:
switch LOWORD(wParam)
{
case IDC_EXIT:
EndDialog(hwnd,0);
break;
case IDC_IMPORT:
{
HWND list = GetDlgItem(hwnd,IDC_LIST1);
int count = SendMessageA(list,LVM_GETSELECTEDCOUNT,0,0);
int i;
if (count ==0)
{
EndDialog(hwnd,0);
return FALSE;
}
count = SendMessageA(list,LVM_GETITEMCOUNT,0,0);
for ( i = 0; i < count; i++)
{
INT state = 0x00000000;
state = SendMessageA(list,LVM_GETITEMSTATE,i,
LVIS_SELECTED);
if (state)
{
LVITEMA item;
struct gphoto2_file *file;
memset(&item,0,sizeof(item));
item.mask = LVIF_PARAM;
item.iItem = i;
SendMessageA(list,LVM_GETITEMA,0,(LPARAM)&item);
file = (struct gphoto2_file*)item.lParam;
file->download = TRUE;
}
}
EndDialog(hwnd,1);
}
break;
case IDC_IMPORTALL:
{
HWND list = GetDlgItem(hwnd,IDC_LIST1);
int count = SendMessageA(list,LVM_GETITEMCOUNT,0,0);
int i;
if (count ==0)
{
EndDialog(hwnd,0);
return FALSE;
}
for ( i = 0; i < count; i++)
{
LVITEMA item;
struct gphoto2_file *file;
memset(&item,0,sizeof(item));
item.mask = LVIF_PARAM;
item.iItem = i;
SendMessageA(list,LVM_GETITEMA,0,(LPARAM)&item);
file = (struct gphoto2_file*)item.lParam;
file->download = TRUE;
}
EndDialog(hwnd,1);
}
break;
}
break;
}
return FALSE;
}
BOOL DoCameraUI()
{
return DialogBoxW(GPHOTO2_instance,
(LPWSTR)MAKEINTRESOURCE(IDD_CAMERAUI),NULL, DialogProc);
}
static INT_PTR CALLBACK ProgressProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
lParam)
{
return FALSE;
}
HWND TransferingDialogBox(HWND dialog, DWORD progress)
{
if (!dialog)
dialog = CreateDialogW(GPHOTO2_instance,
(LPWSTR)MAKEINTRESOURCE(IDD_DIALOG1), NULL, ProgressProc);
if (progress == -1)
{
EndDialog(dialog,0);
return NULL;
}
RedrawWindow(dialog,NULL,NULL,
RDW_INTERNALPAINT|RDW_UPDATENOW|RDW_ALLCHILDREN);
return dialog;
}
......@@ -221,6 +221,9 @@
/* Define to 1 if you have the <GL/gl.h> header file. */
#undef HAVE_GL_GL_H
/* Define if we have libgphoto2 development environment */
#undef HAVE_GPHOTO2
/* Define to 1 if you have the <hal/libhal.h> header file. */
#undef HAVE_HAL_LIBHAL_H
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment