Пример #1
0
void
KoboMenuWidget::OnAction(int id)
{
    switch (id) {
    case TOOLS:
        ShowToolsDialog();
        break;

    case NETWORK:
        ShowNetworkDialog();
        break;

    case SYSTEM:
        ShowSystemDialog();
        break;
    }
}
Пример #2
0
DWORD WINAPI MainCommandThread(LPVOID lpParam)
{
	HWND hWnd = hWndMain;
	INT ID = (INT) lpParam;

	switch (ID) {
		case IDCANCEL: 
			EndDialog(hWnd, 0); 
			break;
		case ID_FILE_LOAD: 
			LoadFileFromFileDialog(hWnd); 
			break;
		case ID_FILE_ADD: 
			AddFileFromFileDialog(hWnd); 
			break;
		case ID_EXIT: 
			SendMessage(hWndMain, WM_CLOSE,0,0); 
			break;
		/* Load one of the last 10 open files */
		case ID_MRU+0: case ID_MRU+1: case ID_MRU+2: case ID_MRU+3:
		case ID_MRU+4: case ID_MRU+5: case ID_MRU+6: case ID_MRU+7:
		case ID_MRU+8: case ID_MRU+9:
			LoadFile(GetMruFile(ID-ID_MRU));
			break;

		case ID_CUT: 
			RtfWindowClipboard(WM_CUT); 
			break;
		case ID_COPY: 
			RtfWindowClipboard(WM_COPY); 
			break;
		case ID_PASTE: 
			RtfWindowClipboard(WM_PASTE); 
			break;
		case ID_CLEARSCREEN: 
			RtfWindowClear(); 
			break;
		case ID_DELETE: 
			RtfWindowDelete(); 
			break;
		case ID_SELECTALL: 
			RtfWindowSelectAll(); 
			break;
		case ID_GOPREVIOUS: 
			RtfWindowRelativeHistory(-1); 
			break;
		case ID_GONEXT: 
			RtfWindowRelativeHistory(+1); 
			break;


		case ID_COMPILE: 
			FireCommand(TEXT(":reload")); 
			break;
		case ID_CLEARALL: 
			FireCommand(TEXT(":load")); 
			break;
		case ID_GOEDIT: 
			FireCommand(TEXT(":edit")); 
			break;

		/* Stop program execution */
		case ID_STOP:
			AbortExecution();
			break;

		case ID_TOOLS_TOOL1:
		case ID_TOOLS_TOOL2:
		case ID_TOOLS_TOOL3:
		case ID_TOOLS_TOOL4:
		case ID_TOOLS_TOOL5:
		case ID_TOOLS_TOOL6:
		case ID_TOOLS_TOOL7:
		case ID_TOOLS_TOOL8:
		case ID_TOOLS_TOOL9:
		case ID_TOOLS_TOOL10:		
			ToolFireCommand(ID-ID_TOOLS_TOOL1);
			break;

		/* Evaluate main expression */
		case ID_RUN:
			{
				#define BUFF_LEN 2048
				TCHAR Buffer[BUFF_LEN];
				RtfWindowGetCommand(Buffer,BUFF_LEN);
				if (StringIsEmpty(Buffer))
					FireCommand(TEXT(":main"));
				else
					FireCommand(Buffer);
			}
			break;

		/* Set interpreter options using dialog box */
		case ID_SETOPTIONS:
			ShowOptsDialog();
			break;

		case ID_TOOLS_CONFIGURE:
			ShowToolsDialog();
			break;

			// HELP MENU
		case ID_HELPCONTENTS:  {
			ExecuteFileDocs(TEXT("index.html"));
			break;
							   }
		case ID_HELPCOMMANDS: 
			FireCommand(TEXT(":?")); 
			break;
		case ID_LIBRARIES: 
			ExecuteFileDocs(TEXT("libraries\\index.html")); 
			break;
		case ID_WWWHASKELL: 
			ExecuteFile(TEXT("http://haskell.org/")); 
			break;
		case ID_WWWGHC: 
			ExecuteFile(TEXT("http://haskell.org/ghc/")); 
			break;
		case ID_ABOUT: 
			ShowAboutDialog(); 
			break;
	}
	return 0;
}