Beispiel #1
0
// Invoked before starting printing GHCi output for a command
VOID RtfWindowStartNextOutput()
{
    RtfWindowPutS(TEXT("\n"));
    FlushBuffer(TRUE);;
    BufFormat = DefFormat;
    NowFormat = DefFormat;
    BackSpaces = 0;
    StartOfOutput = RtfWindowTextLength();
}
Beispiel #2
0
VOID RtfEchoCommand(LPCTSTR s)
{
    RtfWindowPutS(s);
    RtfWindowPutS(TEXT("\n"));
}
Beispiel #3
0
VOID UpdateOptions(HWND hDlg) 
{
  FLAG *fs;
  TCHAR Buffer[3*MAX_PATH];

  if(ComboHasChanged(hDlg,GHCi_Combo_Startup)) {
	  INT resp = MessageBox( hDlg
		                   , TEXT("GHCi startup has changed. The interpreter must be initialized. Do you want to proceed?")
						   , TEXT("WinGHCi"), MB_YESNO|MB_ICONQUESTION);

	  if(resp==IDYES) {
        RtfWindowPutS(TEXT("\n"));
		ComboGetDlgText(hDlg, GHCi_Combo_Startup, Buffer, 3*MAX_PATH);
		
		SetEvent(hKillGHCi);
		//pause StdoutPrinterThread thread
		SignalObjectAndWait(hSigSuspendStdoutPrinterThread
			               ,hSigStdoutPrinterThreadSuspended, INFINITE, FALSE);

		if (CreateGHCiProcess(Buffer)) {		
            ComboUpdate(hDlg,GHCi_Combo_Startup);
		} else {
			TCHAR ErrorMsg[3*MAX_PATH];
			wsprintf( ErrorMsg,TEXT("GHCi could not be initialized as follows:\n %s\n\nIt will be restarted using the previous configuration:\n %s")
				    , Buffer, ComboGetValue(GHCi_Combo_Startup)
				);
			MessageBox( hDlg
		              , ErrorMsg
					  , TEXT("WinGHCi"), MB_OK|MB_ICONSTOP);
			CreateGHCiProcess(ComboGetValue(GHCi_Combo_Startup));
		}

		// resume StdoutPrinterThread
		Sleep(100);
		SetEvent(hSigResumeStdoutPrinterThread);
	  }	
  }



 //update flags
 for(fs = flags; fs->FlagState != NULL; fs++) {
	 BOOL newState = GetDlgItemBool(hDlg, fs->CtrlID);
	 BOOL hasChanged = newState != *(fs->FlagState);
	 *(fs->FlagState) = newState;

	 if(hasChanged) {
		MakeGHCiFlagCommand(fs,Buffer);
		FireCommand(Buffer);
	 }
 }

 // update editor	
 if(ComboHasChanged(hDlg,GHCi_Combo_Editor)) {
	 ComboUpdate(hDlg,GHCi_Combo_Editor);
	 MakeGHCiEditorCommand(ComboGetValue(GHCi_Combo_Editor), Buffer);
	 FireCommand(Buffer);
 }


 //update prompt
 if(ComboHasChanged(hDlg,GHCi_Combo_Prompt)) {
	 ComboUpdate(hDlg,GHCi_Combo_Prompt);
	 MakeGHCiPromptCommand(ComboGetValue(GHCi_Combo_Prompt), Buffer, FALSE);
	 FireCommand(Buffer);
 }


}