Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
88f67ce6
Commit
88f67ce6
authored
Dec 01, 2014
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3466 from taka-no-me:ctrl_s_win
parents
50c9367d
3fa02787
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
9 deletions
+63
-9
window_w32.cpp
modules/highgui/src/window_w32.cpp
+63
-9
No files found.
modules/highgui/src/window_w32.cpp
View file @
88f67ce6
...
@@ -1146,7 +1146,7 @@ cvShowImage( const char* name, const CvArr* arr )
...
@@ -1146,7 +1146,7 @@ cvShowImage( const char* name, const CvArr* arr )
icvUpdateWindowPos
(
window
);
icvUpdateWindowPos
(
window
);
InvalidateRect
(
window
->
hwnd
,
0
,
0
);
InvalidateRect
(
window
->
hwnd
,
0
,
0
);
// philipg: this is not needed and just slows things down
// philipg: this is not needed and just slows things down
// UpdateWindow(window->hwnd);
// UpdateWindow(window->hwnd);
__END__
;
__END__
;
}
}
...
@@ -1304,7 +1304,7 @@ MainWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
...
@@ -1304,7 +1304,7 @@ MainWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
switch
(
uMsg
)
switch
(
uMsg
)
{
{
case
WM_COPY
:
case
WM_COPY
:
::
WindowProc
(
hwnd
,
uMsg
,
wParam
,
lParam
);
// call highgui proc. There may be a better way to do this.
::
SendMessage
(
window
->
hwnd
,
uMsg
,
wParam
,
lParam
);
break
;
break
;
case
WM_DESTROY
:
case
WM_DESTROY
:
...
@@ -1838,6 +1838,56 @@ cvDestroyAllWindows(void)
...
@@ -1838,6 +1838,56 @@ cvDestroyAllWindows(void)
}
}
}
}
static
void
showSaveDialog
(
CvWindow
*
window
)
{
#ifndef HAVE_OPENGL
if
(
!
window
||
!
window
->
image
)
return
;
SIZE
sz
;
int
channels
;
void
*
data
;
if
(
icvGetBitmapData
(
window
,
&
sz
,
&
channels
,
&
data
))
return
;
// nothing to save
char
szFileName
[
MAX_PATH
]
=
""
;
// try to use window title as file name
GetWindowText
(
window
->
frame
,
szFileName
,
MAX_PATH
);
OPENFILENAME
ofn
;
ZeroMemory
(
&
ofn
,
sizeof
(
ofn
));
#ifdef OPENFILENAME_SIZE_VERSION_400
// we are not going to use new fields any way
ofn
.
lStructSize
=
OPENFILENAME_SIZE_VERSION_400
;
#else
ofn
.
lStructSize
=
sizeof
(
ofn
);
#endif
ofn
.
hwndOwner
=
window
->
hwnd
;
ofn
.
lpstrFilter
=
"Portable Network Graphics files (*.png)
\0
*.png
\0
"
"JPEG files (*.jpeg;*.jpg;*.jpe)
\0
*.jpeg;*.jpg;*.jpe
\0
"
"Windows bitmap (*.bmp;*.dib)
\0
*.bmp;*.dib
\0
"
"TIFF Files (*.tiff;*.tif)
\0
*.tiff;*.tif
\0
"
"JPEG-2000 files (*.jp2)
\0
*.jp2
\0
"
"WebP files (*.webp)
\0
*.webp
\0
"
"Portable image format (*.pbm;*.pgm;*.ppm;*.pxm;*.pnm)
\0
*.pbm;*.pgm;*.ppm;*.pxm;*.pnm
\0
"
"OpenEXR Image files (*.exr)
\0
*.exr
\0
"
"Radiance HDR (*.hdr;*.pic)
\0
*.hdr;*.pic
\0
"
"Sun raster files (*.sr;*.ras)
\0
*.sr;*.ras
\0
"
"All Files (*.*)
\0
*.*
\0
"
;
ofn
.
lpstrFile
=
szFileName
;
ofn
.
nMaxFile
=
MAX_PATH
;
ofn
.
Flags
=
OFN_EXPLORER
|
OFN_PATHMUSTEXIST
|
OFN_OVERWRITEPROMPT
|
OFN_NOREADONLYRETURN
|
OFN_NOCHANGEDIR
;
ofn
.
lpstrDefExt
=
"png"
;
if
(
GetSaveFileName
(
&
ofn
))
{
cv
::
Mat
tmp
;
cv
::
flip
(
cv
::
Mat
(
sz
.
cy
,
sz
.
cx
,
CV_8UC
(
channels
),
data
),
tmp
,
0
);
cv
::
imwrite
(
szFileName
,
tmp
);
}
#else
(
void
)
window
;
#endif // HAVE_OPENGL
}
CV_IMPL
int
CV_IMPL
int
cvWaitKey
(
int
delay
)
cvWaitKey
(
int
delay
)
...
@@ -1883,12 +1933,12 @@ cvWaitKey( int delay )
...
@@ -1883,12 +1933,12 @@ cvWaitKey( int delay )
case
WM_KEYDOWN
:
case
WM_KEYDOWN
:
TranslateMessage
(
&
message
);
TranslateMessage
(
&
message
);
if
(
(
message
.
wParam
>=
VK_F1
&&
message
.
wParam
<=
VK_F24
)
||
if
(
(
message
.
wParam
>=
VK_F1
&&
message
.
wParam
<=
VK_F24
)
||
message
.
wParam
==
VK_HOME
||
message
.
wParam
==
VK_END
||
message
.
wParam
==
VK_HOME
||
message
.
wParam
==
VK_END
||
message
.
wParam
==
VK_UP
||
message
.
wParam
==
VK_DOWN
||
message
.
wParam
==
VK_UP
||
message
.
wParam
==
VK_DOWN
||
message
.
wParam
==
VK_LEFT
||
message
.
wParam
==
VK_RIGHT
||
message
.
wParam
==
VK_LEFT
||
message
.
wParam
==
VK_RIGHT
||
message
.
wParam
==
VK_INSERT
||
message
.
wParam
==
VK_DELETE
||
message
.
wParam
==
VK_INSERT
||
message
.
wParam
==
VK_DELETE
||
message
.
wParam
==
VK_PRIOR
||
message
.
wParam
==
VK_NEXT
)
message
.
wParam
==
VK_PRIOR
||
message
.
wParam
==
VK_NEXT
)
{
{
DispatchMessage
(
&
message
);
DispatchMessage
(
&
message
);
is_processed
=
1
;
is_processed
=
1
;
...
@@ -1897,7 +1947,11 @@ cvWaitKey( int delay )
...
@@ -1897,7 +1947,11 @@ cvWaitKey( int delay )
// Intercept Ctrl+C for copy to clipboard
// Intercept Ctrl+C for copy to clipboard
if
(
'C'
==
message
.
wParam
&&
(
::
GetKeyState
(
VK_CONTROL
)
>>
15
))
if
(
'C'
==
message
.
wParam
&&
(
::
GetKeyState
(
VK_CONTROL
)
>>
15
))
::
PostMessage
(
message
.
hwnd
,
WM_COPY
,
0
,
0
);
::
SendMessage
(
message
.
hwnd
,
WM_COPY
,
0
,
0
);
// Intercept Ctrl+S for "save as" dialog
if
(
'S'
==
message
.
wParam
&&
(
::
GetKeyState
(
VK_CONTROL
)
>>
15
))
showSaveDialog
(
window
);
default
:
default
:
DispatchMessage
(
&
message
);
DispatchMessage
(
&
message
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment