Commit 1d46871caa741e133f41cc402116768d959885c5

Authored by Peter Zhigalov
1 parent a1fbe5b2

Добавил "New Window" в проект с WinAPI, исправил build-скрипты под Windows

buildscripts/win_qt4.4.3_mingw342.bat
1 1 @echo off
2 2 set V_PROJECT=fem_draw_qt
3   -set QTDIR=C:\Qt\qt4.4.3-mingw342-static
4   -set MINGWDIR=C:\Qt\MinGW-3.4.2
  3 +set QTDIR=C:\Qt\4.4.3\mingw342_32_static
  4 +set MINGWDIR=C:\Qt\Tools\mingw342_32
5 5 set V_BUILDDIR=build_win_qt4.4.3_mingw342
6 6  
7 7 set PATH=%QTDIR%\bin;%MINGWDIR%\bin;%MINGWDIR%\libexec\gcc\mingw32\3.4.2;%WINDIR%;%WINDIR%\System32
... ...
buildscripts/win_qt4.4.3_msvc2005.bat
... ... @@ -2,8 +2,8 @@
2 2 set V_PROJECT=fem_draw_qt
3 3 set V_ARCH=x86
4 4 set V_VCVARS="C:\Program Files (x86)\Microsoft Visual Studio 8\VC\vcvarsall.bat"
5   -set V_QTDIR=C:\Qt\qt4.4.3-msvc2005-x86-static
6   -set V_JOM=C:\Qt\jom.exe
  5 +set V_QTDIR=C:\Qt\4.4.3\msvc2005_static
  6 +set V_JOM=C:\Qt\Tools\QtCreator\bin\jom.exe
7 7 set V_BUILDDIR=build_win_qt4.4.3_msvc2005
8 8  
9 9 call %V_VCVARS% %V_ARCH%
... ...
buildscripts/win_qt4.4.3_msvc2005_x64.bat
... ... @@ -2,8 +2,8 @@
2 2 set V_PROJECT=fem_draw_qt
3 3 set V_ARCH=x64
4 4 set V_VCVARS="C:\Program Files (x86)\Microsoft Visual Studio 8\VC\vcvarsall.bat"
5   -set V_QTDIR=C:\Qt\qt4.4.3-msvc2005-x64-static
6   -set V_JOM=C:\Qt\jom.exe
  5 +set V_QTDIR=C:\Qt\4.4.3\msvc2005_64_static
  6 +set V_JOM=C:\Qt\Tools\QtCreator\bin\jom.exe
7 7 set V_BUILDDIR=build_win_qt4.4.3_msvc2005_x64
8 8  
9 9 call %V_VCVARS% %V_ARCH%
... ...
buildscripts/winapi_mingw342.bat
1 1 @echo off
2 2 set V_PROJECT=fem_draw_winapi
3   -set MINGWDIR=C:\Qt\MinGW-3.4.2
  3 +set MINGWDIR=C:\Qt\Tools\mingw342_32
4 4 set V_BUILDDIR=build_winapi_mingw342
5 5 set MINGW-CXX=g++
6 6 set MINGW-WINDRES=windres
... ...
buildscripts/winapi_mingw342_ansi.bat
1 1 @echo off
2 2 set V_PROJECT=fem_draw_winapi
3   -set MINGWDIR=C:\Qt\MinGW-3.4.2
  3 +set MINGWDIR=C:\Qt\Tools\mingw342_32
4 4 set V_BUILDDIR=build_winapi_mingw342_ansi
5 5 set MINGW-CXX=g++
6 6 set MINGW-WINDRES=windres
... ...
src_winapi/main.cpp
... ... @@ -467,6 +467,34 @@ finish:
467 467 ReleaseDC(pdraw->hwnd, hdc1);
468 468 }
469 469  
  470 +// Событие при нажатии кнопки New Window
  471 +void on_actionNew_Window_triggered()
  472 +{
  473 + TCHAR szFileName[MAX_PATH];
  474 + if(GetModuleFileName(NULL, szFileName, MAX_PATH))
  475 + {
  476 + STARTUPINFO info;
  477 + memset(&info, 0, sizeof(info));
  478 + info.cb = sizeof(info);
  479 + PROCESS_INFORMATION processInfo;
  480 + if(CreateProcess(szFileName, TEXT(""), NULL, NULL, TRUE, 0, NULL, NULL, &info, &processInfo))
  481 + {
  482 + CloseHandle(processInfo.hProcess);
  483 + CloseHandle(processInfo.hThread);
  484 + }
  485 + else
  486 + {
  487 + MessageBox(hwnd, TEXT("Error: Error while creating new process!"), TEXT("Error"), MB_OK | MB_ICONERROR);
  488 + return;
  489 + }
  490 + }
  491 + else
  492 + {
  493 + MessageBox(hwnd, TEXT("Error: Unable to get current module file name!"), TEXT("Error"), MB_OK | MB_ICONERROR);
  494 + return;
  495 + }
  496 +}
  497 +
470 498 // Событие при нажатии кнопки Exit
471 499 void on_actionExit_triggered()
472 500 {
... ... @@ -1316,6 +1344,9 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
1316 1344 case CONTROL_MENU_SAVE: // Событие при сохранении
1317 1345 on_actionSave_Image_File_triggered();
1318 1346 break;
  1347 + case CONTROL_MENU_NEW_WINDOW: // Событие при нажатии кнопки New Window
  1348 + on_actionNew_Window_triggered();
  1349 + break;
1319 1350 case CONTROL_MENU_EXIT: // Событие при нажатии кнопки Exit
1320 1351 on_actionExit_triggered();
1321 1352 break;
... ... @@ -1970,6 +2001,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpCmdLine, int nCmdShow
1970 2001 AppendMenu(menu::hFileMenu, MF_STRING, CONTROL_MENU_COPY, TEXT("Copy Image to Clipboard\tCtrl+C"));
1971 2002 AppendMenu(menu::hFileMenu, MF_STRING, CONTROL_MENU_SAVE, TEXT("Save Image...\tCtrl+S"));
1972 2003 AppendMenu(menu::hFileMenu, MF_SEPARATOR, (UINT_PTR)NULL, TEXT(""));
  2004 + AppendMenu(menu::hFileMenu, MF_STRING, CONTROL_MENU_NEW_WINDOW, TEXT("New Window"));
1973 2005 AppendMenu(menu::hFileMenu, MF_STRING, CONTROL_MENU_EXIT, TEXT("Exit\tCtrl+Q"));
1974 2006 menu::hInterpMenu = CreatePopupMenu();
1975 2007 AppendMenu(menu::hMenu, MF_STRING | MF_POPUP, (UINT_PTR)menu::hInterpMenu, TEXT("Interpolation"));
... ...
src_winapi/resources.h
... ... @@ -22,7 +22,8 @@
22 22 #define CONTROL_MENU_TRANSPARENT 10021
23 23 #define CONTROL_MENU_COPY 10022
24 24 #define CONTROL_MENU_SAVE 10023
25   -#define CONTROL_MENU_EXIT 10024
  25 +#define CONTROL_MENU_NEW_WINDOW 10024
  26 +#define CONTROL_MENU_EXIT 10025
26 27 #define CONTROL_MENU_INCREASE_INTERPOLATION 10030
27 28 #define CONTROL_MENU_DECREASE_INTERPOLATION 10031
28 29 #define CONTROL_MENU_ISOLINES_SHOW 10040
... ...