void CSelectPluginDlg::OnCancel() //------------------------------- { //remember window size: SaveWindowPos(); CDialog::OnCancel(); }
INT_PTR WINAPI doRecInputDialog(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { if (INT_PTR r = SNM_HookThemeColorsMessage(hwndDlg, uMsg, wParam, lParam)) return r; switch(uMsg) { case WM_INITDIALOG: CheckDlgButton(hwndDlg, IDC_DONTSHOW, !g_bEnRecInputCheck ? BST_CHECKED : BST_UNCHECKED); RestoreWindowPos(hwndDlg, RECINPUTWNDPOS_KEY, false); return 0; case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: case IDCANCEL: g_bEnRecInputCheck = IsDlgButtonChecked(hwndDlg, IDC_DONTSHOW) ? false : true; WritePrivateProfileString(SWS_INI, RECINPUTCHECK_KEY, g_bEnRecInputCheck ? "1" : "0", get_ini_file()); SaveWindowPos(hwndDlg, RECINPUTWNDPOS_KEY); EndDialog(hwndDlg, (INT_PTR)(LOWORD(wParam))); break; } } return 0; }
INT_PTR WINAPI doResolve(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { if (INT_PTR r = SNM_HookThemeColorsMessage(hwndDlg, uMsg, wParam, lParam)) return r; switch (uMsg) { case WM_INITDIALOG: { SetDlgItemText(hwndDlg, IDC_TEXT, g_cErrorStr); CheckDlgButton(hwndDlg, IDC_APPLY, BST_CHECKED); HWND hTracks = GetDlgItem(hwndDlg, IDC_TRACK); WDL_UTF8_HookComboBox(hTracks); SendMessage(hTracks, CB_ADDSTRING, 0, (LPARAM)__LOCALIZE("(create new track)","sws_DLG_114")); for (int i = 1; i <= GetNumTracks(); i++) { MediaTrack* tr = CSurf_TrackFromID(i, false); if (tr != g_send) { char cName[80]; _snprintf(cName, 80, "%d: %s", i, (char*)GetSetMediaTrackInfo(tr, "P_NAME", NULL)); SendMessage(hTracks, CB_ADDSTRING, 0, (LPARAM)cName); } } SendMessage(hTracks, CB_SETCURSEL, 0, 0); RestoreWindowPos(hwndDlg, RESOLVE_WND_POS, false); g_iResolveRet = 0; return 0; } case WM_COMMAND: wParam = LOWORD(wParam); if (wParam == IDC_DELETE) g_iResolveRet = 1; else if (wParam == IDOK) { char cTrack[10]; GetDlgItemText(hwndDlg, IDC_TRACK, cTrack, 10); int id = atol(cTrack); if (!id) // assume they chose "create new track" { id = GetNumTracks()+1; InsertTrackAtIndex(id, false); TrackList_AdjustWindows(false); } g_recv = CSurf_TrackFromID(id, false); g_iResolveRet = 2; } if (wParam == IDC_DELETE || wParam == IDOK || wParam == IDCANCEL) { SaveWindowPos(hwndDlg, RESOLVE_WND_POS); EndDialog(hwndDlg,0); } return 0; } return 0; }
/******************************Public*Routine******************************\ * VideoCd_OnQueryEndSession * \**************************************************************************/ BOOL VideoCd_OnQueryEndSession( HWND hwnd ) { SaveWindowPos(hwnd); return TRUE; }
/******************************Public*Routine******************************\ * VideoCd_OnClose * \**************************************************************************/ void VideoCd_OnClose( HWND hwnd ) { VcdPlayerCloseCmd(); SaveWindowPos(hwnd); DestroyWindow(hwnd); }
/** * @brief 設定ダイアログ表示関数 * @param hInst ダイアログが含まれるインスタンスのハンドル * @param hWnd 親ウィンドウのウィンドウハンドル * @param str 表示するヘッダ文字列の初期値(カンマ区切り) * @param size strバッファの大きさ * @param adjust ウィンドウサイズ自動調節フラグ * * 設定ダイアログを表示する。 */ int DoSetting(HINSTANCE hInst, HWND hWnd, char *str, int size, UINT *adjust) { setstr = str; setsize = size; adjustwindow = *adjust; hInstance = hInst; ::DialogBox(hInst, (LPCTSTR) IDD_SETTING, hWnd, (DLGPROC) Setting); *adjust = (adjustwindow != BST_UNCHECKED) ? 1 : 0; SaveWindowPos(szIni); return 0; }
Error GTKWindow::VulcanMindMeld(Window *pOther) { Error eRet; Rect oRect; m_pMindMeldMutex->Acquire(); gdk_threads_enter(); gdk_flush(); gdk_threads_leave(); oRect.x1 = oRect.x2 = oRect.y1 = oRect.y2 = 0; GetWindowPosition(oRect); eRet = Window::VulcanMindMeld(pOther); if (IsError(eRet)) { m_pMindMeldMutex->Release(); return eRet; } Rect oNewRect, oSize; m_pCanvas->GetBackgroundRect(oSize); GdkBitmap *mask = ((GTKCanvas *)m_pCanvas)->GetMask(); GetReloadWindowPos(oRect, oSize.Width(), oSize.Height(), oNewRect); gdk_threads_enter(); gtk_widget_set_uposition(mainWindow, oNewRect.x1, oNewRect.y1); gtk_widget_set_usize(mainWindow, oNewRect.Width(), oNewRect.Height()); if (mask) gdk_window_shape_combine_mask(mainWindow->window, mask, 0, 0); gdk_threads_leave(); Pos NewPos; NewPos.x = oNewRect.x1; NewPos.y = oNewRect.y1; SaveWindowPos(NewPos); ((GTKCanvas *)m_pCanvas)->SetParent(this); m_pCanvas->Update(); m_pMindMeldMutex->Release(); return kError_NoErr; }
static INT_PTR WINAPI doDeleteDialog(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { if (INT_PTR r = SNM_HookThemeColorsMessage(hwndDlg, uMsg, wParam, lParam)) return r; switch (uMsg) { case WM_INITDIALOG: { HWND list = GetDlgItem(hwndDlg, IDC_COMBO); WDL_UTF8_HookComboBox(list); for (int i = 0; i < g_relatedProjects.Get()->GetSize(); i++) SendMessage(list, CB_ADDSTRING, 0, (LPARAM)g_relatedProjects.Get()->Get(i)->Get()); SendMessage(list, CB_SETCURSEL, 0, 0); SetWindowText(hwndDlg, __LOCALIZE("SWS Delete Related Project","sws_mbox")); RestoreWindowPos(hwndDlg, DELWINDOW_POS_KEY); return 0; } case WM_COMMAND: switch(LOWORD(wParam)) { case IDOK: { HWND list = GetDlgItem(hwndDlg, IDC_COMBO); int iList = (int)SendMessage(list, CB_GETCURSEL, 0, 0); if (iList >= 0 && iList < g_relatedProjects.Get()->GetSize()) g_relatedProjects.Get()->Delete(iList, true); Undo_OnStateChangeEx(__LOCALIZE("Delete related project","sws_undo"), UNDO_STATE_MISCCFG, -1); } // Fall through to cancel to save/end case IDCANCEL: SaveWindowPos(hwndDlg, DELWINDOW_POS_KEY); EndDialog(hwndDlg, 0); break; } break; } return 0; }
Error GTKWindow::Close(void) { Rect oRect; Pos oPos; if (quitLoop) return kError_NoErr; GetWindowPosition(oRect); oPos.x = oRect.x1; oPos.y = oRect.y1; SaveWindowPos(oPos); gdk_threads_enter(); gtk_timeout_remove(gtkTimer); gtk_widget_destroy(mainWindow); gdk_flush(); gdk_threads_leave(); quitLoop = true; return kError_NoErr; }
//----------------------------------------------------------------------------- // LaunchAppDialogProc() //----------------------------------------------------------------------------- // DialogProc de la fenêtre de lancement d'application //----------------------------------------------------------------------------- static int CALLBACK LaunchAppDialogProc(HWND w,UINT msg,WPARAM wp,LPARAM lp) { UNREFERENCED_PARAMETER(lp); // TRACE((TRACE_DEBUG,_F_,"msg=0x%08lx LOWORD(wp)=0x%04x HIWORD(wp)=%d lp=%d",msg,LOWORD(wp),HIWORD(wp),lp)); CheckIfQuitMessage(msg); int rc=FALSE; switch (msg) { case WM_INITDIALOG: // ------------------------------------------------------- WM_INITDIALOG OnInitDialog(w); MoveControls(w); break; case WM_DESTROY: // break; case WM_HELP: Help(); break; case WM_TIMER: TRACE((TRACE_INFO,_F_,"WM_TIMER (SetForeground)")); if (giSetForegroundTimer==(int)wp) { KillTimer(w,giSetForegroundTimer); SetForegroundWindow(w); SetFocus(w); } break; case WM_COMMAND: // ------------------------------------------------------- WM_COMMAND //TRACE((TRACE_DEBUG,_F_,"WM_COMMAND LOWORD(wp)=0x%04x HIWORD(wp)=%d lp=%d",LOWORD(wp),HIWORD(wp),lp)); switch (LOWORD(wp)) { case IDOK: if (HIWORD(wp)==0) // les notifications autres que "from a control" ne nous intéressent pas ! { LaunchSelectedApp(w); } break; case IDCANCEL: if (HIWORD(wp)==0) // les notifications autres que "from a control" ne nous intéressent pas ! { SaveWindowPos(w); EndDialog(w,IDCANCEL); } break; case CK_VISIBLE: gbLaunchTopMost=(IsDlgButtonChecked(w,CK_VISIBLE)==BST_CHECKED); SetWindowPos(w,gbLaunchTopMost?HWND_TOPMOST:HWND_NOTOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE); break; } break; case WM_SIZE: // ------------------------------------------------------- WM_SIZE MoveControls(w); break; case WM_NOTIFY: // ------------------------------------------------------- WM_NOTIFY switch (((NMHDR FAR *)lp)->code) { case NM_DBLCLK: if (wp==TV_APPLICATIONS) { LaunchSelectedApp(w); } break; case TVN_KEYDOWN: { LPNMTVKEYDOWN ptvkd = (LPNMTVKEYDOWN)lp; switch (ptvkd->wVKey) { case VK_F5: FillTreeView(w); break; } } break; } break; } return rc; }
BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { static HINSTANCE hRichEditDLL = 0; if (!hRichEditDLL) hRichEditDLL= LoadLibrary("RichEd32.dll"); switch (msg) { case WM_INITDIALOG: { int argc; char **argv; int i, j; int argSpaceSize; bool chooseCompressor = false; g_sdata.hwnd=hwndDlg; HICON hIcon = LoadIcon(g_sdata.hInstance,MAKEINTRESOURCE(IDI_ICON)); SetClassLong(hwndDlg,GCL_HICON,(long)hIcon); // Altered by Darren Owen (DrO) on 29/9/2003 // Added in receiving of mouse and key events from the richedit control SendMessage(GetDlgItem(hwndDlg,IDC_LOGWIN),EM_SETEVENTMASK,NULL,ENM_SELCHANGE|ENM_MOUSEEVENTS|ENM_KEYEVENTS); DragAcceptFiles(g_sdata.hwnd,FALSE); g_sdata.menu = GetMenu(g_sdata.hwnd); g_sdata.fileSubmenu = GetSubMenu(g_sdata.menu, FILE_MENU_INDEX); g_sdata.editSubmenu = GetSubMenu(g_sdata.menu, EDIT_MENU_INDEX); g_sdata.toolsSubmenu = GetSubMenu(g_sdata.menu, TOOLS_MENU_INDEX); RestoreMRUList(); CreateToolBar(); InitTooltips(g_sdata.hwnd); SetBranding(g_sdata.hwnd); HFONT hFont = CreateFont(14,0,0,0,FW_NORMAL,0,0,0,DEFAULT_CHARSET,OUT_CHARACTER_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,FIXED_PITCH|FF_DONTCARE,"Courier New"); SendDlgItemMessage(hwndDlg,IDC_LOGWIN,WM_SETFONT,(WPARAM)hFont,0); RestoreWindowPos(g_sdata.hwnd); RestoreCompressor(); g_sdata.compressor = (NCOMPRESSOR)-1; argSpaceSize = SetArgv((char *)GetCommandLine(), &argc, &argv); if(argc > 1) { int n; g_sdata.script_alloced = true; g_sdata.script = (char *) GlobalAlloc(GPTR,argSpaceSize+2*(argc-1)*sizeof(char)+1); lstrcpy(g_sdata.script,""); for(i=1; i<argc; i++) { if(!lstrncmpi(argv[i],"/XSetCompressor ",lstrlen("/XSetCompressor "))) { char *p = argv[i]+lstrlen("/XSetCompressor "); if(!lstrncmpi(p,"/FINAL ",lstrlen("/FINAL "))) { p += lstrlen("/FINAL "); } while(*p == ' ') p++; if(p && lstrlen(p)) { for(j=(int)COMPRESSOR_SCRIPT+1; j < (int)COMPRESSOR_BEST; j++) { if(!lstrcmpi(p,compressor_names[j])) { SetCompressor((NCOMPRESSOR)j); } } } } else if(!lstrcmpi(argv[i],"/ChooseCompressor")) { chooseCompressor = true; } else { lstrcat(g_sdata.script,"\""); lstrcat(g_sdata.script,argv[i]); lstrcat(g_sdata.script,"\" "); } } n = lstrlen(g_sdata.script); if(n > 0) { g_sdata.script[n-1] = '\0'; } PushMRUFile(argv[argc-1]); } if (argSpaceSize) GlobalFree(argv); if(g_sdata.compressor == (NCOMPRESSOR)-1) { SetCompressor(g_sdata.default_compressor); } if(chooseCompressor) { if (DialogBox(g_sdata.hInstance,MAKEINTRESOURCE(DLG_COMPRESSOR),g_sdata.hwnd,(DLGPROC)CompressorProc)) { EnableItems(g_sdata.hwnd); return TRUE; } } CompileNSISScript(); return TRUE; } case WM_PAINT: { PAINTSTRUCT ps; GetClientRect(g_sdata.hwnd, &g_resize.griprect); HDC hdc = BeginPaint(g_sdata.hwnd, &ps); g_resize.griprect.left = g_resize.griprect.right - GetSystemMetrics(SM_CXVSCROLL); g_resize.griprect.top = g_resize.griprect.bottom - GetSystemMetrics(SM_CYVSCROLL); DrawFrameControl(hdc, &g_resize.griprect, DFC_SCROLL, DFCS_SCROLLSIZEGRIP); EndPaint(g_sdata.hwnd,&ps); return TRUE; } case WM_DESTROY: { SaveSymbols(); SaveCompressor(); SaveMRUList(); SaveWindowPos(g_sdata.hwnd); DestroyTooltips(); PostQuitMessage(0); return TRUE; } case WM_CLOSE: { if (!g_sdata.thread) { DragAcceptFiles(g_sdata.hwnd,FALSE); ImageList_Destroy(g_toolbar.imagelist); ImageList_Destroy(g_toolbar.imagelistd); ImageList_Destroy(g_toolbar.imagelisth); DestroyWindow(hwndDlg); FreeLibrary(hRichEditDLL); } return TRUE; } case WM_DROPFILES: { int num; char szTmp[MAX_PATH]; num = DragQueryFile((HDROP)wParam,-1,NULL,0); if (num==1) { DragQueryFile((HDROP)wParam,0,szTmp,MAX_PATH); if (lstrlen(szTmp)>0) { g_sdata.script_alloced = true; g_sdata.script = (char *)GlobalAlloc(GPTR,sizeof(szTmp)+7); wsprintf(g_sdata.script,"\"%s\"",szTmp); PushMRUFile(g_sdata.script); ResetObjects(); CompileNSISScript(); } } break; } case WM_GETMINMAXINFO: { ((MINMAXINFO*)lParam)->ptMinTrackSize.x=MINWIDTH; ((MINMAXINFO*)lParam)->ptMinTrackSize.y=MINHEIGHT; } case WM_ENTERSIZEMOVE: { GetClientRect(g_sdata.hwnd, &g_resize.resizeRect); return TRUE; } case WM_SIZE: { if ((wParam == SIZE_MAXHIDE)||(wParam == SIZE_MAXSHOW)) return TRUE; RECT rSize; if (hwndDlg == g_sdata.hwnd) { GetClientRect(g_sdata.hwnd, &rSize); if (((rSize.right==0)&&(rSize.bottom==0))||((g_resize.resizeRect.right==0)&&(g_resize.resizeRect.bottom==0))) return TRUE; g_resize.dx = rSize.right - g_resize.resizeRect.right; g_resize.dy = rSize.bottom - g_resize.resizeRect.bottom; EnumChildWindows(g_sdata.hwnd, DialogResize, (LPARAM)0); g_resize.resizeRect = rSize; } return TRUE; } case WM_SIZING: { InvalidateRect(g_sdata.hwnd,&g_resize.griprect,TRUE); GetClientRect(g_sdata.hwnd, &g_resize.griprect); g_resize.griprect.left = g_resize.griprect.right - GetSystemMetrics(SM_CXVSCROLL); g_resize.griprect.top = g_resize.griprect.bottom - GetSystemMetrics(SM_CYVSCROLL); return TRUE; } case WM_MAKENSIS_PROCESSCOMPLETE: { if (g_sdata.thread) { CloseHandle(g_sdata.thread); g_sdata.thread=0; } if(g_sdata.compressor == COMPRESSOR_BEST) { if (g_sdata.retcode==0 && FileExists(g_sdata.output_exe)) { char temp_file_name[1024]; wsprintf(temp_file_name,"%s_makensisw_temp",g_sdata.output_exe); if(!lstrcmpi(g_sdata.compressor_name,compressor_names[(int)COMPRESSOR_SCRIPT+1])) { SetCompressorStats(); CopyFile(g_sdata.output_exe,temp_file_name,false); g_sdata.best_compressor_name = g_sdata.compressor_name; g_sdata.compressor_name = compressor_names[(int)COMPRESSOR_SCRIPT+2]; ResetObjects(); ResetInputScript(); CompileNSISScript(); return TRUE; } else { int this_compressor; int last_compressor; int i; HANDLE hPrev, hThis; DWORD prevSize, thisSize; for(i=(int)COMPRESSOR_SCRIPT+2; i<(int)COMPRESSOR_BEST; i++) { if(!lstrcmpi(g_sdata.compressor_name,compressor_names[i])) { this_compressor = i; last_compressor = i-1; break; } } if(FileExists(temp_file_name)) { hPrev = CreateFile(temp_file_name,GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, NULL); if(hPrev != INVALID_HANDLE_VALUE) { prevSize = GetFileSize(hPrev, 0); CloseHandle(hPrev); if(prevSize != INVALID_FILE_SIZE) { hThis = CreateFile(g_sdata.output_exe,GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, NULL); if(hThis != INVALID_HANDLE_VALUE) { thisSize = GetFileSize(hThis, 0); CloseHandle(hThis); if(thisSize != INVALID_FILE_SIZE) { if(prevSize > thisSize) { CopyFile(g_sdata.output_exe,temp_file_name,false); SetCompressorStats(); g_sdata.best_compressor_name = g_sdata.compressor_name; } } } } } } if(this_compressor == ((int)COMPRESSOR_BEST - 1)) { char buf[1024]; g_sdata.compressor_name = compressor_names[(int)COMPRESSOR_SCRIPT+1]; g_sdata.appended = false; ResetInputScript(); if(!lstrcmpi(g_sdata.best_compressor_name,compressor_names[this_compressor])) { wsprintf(buf,COMPRESSOR_MESSAGE,g_sdata.best_compressor_name,thisSize); LogMessage(g_sdata.hwnd,buf); } else { CopyFile(temp_file_name,g_sdata.output_exe,false); wsprintf(buf,RESTORED_COMPRESSOR_MESSAGE,g_sdata.best_compressor_name,prevSize); LogMessage(g_sdata.hwnd,buf); LogMessage(g_sdata.hwnd, g_sdata.compressor_stats); } DeleteFile(temp_file_name); ResetInputScript(); lstrcpy(g_sdata.compressor_stats,""); } else { g_sdata.compressor_name = compressor_names[this_compressor+1]; ResetObjects(); ResetInputScript(); CompileNSISScript(); return TRUE; } } } } EnableItems(g_sdata.hwnd); if (!g_sdata.retcode) { MessageBeep(MB_ICONASTERISK); if (g_sdata.warnings) SetTitle(g_sdata.hwnd,"Finished with Warnings"); else SetTitle(g_sdata.hwnd,"Finished Sucessfully"); // Added by Darren Owen (DrO) on 1/10/2003 if(g_sdata.recompile_test) PostMessage(g_sdata.hwnd, WM_COMMAND, LOWORD(IDC_TEST), 0); } else { MessageBeep(MB_ICONEXCLAMATION); SetTitle(g_sdata.hwnd,"Compile Error: See Log for Details"); } // Added by Darren Owen (DrO) on 1/10/2003 // ensures the recompile and run state is reset after use g_sdata.recompile_test = 0; DragAcceptFiles(g_sdata.hwnd,TRUE); return TRUE; } case WM_NOTIFY: switch (((NMHDR*)lParam)->code ) { case EN_SELCHANGE: SendDlgItemMessage(hwndDlg,IDC_LOGWIN, EM_EXGETSEL, 0, (LPARAM) &g_sdata.textrange); { BOOL enabled = (g_sdata.textrange.cpMax-g_sdata.textrange.cpMin<=0?FALSE:TRUE); EnableMenuItem(g_sdata.menu,IDM_COPYSELECTED,(enabled?MF_ENABLED:MF_GRAYED)); EnableToolBarButton(IDM_COPY,enabled); } // Altered by Darren Owen (DrO) on 6/10/2003 // Allows the detection of the right-click menu when running on OSes below Windows 2000 // and will then simulate the effective WM_CONTEXTMENU message that would be received // note: removed the WM_CONTEXTMENU handling to prevent a duplicate menu appearing on // Windows 2000 and higher case EN_MSGFILTER: #define lpnmMsg ((MSGFILTER*)lParam) if(WM_RBUTTONUP == lpnmMsg->msg || WM_KEYUP == lpnmMsg->msg && lpnmMsg->wParam == VK_APPS){ POINT pt; HWND edit = GetDlgItem(g_sdata.hwnd,IDC_LOGWIN); RECT r; GetCursorPos(&pt); // Added and altered by Darren Owen (DrO) on 29/9/2003 // Will place the right-click menu in the top left corner of the window // if the application key is pressed and the mouse is not in the window // from here... ScreenToClient(edit, &pt); GetClientRect(edit, &r); if(!PtInRect(&r, pt)) pt.x = pt.y = 0; MapWindowPoints(edit, HWND_DESKTOP, &pt, 1); TrackPopupMenu(g_sdata.editSubmenu, TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RIGHTBUTTON, pt.x, pt.y, 0, g_sdata.hwnd, 0); } case TBN_DROPDOWN: { LPNMTOOLBAR pToolBar = (LPNMTOOLBAR) lParam; if(pToolBar->hdr.hwndFrom == g_toolbar.hwnd && pToolBar->iItem == IDM_COMPRESSOR) { ShowToolbarDropdownMenu(); return TBDDRET_DEFAULT; } else { return TBDDRET_NODEFAULT; } } } return TRUE; case WM_COPYDATA: { PCOPYDATASTRUCT cds = PCOPYDATASTRUCT(lParam); switch (cds->dwData) { case MAKENSIS_NOTIFY_SCRIPT: if (g_sdata.input_script) GlobalFree(g_sdata.input_script); g_sdata.input_script = (char *)GlobalAlloc(GPTR, cds->cbData); lstrcpy(g_sdata.input_script, (char *)cds->lpData); break; case MAKENSIS_NOTIFY_WARNING: g_sdata.warnings++; break; case MAKENSIS_NOTIFY_ERROR: break; case MAKENSIS_NOTIFY_OUTPUT: if (g_sdata.output_exe) GlobalFree(g_sdata.output_exe); g_sdata.output_exe = (char *)GlobalAlloc(GPTR, cds->cbData); lstrcpy(g_sdata.output_exe, (char *)cds->lpData); break; } return TRUE; } case WM_COMMAND: { switch (LOWORD(wParam)) { case IDM_BROWSESCR: { if (g_sdata.input_script) { char str[MAX_PATH],*str2; lstrcpy(str,g_sdata.input_script); str2=my_strrchr(str,'\\'); if(str2!=NULL) *str2=0; ShellExecute(g_sdata.hwnd,"open",str,NULL,NULL,SW_SHOWNORMAL); } return TRUE; } case IDM_ABOUT: { DialogBox(g_sdata.hInstance,MAKEINTRESOURCE(DLG_ABOUT),g_sdata.hwnd,(DLGPROC)AboutProc); return TRUE; } case IDM_NSISHOME: { ShellExecute(g_sdata.hwnd,"open",NSIS_URL,NULL,NULL,SW_SHOWNORMAL); return TRUE; } case IDM_FORUM: { ShellExecute(g_sdata.hwnd,"open",NSIS_FOR,NULL,NULL,SW_SHOWNORMAL); return TRUE; } case IDM_NSISUPDATE: { int rv; rv = MessageBox(g_sdata.hwnd,NSISUPDATEPROMPT,"Question",MB_YESNO|MB_ICONQUESTION); if(rv == IDYES) { char pathf[MAX_PATH],*path; GetModuleFileName(NULL,pathf,sizeof(pathf)); path=my_strrchr(pathf,'\\'); if(path!=NULL) *path=0; lstrcat(pathf,NSIS_UPDATE); ShellExecute(g_sdata.hwnd,"open",pathf,NULL,NULL,SW_SHOWNORMAL); PostMessage(g_sdata.hwnd,WM_COMMAND, IDM_EXIT, 0); } return TRUE; } case IDM_SELECTALL: { SendDlgItemMessage(g_sdata.hwnd, IDC_LOGWIN, EM_SETSEL, 0, -1); return TRUE; } case IDM_DOCS: { ShowDocs(); return TRUE; } case IDM_LOADSCRIPT: { if (!g_sdata.thread) { OPENFILENAME l={sizeof(l),}; char buf[MAX_PATH]; l.hwndOwner = hwndDlg; l.lpstrFilter = "NSIS Script (*.nsi)\0*.nsi\0All Files (*.*)\0*.*\0"; l.lpstrFile = buf; l.nMaxFile = MAX_STRING-1; l.lpstrTitle = "Load Script"; l.lpstrDefExt = "log"; l.lpstrFileTitle = NULL; l.lpstrInitialDir = NULL; l.Flags = OFN_HIDEREADONLY|OFN_EXPLORER|OFN_PATHMUSTEXIST|OFN_FILEMUSTEXIST; lstrcpy(buf,""); if (GetOpenFileName(&l)) { g_sdata.script = (char *)GlobalAlloc(GPTR,lstrlen(buf)+3); wsprintf(g_sdata.script,"\"%s\"",buf); PushMRUFile(g_sdata.script); ResetObjects(); CompileNSISScript(); } } return TRUE; } case IDM_MRU_FILE: case IDM_MRU_FILE+1: case IDM_MRU_FILE+2: case IDM_MRU_FILE+3: case IDM_MRU_FILE+4: LoadMRUFile(LOWORD(wParam)-IDM_MRU_FILE); return TRUE; case IDM_CLEAR_MRU_LIST: ClearMRUList(); return TRUE; case IDM_COMPRESSOR: { SetCompressor((NCOMPRESSOR)(g_sdata.compressor+1)); return TRUE; } case IDM_CLEARLOG: { if (!g_sdata.thread) { ClearLog(g_sdata.hwnd); } return TRUE; } case IDM_RECOMPILE: { CompileNSISScript(); return TRUE; } // Added by Darren Owen (DrO) on 1/10/2003 case IDM_RECOMPILE_TEST: case IDC_RECOMPILE_TEST: { g_sdata.recompile_test = 1; CompileNSISScript(); return TRUE; } case IDM_SETTINGS: { DialogBox(g_sdata.hInstance,MAKEINTRESOURCE(DLG_SETTINGS),g_sdata.hwnd,(DLGPROC)SettingsProc); return TRUE; } case IDM_TEST: case IDC_TEST: { if (g_sdata.output_exe) { ShellExecute(g_sdata.hwnd,"open",g_sdata.output_exe,NULL,NULL,SW_SHOWNORMAL); } return TRUE; } case IDM_EDITSCRIPT: { if (g_sdata.input_script) { if ((int)ShellExecute(g_sdata.hwnd,"open",g_sdata.input_script,NULL,NULL,SW_SHOWNORMAL)<=32) { char path[MAX_PATH]; if (GetWindowsDirectory(path,sizeof(path))) { lstrcat(path,"\\notepad.exe"); ShellExecute(g_sdata.hwnd,"open",path,g_sdata.input_script,NULL,SW_SHOWNORMAL); } } } return TRUE; } case IDC_CLOSE: case IDM_EXIT: { if (!g_sdata.thread) { DestroyWindow(g_sdata.hwnd); } return TRUE; } case IDM_COPY: { CopyToClipboard(g_sdata.hwnd); return TRUE; } case IDM_COPYSELECTED: { SendDlgItemMessage(g_sdata.hwnd,IDC_LOGWIN, WM_COPY, 0, 0); return TRUE; } case IDM_SAVE: { OPENFILENAME l={sizeof(l),}; char buf[MAX_STRING]; l.hwndOwner = hwndDlg; l.lpstrFilter = "Log Files (*.log)\0*.log\0Text Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0"; l.lpstrFile = buf; l.nMaxFile = MAX_STRING-1; l.lpstrTitle = "Save Output"; l.lpstrDefExt = "log"; l.lpstrInitialDir = NULL; l.Flags = OFN_HIDEREADONLY|OFN_EXPLORER|OFN_PATHMUSTEXIST; lstrcpy(buf,"output"); if (GetSaveFileName(&l)) { HANDLE hFile = CreateFile(buf,GENERIC_WRITE,0,0,CREATE_ALWAYS,0,0); if (hFile) { int len=SendDlgItemMessage(g_sdata.hwnd,IDC_LOGWIN,WM_GETTEXTLENGTH,0,0); char *existing_text=(char*)GlobalAlloc(GPTR,len); existing_text[0]=0; GetDlgItemText(g_sdata.hwnd, IDC_LOGWIN, existing_text, len); DWORD dwWritten = 0; WriteFile(hFile,existing_text,len,&dwWritten,0); CloseHandle(hFile); GlobalFree(existing_text); } } return TRUE; } case IDM_FIND: { if (!g_find.uFindReplaceMsg) g_find.uFindReplaceMsg = RegisterWindowMessage(FINDMSGSTRING); my_memset(&g_find.fr, 0, sizeof(FINDREPLACE)); g_find.fr.lStructSize = sizeof(FINDREPLACE); g_find.fr.hwndOwner = hwndDlg; g_find.fr.Flags = FR_NOUPDOWN; g_find.fr.lpstrFindWhat = (char *)GlobalAlloc(GPTR, 128); if (!g_find.fr.lpstrFindWhat) return TRUE; g_find.fr.wFindWhatLen = 128; g_find.hwndFind = FindText(&g_find.fr); return TRUE; } default: { int i; DWORD command = LOWORD(wParam); for(i=(int)COMPRESSOR_SCRIPT; i<=(int)COMPRESSOR_BEST; i++) { if(command == compressor_commands[i]) { SetCompressor((NCOMPRESSOR)i); return TRUE; } } } } } } if (g_find.uFindReplaceMsg && msg == g_find.uFindReplaceMsg) { LPFINDREPLACE lpfr = (LPFINDREPLACE)lParam; if (lpfr->Flags & FR_FINDNEXT) { WPARAM flags = FR_DOWN; if (lpfr->Flags & FR_MATCHCASE) flags |= FR_MATCHCASE; if (lpfr->Flags & FR_WHOLEWORD) flags |= FR_WHOLEWORD; FINDTEXTEX ft; SendDlgItemMessage(hwndDlg, IDC_LOGWIN, EM_EXGETSEL, 0, (LPARAM)&ft.chrg); if (ft.chrg.cpMax == ft.chrg.cpMin) ft.chrg.cpMin = 0; else ft.chrg.cpMin = ft.chrg.cpMax; ft.chrg.cpMax = SendDlgItemMessage(hwndDlg, IDC_LOGWIN, WM_GETTEXTLENGTH, 0, 0); ft.lpstrText = lpfr->lpstrFindWhat; ft.chrg.cpMin = SendDlgItemMessage(hwndDlg, IDC_LOGWIN, EM_FINDTEXTEX, flags, (LPARAM)&ft); if (ft.chrg.cpMin != -1) SendDlgItemMessage(hwndDlg, IDC_LOGWIN, EM_SETSEL, ft.chrgText.cpMin, ft.chrgText.cpMax); else MessageBeep(MB_ICONASTERISK); } if (lpfr->Flags & FR_DIALOGTERM) g_find.hwndFind = 0; return TRUE; } return 0; }
INT_PTR WINAPI doColorDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { #ifndef _WIN32 static int iSettingColor = -1; #endif if (INT_PTR r = SNM_HookThemeColorsMessage(hwndDlg, uMsg, wParam, lParam)) return r; switch (uMsg) { case WM_INITDIALOG: UpdateCustomColors(); RestoreWindowPos(hwndDlg, COLORDLG_WINDOWPOS_KEY, false); return 0; case WM_DRAWITEM: { LPDRAWITEMSTRUCT pDI = (LPDRAWITEMSTRUCT)lParam; HBRUSH hb = NULL; switch (pDI->CtlID) { case IDC_COLOR1: hb = CreateSolidBrush(g_crGradStart); break; case IDC_COLOR2: hb = CreateSolidBrush(g_crGradEnd); break; } FillRect(pDI->hDC, &pDI->rcItem, hb); DeleteObject(hb); return 1; } #ifndef _WIN32 case WM_TIMER: { COLORREF cr; if (iSettingColor != -1 && GetChosenColor(&cr)) { switch (iSettingColor) { case 0: g_crGradStart = cr; break; case 1: g_crGradEnd = cr; break; case 2: UpdateCustomColors(); break; } PersistColors(); InvalidateRect(hwndDlg, NULL, 0); KillTimer(hwndDlg, 1); iSettingColor = -1; } break; } #endif case WM_COMMAND: { wParam = LOWORD(wParam); switch(wParam) { case IDC_COLOR1: case IDC_COLOR2: case IDC_SETCUST: { #ifdef _WIN32 CHOOSECOLOR cc; memset(&cc, 0, sizeof(CHOOSECOLOR)); cc.lStructSize = sizeof(CHOOSECOLOR); cc.hwndOwner = hwndDlg; cc.lpCustColors = g_custColors; cc.Flags = CC_FULLOPEN | CC_RGBINIT; if (wParam == IDC_COLOR1) { cc.rgbResult = g_crGradStart; if (ChooseColor(&cc)) { g_crGradStart = cc.rgbResult; PersistColors(); RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); } } else if (wParam == IDC_COLOR2) { cc.rgbResult = g_crGradEnd; if (ChooseColor(&cc)) { g_crGradEnd = cc.rgbResult; PersistColors(); RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); } } else if (wParam == IDC_SETCUST && ChooseColor(&cc)) PersistColors(); #else switch(wParam) { case IDC_COLOR1: iSettingColor = 0; ShowColorChooser(g_crGradStart); break; case IDC_COLOR2: iSettingColor = 1; ShowColorChooser(g_crGradEnd); break; case IDC_SETCUST: iSettingColor = 2; ShowColorChooser(g_custColors[0]); break; } SetTimer(hwndDlg, 1, 50, NULL); #endif break; } case IDC_SAVECOL: case IDC_LOADCOL: case IDC_LOADFROMTHEME: { char cPath[512] = { 0 }; const char* cExt = "SWS Color Files (*.SWSColor)\0*.SWSColor\0Color Theme Files (*.ReaperTheme)\0*.ReaperTheme\0All Files\0*.*\0"; GetPrivateProfileString("REAPER", "lastthemefn", "", cPath, 512, get_ini_file()); char* pC = strrchr(cPath, PATH_SLASH_CHAR); if (pC) *pC = 0; if (wParam == IDC_SAVECOL) { char cFilename[512]; UpdateCustomColors(); if (BrowseForSaveFile(__LOCALIZE("Save color theme","sws_color"), cPath, NULL, cExt, cFilename, 512)) { char key[32]; char val[32]; for (int i = 0; i < 16; i++) { sprintf(key, "custcolor%d", i+1); sprintf(val, "%d", g_custColors[i]); WritePrivateProfileString("SWS Color", key, val, cFilename); } sprintf(val, "%d", g_crGradStart); WritePrivateProfileString("SWS Color", "gradientStart", val, cFilename); sprintf(val, "%d", g_crGradEnd); WritePrivateProfileString("SWS Color", "gradientEnd", val, cFilename); } } else if (wParam == IDC_LOADCOL || wParam == IDC_LOADFROMTHEME) { #ifndef _WIN32 if (MessageBox(hwndDlg, __LOCALIZE("WARNING: Loading colors from file will overwrite your global personalized color choices.\nIf these are important to you, press press cancel to abort the loading of new colors!","sws_color"), __LOCALIZE("OSX Color Load WARNING","sws_color"), MB_OKCANCEL) == IDCANCEL) break; #endif if (wParam == IDC_LOADCOL) { char* cFile = BrowseForFiles(__LOCALIZE("Choose color theme file","sws_color"), cPath, NULL, false, cExt); if (cFile) { lstrcpyn(cPath, cFile, 512); free(cFile); } else cPath[0] = 0; } else GetPrivateProfileString("REAPER", "lastthemefn", "", cPath, 512, get_ini_file()); if (cPath[0]) { char key[32]; bool bFound = false; for (int i = 0; i < 16; i++) { sprintf(key, "custcolor%d", i+1); int iColor = GetPrivateProfileInt("SWS Color", key, -1, cPath); if (iColor != -1) { g_custColors[i] = iColor; bFound = true; } } if (!bFound) { char cMsg[512]; _snprintf(cMsg, 512, __LOCALIZE_VERFMT("No SWS custom colors found in %s.","sws_color"), cPath); MessageBox(hwndDlg, cMsg, __LOCALIZE("SWS Color Load","sws_color"), MB_OK); } g_crGradStart = GetPrivateProfileInt("SWS Color", "gradientStart", g_crGradStart, cPath); g_crGradEnd = GetPrivateProfileInt("SWS Color", "gradientEnd", g_crGradEnd, cPath); PersistColors(); #ifdef _WIN32 RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); #else InvalidateRect(hwndDlg, NULL, 0); #endif } } } break; case IDOK: // Do something ? // fall through! case IDCANCEL: #ifndef _WIN32 if (iSettingColor != -1) { HideColorChooser(); KillTimer(hwndDlg, 1); } #endif SaveWindowPos(hwndDlg, COLORDLG_WINDOWPOS_KEY); EndDialog(hwndDlg,0); break; } return 0; } } return 0; }
WDL_DLGRET EnvelopeLfoDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { const char cWndPosKey[] = "LFO Window Pos"; if (INT_PTR r = SNM_HookThemeColorsMessage(hwnd, uMsg, wParam, lParam)) return r; switch(uMsg) { case WM_INITDIALOG : { WDL_UTF8_HookComboBox(GetDlgItem(hwnd, IDC_PADRELFO_TARGET)); WDL_UTF8_HookComboBox(GetDlgItem(hwnd, IDC_PADRELFO_TIMESEGMENT)); WDL_UTF8_HookComboBox(GetDlgItem(hwnd, IDC_PADRELFO_LFOSHAPE)); WDL_UTF8_HookComboBox(GetDlgItem(hwnd, IDC_PADRELFO_SYNCFREQUENCY)); WDL_UTF8_HookComboBox(GetDlgItem(hwnd, IDC_PADRELFO_SYNCDELAY)); WDL_UTF8_HookComboBox(GetDlgItem(hwnd, IDC_PADRELFO_TAKEENV)); WDL_UTF8_HookComboBox(GetDlgItem(hwnd, IDC_PADRELFO_MIDICC)); for(int i=eENVTYPE_TRACK; i<=eENVTYPE_MIDICC; i++) { int x = (int)SendDlgItemMessage(hwnd,IDC_PADRELFO_TARGET,CB_ADDSTRING,0,(LPARAM)GetEnvTypeStr((EnvType)i)); SendDlgItemMessage(hwnd,IDC_PADRELFO_TARGET,CB_SETITEMDATA,x,i); if(i == EnvelopeProcessor::getInstance()->_parameters.envType) SendDlgItemMessage(hwnd,IDC_PADRELFO_TARGET,CB_SETCURSEL,x,0); } SendMessage(hwnd, WM_COMMAND, MAKEWPARAM(IDC_PADRELFO_TARGET, CBN_SELCHANGE), NULL); if(EnvelopeProcessor::getInstance()->_parameters.activeTakeOnly) CheckDlgButton(hwnd, IDC_PADRELFO_ACTIVETAKES, TRUE); else CheckDlgButton(hwnd, IDC_PADRELFO_ACTIVETAKES, FALSE); int iLastShape = eWAVSHAPE_SAWDOWN_BEZIER; if(EnvelopeProcessor::getInstance()->_parameters.envType == eENVTYPE_MIDICC) iLastShape = eWAVSHAPE_SAWDOWN; for(int i=eWAVSHAPE_SINE; i<=iLastShape; i++) { int x = (int)SendDlgItemMessage(hwnd,IDC_PADRELFO_LFOSHAPE,CB_ADDSTRING,0,(LPARAM)GetWaveShapeStr((WaveShape)i)); SendDlgItemMessage(hwnd,IDC_PADRELFO_LFOSHAPE,CB_SETITEMDATA,x,i); if(i == EnvelopeProcessor::getInstance()->_parameters.waveParams.shape) SendDlgItemMessage(hwnd,IDC_PADRELFO_LFOSHAPE,CB_SETCURSEL,x,0); } for(int i=eGRID_OFF; i<eGRID_LAST; i++) { int x = (int)SendDlgItemMessage(hwnd,IDC_PADRELFO_SYNCFREQUENCY,CB_ADDSTRING,0,(LPARAM)GetGridDivisionStr((GridDivision)i)); SendDlgItemMessage(hwnd,IDC_PADRELFO_SYNCFREQUENCY,CB_SETITEMDATA,x,i); if(i == EnvelopeProcessor::getInstance()->_parameters.waveParams.freqBeat) SendDlgItemMessage(hwnd,IDC_PADRELFO_SYNCFREQUENCY,CB_SETCURSEL,x,0); } SendMessage(hwnd, WM_COMMAND, MAKEWPARAM(IDC_PADRELFO_SYNCFREQUENCY, CBN_SELCHANGE), NULL); for(int i=eGRID_OFF; i<eGRID_LAST; i++) { if( (i>eGRID_OFF) && (i<=eGRID_1_1) ) continue; int x = (int)SendDlgItemMessage(hwnd,IDC_PADRELFO_SYNCDELAY,CB_ADDSTRING,0,(LPARAM)GetGridDivisionStr((GridDivision)i)); SendDlgItemMessage(hwnd,IDC_PADRELFO_SYNCDELAY,CB_SETITEMDATA,x,i); if(i == EnvelopeProcessor::getInstance()->_parameters.waveParams.delayBeat) SendDlgItemMessage(hwnd,IDC_PADRELFO_SYNCDELAY,CB_SETCURSEL,x,0); } SendMessage(hwnd, WM_COMMAND, MAKEWPARAM(IDC_PADRELFO_SYNCDELAY, CBN_SELCHANGE), NULL); char buffer[BUFFER_SIZE]; sprintf(buffer, "%.3lf", EnvelopeProcessor::getInstance()->_parameters.waveParams.freqHz); SetDlgItemText(hwnd, IDC_PADRELFO_FREQUENCY, buffer); sprintf(buffer, "%.3lf", EnvelopeProcessor::getInstance()->_parameters.waveParams.delayMsec); SetDlgItemText(hwnd, IDC_PADRELFO_DELAY, buffer); sprintf(buffer, "%.0lf", 100.0*EnvelopeProcessor::getInstance()->_parameters.waveParams.strength); SetDlgItemText(hwnd, IDC_PADRELFO_STRENGTH, buffer); sprintf(buffer, "%.0lf", 100.0*EnvelopeProcessor::getInstance()->_parameters.waveParams.offset); SetDlgItemText(hwnd, IDC_PADRELFO_OFFSET, buffer); for(int i=eTAKEENV_VOLUME; i<=eTAKEENV_PITCH; i++) { int x = (int)SendDlgItemMessage(hwnd,IDC_PADRELFO_TAKEENV,CB_ADDSTRING,0,(LPARAM)GetTakeEnvelopeStr((TakeEnvType)i)); SendDlgItemMessage(hwnd,IDC_PADRELFO_TAKEENV,CB_SETITEMDATA,x,i); if(i == EnvelopeProcessor::getInstance()->_parameters.takeEnvType) SendDlgItemMessage(hwnd,IDC_PADRELFO_TAKEENV,CB_SETCURSEL,x,0); } for(int i=0; i<128; i++) { sprintf(buffer, "%3d", i); int x = (int)SendDlgItemMessage(hwnd,IDC_PADRELFO_MIDICC,CB_ADDSTRING,0,(LPARAM)buffer); SendDlgItemMessage(hwnd,IDC_PADRELFO_MIDICC,CB_SETITEMDATA,x,i); if(i == EnvelopeProcessor::getInstance()->_parameters.midiCc) SendDlgItemMessage(hwnd,IDC_PADRELFO_MIDICC,CB_SETCURSEL,x,0); } RestoreWindowPos(hwnd, cWndPosKey, false); SetFocus(GetDlgItem(hwnd, IDC_PADRELFO_TARGET)); return 0; } case WM_COMMAND : switch(LOWORD(wParam)) { case IDOK: { int combo = (int)SendDlgItemMessage(hwnd,IDC_PADRELFO_TARGET,CB_GETCURSEL,0,0); if(combo != CB_ERR) EnvelopeProcessor::getInstance()->_parameters.envType = (EnvType)(SendDlgItemMessage(hwnd,IDC_PADRELFO_TARGET,CB_GETITEMDATA,combo,0)); EnvelopeProcessor::getInstance()->_parameters.activeTakeOnly = (IsDlgButtonChecked(hwnd, IDC_PADRELFO_ACTIVETAKES) != 0); combo = (int)SendDlgItemMessage(hwnd,IDC_PADRELFO_TIMESEGMENT,CB_GETCURSEL,0,0); if(combo != CB_ERR) EnvelopeProcessor::getInstance()->_parameters.timeSegment = (TimeSegment)(SendDlgItemMessage(hwnd,IDC_PADRELFO_TIMESEGMENT,CB_GETITEMDATA,combo,0)); combo = (int)SendDlgItemMessage(hwnd,IDC_PADRELFO_LFOSHAPE,CB_GETCURSEL,0,0); if(combo != CB_ERR) EnvelopeProcessor::getInstance()->_parameters.waveParams.shape = (WaveShape)(SendDlgItemMessage(hwnd,IDC_PADRELFO_LFOSHAPE,CB_GETITEMDATA,combo,0)); combo = (int)SendDlgItemMessage(hwnd,IDC_PADRELFO_SYNCFREQUENCY,CB_GETCURSEL,0,0); if(combo != CB_ERR) EnvelopeProcessor::getInstance()->_parameters.waveParams.freqBeat = (GridDivision)(SendDlgItemMessage(hwnd,IDC_PADRELFO_SYNCFREQUENCY,CB_GETITEMDATA,combo,0)); combo = (int)SendDlgItemMessage(hwnd,IDC_PADRELFO_SYNCDELAY,CB_GETCURSEL,0,0); if(combo != CB_ERR) EnvelopeProcessor::getInstance()->_parameters.waveParams.delayBeat = (GridDivision)(SendDlgItemMessage(hwnd,IDC_PADRELFO_SYNCDELAY,CB_GETITEMDATA,combo,0)); char buffer[BUFFER_SIZE]; GetDlgItemText(hwnd,IDC_PADRELFO_FREQUENCY,buffer,BUFFER_SIZE); EnvelopeProcessor::getInstance()->_parameters.waveParams.freqHz = atof(buffer); GetDlgItemText(hwnd,IDC_PADRELFO_DELAY,buffer,BUFFER_SIZE); EnvelopeProcessor::getInstance()->_parameters.waveParams.delayMsec = atof(buffer); GetDlgItemText(hwnd,IDC_PADRELFO_STRENGTH,buffer,BUFFER_SIZE); EnvelopeProcessor::getInstance()->_parameters.waveParams.strength = atof(buffer)/100.0; GetDlgItemText(hwnd,IDC_PADRELFO_OFFSET,buffer,BUFFER_SIZE); EnvelopeProcessor::getInstance()->_parameters.waveParams.offset = atof(buffer)/100.0; combo = (int)SendDlgItemMessage(hwnd,IDC_PADRELFO_TAKEENV,CB_GETCURSEL,0,0); if(combo != CB_ERR) EnvelopeProcessor::getInstance()->_parameters.takeEnvType = (TakeEnvType)(SendDlgItemMessage(hwnd,IDC_PADRELFO_TAKEENV,CB_GETITEMDATA,combo,0)); combo = (int)SendDlgItemMessage(hwnd,IDC_PADRELFO_MIDICC,CB_GETCURSEL,0,0); if(combo != CB_ERR) EnvelopeProcessor::getInstance()->_parameters.midiCc = (int)SendDlgItemMessage(hwnd,IDC_PADRELFO_MIDICC,CB_GETITEMDATA,combo,0); EnvelopeProcessor::ErrorCode res = EnvelopeProcessor::eERRORCODE_UNKNOWN; switch(EnvelopeProcessor::getInstance()->_parameters.envType) { case eENVTYPE_TRACK : res = EnvelopeProcessor::getInstance()->generateSelectedTrackEnvLfo(); break; case eENVTYPE_TAKE : res = EnvelopeProcessor::getInstance()->generateSelectedTakesLfo(); break; case eENVTYPE_MIDICC : res = EnvelopeProcessor::getInstance()->generateSelectedMidiTakeLfo(); break; default: break; } EnvelopeProcessor::errorHandlerDlg(hwnd, res); //EndDialog(hwnd,0); return 0; } break; case IDCANCEL: { ShowWindow(hwnd, SW_HIDE); return 0; } break; case IDC_PADRELFO_TARGET: { if(HIWORD(wParam) == CBN_SELCHANGE) { int combo = (int)SendDlgItemMessage(hwnd,IDC_PADRELFO_TARGET,CB_GETCURSEL,0,0); if(combo != CB_ERR) { EnvType envType = (EnvType)(SendDlgItemMessage(hwnd,IDC_PADRELFO_TARGET,CB_GETITEMDATA,combo,0)); switch(envType) { case eENVTYPE_TRACK: EnableWindow(GetDlgItem(hwnd,IDC_PADRELFO_ACTIVETAKES), FALSE); EnableWindow(GetDlgItem(hwnd,IDC_PADRELFO_TAKEENV), FALSE); EnableWindow(GetDlgItem(hwnd,IDC_PADRELFO_MIDICC), FALSE); break; case eENVTYPE_TAKE: EnableWindow(GetDlgItem(hwnd,IDC_PADRELFO_ACTIVETAKES), TRUE); EnableWindow(GetDlgItem(hwnd,IDC_PADRELFO_TAKEENV), TRUE); EnableWindow(GetDlgItem(hwnd,IDC_PADRELFO_MIDICC), FALSE); break; case eENVTYPE_MIDICC: EnableWindow(GetDlgItem(hwnd,IDC_PADRELFO_ACTIVETAKES), TRUE); EnableWindow(GetDlgItem(hwnd,IDC_PADRELFO_TAKEENV), FALSE); EnableWindow(GetDlgItem(hwnd,IDC_PADRELFO_MIDICC), TRUE); break; default: break; } SendDlgItemMessage(hwnd,IDC_PADRELFO_TIMESEGMENT,CB_RESETCONTENT,0,NULL); for(int i=eTIMESEGMENT_TIMESEL; i<eTIMESEGMENT_LAST; i++) { if( (envType == eENVTYPE_TRACK) && (i == eTIMESEGMENT_SELITEM) ) continue; if( (envType == eENVTYPE_TAKE) && (i == eTIMESEGMENT_PROJECT) ) continue; int x = (int)SendDlgItemMessage(hwnd,IDC_PADRELFO_TIMESEGMENT,CB_ADDSTRING,0,(LPARAM)GetTimeSegmentStr((TimeSegment)i)); SendDlgItemMessage(hwnd,IDC_PADRELFO_TIMESEGMENT,CB_SETITEMDATA,x,i); if(i == EnvelopeProcessor::getInstance()->_parameters.timeSegment) SendDlgItemMessage(hwnd,IDC_PADRELFO_TIMESEGMENT,CB_SETCURSEL,x,0); } } } return 0; } break; case IDC_PADRELFO_SYNCFREQUENCY: { if(HIWORD(wParam) == CBN_SELCHANGE) { int combo = (int)SendDlgItemMessage(hwnd,IDC_PADRELFO_SYNCFREQUENCY,CB_GETCURSEL,0,0); if(combo != CB_ERR) { GridDivision freqBeat = (GridDivision)(SendDlgItemMessage(hwnd,IDC_PADRELFO_SYNCFREQUENCY,CB_GETITEMDATA,combo,0)); if(freqBeat == eGRID_OFF) EnableWindow(GetDlgItem(hwnd,IDC_PADRELFO_FREQUENCY), TRUE); else EnableWindow(GetDlgItem(hwnd,IDC_PADRELFO_FREQUENCY), FALSE); } } return 0; } break; case IDC_PADRELFO_SYNCDELAY: { if(HIWORD(wParam) == CBN_SELCHANGE) { int combo = (int)SendDlgItemMessage(hwnd,IDC_PADRELFO_SYNCDELAY,CB_GETCURSEL,0,0); if(combo != CB_ERR) { GridDivision delayBeat = (GridDivision)(SendDlgItemMessage(hwnd,IDC_PADRELFO_SYNCDELAY,CB_GETITEMDATA,combo,0)); if(delayBeat == eGRID_OFF) EnableWindow(GetDlgItem(hwnd,IDC_PADRELFO_DELAY), TRUE); else EnableWindow(GetDlgItem(hwnd,IDC_PADRELFO_DELAY), FALSE); } } return 0; } break; } case WM_DESTROY: SaveWindowPos(hwnd, cWndPosKey); break; } return 0; }
WDL_DLGRET EnvelopeProcessorDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { const char cWndPosKey[] = "EnvProc Window Pos"; if (INT_PTR r = SNM_HookThemeColorsMessage(hwnd, uMsg, wParam, lParam)) return r; switch(uMsg) { case WM_INITDIALOG : { WDL_UTF8_HookComboBox(GetDlgItem(hwnd, IDC_PADREENVPROC_TYPE)); WDL_UTF8_HookComboBox(GetDlgItem(hwnd, IDC_PADREENVPROC_TARGET)); WDL_UTF8_HookComboBox(GetDlgItem(hwnd, IDC_PADREENVPROC_TIMESEGMENT)); WDL_UTF8_HookComboBox(GetDlgItem(hwnd, IDC_PADREENVPROC_TAKEENV)); for(int i=eENVTYPE_TRACK; i<eENVTYPE_MIDICC; i++) { int x = (int)SendDlgItemMessage(hwnd,IDC_PADREENVPROC_TARGET,CB_ADDSTRING,0,(LPARAM)GetEnvTypeStr((EnvType)i)); SendDlgItemMessage(hwnd,IDC_PADREENVPROC_TARGET,CB_SETITEMDATA,x,i); if(i == EnvelopeProcessor::getInstance()->_envModParams.envType) SendDlgItemMessage(hwnd,IDC_PADREENVPROC_TARGET,CB_SETCURSEL,x,0); } SendMessage(hwnd, WM_COMMAND, MAKEWPARAM(IDC_PADREENVPROC_TARGET, CBN_SELCHANGE), NULL); if(EnvelopeProcessor::getInstance()->_envModParams.activeTakeOnly) CheckDlgButton(hwnd, IDC_PADREENVPROC_ACTIVETAKES, TRUE); else CheckDlgButton(hwnd, IDC_PADREENVPROC_ACTIVETAKES, FALSE); for(int i=eENVMOD_FADEIN; i<eENVMOD_LAST; i++) { int x = (int)SendDlgItemMessage(hwnd,IDC_PADREENVPROC_TYPE,CB_ADDSTRING,0,(LPARAM)GetEnvModTypeStr((EnvModType)i)); SendDlgItemMessage(hwnd,IDC_PADREENVPROC_TYPE,CB_SETITEMDATA,x,i); if(i == EnvelopeProcessor::getInstance()->_envModParams.type) SendDlgItemMessage(hwnd,IDC_PADREENVPROC_TYPE,CB_SETCURSEL,x,0); } char buffer[BUFFER_SIZE]; sprintf(buffer, "%.0lf", 100.0*EnvelopeProcessor::getInstance()->_envModParams.strength); SetDlgItemText(hwnd, IDC_PADREENVPROC_STRENGTH, buffer); sprintf(buffer, "%.0lf", 100.0*EnvelopeProcessor::getInstance()->_envModParams.offset); SetDlgItemText(hwnd, IDC_PADREENVPROC_OFFSET, buffer); for(int i=eTAKEENV_VOLUME; i<=eTAKEENV_PITCH; i++) { int x = (int)SendDlgItemMessage(hwnd,IDC_PADREENVPROC_TAKEENV,CB_ADDSTRING,0,(LPARAM)GetTakeEnvelopeStr((TakeEnvType)i)); SendDlgItemMessage(hwnd,IDC_PADREENVPROC_TAKEENV,CB_SETITEMDATA,x,i); if(i == EnvelopeProcessor::getInstance()->_envModParams.takeEnvType) SendDlgItemMessage(hwnd,IDC_PADREENVPROC_TAKEENV,CB_SETCURSEL,x,0); } RestoreWindowPos(hwnd, cWndPosKey, false); SetFocus(GetDlgItem(hwnd, IDC_PADREENVPROC_TYPE)); return 0; } break; case WM_COMMAND : { switch(LOWORD(wParam)) { case IDOK: { int combo = (int)SendDlgItemMessage(hwnd,IDC_PADREENVPROC_TARGET,CB_GETCURSEL,0,0); if(combo != CB_ERR) EnvelopeProcessor::getInstance()->_envModParams.envType = (EnvType)(SendDlgItemMessage(hwnd,IDC_PADREENVPROC_TARGET,CB_GETITEMDATA,combo,0)); EnvelopeProcessor::getInstance()->_envModParams.activeTakeOnly = (IsDlgButtonChecked(hwnd, IDC_PADREENVPROC_ACTIVETAKES) != 0); combo = (int)SendDlgItemMessage(hwnd,IDC_PADREENVPROC_TIMESEGMENT,CB_GETCURSEL,0,0); if(combo != CB_ERR) EnvelopeProcessor::getInstance()->_envModParams.timeSegment = (TimeSegment)(SendDlgItemMessage(hwnd,IDC_PADREENVPROC_TIMESEGMENT,CB_GETITEMDATA,combo,0)); combo = (int)SendDlgItemMessage(hwnd,IDC_PADREENVPROC_TYPE,CB_GETCURSEL,0,0); if(combo != CB_ERR) EnvelopeProcessor::getInstance()->_envModParams.type = (EnvModType)(SendDlgItemMessage(hwnd,IDC_PADREENVPROC_TYPE,CB_GETITEMDATA,combo,0)); char buffer[BUFFER_SIZE]; GetDlgItemText(hwnd,IDC_PADREENVPROC_STRENGTH,buffer,BUFFER_SIZE); EnvelopeProcessor::getInstance()->_envModParams.strength = atof(buffer)/100.0; GetDlgItemText(hwnd,IDC_PADREENVPROC_OFFSET,buffer,BUFFER_SIZE); EnvelopeProcessor::getInstance()->_envModParams.offset = atof(buffer)/100.0; combo =(int) SendDlgItemMessage(hwnd,IDC_PADREENVPROC_TAKEENV,CB_GETCURSEL,0,0); if(combo != CB_ERR) EnvelopeProcessor::getInstance()->_envModParams.takeEnvType = (TakeEnvType)(SendDlgItemMessage(hwnd,IDC_PADREENVPROC_TAKEENV,CB_GETITEMDATA,combo,0)); EnvelopeProcessor::ErrorCode res = EnvelopeProcessor::eERRORCODE_UNKNOWN; switch(EnvelopeProcessor::getInstance()->_envModParams.envType) { case eENVTYPE_TRACK : res = EnvelopeProcessor::getInstance()->processSelectedTrackEnv(); break; case eENVTYPE_TAKE : res = EnvelopeProcessor::getInstance()->processSelectedTakes(); break; default: break; } EnvelopeProcessor::errorHandlerDlg(hwnd, res); return 0; } break; case IDCANCEL: { ShowWindow(hwnd, SW_HIDE); return 0; } break; case IDC_PADREENVPROC_TARGET: { if(HIWORD(wParam) == CBN_SELCHANGE) { int combo = (int)SendDlgItemMessage(hwnd,IDC_PADREENVPROC_TARGET,CB_GETCURSEL,0,0); if(combo != CB_ERR) { EnvType envType = (EnvType)(SendDlgItemMessage(hwnd,IDC_PADREENVPROC_TARGET,CB_GETITEMDATA,combo,0)); switch(envType) { case eENVTYPE_TRACK: EnableWindow(GetDlgItem(hwnd,IDC_PADREENVPROC_ACTIVETAKES), FALSE); EnableWindow(GetDlgItem(hwnd,IDC_PADREENVPROC_TAKEENV), FALSE); break; case eENVTYPE_TAKE: EnableWindow(GetDlgItem(hwnd,IDC_PADREENVPROC_ACTIVETAKES), TRUE); EnableWindow(GetDlgItem(hwnd,IDC_PADREENVPROC_TAKEENV), TRUE); break; default: break; } SendDlgItemMessage(hwnd,IDC_PADREENVPROC_TIMESEGMENT,CB_RESETCONTENT,0,NULL); for(int i=eTIMESEGMENT_TIMESEL; i<eTIMESEGMENT_LAST; i++) { if( (envType == eENVTYPE_TRACK) && (i == eTIMESEGMENT_SELITEM) ) continue; if( (envType == eENVTYPE_TAKE) && (i == eTIMESEGMENT_PROJECT) ) continue; int x = (int)SendDlgItemMessage(hwnd,IDC_PADREENVPROC_TIMESEGMENT,CB_ADDSTRING,0,(LPARAM)GetTimeSegmentStr((TimeSegment)i)); SendDlgItemMessage(hwnd,IDC_PADREENVPROC_TIMESEGMENT,CB_SETITEMDATA,x,i); if(i == EnvelopeProcessor::getInstance()->_envModParams.timeSegment) SendDlgItemMessage(hwnd,IDC_PADREENVPROC_TIMESEGMENT,CB_SETCURSEL,x,0); } } } return 0; } break; } } case WM_DESTROY: SaveWindowPos(hwnd, cWndPosKey); break; } return 0; }
INT_PTR CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: { g_sdata.hwnd=hwndDlg; HICON hIcon = LoadIcon(g_sdata.hInstance,MAKEINTRESOURCE(IDI_ICON)); SetClassLongPtr(hwndDlg,GCLP_HICON,(LONG_PTR)hIcon); // Altered by Darren Owen (DrO) on 29/9/2003 // Added in receiving of mouse and key events from the richedit control SendMessage(GetDlgItem(hwndDlg,IDC_LOGWIN),EM_SETEVENTMASK,(WPARAM)NULL,ENM_SELCHANGE|ENM_MOUSEEVENTS|ENM_KEYEVENTS); DragAcceptFiles(g_sdata.hwnd,FALSE); g_sdata.menu = GetMenu(g_sdata.hwnd); g_sdata.fileSubmenu = FindSubMenu(g_sdata.menu, IDM_FILE); g_sdata.editSubmenu = FindSubMenu(g_sdata.menu, IDM_EDIT); g_sdata.toolsSubmenu = FindSubMenu(g_sdata.menu, IDM_TOOLS); RestoreMRUList(); CreateToolBar(); InitTooltips(g_sdata.hwnd); SetDlgItemText(g_sdata.hwnd,IDC_VERSION,g_sdata.branding); HFONT hFont = CreateFont(14,FW_NORMAL,FIXED_PITCH|FF_DONTCARE,_T("Courier New")); SendDlgItemMessage(hwndDlg,IDC_LOGWIN,WM_SETFONT,(WPARAM)hFont,0); RestoreWindowPos(g_sdata.hwnd); RestoreCompressor(); SetScript(_T("")); g_sdata.compressor = COMPRESSOR_NONE_SELECTED; g_sdata.userSelectCompressor = FALSE; ProcessCommandLine(); if(g_sdata.compressor == COMPRESSOR_NONE_SELECTED) { SetCompressor(g_sdata.default_compressor); } if(g_sdata.userSelectCompressor) { if (DialogBox(g_sdata.hInstance,MAKEINTRESOURCE(DLG_COMPRESSOR),g_sdata.hwnd,(DLGPROC)CompressorProc)) { EnableItems(g_sdata.hwnd); return TRUE; } } CompileNSISScript(); return TRUE; } case WM_PAINT: { PAINTSTRUCT ps; GetGripperPos(hwndDlg, g_resize.griprect); HDC hdc = BeginPaint(hwndDlg, &ps); DrawFrameControl(hdc, &g_resize.griprect, DFC_SCROLL, DFCS_SCROLLSIZEGRIP); EndPaint(hwndDlg, &ps); return TRUE; } case WM_DESTROY: { DragAcceptFiles(g_sdata.hwnd,FALSE); SaveSymbols(); SaveCompressor(); SaveMRUList(); SaveWindowPos(g_sdata.hwnd); ImageList_Destroy(g_toolbar.imagelist); ImageList_Destroy(g_toolbar.imagelistd); ImageList_Destroy(g_toolbar.imagelisth); DestroyTooltips(); PostQuitMessage(0); return TRUE; } case WM_CLOSE: { if (!g_sdata.thread) { DestroyWindow(hwndDlg); } return TRUE; } case WM_DROPFILES: { int num; TCHAR szTmp[MAX_PATH]; num = DragQueryFile((HDROP)wParam,(UINT)-1,NULL,0); if (num==1) { DragQueryFile((HDROP)wParam,0,szTmp,MAX_PATH); if (lstrlen(szTmp)>0) { SetScript(szTmp); PushMRUFile(g_sdata.script); ResetObjects(); CompileNSISScript(); } } else { MessageBox(hwndDlg,MULTIDROPERROR,ERRBOXTITLE,MB_OK|MB_ICONSTOP); } DragFinish((HDROP)wParam); break; } case WM_GETMINMAXINFO: { ((MINMAXINFO*)lParam)->ptMinTrackSize.x=MINWIDTH; ((MINMAXINFO*)lParam)->ptMinTrackSize.y=MINHEIGHT; } case WM_ENTERSIZEMOVE: { GetClientRect(g_sdata.hwnd, &g_resize.resizeRect); return TRUE; } case WM_SIZE: { if ((wParam == SIZE_MAXHIDE)||(wParam == SIZE_MAXSHOW)) return TRUE; RECT rSize; if (hwndDlg == g_sdata.hwnd) { GetClientRect(g_sdata.hwnd, &rSize); if (((rSize.right==0)&&(rSize.bottom==0))||((g_resize.resizeRect.right==0)&&(g_resize.resizeRect.bottom==0))) return TRUE; g_resize.dx = rSize.right - g_resize.resizeRect.right; g_resize.dy = rSize.bottom - g_resize.resizeRect.bottom; EnumChildWindows(g_sdata.hwnd, DialogResize, (LPARAM)0); g_resize.resizeRect = rSize; } return TRUE; } case WM_SIZING: { InvalidateRect(hwndDlg, &g_resize.griprect, TRUE); GetGripperPos(hwndDlg, g_resize.griprect); return TRUE; } case WM_NCHITTEST: { RECT r = g_resize.griprect; MapWindowPoints(hwndDlg, 0, (POINT*)&r, 2); POINT pt = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)}; if (PtInRect(&r, pt)) { SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, HTBOTTOMRIGHT); return TRUE; } return FALSE; } case WM_MAKENSIS_PROCESSCOMPLETE: { if (g_sdata.thread) { CloseHandle(g_sdata.thread); g_sdata.thread=0; } if(g_sdata.compressor == COMPRESSOR_BEST) { if (g_sdata.retcode==0 && FileExists(g_sdata.output_exe)) { TCHAR temp_file_name[1024]; // BUGBUG: Hardcoded buffer size wsprintf(temp_file_name,_T("%s_makensisw_temp"),g_sdata.output_exe); if(!lstrcmpi(g_sdata.compressor_name,compressor_names[(int)COMPRESSOR_SCRIPT+1])) { SetCompressorStats(); CopyFile(g_sdata.output_exe,temp_file_name,false); g_sdata.best_compressor_name = g_sdata.compressor_name; g_sdata.compressor_name = compressor_names[(int)COMPRESSOR_SCRIPT+2]; ResetObjects(); CompileNSISScript(); return TRUE; } else { int this_compressor=0; int i; HANDLE hPrev, hThis; DWORD prevSize=0, thisSize=0; for(i=(int)COMPRESSOR_SCRIPT+2; i<(int)COMPRESSOR_BEST; i++) { if(!lstrcmpi(g_sdata.compressor_name,compressor_names[i])) { this_compressor = i; break; } } if(FileExists(temp_file_name)) { hPrev = CreateFile(temp_file_name,GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, (DWORD)NULL, NULL); if(hPrev != INVALID_HANDLE_VALUE) { prevSize = GetFileSize(hPrev, 0); CloseHandle(hPrev); if(prevSize != INVALID_FILE_SIZE) { hThis = CreateFile(g_sdata.output_exe,GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, (DWORD)NULL, NULL); if(hThis != INVALID_HANDLE_VALUE) { thisSize = GetFileSize(hThis, 0); CloseHandle(hThis); if(thisSize != INVALID_FILE_SIZE) { if(prevSize > thisSize) { CopyFile(g_sdata.output_exe,temp_file_name,false); SetCompressorStats(); g_sdata.best_compressor_name = g_sdata.compressor_name; } } } } } } if(this_compressor == ((int)COMPRESSOR_BEST - 1)) { TCHAR buf[1024]; g_sdata.compressor_name = compressor_names[(int)COMPRESSOR_SCRIPT+1]; if(!lstrcmpi(g_sdata.best_compressor_name,compressor_names[this_compressor])) { wsprintf(buf,COMPRESSOR_MESSAGE,g_sdata.best_compressor_name,thisSize); LogMessage(g_sdata.hwnd,buf); } else { CopyFile(temp_file_name,g_sdata.output_exe,false); wsprintf(buf,RESTORED_COMPRESSOR_MESSAGE,g_sdata.best_compressor_name,prevSize); LogMessage(g_sdata.hwnd,buf); LogMessage(g_sdata.hwnd, g_sdata.compressor_stats); } DeleteFile(temp_file_name); lstrcpy(g_sdata.compressor_stats,_T("")); } else { g_sdata.compressor_name = compressor_names[this_compressor+1]; ResetObjects(); CompileNSISScript(); return TRUE; } } } } EnableItems(g_sdata.hwnd); if (!g_sdata.retcode) { MessageBeep(MB_ICONASTERISK); if (g_sdata.warnings) SetTitle(g_sdata.hwnd,_T("Finished with Warnings")); else SetTitle(g_sdata.hwnd,_T("Finished Sucessfully")); // Added by Darren Owen (DrO) on 1/10/2003 if(g_sdata.recompile_test) PostMessage(g_sdata.hwnd, WM_COMMAND, LOWORD(IDC_TEST), 0); } else { MessageBeep(MB_ICONEXCLAMATION); SetTitle(g_sdata.hwnd,_T("Compile Error: See Log for Details")); } // Added by Darren Owen (DrO) on 1/10/2003 // ensures the recompile and run state is reset after use g_sdata.recompile_test = 0; DragAcceptFiles(g_sdata.hwnd,TRUE); return TRUE; } case MakensisAPI::QUERYHOST: { if (MakensisAPI::QH_OUTPUTCHARSET) { const UINT reqcp = 1200; // We want UTF-16LE SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, (LONG_PTR)(1+reqcp)); return TRUE; } return FALSE; } case WM_NOTIFY: switch (((NMHDR*)lParam)->code ) { case EN_SELCHANGE: SendDlgItemMessage(hwndDlg,IDC_LOGWIN, EM_EXGETSEL, 0, (LPARAM) &g_sdata.textrange); { BOOL enabled = (g_sdata.textrange.cpMax-g_sdata.textrange.cpMin<=0?FALSE:TRUE); EnableMenuItem(g_sdata.menu,IDM_COPYSELECTED,(enabled?MF_ENABLED:MF_GRAYED)); EnableToolBarButton(IDM_COPY,enabled); } // Altered by Darren Owen (DrO) on 6/10/2003 // Allows the detection of the right-click menu when running on OSes below Windows 2000 // and will then simulate the effective WM_CONTEXTMENU message that would be received // note: removed the WM_CONTEXTMENU handling to prevent a duplicate menu appearing on // Windows 2000 and higher case EN_MSGFILTER: #define lpnmMsg ((MSGFILTER*)lParam) if(WM_RBUTTONUP == lpnmMsg->msg || (WM_KEYUP == lpnmMsg->msg && lpnmMsg->wParam == VK_APPS)){ POINT pt; HWND edit = GetDlgItem(g_sdata.hwnd,IDC_LOGWIN); RECT r; GetCursorPos(&pt); // Added and altered by Darren Owen (DrO) on 29/9/2003 // Will place the right-click menu in the top left corner of the window // if the application key is pressed and the mouse is not in the window // from here... ScreenToClient(edit, &pt); GetClientRect(edit, &r); if(!PtInRect(&r, pt)) pt.x = pt.y = 0; MapWindowPoints(edit, HWND_DESKTOP, &pt, 1); TrackPopupMenu(g_sdata.editSubmenu, TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RIGHTBUTTON, pt.x, pt.y, 0, g_sdata.hwnd, 0); } case TBN_DROPDOWN: { LPNMTOOLBAR pToolBar = (LPNMTOOLBAR) lParam; if(pToolBar->hdr.hwndFrom == g_toolbar.hwnd && pToolBar->iItem == IDM_COMPRESSOR) { ShowToolbarDropdownMenu(); return TBDDRET_DEFAULT; } else { return TBDDRET_NODEFAULT; } } } return TRUE; case WM_COPYDATA: { PCOPYDATASTRUCT cds = PCOPYDATASTRUCT(lParam); switch (cds->dwData) { case MakensisAPI::NOTIFY_SCRIPT: MemSafeFree(g_sdata.input_script); g_sdata.input_script = (TCHAR*) MemAlloc(cds->cbData * sizeof(TCHAR)); lstrcpy(g_sdata.input_script, (TCHAR *)cds->lpData); break; case MakensisAPI::NOTIFY_WARNING: g_sdata.warnings++; break; case MakensisAPI::NOTIFY_ERROR: break; case MakensisAPI::NOTIFY_OUTPUT: MemSafeFree(g_sdata.output_exe); g_sdata.output_exe = (TCHAR*) MemAlloc(cds->cbData * sizeof(TCHAR)); lstrcpy(g_sdata.output_exe, (TCHAR *)cds->lpData); break; } return TRUE; } case WM_COMMAND: { switch (LOWORD(wParam)) { case IDM_BROWSESCR: { if (g_sdata.input_script) { TCHAR str[MAX_PATH],*str2; lstrcpy(str,g_sdata.input_script); str2=_tcsrchr(str,_T('\\')); if(str2!=NULL) *(str2+1)=0; ShellExecute(g_sdata.hwnd,_T("open"),str,NULL,NULL,SW_SHOWNORMAL); } return TRUE; } case IDM_ABOUT: { return DialogBox(g_sdata.hInstance,MAKEINTRESOURCE(DLG_ABOUT),hwndDlg,(DLGPROC)AboutProc); } case IDM_NSISHOME: { ShellExecuteA(g_sdata.hwnd,"open",NSIS_URL,NULL,NULL,SW_SHOWNORMAL); return TRUE; } case IDM_FORUM: { ShellExecuteA(g_sdata.hwnd,"open",NSIS_FOR,NULL,NULL,SW_SHOWNORMAL); return TRUE; } case IDM_NSISUPDATE: { Update(); return TRUE; } case IDM_SELECTALL: { SendDlgItemMessage(g_sdata.hwnd, IDC_LOGWIN, EM_SETSEL, 0, -1); return TRUE; } case IDM_DOCS: { ShowDocs(); return TRUE; } case IDM_LOADSCRIPT: { if (!g_sdata.thread) { OPENFILENAME l={sizeof(l),}; TCHAR buf[MAX_PATH]; l.hwndOwner = hwndDlg; l.lpstrFilter = _T("NSIS Script (*.nsi)\0*.nsi\0All Files (*.*)\0*.*\0"); l.lpstrFile = buf; l.nMaxFile = MAX_STRING-1; l.lpstrTitle = _T("Load Script"); l.lpstrDefExt = _T("log"); l.lpstrFileTitle = NULL; l.lpstrInitialDir = NULL; l.Flags = OFN_HIDEREADONLY|OFN_EXPLORER|OFN_PATHMUSTEXIST|OFN_FILEMUSTEXIST; lstrcpy(buf,_T("")); if (GetOpenFileName(&l)) { SetScript(buf); PushMRUFile(g_sdata.script); ResetObjects(); CompileNSISScript(); } } return TRUE; } case IDM_MRU_FILE: case IDM_MRU_FILE+1: case IDM_MRU_FILE+2: case IDM_MRU_FILE+3: case IDM_MRU_FILE+4: LoadMRUFile(LOWORD(wParam)-IDM_MRU_FILE); return TRUE; case IDM_CLEAR_MRU_LIST: ClearMRUList(); return TRUE; case IDM_COMPRESSOR: { SetCompressor((NCOMPRESSOR)(g_sdata.compressor+1)); return TRUE; } case IDM_CLEARLOG: { if (!g_sdata.thread) { ClearLog(g_sdata.hwnd); } return TRUE; } case IDM_RECOMPILE: { CompileNSISScript(); return TRUE; } // Added by Darren Owen (DrO) on 1/10/2003 case IDM_RECOMPILE_TEST: { g_sdata.recompile_test = 1; CompileNSISScript(); return TRUE; } case IDM_SETTINGS: { DialogBox(g_sdata.hInstance,MAKEINTRESOURCE(DLG_SETTINGS),g_sdata.hwnd,(DLGPROC)SettingsProc); return TRUE; } case IDM_TEST: case IDC_TEST: { if (g_sdata.output_exe) { ShellExecute(g_sdata.hwnd,_T("open"),g_sdata.output_exe,NULL,NULL,SW_SHOWNORMAL); } return TRUE; } case IDM_EDITSCRIPT: { if (g_sdata.input_script) { LPCTSTR verb = _T("open"); // BUGBUG: Should not force the open verb? HINSTANCE hi = ShellExecute(g_sdata.hwnd,verb,g_sdata.input_script,NULL,NULL,SW_SHOWNORMAL); if ((UINT_PTR)hi <= 32) { TCHAR path[MAX_PATH]; if (GetWindowsDirectory(path,sizeof(path))) { lstrcat(path,_T("\\notepad.exe")); ShellExecute(g_sdata.hwnd,verb,path,g_sdata.input_script,NULL,SW_SHOWNORMAL); } } } return TRUE; } case IDCANCEL: case IDM_EXIT: { if (!g_sdata.thread) { DestroyWindow(g_sdata.hwnd); } return TRUE; } case IDM_CANCEL: { SetEvent(g_sdata.sigint_event); SetEvent(g_sdata.sigint_event_legacy); return TRUE; } case IDM_COPY: { CopyToClipboard(g_sdata.hwnd); return TRUE; } case IDM_COPYSELECTED: { SendDlgItemMessage(g_sdata.hwnd,IDC_LOGWIN, WM_COPY, 0, 0); return TRUE; } case IDM_SAVE: { OPENFILENAME l={sizeof(l),}; TCHAR buf[MAX_STRING]; l.hwndOwner = hwndDlg; l.lpstrFilter = _T("Log Files (*.log)\0*.log\0Text Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0"); l.lpstrFile = buf; l.nMaxFile = MAX_STRING-1; l.lpstrTitle = _T("Save Output"); l.lpstrDefExt = _T("log"); l.lpstrInitialDir = NULL; l.Flags = OFN_HIDEREADONLY|OFN_EXPLORER|OFN_PATHMUSTEXIST; lstrcpy(buf,_T("output")); if (GetSaveFileName(&l)) { HANDLE hFile = CreateFile(buf,GENERIC_WRITE,0,0,CREATE_ALWAYS,0,0); if (INVALID_HANDLE_VALUE != hFile) { int len=SendDlgItemMessage(g_sdata.hwnd,IDC_LOGWIN,WM_GETTEXTLENGTH,0,0); TCHAR *existing_text=(TCHAR*) MemAlloc(len * sizeof(TCHAR)); if (existing_text) { // BUGBUG:TODO: Error message for bad hFile and existing_text? existing_text[0]=0; GetDlgItemText(g_sdata.hwnd, IDC_LOGWIN, existing_text, len); DWORD dwWritten = 0; WriteFile(hFile,existing_text,len,&dwWritten,0); MemFree(existing_text); } CloseHandle(hFile); } } return TRUE; } case IDM_FIND: { if (!g_find.uFindReplaceMsg) g_find.uFindReplaceMsg = RegisterWindowMessage(FINDMSGSTRING); memset(&g_find.fr, 0, sizeof(FINDREPLACE)); g_find.fr.lStructSize = sizeof(FINDREPLACE); g_find.fr.hwndOwner = hwndDlg; g_find.fr.Flags = FR_NOUPDOWN; g_find.fr.lpstrFindWhat = g_findbuf; g_find.fr.wFindWhatLen = COUNTOF(g_findbuf); g_find.hwndFind = FindText(&g_find.fr); return TRUE; } default: { int i; DWORD command = LOWORD(wParam); for(i=(int)COMPRESSOR_SCRIPT; i<=(int)COMPRESSOR_BEST; i++) { if(command == compressor_commands[i]) { SetCompressor((NCOMPRESSOR)i); return TRUE; } } } } } } if (g_find.uFindReplaceMsg && msg == g_find.uFindReplaceMsg) { LPFINDREPLACE lpfr = (LPFINDREPLACE)lParam; if (lpfr->Flags & FR_FINDNEXT) { WPARAM flags = FR_DOWN; if (lpfr->Flags & FR_MATCHCASE) flags |= FR_MATCHCASE; if (lpfr->Flags & FR_WHOLEWORD) flags |= FR_WHOLEWORD; FINDTEXTEX ft; SendDlgItemMessage(hwndDlg, IDC_LOGWIN, EM_EXGETSEL, 0, (LPARAM)&ft.chrg); if (ft.chrg.cpMax == ft.chrg.cpMin) ft.chrg.cpMin = 0; else ft.chrg.cpMin = ft.chrg.cpMax; ft.chrg.cpMax = SendDlgItemMessage(hwndDlg, IDC_LOGWIN, WM_GETTEXTLENGTH, 0, 0); ft.lpstrText = lpfr->lpstrFindWhat; ft.chrg.cpMin = SendDlgItemMessage(hwndDlg, IDC_LOGWIN, EM_FINDTEXTEX, flags, (LPARAM)&ft); if (ft.chrg.cpMin != -1) SendDlgItemMessage(hwndDlg, IDC_LOGWIN, EM_SETSEL, ft.chrgText.cpMin, ft.chrgText.cpMax); else MessageBeep(MB_ICONASTERISK); } if (lpfr->Flags & FR_DIALOGTERM) g_find.hwndFind = 0; return TRUE; } return 0; }
BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { static HINSTANCE hRichEditDLL = 0; if (!hRichEditDLL) hRichEditDLL= LoadLibrary("RichEd32.dll"); switch (msg) { case WM_INITDIALOG: { g_hwnd=hwndDlg; HICON hIcon = LoadIcon(g_hInstance,MAKEINTRESOURCE(IDI_ICON)); SetClassLong(hwndDlg,GCL_HICON,(long)hIcon); HFONT hFont = CreateFont(14,0,0,0,FW_NORMAL,0,0,0,DEFAULT_CHARSET,OUT_CHARACTER_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,FIXED_PITCH|FF_DONTCARE,"Courier New"); SendDlgItemMessage(hwndDlg,IDC_LOGWIN,WM_SETFONT,(WPARAM)hFont,0); SendDlgItemMessage(hwndDlg,IDC_LOGWIN,EM_SETBKGNDCOLOR,0,GetSysColor(COLOR_BTNFACE)); RestoreWindowPos(g_hwnd); CompileNSISScript(); return TRUE; } case WM_DESTROY: { SaveWindowPos(g_hwnd); PostQuitMessage(0); return TRUE; } case WM_CLOSE: { if (!g_hThread) { DestroyWindow(hwndDlg); FreeLibrary(hRichEditDLL); } return TRUE; } case WM_GETMINMAXINFO: { ((MINMAXINFO*)lParam)->ptMinTrackSize.x=MINWIDTH; ((MINMAXINFO*)lParam)->ptMinTrackSize.y=MINHEIGHT; } case WM_ENTERSIZEMOVE: { GetClientRect(g_hwnd, &resizeRect); return TRUE; } case WM_SIZE: { if ((wParam == SIZE_MAXHIDE)||(wParam == SIZE_MAXSHOW)) return TRUE; } case WM_SIZING: { RECT rSize; if (hwndDlg == g_hwnd) { GetClientRect(g_hwnd, &rSize); if (((rSize.right==0)&&(rSize.bottom==0))||((resizeRect.right==0)&&(resizeRect.bottom==0))) return TRUE; dx = rSize.right - resizeRect.right; dy = rSize.bottom - resizeRect.bottom; EnumChildWindows(g_hwnd, DialogResize, (LPARAM)0); resizeRect = rSize; } return TRUE; } case WM_MAKENSIS_PROCESSCOMPLETE: { if (g_hThread) { CloseHandle(g_hThread); g_hThread=0; } if (g_retcode==0) SetTitle(g_hwnd,"Finished Sucessfully"); else SetTitle(g_hwnd,"Compile Error: See Log for Details"); EnableItems(g_hwnd); return TRUE; } case WM_COMMAND: { switch (LOWORD(wParam)) { case IDM_ABOUT: { DialogBox(g_hInstance,MAKEINTRESOURCE(DLG_ABOUT),g_hwnd,(DLGPROC)AboutProc); return TRUE; } case IDM_NSISHOME: { ShellExecute(g_hwnd,"open",NSIS_URL,NULL,NULL,SW_SHOWNORMAL); return TRUE; } case IDM_DOCS: { char pathf[MAX_PATH],*path; GetModuleFileName(NULL,pathf,sizeof(pathf)); path=my_strrchr(pathf,'\\'); if(path!=NULL) *path=0; lstrcat(pathf,"\\makensis.htm"); if ((int)ShellExecute(g_hwnd,"open",pathf,NULL,NULL,SW_SHOWNORMAL)<=32) ShellExecute(g_hwnd,"open",DOCPATH,NULL,NULL,SW_SHOWNORMAL); return TRUE; } case IDM_RECOMPILE: { CompileNSISScript(); return TRUE; } case IDM_TEST: case IDC_TEST: { if (g_output_exe[0]) { ShellExecute(g_hwnd,"open",g_output_exe,NULL,NULL,SW_SHOWNORMAL); } return TRUE; } case IDM_EDITSCRIPT: { if (g_input_script[0]) { if ((int)ShellExecute(g_hwnd,"open",g_input_script,NULL,NULL,SW_SHOWNORMAL)<=32) { char path[MAX_PATH]; if (GetWindowsDirectory(path,sizeof(path))) { lstrcat(path,"\\notepad.exe"); ShellExecute(g_hwnd,"open",path,g_input_script,NULL,SW_SHOWNORMAL); } } } return TRUE; } case IDC_CLOSE: case IDM_EXIT: { if (!g_hThread) { DestroyWindow(hwndDlg); } return TRUE; } case IDM_COPY: { CopyToClipboard(g_hwnd); return TRUE; } case IDM_COPYSELECTED: { SendMessage(GetDlgItem(g_hwnd,IDC_LOGWIN), WM_COPY, 0, 0); return TRUE; } case IDM_SAVE: { OPENFILENAME l={sizeof(l),}; char buf[MAX_STRING]; l.hwndOwner = hwndDlg; l.lpstrFilter = "Log Files (*.log)\0Text Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0"; l.lpstrFile = buf; l.nMaxFile = 1023; l.lpstrTitle = "Save Output"; l.lpstrDefExt = "log"; l.lpstrInitialDir = NULL; l.Flags = OFN_HIDEREADONLY|OFN_EXPLORER|OFN_PATHMUSTEXIST; lstrcpy(buf,"output.log"); if (GetSaveFileName(&l)) { HANDLE hFile = CreateFile(buf,GENERIC_WRITE,0,0,CREATE_ALWAYS,0,0); if (hFile) { int len=SendDlgItemMessage(g_hwnd,IDC_LOGWIN,WM_GETTEXTLENGTH,0,0); char *existing_text=(char*)GlobalAlloc(GPTR,len); existing_text[0]=0; GetDlgItemText(g_hwnd, IDC_LOGWIN, existing_text, len); DWORD dwWritten = 0; WriteFile(hFile,existing_text,len,&dwWritten,0); CloseHandle(hFile); GlobalFree(existing_text); } } return TRUE; } } } } return 0; }
void CSelectPluginDlg::OnOK() //--------------------------- { if(m_pPlugin==nullptr) { CDialog::OnOK(); return; } bool changed = false; CVstPluginManager *pManager = theApp.GetPluginManager(); VSTPluginLib *pNewPlug = GetSelectedPlugin(); VSTPluginLib *pFactory = nullptr; IMixPlugin *pCurrentPlugin = nullptr; if (m_pPlugin) pCurrentPlugin = m_pPlugin->pMixPlugin; if ((pManager) && (pManager->IsValidPlugin(pNewPlug))) pFactory = pNewPlug; if (pFactory) { // Plugin selected if ((!pCurrentPlugin) || &pCurrentPlugin->GetPluginFactory() != pFactory) { CriticalSection cs; // Destroy old plugin, if there was one. m_pPlugin->Destroy(); // Initialize plugin info MemsetZero(m_pPlugin->Info); m_pPlugin->Info.dwPluginId1 = pFactory->pluginId1; m_pPlugin->Info.dwPluginId2 = pFactory->pluginId2; m_pPlugin->editorX = m_pPlugin->editorY = int32_min; #ifndef NO_VST if(m_pPlugin->Info.dwPluginId1 == kEffectMagic) { switch(m_pPlugin->Info.dwPluginId2) { // Enable drymix by default for these known plugins case CCONST('S', 'c', 'o', 'p'): m_pPlugin->SetWetMix(); break; } } #endif // NO_VST mpt::String::Copy(m_pPlugin->Info.szName, pFactory->libraryName.ToLocale().c_str()); mpt::String::Copy(m_pPlugin->Info.szLibraryName, pFactory->libraryName.ToUTF8().c_str()); cs.Leave(); // Now, create the new plugin if(pManager && m_pModDoc) { pManager->CreateMixPlugin(*m_pPlugin, m_pModDoc->GetrSoundFile()); if (m_pPlugin->pMixPlugin) { IMixPlugin *p = m_pPlugin->pMixPlugin; const CString name = p->GetDefaultEffectName(); if(!name.IsEmpty()) { mpt::String::Copy(m_pPlugin->Info.szName, name.GetString()); } // Check if plugin slot is already assigned to any instrument, and if not, create one. if(p->IsInstrument() && m_pModDoc->HasInstrumentForPlugin(m_nPlugSlot) == INSTRUMENTINDEX_INVALID) { m_pModDoc->InsertInstrumentForPlugin(m_nPlugSlot); } } else { MemsetZero(m_pPlugin->Info); } } changed = true; } } else if(m_pPlugin->IsValidPlugin()) { // No effect CriticalSection cs; m_pPlugin->Destroy(); // Clear plugin info MemsetZero(m_pPlugin->Info); changed = true; } //remember window size: SaveWindowPos(); if(changed) { if(m_pPlugin->Info.dwPluginId2) TrackerSettings::Instance().gnPlugWindowLast = m_pPlugin->Info.dwPluginId2; if(m_pModDoc) { m_pModDoc->UpdateAllViews(nullptr, PluginHint(static_cast<PLUGINDEX>(m_nPlugSlot + 1)).Info().Names()); } CDialog::OnOK(); } else { CDialog::OnCancel(); } }
INT_PTR WINAPI doDebug(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_INITDIALOG: { RestoreWindowPos(hwndDlg, DEBUG_WINDOWPOS_KEY); HWND listView = GetDlgItem(hwndDlg, IDC_LIST); LineParser lp(false); char cFile[256]; strcpy(cFile, get_ini_file()); strcpy(strrchr(cFile, '.'), "-kb.ini"); FILE* f = fopen(cFile, "r"); char cLine[65536]; int i = 0; LVITEM item; item.mask = LVIF_TEXT | LVIF_PARAM; item.iSubItem = 0; while (f && fgets(cLine, 65536, f)) { lp.parse(cLine); if (lp.getnumtokens() - 5 > 0 && strcmp(lp.gettoken_str(0), "ACT") == 0) { Macro* m = g_macros.Add(new Macro(&lp)); item.lParam = (LPARAM)m; item.iItem = i++; item.pszText = m->m_cName; ListView_InsertItem(listView, &item); } } if (f) fclose(f); ListView_SortItems(listView, MacroSort, 0); return 0; } case WM_NOTIFY: { NMLISTVIEW* s = (NMLISTVIEW*)lParam; if (s->hdr.code == LVN_ITEMCHANGED && s->uNewState & LVIS_SELECTED) g_selectedMacro = (Macro*)s->lParam; break; } case WM_COMMAND: //if you need to debug commands, you probably want to ignore the focus stuff. Break a few lines down. if (wParam == 33555433 || wParam == 16778217) return 0; if (LOWORD(wParam)==IDCANCEL) { g_selectedMacro = NULL; SaveWindowPos(hwndDlg, DEBUG_WINDOWPOS_KEY); EndDialog(hwndDlg,0); } if (LOWORD(wParam)==IDOK) { SaveWindowPos(hwndDlg, DEBUG_WINDOWPOS_KEY); EndDialog(hwndDlg,0); } return 0; case WM_DESTROY: // We're done return 0; } return 0; }
WDL_DLGRET CueBussDlgProc(HWND _hwnd, UINT _uMsg, WPARAM _wParam, LPARAM _lParam) { if (INT_PTR r = SNM_HookThemeColorsMessage(_hwnd, _uMsg, _wParam, _lParam)) return r; const char cWndPosKey[] = "CueBus Window Pos"; switch(_uMsg) { case WM_INITDIALOG: { WDL_UTF8_HookComboBox(GetDlgItem(_hwnd, IDC_SNM_CUEBUS_TYPE)); WDL_UTF8_HookComboBox(GetDlgItem(_hwnd, IDC_COMBO)); for(int i=0; i < SNM_MAX_HW_OUTS; i++) WDL_UTF8_HookComboBox(GetDlgItem(_hwnd, IDC_SNM_CUEBUS_HWOUT1+i)); RestoreWindowPos(_hwnd, cWndPosKey, false); char buf[16] = ""; for(int i=0; i < SNM_MAX_CUE_BUSS_CONFS; i++) if (_snprintfStrict(buf,sizeof(buf),"%d",i+1) > 0) SendDlgItemMessage(_hwnd,IDC_COMBO,CB_ADDSTRING,0,(LPARAM)buf); SendDlgItemMessage(_hwnd,IDC_COMBO,CB_SETCURSEL,0,0); FillCueBussDlg(_hwnd); return 0; } break; case WM_CLOSE : g_cueBussHwnd = NULL; // for proper toggle state report, see openCueBussWnd() break; case WM_COMMAND : switch(LOWORD(_wParam)) { case IDC_COMBO: if(HIWORD(_wParam) == CBN_SELCHANGE) // config id update? { int id = (int)SendDlgItemMessage(_hwnd, IDC_COMBO, CB_GETCURSEL, 0, 0); if (id != CB_ERR) { g_cueBussConfId = id; FillCueBussDlg(); } } break; case IDOK: CueBuss(__LOCALIZE("Create cue buss from track selection","sws_undo"), g_cueBussConfId); return 0; case IDCANCEL: g_cueBussHwnd = NULL; // for proper toggle state report, see openCueBussWnd() ShowWindow(_hwnd, SW_HIDE); return 0; case IDC_FILES: { char curPath[SNM_MAX_PATH]=""; GetDlgItemText(_hwnd, IDC_SNM_CUEBUS_TEMPLATE, curPath, sizeof(curPath)); if (!*curPath || !FileOrDirExists(curPath)) if (_snprintfStrict(curPath, sizeof(curPath), "%s%cTrackTemplates", GetResourcePath(), PATH_SLASH_CHAR) <= 0) *curPath = '\0'; if (char* fn = BrowseForFiles(__LOCALIZE("S&M - Load track template","sws_DLG_149"), curPath, NULL, false, "REAPER Track Template (*.RTrackTemplate)\0*.RTrackTemplate\0")) { SetDlgItemText(_hwnd,IDC_SNM_CUEBUS_TEMPLATE,fn); free(fn); SaveCueBussSettings(); } break; } case IDC_CHECK3: { bool templateEnable = (IsDlgButtonChecked(_hwnd, IDC_CHECK3) == 1); EnableWindow(GetDlgItem(_hwnd, IDC_SNM_CUEBUS_TEMPLATE), templateEnable); EnableWindow(GetDlgItem(_hwnd, IDC_FILES), templateEnable); EnableWindow(GetDlgItem(_hwnd, IDC_SNM_CUEBUS_NAME), !templateEnable); for(int k=0; k < SNM_MAX_HW_OUTS ; k++) EnableWindow(GetDlgItem(_hwnd, IDC_SNM_CUEBUS_HWOUT1+k), !templateEnable); EnableWindow(GetDlgItem(_hwnd, IDC_CHECK1), !templateEnable); EnableWindow(GetDlgItem(_hwnd, IDC_CHECK4), !templateEnable); // SetFocus(GetDlgItem(_hwnd, templateEnable ? IDC_SNM_CUEBUS_TEMPLATE : IDC_SNM_CUEBUS_NAME)); SaveCueBussSettings(); break; } case IDC_SNM_CUEBUS_SOLOGRP: case IDC_CHECK1: case IDC_CHECK2: case IDC_CHECK4: SaveCueBussSettings(); break; case IDC_SNM_CUEBUS_TYPE: case IDC_SNM_CUEBUS_HWOUT1: case IDC_SNM_CUEBUS_HWOUT2: case IDC_SNM_CUEBUS_HWOUT3: case IDC_SNM_CUEBUS_HWOUT4: case IDC_SNM_CUEBUS_HWOUT5: case IDC_SNM_CUEBUS_HWOUT6: case IDC_SNM_CUEBUS_HWOUT7: case IDC_SNM_CUEBUS_HWOUT8: if(HIWORD(_wParam) == CBN_SELCHANGE) SaveCueBussSettings(); break; case IDC_SNM_CUEBUS_TEMPLATE: case IDC_SNM_CUEBUS_NAME: if (HIWORD(_wParam)==EN_CHANGE) SaveCueBussSettings(); break; } break; case WM_DESTROY: SaveWindowPos(_hwnd, cWndPosKey); break; } return 0; }