int main(void){ pc.format(8,SerialBLK::None,1); pc.baud(500000); // Baudrate ua0.SvMessage("FuncGenMain3"); // Meldung zum PC senden Timer stw; stw.start(); // while(1)-Loop der mit dem PC kommuniziert while(1) { CommandHandler(); if( (stw.read_ms()>10) ) { // 100Hz // dieser Teil wird mit 100Hz aufgerufen //Timer resetten stw.reset(); // Funktionsgeneratoren rechnen ExecSignalChain(); if( ua0.acqON ) { ua0.WriteSV(1, v1); //Wird nur verwendet, wenn man TP1Ord.H eingebunden hat //Ansonsten rauslöschen ua0.WriteSV(2,tp.y); } } } return 1; }
// // Main window procedure // LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { int width, height; NMHDR *hdr = (NMHDR *)lParam; SCROLLINFO si; switch(msg) { case WM_CREATE: hwndCtrl = CreateWindowEx(WS_EX_CLIENTEDGE, szChildClass, "Test", WS_VISIBLE | WS_CHILD | WS_VSCROLL | WS_HSCROLL, 0,0,0,0, hwnd, 0, GetModuleHandle(0), 0); InitializeCoolSB(hwndCtrl); CoolSB_SetStyle(hwndCtrl, SB_BOTH, CSBS_NORMAL); si.cbSize = sizeof(si); si.fMask = SIF_ALL; si.nMin = 0; si.nMax = 100; si.nPos = 0; si.nPage = 10; SetScrollInfo(hwndCtrl, SB_VERT, &si, TRUE); return 0; case WM_DESTROY: PostQuitMessage(0); return 0; case WM_CLOSE: DestroyWindow(hwnd); return 0; case WM_SIZE: width = (short)LOWORD(lParam); height = (short)HIWORD(lParam); MoveWindow(hwndCtrl, 0, 0, width, height, TRUE); return 0; case WM_COMMAND: return CommandHandler(hwnd, wParam, lParam); case WM_NOTIFY: if(hdr->code == NM_COOLSB_CUSTOMDRAW) { return HandleCustomDraw(wParam, (NMCSBCUSTOMDRAW *)lParam); } break; } return DefWindowProc(hwnd, msg, wParam, lParam); }
INT_PTR CALLBACK statPanDlgProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ) { switch (message) { case WM_COMMAND: if (CommandHandler(hwnd, LOWORD(wParam), HIWORD(wParam), (HWND)lParam)) { return FALSE; } break; } return FALSE; }
void WalkTestRecorder::HandleRecordedCommand () { // Emit recorded commands directly to the CommandHandler if (cfg_playrecording > 0 && recording.GetSize () > 0) { csRecordedCamera* reccam = (csRecordedCamera*)recording[ cfg_playrecording]; if (reccam->cmd) CommandHandler(reccam->cmd, reccam->arg); } }
LRESULT CALLBACK StaticWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { PAINTSTRUCT ps; // sprintf(buf, "StaticMsg: %08x\n", message); // OutputDebugString(buf); switch (message) { case WM_COMMAND: if (!CommandHandler(hWnd, LOWORD(wParam), HIWORD(wParam), (HWND)lParam)) { return FALSE; } break; case WM_PAINT: { RECT rect; BeginPaint(hWnd, &ps); HDC hDC = ps.hdc; GetClientRect(hWnd, &rect); rect.bottom -= 2; SelectObject(hDC, CreatePen(PS_SOLID, 0, GetSysColor(COLOR_3DSHADOW))); MoveToEx(hDC,rect.left,rect.bottom,NULL); LineTo(hDC,rect.left,rect.top); LineTo(hDC,rect.right,rect.top); DeleteObject(SelectObject(hDC, CreatePen(PS_SOLID, 0, GetSysColor(COLOR_3DHIGHLIGHT)))); MoveToEx(hDC,rect.left+1,rect.bottom,NULL); LineTo(hDC,rect.left+1,rect.top+1); LineTo(hDC,rect.right,rect.top+1); SelectObject(hDC, CreatePen(PS_SOLID, 0, GetSysColor(COLOR_3DHIGHLIGHT))); MoveToEx(hDC,rect.left+1,rect.bottom,NULL); LineTo(hDC,rect.right,rect.bottom); LineTo(hDC,rect.right,rect.top); DeleteObject(SelectObject(hDC, CreatePen(PS_SOLID, 0, GetSysColor(COLOR_3DSHADOW)))); MoveToEx(hDC,rect.left+1,rect.bottom-1,NULL); LineTo(hDC,rect.right-1,rect.bottom-1); LineTo(hDC,rect.right-1,rect.top-1); DeleteObject(SelectObject(hDC, GetStockObject(BLACK_PEN))); EndPaint(hWnd, &ps); } break; default: break; } return (DefWindowProc(hWnd, message, wParam, lParam)); }
KeyValStore_Status_t KeyValStore(int argc, char * argv[]){ Command_t command = {}; Result_t result = {}; int ret = 0; if (PARSE_FAIL == CommandParser(argc, argv, &command)) { ret = 1; } else if (HANDLE_FAIL == CommandHandler(&command, &result)) { ret = 2; } else if (OUTPUT_FAIL == CommandOutput(&result)){ ret = 3; } return ret; }
/* ============ WMAIN_WndProc ============ */ LONG WINAPI WMAIN_WndProc ( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { LONG lRet = 1; RECT rect; HDC maindc; GetClientRect(hWnd, &rect); switch (uMsg) { case WM_CREATE: maindc = GetDC(hWnd); bSetupPixelFormat(maindc); break; case WM_COMMAND: lRet = CommandHandler (hWnd, wParam, lParam); break; case WM_CLOSE: if (!ConfirmModified()) break; PostQuitMessage (0); break; default: /* pass all unhandled messages to DefWindowProc */ lRet = DefWindowProc (hWnd, uMsg, wParam, lParam); break; } /* return 1 if handled message, 0 if not */ return lRet; }
LRESULT CALLBACK AppWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { TCHAR buf[256]; //sprintf(buf, "AppMsg: %08x\n", message); //OutputDebugString(buf); switch (message) { case WM_CREATE: { pApp->SetHWnd(hWnd); pApp->SetHMenu(GetMenu(hWnd)); pApp->SetDC(GetDC(hWnd)); pApp->CreateControls(); DragAcceptFiles(hWnd, TRUE); HICON hIcon= LoadIcon(pApp->GetInstance(), MAKEINTRESOURCE(IDI_MAINWND)); SendMessage(hWnd, WM_SETICON, FALSE, reinterpret_cast<LPARAM>(hIcon)); SendMessage(hWnd, WM_SETICON, TRUE, reinterpret_cast<LPARAM>(hIcon)); return FALSE; } case WM_INITAFTERCREATE: pApp->PostInit(); break; case WM_ENABLE: break; case WM_WINDOWPOSCHANGING: { WINDOWPOS *wp = (WINDOWPOS*)lParam; if (wp->cx<310) { wp->cx=310; } if (wp->cy<170) { wp->cy=170; } break; } case WM_MOVE: pApp->Move(); break; case WM_SIZE: pApp->Resize(wParam, LOWORD(lParam), HIWORD(lParam)); break; case WM_DROPFILES: DragQueryFile((HDROP)wParam, 0, buf, 256); DragFinish((HDROP)wParam); return 0; case WM_COMMAND: if (!CommandHandler(hWnd, LOWORD(wParam), HIWORD(wParam), (HWND)lParam)) { return FALSE; } break; case WM_TIMER: break; case WM_LBUTTONDOWN: break; case WM_LBUTTONUP: break; case WM_MBUTTONDOWN: break; case WM_MBUTTONUP: break; case WM_RBUTTONDOWN: break; case WM_RBUTTONUP: break; case WM_MOUSEMOVE: break; case WM_CHAR: if((TCHAR)wParam != VK_ESCAPE) break; break; case WM_QUERYENDSESSION: return FALSE; case WM_ERASEBKGND: break; case WM_PAINT: break; case WM_CLOSE: pApp->AppIsClosing(); DestroyWindow(hWnd); return TRUE; case WM_DESTROY: pApp->AppIsClosing(); DragAcceptFiles(hWnd, 0); PostQuitMessage(0); return FALSE; default: break; } return (DefWindowProc(hWnd, message, wParam, lParam)); }
// // Main window procedure // LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { int width, height, heightsb; HIMAGELIST hImgList; RECT rect; HDWP hdwp; NMHDR *nmhdr; TCHAR msgstr[MAX_PATH+200]; switch(msg) { case WM_CREATE: g_hwndTextView = CreateTextView(hwnd); g_hwndStatusbar = CreateStatusBar(hwnd); TextView_SetContextMenu(g_hwndTextView, GetSubMenu(LoadMenu(GetModuleHandle(0), MAKEINTRESOURCE(IDR_MENU2)), 0)); // load the image list hImgList = ImageList_LoadImage( GetModuleHandle(0), MAKEINTRESOURCE(IDB_BITMAP1), 16, 0, RGB(255,0,255), IMAGE_BITMAP, LR_LOADTRANSPARENT|LR_CREATEDIBSECTION ); TextView_SetImageList(g_hwndTextView, hImgList); // highlight specific lines with image-index "1" //TextView_SetLineImage(g_hwndTextView, 16, 1); //TextView_SetLineImage(g_hwndTextView, 5, 1); //TextView_SetLineImage(g_hwndTextView, 36, 1); //TextView_SetLineImage(g_hwndTextView, 11, 1); // tell windows that we can handle drag+drop'd files DragAcceptFiles(hwnd, TRUE); return 0; case WM_DROPFILES: HandleDropFiles(hwnd, (HDROP)wParam); return 0; case WM_DESTROY: SaveFileData(g_szFileName, hwnd); PostQuitMessage(0); DeleteObject(g_hFont); return 0; //case WM_NCCALCSIZE: // return NcCalcSize(hwnd, wParam, lParam); case WM_INITMENU: CheckMenuCommand((HMENU)wParam, IDM_VIEW_LINENUMBERS, g_fLineNumbers); CheckMenuCommand((HMENU)wParam, IDM_VIEW_LONGLINES, g_fLongLines); CheckMenuCommand((HMENU)wParam, IDM_VIEW_SAVEEXIT, g_fSaveOnExit); CheckMenuCommand((HMENU)wParam, IDM_VIEW_STATUSBAR, g_fShowStatusbar); //CheckMenuCommand((HMENU)wParam, IDM_VIEW_SEARCHBAR, g_hwndSearchBar ? TRUE : FALSE); EnableMenuCommand((HMENU)wParam, IDM_EDIT_UNDO, TextView_CanUndo(g_hwndTextView)); EnableMenuCommand((HMENU)wParam, IDM_EDIT_REDO, TextView_CanRedo(g_hwndTextView)); EnableMenuCommand((HMENU)wParam, IDM_EDIT_PASTE, IsClipboardFormatAvailable(CF_TEXT)); EnableMenuCommand((HMENU)wParam, IDM_EDIT_COPY, TextView_GetSelSize(g_hwndTextView)); EnableMenuCommand((HMENU)wParam, IDM_EDIT_CUT, TextView_GetSelSize(g_hwndTextView)); EnableMenuCommand((HMENU)wParam, IDM_EDIT_DELETE, TextView_GetSelSize(g_hwndTextView)); return 0; //case WM_USER: // wsprintf(msgstr, _T("%s\n\nThis file has been modified outside of Neatpad.") // _T("Do you wish to reload it?"), g_szFileName); // MessageBox(hwnd, msgstr, _T("Neatpad"), MB_ICONQUESTION|MB_YESNO); // // return 0; case WM_ENABLE: // keep the modeless find/replace dialog in the same enabled state as the main window EnableWindow(g_hwndSearchDlg, (BOOL)wParam); return 0; case WM_MENUSELECT: StatusBarMenuSelect(hwnd, g_hwndStatusbar, wParam, lParam); return 0; case WM_NOTIFY: nmhdr = (NMHDR *)lParam; if(nmhdr->hwndFrom == g_hwndTextView) return TextViewNotifyHandler(hwnd, nmhdr); else return NotifyHandler(hwnd, nmhdr); case WM_COMMAND: return CommandHandler(hwnd, LOWORD(wParam), HIWORD(wParam), (HWND)lParam); case WM_SETFOCUS: SetFocus(g_hwndTextView); return 0; case WM_CLOSE: // does the file need saving? if(TextView_CanUndo(g_hwndTextView)) { UINT r; wsprintf(msgstr, _T("Do you want to save changes to\r\n%s?"), g_szFileName); r = MessageBox(hwnd, msgstr, APP_TITLE, MB_YESNOCANCEL | MB_ICONQUESTION); if(r == IDCANCEL) return 0; } DestroyWindow(hwnd); return 0; case WM_SIZE: // resize the TextView and StatusBar to fit within the main window's client area width = (short)LOWORD(lParam); height = (short)HIWORD(lParam); GetWindowRect(g_hwndStatusbar, &rect); heightsb = rect.bottom-rect.top; hdwp = BeginDeferWindowPos(3); if(g_fShowStatusbar) { DeferWindowPos(hdwp, g_hwndStatusbar, 0, 0, height - heightsb, width, heightsb, SWP_SHOWWINDOW); // MoveWindow(g_hwndStatusbar, 0, height - heightsb, width, heightsb, TRUE); height -= heightsb; } DeferWindowPos(hdwp, g_hwndTextView, 0, 0, 0, width, height, SWP_SHOWWINDOW); //MoveWindow(g_hwndTextView, 0, 0, width, height, TRUE); EndDeferWindowPos(hdwp); SetStatusBarParts(g_hwndStatusbar); return 0; } return DefWindowProc(hwnd, msg, wParam, lParam); }
void Main::InitCommands() { // コマンド m_commands = CreateCommands(COMMANDS, sizeof(COMMANDS) / sizeof(COMMANDS[0])); function current(this, &Main::ForwardToCurrent); function all (this, &Main::ForwardToAll); function shown (this, &Main::ForwardToShown); function hidden (this, &Main::ForwardToHidden); function left (this, &Main::ForwardToLeft); function right (this, &Main::ForwardToRight); function others (this, &Main::ForwardToOthers); function dups (this, &Main::ForwardToDuplicate); function anyFolder(this, &Main::EnableIfAnyFolder); function anySelect(this, &Main::EnableIfAnySelection); // System CommandProcess(L"System.Exit" , m_form, CommandClose); CommandProcess(L"System.Restart", &Main::SystemRestart); CommandProcess(L"System.About" , &Main::SystemAbout); // File CommandProcess(L"Explorer.Clone" , &Main::ExplorerImport, 0); CommandProcess(L"Explorer.Import" , &Main::ExplorerImport, 1); CommandProcess(L"File.Open" , &Main::FileOpen, 0); CommandProcess(L"File.Load" , &Main::FileLoad); CommandHandler(L"File.Save" , &Main::FileSave , null, &Main::EnableIfAnyFolder, null); CommandHandler(L"File.MRU" , &Main::FileMRU , null, &Main::ObserveMRU, null); CommandHandler(L"RecycleBin.Empty" , &Main::ProcessRecycleBin , null, &Main::ObserveRecycleBin, null); // Current CommandHandler(L"Current.Lock(true)" , &Main::CurrentLock, BoolTrue , &Main::ObserveLock, BoolTrue); CommandHandler(L"Current.Lock(false)" , &Main::CurrentLock, BoolFalse , &Main::ObserveLock, BoolFalse); CommandHandler(L"Current.Lock(toggle)" , &Main::CurrentLock, BoolUnknown , &Main::ObserveLock, BoolUnknown); CommandToFocus(L"Current.Menu" , CommandMenu); CommandToFocus(L"Current.New" , AVESTA_New); CommandToFocus(L"Current.NewFolder" , AVESTA_NewFolder); CommandToFocus(L"Current.SelectPattern" , AVESTA_SelectPattern); CommandToFocus(L"Current.Close" , CommandClose); CommandToFocus(L"Current.Show(false)" , AVESTA_Hide); CommandToFocus(L"Current.Export" , AVESTA_Export); CommandToFocus(L"Current.Refresh" , CommandUpdate); CommandToFocus(L"Current.Find" , AVESTA_Find); CommandToFocus(L"Current.PatternMask" , AVESTA_PatternMask); CommandToSelect(L"Current.Cut" , CommandCut); CommandToSelect(L"Current.Copy" , CommandCopy); CommandToSelect(L"Current.Copy.Base" , AVESTA_CopyBase); CommandToSelect(L"Current.Copy.Name" , AVESTA_CopyName); CommandToSelect(L"Current.Copy.Path" , AVESTA_CopyPath); CommandToSelect(L"Current.Copy.Here" , AVESTA_CopyHere); CommandToSelect(L"Current.Delete" , CommandDelete); CommandToSelect(L"Current.Bury" , CommandBury); CommandToSelect(L"Current.Rename" , CommandRename); CommandToSelect(L"Current.Rename.Dialog" , AVESTA_RenameDialog); CommandToSelect(L"Current.Property" , CommandProperty); CommandToSelect(L"Current.CopyTo" , AVESTA_CopyTo); CommandToSelect(L"Current.MoveTo" , AVESTA_MoveTo); CommandToSelect(L"Current.CopyToOther" , AVESTA_CopyToOther); CommandToSelect(L"Current.MoveToOther" , AVESTA_MoveToOther); CommandToSelect(L"Current.CopyCheckedTo" , AVESTA_CopyCheckedTo); CommandToSelect(L"Current.MoveCheckedTo" , AVESTA_MoveCheckedTo); CommandToFocus(L"Current.SyncDescendants" , AVESTA_SyncDesc); CommandToFocus(L"Current.Key.Up" , CommandKeyUp); CommandToFocus(L"Current.Key.Down" , CommandKeyDown); CommandToFocus(L"Current.Key.Left" , CommandKeyLeft); CommandToFocus(L"Current.Key.Right" , CommandKeyRight); CommandToFocus(L"Current.Key.Home" , CommandKeyHome); CommandToFocus(L"Current.Key.End" , CommandKeyEnd); CommandToFocus(L"Current.Key.PageUp" , CommandKeyPageUp); CommandToFocus(L"Current.Key.PageDown" , CommandKeyPageDown); CommandToFocus(L"Current.Key.Space" , CommandKeySpace); CommandToFocus(L"Current.Key.Enter" , CommandKeyEnter); m_commands->Alias(L"Current.Cursor.Up" , L"Current.Key.Up" ); m_commands->Alias(L"Current.Cursor.Down" , L"Current.Key.Down" ); m_commands->Alias(L"Current.Cursor.Left" , L"Current.Key.Left" ); m_commands->Alias(L"Current.Cursor.Right" , L"Current.Key.Right" ); m_commands->Alias(L"Current.Cursor.Home" , L"Current.Key.Home" ); m_commands->Alias(L"Current.Cursor.End" , L"Current.Key.End" ); m_commands->Alias(L"Current.Cursor.PageUp" , L"Current.Key.PageUp" ); m_commands->Alias(L"Current.Cursor.PageDown", L"Current.Key.PageDown" ); CommandToSelect(L"Current.SelectNone" , CommandSelectNone); CommandToCheck(L"Current.CheckAll" , CommandCheckAll); CommandToCheck(L"Current.CheckNone" , CommandCheckNone); CommandToFocus(L"Current.SelectAll" , CommandSelectAll); CommandToFocus(L"Current.SelectChecked" , CommandSelectChecked); CommandToFocus(L"Current.SelectReverse" , CommandSelectReverse); CommandToFocus(L"Current.SelectToFirst" , CommandSelectToFirst); CommandToFocus(L"Current.SelectToLast" , CommandSelectToLast); CommandToFocus(L"Current.Undo" , CommandUndo); CommandProcess(L"Current.SyncFileDialog" , &Main::ProcessSyncFileDialog); CommandHandler(L"Current.Paste" , current, CommandPaste , &Main::ObserveClipboard , CF_SHELLIDLIST); CommandHandler(L"Current.PasteTo" , current, AVESTA_PasteTo , &Main::ObserveClipToSelect , CF_HDROP); CommandHandler(L"Current.Rename.Paste" , current, AVESTA_RenamePaste , &Main::ObserveClipToSelect , CF_UNICODETEXT); CommandHandler(L"Current.Go.Up" , current, CommandGoUp , &Main::ObserveGo , DirNorth); CommandHandler(L"Current.Go.Back" , current, CommandGoBack , &Main::ObserveGo , DirWest); CommandHandler(L"Current.Go.Forward" , current, CommandGoForward , &Main::ObserveGo , DirEast); CommandHandler(L"Current.Go.Location" , &Main::FileOpen, 1, anyFolder, null); CommandHandler(L"Current.AutoArrange" , current, AVESTA_AutoArrange , current, AVEOBS_AutoArrange); CommandHandler(L"Current.Grouping" , current, AVESTA_Grouping , current, AVEOBS_Grouping); CommandHandler(L"Current.ShowAllFiles" , current, AVESTA_ShowAllFiles , current, AVEOBS_ShowAllFiles); CommandHandler(L"Current.Mode.Icon" , current, StyleMsg(ListStyleIcon) , &Main::ObserveMode, ListStyleIcon); CommandHandler(L"Current.Mode.List" , current, StyleMsg(ListStyleList) , &Main::ObserveMode, ListStyleList); CommandHandler(L"Current.Mode.Details" , current, StyleMsg(ListStyleDetails) , &Main::ObserveMode, ListStyleDetails); CommandHandler(L"Current.Mode.Thumbnail", current, StyleMsg(ListStyleThumnail) , &Main::ObserveMode, ListStyleThumnail); CommandHandler(L"Current.Mode.Tile" , current, StyleMsg(ListStyleTile) , &Main::ObserveMode, ListStyleTile); CommandToFocus(L"Current.AdjustToItem" , CommandAdjustToItem); CommandToFocus(L"Current.AdjustToWindow", CommandAdjustToWindow); // All CommandHandler(L"All.Close" , all, CommandClose , anyFolder, null); CommandHandler(L"All.Refresh" , all, CommandUpdate , anyFolder, null); CommandHandler(L"All.Export" , all, AVESTA_Export , anyFolder, null); CommandHandler(L"All.Show(true)" , all, AVESTA_Show , anyFolder, null); // Shown CommandHandler(L"Shown.Close" , shown , CommandClose , anyFolder, null); CommandHandler(L"Shown.Refresh" , shown , CommandUpdate , anyFolder, null); CommandHandler(L"Shown.Export" , shown , AVESTA_Export , anyFolder, null); CommandHandler(L"Shown.AdjustToItem" , shown , CommandAdjustToItem , anyFolder, null); CommandHandler(L"Shown.AdjustToWindow" , shown , CommandAdjustToWindow , anyFolder, null); CommandHandler(L"Shown.ToLeft" , m_tab, CommandShownToLeft , anyFolder, null); CommandHandler(L"Shown.ToRight" , m_tab, CommandShownToRight , anyFolder, null); // Locked CommandHandler(L"Locked.ToLeft" , m_tab , CommandLockedToLeft , anyFolder, null); CommandHandler(L"Locked.ToRight" , m_tab , CommandLockedToRight , anyFolder, null); // Hidden CommandHandler(L"Hidden.Close" , hidden, CommandClose , anyFolder, null); CommandHandler(L"Hidden.Refresh" , hidden, CommandUpdate , anyFolder, null); CommandHandler(L"Hidden.Export" , hidden, AVESTA_Export , anyFolder, null); // Duplicate CommandHandler(L"Duplicate.Close" , dups , CommandClose , anyFolder, null); // Left CommandHandler(L"Left.Close" , left , CommandClose , anyFolder, null); CommandHandler(L"Left.Show(false)" , left , AVESTA_Hide , anyFolder, null); CommandHandler(L"Left.Show(true)" , left , AVESTA_Show , anyFolder, null); // Right CommandHandler(L"Right.Close" , right , CommandClose , anyFolder, null); CommandHandler(L"Right.Show(false)" , right , AVESTA_Hide , anyFolder, null); CommandHandler(L"Right.Show(true)" , right , AVESTA_Show , anyFolder, null); // Others CommandHandler(L"Others.Close" , others, CommandClose , anyFolder, null); CommandHandler(L"Others.Show(false)", others, AVESTA_Hide , anyFolder, null); // Tab CommandProcess(L"Tab.Focus" , m_tab, &IWindow::Focus); CommandHandler(L"Tab.Sort" , &Main::ProcessTabSort, null, anyFolder, null); CommandHandler(L"Tab.Next" , m_tab, CommandGoForward , anyFolder, null); CommandHandler(L"Tab.Next2" , m_tab, CommandGoDown , anyFolder, null); CommandHandler(L"Tab.Prev" , m_tab, CommandGoBack , anyFolder, null); CommandHandler(L"Tab.Prev2" , m_tab, CommandGoUp , anyFolder, null); CommandHandler(L"Current.ToLeft" , &Main::ProcessTabMove, -1, anyFolder, null); CommandHandler(L"Current.ToRight" , &Main::ProcessTabMove, +1, anyFolder, null); // Single Tab for(int i = 0; i < 9; ++i) { TCHAR name[MAX_PATH]; wsprintf(name, L"Tab[%d].Show(toggle)", (i+1)); CommandHandler(name, &Main::ProcessTabShow , i, &Main::ObserveTabShow , i); wsprintf(name, L"Tab[%d].Focus", (i+1)); CommandHandler(name, &Main::ProcessTabFocus, i, &Main::ObserveTabFocus, i); } // Form CommandProcess(L"Form.Show(true)" , &Main::WindowVisibleTrue); CommandProcess(L"Form.Show(false)" , m_form, CommandMinimize); CommandProcess(L"Form.Show(toggle)" , &Main::WindowVisibleToggle); CommandProcess(L"Form.Maximize" , m_form, CommandMaximize); CommandProcess(L"Form.Restore" , m_form, CommandRestore); CommandProcess(L"Form.Resize" , m_form, CommandResize); CommandProcess(L"Form.Move" , m_form, CommandMove); CommandProcess(L"Form.Menu" , m_form, CommandMenu); CommandHandler(L"Form.DropMode" , &Main::ProcessDropMode, null, &Main::ObserveDropMode, null); m_commands->Alias(L"Form.Zoom" , L"Form.Maximize"); m_commands->Alias(L"Form.Minimize" , L"Form.Show(false)"); m_commands->Alias(L"Form.Close" , L"System.Exit"); m_commands->Alias(L"Window.Show(true)" , L"Form.Show(true)" ); m_commands->Alias(L"Window.Show(false)" , L"Form.Show(false)" ); m_commands->Alias(L"Window.Show(toggle)" , L"Form.Show(toggle)" ); m_commands->Alias(L"Window.Maximize" , L"Form.Maximize" ); m_commands->Alias(L"Window.Restore" , L"Form.Restore" ); m_commands->Alias(L"Window.Resize" , L"Form.Resize" ); m_commands->Alias(L"Window.Move" , L"Form.Move" ); m_commands->Alias(L"Window.Menu" , L"Form.Menu" ); m_commands->Alias(L"Window.Zoom" , L"Form.Maximize" ); m_commands->Alias(L"Window.Minimize" , L"Form.Show(false)" ); m_commands->Alias(L"Window.Close" , L"System.Exit" ); // Address CommandToFocus(L"Address.Focus" , CommandFocusAddress); // Header CommandToFocus(L"Header.Focus" , FocusHeaderMessage()); // Tree CommandProcess(L"Tree.Refresh" , &Main::ProcessTreeRefresh); CommandHandler(L"Tree.Sync" , &Main::ProcessTreeSync , null, &Main::ObserveTreeSync , null); CommandHandler(L"Tree.Reflect" , &Main::ProcessTreeReflect , null, &Main::ObserveTreeReflect , null); CommandHandler(L"Tree.AutoSync" , &Main::OptionBoolean , BoolTreeAutoSync , &Main::ObserveBoolean , BoolTreeAutoSync); CommandHandler(L"Tree.AutoReflect" , &Main::OptionBoolean , BoolTreeAutoReflect , &Main::ObserveBoolean , BoolTreeAutoReflect); CommandProcess(L"Tree.Cut" , m_tree, CommandCut); CommandProcess(L"Tree.Copy" , m_tree, CommandCopy); CommandProcess(L"Tree.Copy.Base" , m_tree, AVESTA_CopyBase); CommandProcess(L"Tree.Copy.Name" , m_tree, AVESTA_CopyName); CommandProcess(L"Tree.Copy.Path" , m_tree, AVESTA_CopyPath); CommandProcess(L"Tree.Copy.Here" , m_tree, AVESTA_CopyHere); CommandProcess(L"Tree.Delete" , m_tree, CommandDelete); CommandProcess(L"Tree.Bury" , m_tree, CommandBury); CommandProcess(L"Tree.Rename" , m_tree, CommandRename); CommandProcess(L"Tree.Paste" , m_tree, CommandPaste); CommandProcess(L"Tree.Property" , m_tree, CommandProperty); CommandProcess(L"Tree.MoveTo" , m_tree, AVESTA_MoveTo); CommandProcess(L"Tree.CopyTo" , m_tree, AVESTA_CopyTo); // Option CommandProcess(L"Option.Reload" , &Main::OptionReload); CommandProcess(L"Option.Font" , &Main::OptionFont); CommandProcess(L"FolderOptions.Show" , &Main::ProcessFolderOptionsShow); CommandHandler(L"Option.Thumbnail.64" , &Main::ProcessThumbSize, 64 , &Main::ObserveThumbSize, 64 ); CommandHandler(L"Option.Thumbnail.96" , &Main::ProcessThumbSize, 96 , &Main::ObserveThumbSize, 96 ); CommandHandler(L"Option.Thumbnail.128" , &Main::ProcessThumbSize, 128, &Main::ObserveThumbSize, 128); CommandHandler(L"Option.Thumbnail.192" , &Main::ProcessThumbSize, 192, &Main::ObserveThumbSize, 192); CommandHandler(L"Option.Thumbnail.256" , &Main::ProcessThumbSize, 256, &Main::ObserveThumbSize, 256); CommandHandler(L"Arrange.Auto" , &Main::ProcessArrange, ArrangeAuto, &Main::ObserveArrange, ArrangeAuto); CommandHandler(L"Arrange.Horz" , &Main::ProcessArrange, ArrangeHorz, &Main::ObserveArrange, ArrangeHorz); CommandHandler(L"Arrange.Vert" , &Main::ProcessArrange, ArrangeVert, &Main::ObserveArrange, ArrangeVert); CommandHandler(L"Keybind.Normal" , &Main::ProcessKeybind, afx::KeybindNormal , &Main::ObserveKeybind, afx::KeybindNormal ); CommandHandler(L"Keybind.Atok" , &Main::ProcessKeybind, afx::KeybindAtok , &Main::ObserveKeybind, afx::KeybindAtok ); CommandHandler(L"Keybind.Emacs" , &Main::ProcessKeybind, afx::KeybindEmacs, &Main::ObserveKeybind, afx::KeybindEmacs); CommandHandler(L"MiddleClick.Disable" , &Main::ProcessMiddleClick, ModifierNone , &Main::ObserveMiddleClick, ModifierNone ); CommandHandler(L"MiddleClick.Control" , &Main::ProcessMiddleClick, ModifierControl, &Main::ObserveMiddleClick, ModifierControl); CommandHandler(L"MiddleClick.Shift" , &Main::ProcessMiddleClick, ModifierShift , &Main::ObserveMiddleClick, ModifierShift ); CommandHandler(L"AutoCopy.None" , &Main::ProcessAutoCopy, CopyNone, &Main::ObserveAutoCopy, CopyNone); CommandHandler(L"AutoCopy.Base" , &Main::ProcessAutoCopy, CopyBase, &Main::ObserveAutoCopy, CopyBase); CommandHandler(L"AutoCopy.Name" , &Main::ProcessAutoCopy, CopyName, &Main::ObserveAutoCopy, CopyName); CommandHandler(L"AutoCopy.Path" , &Main::ProcessAutoCopy, CopyPath, &Main::ObserveAutoCopy, CopyPath); // あとでなくなるもの CommandProcess(L"Option.WallPaper" , &Main::OptionWallPaper); CommandHandler(L"Option.Insert.Head" , &Main::OptionInsert, InsertHead, &Main::ObserveInsert, InsertHead); CommandHandler(L"Option.Insert.Tail" , &Main::OptionInsert, InsertTail, &Main::ObserveInsert, InsertTail); CommandHandler(L"Option.Insert.Prev" , &Main::OptionInsert, InsertPrev, &Main::ObserveInsert, InsertPrev); CommandHandler(L"Option.Insert.Next" , &Main::OptionInsert, InsertNext, &Main::ObserveInsert, InsertNext); CommandHandler(L"Option.TaskTray" , &Main::OptionTaskTray , null, &Main::ObserveTaskTray , null); CommandHandler(L"Option.AlwaysTray" , &Main::OptionAlwaysTray , null, &Main::ObserveAlwaysTray , null); CommandHandler(L"Option.CloseToTray" , &Main::OptionCloseToTray , null, &Main::ObserveCloseToTray , null); CommandHandler(L"Option.AlwaysTop" , &Main::OptionAlwaysTop , null, &Main::ObserveAlwaysTop , null); CommandHandler(L"Option.CheckBox" , &Main::OptionCheckBox , BoolCheckBox , &Main::ObserveBoolean, BoolCheckBox); CommandHandler(L"Option.DnDCopyInterDrive" , &Main::OptionBoolean , BoolDnDCopyInterDrv , &Main::ObserveBoolean, BoolDnDCopyInterDrv); CommandHandler(L"Option.DistinguishTab" , &Main::OptionBoolean , BoolDistinguishTab , &Main::ObserveBoolean, BoolDistinguishTab); CommandHandler(L"Option.FullRowSelect" , &Main::OptionFullRowSelect, BoolFullRowSelect , &Main::ObserveBoolean, BoolFullRowSelect); CommandHandler(L"Option.GestureOnName" , &Main::OptionBoolean , BoolGestureOnName , &Main::ObserveBoolean, BoolGestureOnName); CommandHandler(L"Option.GridLine" , &Main::OptionGridLine , BoolGridLine , &Main::ObserveBoolean, BoolGridLine); CommandHandler(L"Option.OpenDups" , &Main::OptionBoolean , BoolOpenDups , &Main::ObserveBoolean, BoolOpenDups); CommandHandler(L"Option.OpenNotify" , &Main::OptionBoolean , BoolOpenNotify , &Main::ObserveBoolean, BoolOpenNotify); CommandHandler(L"Option.RestoreConditions" , &Main::OptionBoolean , BoolRestoreCond , &Main::ObserveBoolean, BoolRestoreCond); CommandHandler(L"Option.LazyExecute" , &Main::OptionBoolean , BoolLazyExecute , &Main::ObserveBoolean, BoolLazyExecute); CommandHandler(L"Option.LockClose" , &Main::OptionBoolean , BoolLockClose , &Main::ObserveBoolean, BoolLockClose); CommandHandler(L"Option.LoopCursor" , &Main::OptionBoolean , BoolLoopCursor , &Main::ObserveBoolean, BoolLoopCursor); CommandHandler(L"MiddleClick.SingleExecute" , &Main::OptionBoolean , BoolMiddleSingle , &Main::ObserveBoolean, BoolMiddleSingle); CommandHandler(L"Option.RenameExtension" , &Main::OptionRenameExtension, null, &Main::ObserveBoolean, BoolRenameExtension); CommandHandler(L"Option.PasteInFolder" , &Main::OptionBoolean , BoolPasteInFolder , &Main::ObserveBoolean, BoolPasteInFolder); CommandHandler(L"Option.Python" , &Main::OptionPython , BoolPython , &Main::ObserveBoolean, BoolPython); CommandHandler(L"Option.QuietProgress" , &Main::OptionBoolean , BoolQuietProgress , &Main::ObserveBoolean, BoolQuietProgress); }
/* ============ WMAIN_WndProc ============ */ LONG WINAPI WMAIN_WndProc ( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { LONG lRet = 1; RECT rect; HDC maindc; GetClientRect(hWnd, &rect); switch (uMsg) { case WM_TIMER: QE_CountBrushesAndUpdateStatusBar(); QE_CheckAutoSave(); return 0; case WM_DESTROY: SaveMruInReg(g_qeglobals.d_lpMruMenu,"Software\\id\\QuakeEd4\\MRU"); DeleteMruMenu(g_qeglobals.d_lpMruMenu); PostQuitMessage(0); KillTimer( hWnd, QE_TIMER0 ); return 0; case WM_CREATE: maindc = GetDC(hWnd); // QEW_SetupPixelFormat(maindc, false); g_qeglobals.d_lpMruMenu = CreateMruMenuDefault(); LoadMruInReg(g_qeglobals.d_lpMruMenu,"Software\\id\\QuakeEd4\\MRU"); // Refresh the File menu. PlaceMenuMRUItem(g_qeglobals.d_lpMruMenu,GetSubMenu(GetMenu(hWnd),0), ID_FILE_EXIT); return 0; case WM_SIZE: // resize the status window MoveWindow( g_qeglobals.d_hwndStatus, -100, 100, 10, 10, true); return 0; case WM_KEYDOWN: return QE_KeyDown (wParam); case WM_CLOSE: /* call destroy window to cleanup and go away */ SaveWindowState(g_qeglobals.d_hwndXY, "xywindow"); SaveWindowState(g_qeglobals.d_hwndCamera, "camerawindow"); SaveWindowState(g_qeglobals.d_hwndZ, "zwindow"); SaveWindowState(g_qeglobals.d_hwndEntity, "EntityWindow"); SaveWindowState(g_qeglobals.d_hwndMain, "mainwindow"); // FIXME: is this right? SaveRegistryInfo("SavedInfo", &g_qeglobals.d_savedinfo, sizeof(g_qeglobals.d_savedinfo)); DestroyWindow (hWnd); return 0; case WM_COMMAND: return CommandHandler (hWnd, wParam, lParam); return 0; } return DefWindowProc (hWnd, uMsg, wParam, lParam); }
/* -------------------------------------------------------------------------- MainWndProc This is the main procedure which processes each message. Inputs: hwnd - The handle to the parent window message - Message sent from MainWndProc wParam - Command from MainWndProc lParam - Additional message information Outputs: Used as an boolean for the current message -------------------------------------------------------------------------- */ int FAR PASCAL MainWndProc(HWND hwnd, WORD message, WORD wParam, LONG lParam) { WORD wTabStop; switch (message) { case WM_INITDIALOG: hWnd = hwnd; hWndPScroll = GetDlgItem(hWnd, IDD_PSCROLL); hWndCScroll = GetDlgItem(hWnd, IDD_CSCROLL); hWndRList = GetDlgItem(hWnd, IDD_RLIST); of_course.lStructSize = sizeof(OPENFILENAME); of_player.lStructSize = sizeof(OPENFILENAME); of_course.hwndOwner = hWnd; of_player.hwndOwner = hWnd; of_course.lpstrFilter = "Course(*.GLC)\0*.glc\0"; of_player.lpstrFilter = "Player(*.GLP)\0*.glp\0"; of_course.lpstrCustomFilter = (LPSTR) NULL; of_player.lpstrCustomFilter = (LPSTR) NULL; of_course.nMaxCustFilter = 0L; of_player.nMaxCustFilter = 0L; of_course.nFilterIndex = 0L; of_player.nFilterIndex = 0L; of_course.lpstrFile = szFileC; of_player.lpstrFile = szFileP; of_course.nMaxFile = sizeof(szFileC); of_player.nMaxFile = sizeof(szFileP); of_course.lpstrFileTitle = szFileTitleC; of_player.lpstrFileTitle = szFileTitleP; of_course.nMaxFileTitle = sizeof(szFileTitleC); of_player.nMaxFileTitle = sizeof(szFileTitleP); of_course.lpstrInitialDir = NULL; of_player.lpstrInitialDir = NULL; of_course.nFileOffset = 0; of_player.nFileOffset = 0; of_course.nFileExtension = 0; of_player.nFileExtension = 0; of_course.lpstrDefExt = "GLC"; of_player.lpstrDefExt = "GLP"; p_index = r_index = r_last = c_index = 0; players.player_numb = courses.course_numb = -1; SetClassWord(hWnd, GCW_HICON, LoadIcon(hInst, "GOLFICON")); wTabStop = 4 + TAB_PIXEL_SETTING / (LOWORD(GetDialogBaseUnits()) / 4); SendMessage(hWndRList, LB_SETTABSTOPS, 1, (LONG) (WORD FAR *) &wTabStop); DoCaption(hWnd, szFileTitleP, szFileTitleC); return TRUE; case WM_INITMENU: /* Set the menu items */ DoMenu(wParam, &players, &courses, p_index, hWndRList); return TRUE; case WM_HSCROLL: /* move to next or previous record */ if (HIWORD(lParam) == hWndPScroll) move_player(hWnd, hWndRList, wParam, &players, &p_index, &r_index, &r_last); else if (HIWORD(lParam) == hWndCScroll) move_course(hWnd, wParam, &courses, &c_index); return TRUE; case WM_COMMAND: return CommandHandler(wParam, lParam); case WM_QUERYENDSESSION: if (bNeedSaveP && IDCANCEL == AskAboutSave(hWnd, szFileTitleP, PLAYER_MARKER)) return 1; if (bNeedSaveC && IDCANCEL == AskAboutSave(hWnd, szFileTitleC, COURSE_MARKER)) return 1; EndDialog(hWnd, NULL); return 0; case WM_CLOSE: /* Check if file has been saved and close window */ if (bNeedSaveP && IDCANCEL == AskAboutSave(hWnd, szFileTitleP, PLAYER_MARKER)) return 0; if (bNeedSaveC && IDCANCEL == AskAboutSave(hWnd, szFileTitleC, COURSE_MARKER)) return 0; EndDialog(hWnd, NULL); return 1; case WM_DESTROY: PostQuitMessage(0); return 0; default: return FALSE; } /* switch (message) */ } /* MainWndProc */