"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "psi/dwimg.c" between
ghostscript-9.28rc1.tar.xz and ghostscript-9.28rc2.tar.xz

About: Ghostscript is an interpreter and rendering engine for the PostScript language and for PDF (GPL release). Release candidate.

dwimg.c  (ghostscript-9.28rc1.tar.xz):dwimg.c  (ghostscript-9.28rc2.tar.xz)
skipping to change at line 51 skipping to change at line 51
#include "stdio_.h" #include "stdio_.h"
#include "dwres.h" #include "dwres.h"
#include "dwimg.h" #include "dwimg.h"
#include "dwreg.h" #include "dwreg.h"
#include "gdevdsp.h" #include "gdevdsp.h"
static const char szImgName2[] = "Ghostscript Image"; static const char szImgName2[] = "Ghostscript Image";
static const char szTrcName2[] = "Ghostscript Graphical Trace"; static const char szTrcName2[] = "Ghostscript Graphical Trace";
/* These two are defined in dwmain.c/dwmainc.c because they need access to the g
sdll and instance */
int dwmain_add_file_control_path(const TCHAR *pathfile);
void dwmain_remove_file_control_path(const TCHAR *pathfile);
/* Forward references */ /* Forward references */
LRESULT CALLBACK WndImg2Proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPar am); LRESULT CALLBACK WndImg2Proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPar am);
static void register_class(void); static void register_class(void);
static void draw(IMAGE *img, HDC hdc, int dx, int dy, int wx, int wy, static void draw(IMAGE *img, HDC hdc, int dx, int dy, int wx, int wy,
int sx, int sy); int sx, int sy);
static HGLOBAL copy_dib(IMAGE *img); static HGLOBAL copy_dib(IMAGE *img);
static HPALETTE create_palette(IMAGE *img); static HPALETTE create_palette(IMAGE *img);
static void create_window(IMAGE *img); static void create_window(IMAGE *img);
skipping to change at line 1157 skipping to change at line 1161
/* image window */ /* image window */
/* All accesses to img->image or dimensions must be protected by mutex */ /* All accesses to img->image or dimensions must be protected by mutex */
LRESULT CALLBACK LRESULT CALLBACK
WndImg2Proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) WndImg2Proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
HDC hdc; HDC hdc;
PAINTSTRUCT ps; PAINTSTRUCT ps;
RECT rect; RECT rect;
int nVscrollInc, nHscrollInc; int nVscrollInc, nHscrollInc;
IMAGE *img; IMAGE *img;
static int cFiles = 0;
static char** szFiles = NULL;
if (message == WM_CREATE) { if (message == WM_CREATE) {
/* Object is stored in window extra data. /* Object is stored in window extra data.
* Nothing must try to use the object before WM_CREATE * Nothing must try to use the object before WM_CREATE
* initializes it here. * initializes it here.
*/ */
img = (IMAGE *)(((CREATESTRUCT *)lParam)->lpCreateParams); img = (IMAGE *)(((CREATESTRUCT *)lParam)->lpCreateParams);
SetWindowLongPtr(hwnd, 0, (LONG_PTR)img); SetWindowLongPtr(hwnd, 0, (LONG_PTR)img);
} }
img = (IMAGE *)GetWindowLongPtr(hwnd, 0); img = (IMAGE *)GetWindowLongPtr(hwnd, 0);
skipping to change at line 1455 skipping to change at line 1461
if (img->hmutex != INVALID_HANDLE_VALUE) if (img->hmutex != INVALID_HANDLE_VALUE)
ReleaseMutex(img->hmutex); ReleaseMutex(img->hmutex);
EndPaint(hwnd, &ps); EndPaint(hwnd, &ps);
return 0; return 0;
} }
case WM_DROPFILES: case WM_DROPFILES:
if (img->hwndtext) if (img->hwndtext)
SendMessage(img->hwndtext, message, wParam, lParam); SendMessage(img->hwndtext, message, wParam, lParam);
else { else {
char *szFile; int i, lcFiles, code;
int i, cFiles;
unsigned int Len, error; unsigned int Len, error;
const char *p; const char *p;
const char *szDragPre = "\r("; const char *szDragPre = "\r(";
const char *szDragPost = ") run\r"; const char *szDragPost = ") run\r";
HDROP hdrop = (HDROP)wParam; HDROP hdrop = (HDROP)wParam;
cFiles = DragQueryFile(hdrop, (UINT)(-1), (LPSTR)NULL, 0); for (i = 0; szFiles != NULL && i < cFiles; i++) {
for (i=0; i<cFiles; i++) { if (szFiles[i] != NULL) {
dwmain_remove_file_control_path(szFiles[i]);
free(szFiles[i]);
szFiles[i] = NULL;
}
}
lcFiles = DragQueryFile(hdrop, (UINT)(-1), (LPSTR)NULL, 0);
if (cFiles < lcFiles) {
free(szFiles);
szFiles = malloc(lcFiles * sizeof(char*));
if (!szFiles) {
cFiles = 0;
return 0;
}
memset(szFiles, 0x00, lcFiles * sizeof(char*));
cFiles = lcFiles;
}
for (i=0; i<lcFiles; i++) {
Len = DragQueryFile(hdrop, i, NULL, 0); Len = DragQueryFile(hdrop, i, NULL, 0);
szFile = malloc(Len+1); szFiles[i] = malloc(Len+1);
if (szFile != 0) { if (szFiles[i] != 0) {
error = DragQueryFile(hdrop, i, szFile, Len+1); error = DragQueryFile(hdrop, i, szFiles[i], Len+1);
if (error != 0) { if (error != 0) {
for (p=szDragPre; *p; p++) code = dwmain_add_file_control_path(szFiles[i]);
SendMessage(hwnd,WM_CHAR,*p,1L); if (code >= 0){
for (p=szFile; *p; p++) { for (p=szDragPre; *p; p++)
if (*p == '\\') SendMessage(hwnd,WM_CHAR,*p,1L);
SendMessage(hwnd,WM_CHAR,'/',1L); for (p=szFiles[i]; *p; p++) {
else if (*p == '\\')
SendMessage(hwnd,WM_CHAR,'/',1L);
else
SendMessage(hwnd,WM_CHAR,*p,1L);
}
for (p=szDragPost; *p; p++)
SendMessage(hwnd,WM_CHAR,*p,1L); SendMessage(hwnd,WM_CHAR,*p,1L);
} }
for (p=szDragPost; *p; p++)
SendMessage(hwnd,WM_CHAR,*p,1L);
} }
free(szFile);
} }
} }
DragFinish(hdrop); DragFinish(hdrop);
} }
break; break;
case WM_DESTROY: case WM_DESTROY:
{ /* Save the text window size */ { /* Save the text window size */
char winposbuf[64]; char winposbuf[64];
sprintf(winposbuf, "%d %d %d %d", img->x, img->y, sprintf(winposbuf, "%d %d %d %d", img->x, img->y,
img->cx, img->cy); img->cx, img->cy);
win_set_reg_value((img->device != NULL ? "Image" : "Tracer"), wi nposbuf); win_set_reg_value((img->device != NULL ? "Image" : "Tracer"), wi nposbuf);
} }
{ /* Get rid of left over drag'n'drop file names*/
int i;
for (i = 0; szFiles != NULL && i < cFiles; i++) {
if (szFiles[i] != NULL) {
dwmain_remove_file_control_path(szFiles[i]);
free(szFiles[i]);
szFiles[i] = NULL;
}
}
free(szFiles);
szFiles = NULL;
cFiles = 0;
}
DragAcceptFiles(hwnd, FALSE); DragAcceptFiles(hwnd, FALSE);
break; break;
} }
return DefWindowProc(hwnd, message, wParam, lParam); return DefWindowProc(hwnd, message, wParam, lParam);
} }
/* Repaint a section of the window. */ /* Repaint a section of the window. */
static void static void
draw(IMAGE *img, HDC hdc, int dx, int dy, int wx, int wy, draw(IMAGE *img, HDC hdc, int dx, int dy, int wx, int wy,
int sx, int sy) int sx, int sy)
{ {
HPALETTE oldpalette; HPALETTE oldpalette;
struct bmi_s { struct bmi_s {
BITMAPINFOHEADER h; BITMAPINFOHEADER h;
 End of changes. 10 change blocks. 
17 lines changed or deleted 55 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)