示例#1
0
void AskExit()
{
	if(CheckIfModified()==TRUE)
	{
		SetColor(LIGHTWHITE);
		SetBackColor(RED);
		OpenWindow(10,24,5,32);
		SetColor(YELLOW);
		Print_At(11,29,"Apply Changes on Exit?");
		SetColor(BLUE);
		SetBackColor(WHITE);
		SetBlink(ON);
		Print_At(13,32," <Yes> ");
		Print_At(13,42," <No> ");
		SetBlink(OFF);
		GetKey();
	}
	CloseAllWindows();
	VideoReset();
	if(keycode!=ESC && keychar!='n' && keychar!='N')
		if(WriteHeader(&id32)!=0)
		{
			printf("%s could not write to file\n" ,errstr);
			exit(1);
		}
	CloseFile();
	exit(0);
}
NS_IMETHODIMP nsMessengerContentHandler::HandleContent(const char * aContentType,
                                                nsIInterfaceRequestor* aWindowContext, nsIRequest *request)
{
  nsresult rv = NS_OK;
  if (!request)
    return NS_ERROR_NULL_POINTER;

  // First of all, get the content type and make sure it is a content type we know how to handle!
  if (PL_strcasecmp(aContentType, "application/x-message-display") == 0) {
    nsCOMPtr<nsIURI> aUri;
    nsCOMPtr<nsIChannel> aChannel = do_QueryInterface(request);
    if (!aChannel) return NS_ERROR_FAILURE;

    rv = aChannel->GetURI(getter_AddRefs(aUri));
    if (aUri)
    {
      rv = request->Cancel(NS_ERROR_ABORT);
      if (NS_SUCCEEDED(rv))
      {
        nsCOMPtr<nsIURL> aUrl = do_QueryInterface(aUri);
        if (aUrl)
        {
          nsCAutoString queryPart;
          aUrl->GetQuery(queryPart);
          queryPart.ReplaceSubstring("type=message/rfc822", "type=application/x-message-display");
          aUrl->SetQuery(queryPart);
          rv = OpenWindow(aUri);
        }
      }
    }
  }

  return rv;
}
void SinglePlayerMenu::OnLoadReplay()
{
	char tmp[FILENAME_MAX];
	fnkdat("replay/", tmp, FILENAME_MAX, FNKDAT_USER | FNKDAT_CREAT);
	std::string replaypath(tmp);
	OpenWindow(LoadSaveWindow::Create(false, pTextManager->getLocalized("Load Replay"), replaypath, "rpl"));
}
示例#4
0
bool Init(void)
{
	// platform-specific initialization
	Platform::Init();

	// create window
	OpenWindow();

	// hide the mouse cursor
	Platform::ShowCursor(false);

	// grab input
	Platform::GrabInput(true);

	// print OpenGL attributes
	PrintAttributes();

	// initialize console
	console = new Console(cmdCB);

	// initialize sound system
	Sound::Init();

	// pause audio
	Sound::Pause();

	// success!
	return true;    
}
void SinglePlayerMenu::CloseChildWindow() {
	std::string filename = "";
	std::string extension = "";
	LoadSaveWindow* pLoadSaveWindow = dynamic_cast<LoadSaveWindow*>(pChildWindow);
	if(pLoadSaveWindow != NULL) {
		filename = pLoadSaveWindow->GetFilename();
		extension = pLoadSaveWindow->GetExtension();
	}

	MenuClass::CloseChildWindow();

	if(filename != "") {
		if(extension == "dls") {

		    try {
                startSinglePlayerGame( GameInitSettings(filename) );
		    } catch (std::exception& e) {
		        // most probably the savegame file is not valid or from a different dune legacy version
                OpenWindow(MessageBox::Create(e.what()));
            }
		} else if(extension == "rpl") {
			startReplay(filename);
		}
	}
}
示例#6
0
void RestoreConfig()
{
	int n;
	char *envname;
	char envbuf[256];
	char *name;
	char *ptr;
	char buf[80];

	SetColor(LIGHTWHITE);
	SetBackColor(BLUE);
	OpenWindow(10,10,3,60);
	SetColor(YELLOW);
	Print_At(10,13," Restore Predefined Configuration ");
	SetColor(LIGHTWHITE);
	Print_At(11,12,"Enter file name:");

	name=InputString(11,30,37,cfgfilename);
	if(name!=NULL && name[0]!=0)
	{
		strcpy(buf,name);
		ptr=(char *)strchr(buf,'.');
		if(ptr!=NULL) strset(ptr,0);
		strcpy(cfgfilename,buf);
		strcat(buf,".d32");
		n=open(buf,O_RDONLY | O_BINARY);
		if(n==-1)
		{
			envname=getenv("DOS32A");
			if(envname!=NULL)
			{
				ptr=strchr(envname,' ');
				if(ptr==NULL) ptr=strchr(envname,0);
				memset(envbuf,0,256);
				strncpy(envbuf,envname,(dword)ptr-(dword)envname);
				strcat(envbuf,"\\D32\\"); strcat(envbuf,buf);
				n=open(envbuf,O_RDWR | O_BINARY);
			}
		}
		if(n!=-1)
		{
			read(n,&id32,24);
			close(n);
			SetColor(LIGHTWHITE);
			SetBackColor(BLUE);
			strupr(buf);
			for(n=0; n<13; n++)
			{
				SetPos(24,66+n);
				PrintC(' ');
			}
			Print_At(24,66,"%.13s",buf);
		}
		else DiskError();
	}
	ValidateConfig();
	CloseWindow();
	if(mainmenu_sel==1) ShowBannerStatus();

}
示例#7
0
int
nsNativeViewerApp::Run()
{
  OpenWindow();
  mAppShell->Run();
  return 0;
}
CApp::CApp( )
{
    fSpawnTimer = 0.0f;
    iLife = 10;
    OpenWindow( );
    Run( );
}
示例#9
0
int QueryUserStop(void)
{
     int control, result;
     static int Initialized = FALSE;

     PushHelpIndex(USER_STOP_INDEX);
     
     if (!Initialized)
     {
        Initialize();
        Initialized = TRUE;
     }
              
     SetStatusBar(RED, WHITE, "                                            ");
     SetStatusBar(RED, WHITE, " Defragmentation process stopped.");
     
     OpenWindow(&QueryBox);
     control = ControlWindow(&QueryBox);
     CloseWindow();

     /* Interpret values. */
     if (control == YESBUTTON)
        result = TRUE;
     else
        result = FALSE;

     PopHelpIndex();
     
     return result;
}
示例#10
0
extern "C" int first()
{
	SysBase = *((struct ExecBase**)4);
	IntuitionBase = (struct IntuitionBase*)OpenLibrary("intuition.library", 37);
	DOSBase = (struct DosLibrary*)OpenLibrary("dos.library", 37);

	struct NewWindow nw = {0};

	nw.TopEdge = 0;
	nw.LeftEdge = 0;
	nw.Width = 100;
	nw.Height = 100;
	nw.Flags = WFLG_DRAGBAR;
	nw.Type = WBENCHSCREEN;

	struct Window* win = OpenWindow(&nw);
	if (win == NULL)
	{
		Write(Output(), (void* const)"Failed\n", 7);
		return 0;
	}

	Delay(50*4);

	CloseWindow(win);

	//DisplayBeep(NULL);
	return 0;
}
示例#11
0
	bool Init(void)
	{
		// initialize SDL
		if( SDL_Init( SDL_INIT_EVERYTHING ) < 0 )
			return false;    

		// Check for joystick
		if (SDL_NumJoysticks() > 0)
		{
			// Open joystick
			SDL_Joystick *joy = SDL_JoystickOpen(0);
			if(joy)
			{
				DebugPrint("Opened Joystick 0\n");
				DebugPrint("Name: %s\n", SDL_JoystickName(0));
			}
		}

		// enable unicode
		SDL_EnableUNICODE(1);

		// create the window
		OpenWindow();

		// set window title
		SDL_WM_SetCaption( "Shmup!", NULL );

		// platform-specific attributes
		PrintAttributes();

		// success!
		return true;    
	}
示例#12
0
void cChestEntity::OpenNewWindow(void)
{
	if (m_Neighbour != nullptr)
	{
		ASSERT(  // This should be the primary chest
			(m_Neighbour->GetPosX() < GetPosX()) ||
			(m_Neighbour->GetPosZ() < GetPosZ())
		);
		OpenWindow(new cChestWindow(this, m_Neighbour));
	}
	else
	{
		// There is no chest neighbour, open a single-chest window:
		OpenWindow(new cChestWindow(this));
	}
}
示例#13
0
PDoc* PApp::OpenWorksheet()
{
	try
	{
		if (!gPrefsDir.Contains("Worksheet", B_FILE_NODE | B_SYMLINK_NODE))
		{
			BFile file;
			gPrefsDir.CreateFile("Worksheet", &file);
		}

		BEntry w;
		entry_ref wr;

		FailOSErr(gPrefsDir.FindEntry("Worksheet", &w, true));
		FailOSErr(w.GetRef(&wr));
		OpenWindow(wr);

		PDoc *d = dynamic_cast<PDoc*>(CDoc::FindDoc(wr));
		if (d)
			d->MakeWorksheet();

		return d;
	}
	catch (HErr& e)
	{
		e.DoError();
	}

	return NULL;
} /* PApp::OpenWorksheet */
void SinglePlayerMenu::OnLoadSavegame()
{
	char tmp[FILENAME_MAX];
	fnkdat("save/", tmp, FILENAME_MAX, FNKDAT_USER | FNKDAT_CREAT);
	std::string savepath(tmp);
	OpenWindow(LoadSaveWindow::Create(false, pTextManager->getLocalized("Load Game"), savepath, "dls"));
}
示例#15
0
int ReportDefragDone(void)
{
    static int Initialized = FALSE;

    int control, i, result;

    if (!Initialized)
    {
        Initialize();
        Initialized = TRUE;
    }

    SetStatusBar(RED, WHITE, "                                            ");
    SetStatusBar(RED, WHITE, " Defragmentation done.");

    OpenWindow(&DoneDialog);
    do {
        control = ControlWindow(&DoneDialog);
    } while (control != OKBUTTON);
    CloseWindow();

    for (i = 0; i < 3; i++)
        if (SelectButtons[i].selected)
        {
            result = i;
            SelectButtons[i].selected = FALSE;
        }

    SelectButtons[DEFAULT_OPTION].selected = TRUE;
    return result;
}
示例#16
0
void cChestEntity::OpenNewWindow(void)
{
	// TODO: cats are an obstruction
	if ((GetPosY() + 1 < cChunkDef::Height) && cBlockInfo::IsSolid(GetWorld()->GetBlock(GetPosX(), GetPosY() + 1, GetPosZ())))
	{
		// Obstruction, don't open
		return;
	}

	// Callback for opening together with neighbor chest:
	class cOpenDouble :
		public cChestCallback
	{
		cChestEntity * m_ThisChest;
	public:
		cOpenDouble(cChestEntity * a_ThisChest) :
			m_ThisChest(a_ThisChest)
		{
		}
		
		virtual bool Item(cChestEntity * a_Chest) override
		{
			if ((a_Chest->GetPosY() + 1 < cChunkDef::Height) && cBlockInfo::IsSolid(a_Chest->GetWorld()->GetBlock(a_Chest->GetPosX(), a_Chest->GetPosY() + 1, a_Chest->GetPosZ())))
			{
				// Obstruction, don't open
				return false;
			}

			// The primary chest should eb the one with lesser X or Z coord:
			cChestEntity * Primary = a_Chest;
			cChestEntity * Secondary = m_ThisChest;
			if (
				(Primary->GetPosX() > Secondary->GetPosX()) ||
				(Primary->GetPosZ() > Secondary->GetPosZ())
			)
			{
				std::swap(Primary, Secondary);
			}
			m_ThisChest->OpenWindow(new cChestWindow(Primary, Secondary));
			return false;
		}
	} ;
	
	// Scan neighbors for adjacent chests:
	cOpenDouble OpenDbl(this);
	if (
		m_World->DoWithChestAt(m_PosX - 1, m_PosY, m_PosZ,     OpenDbl) ||
		m_World->DoWithChestAt(m_PosX + 1, m_PosY, m_PosZ,     OpenDbl) ||
		m_World->DoWithChestAt(m_PosX,     m_PosY, m_PosZ - 1, OpenDbl) ||
		m_World->DoWithChestAt(m_PosX,     m_PosY, m_PosZ + 1, OpenDbl)
	)
	{
		// The double-chest window has been opened in the callback
		return;
	}

	// There is no chest neighbor, open a single-chest window:
	OpenWindow(new cChestWindow(this));
}
示例#17
0
void UpdateWindowAction()
{
	if (runtime)
	{
		CloseWindow();
		OpenWindow();
	}
}
示例#18
0
int
nsNativeViewerApp::Run()
{
  PRINTF( ">>> nsViewerApp::Run() <<<\n" );
  OpenWindow();
  mAppShell->Run();
  return 0;
}
示例#19
0
int WINAPI WinMain(HINSTANCE me, HINSTANCE x, LPSTR cmdline, int cmdShow) {
    ghInst = me;
    CreateClass();
    OpenWindow();
    Run();
    if (nl != 0) {
        nl->shutdown();
    }
    return 0;
}
示例#20
0
void cHorse::PlayerOpenWindow(cPlayer & a_Player)
{
	auto Window = GetWindow();
	if (Window == nullptr)
	{
		Window = new cHorseWindow(*this);
		OpenWindow(Window);
	}

	a_Player.OpenWindow(*Window);
}
BOOL        DrvEjectAll( HWND hwnd)

{
    BOOL    fRtn = FALSE;

    if (!CAM_IS_MSD || CAMDRV_IS_NEVEREJECT ||
        !OpenWindow( hwnd, IDD_EJECTALL, 0))
        fRtn = TRUE;

    return (fRtn);
}
示例#22
0
BOOL C_ListBox::Process(long ID,short HitType)
{
	gSoundMgr->PlaySound(GetSound(HitType));
	switch(HitType)
	{
		case C_TYPE_LMOUSEUP:
			if(Callback_)
				(*Callback_)(ID,HitType,this);
			if(GetFlags() & C_BIT_ABSOLUTE)
				OpenWindow((short)(Parent_->GetX() + GetX()),
						   (short)(Parent_->GetY() + GetY() + GetH() + 1),
						   (short)GetW(), (short)GetListHeight());//! 
			else
				OpenWindow((short)(Parent_->GetX() + Parent_->VX_[GetClient()] + GetX()),
						   (short)(Parent_->GetY() + Parent_->VY_[GetClient()] + GetY() + GetH() + 1),
						   (short)GetW(),(short)GetListHeight());//! 
			return(TRUE);
			break;
	}
	return(FALSE);
}
示例#23
0
void CSumItApplication::ArgvReceived(int32 argc, char **argv)
{
	int i;

	for (i = 1; i < argc; i++)
	{
		entry_ref ref;
		
		if (get_ref_for_path(argv[i], &ref) == B_NO_ERROR)
			OpenWindow(ref);
	}
} /* CSumItApplication::ArgvReceived */
示例#24
0
文件: SELDRVBX.C 项目: FDOS/defrag
char ShowDriveSelectionBox(void)
{
  int   control, i, len, index = 0;
  char  drive;
  
  static int Initialized = FALSE;

  PushHelpIndex(SELECT_DRIVE_INDEX);
  
  if (!Initialized)
  {
     Initialized = TRUE;
     Initialize();
  }
  
  drive = GetOptimizationDrive();
  len   = strlen(DrvBuffer);
  
  for (i = 0; i < len; i++)
  {
      if (drive == DrvBuffer[i])
      {
         index = i;
         break;
      }
  }

  if (index)
     if (index - LBox.top < SELBOX_HEIGHT - 2)
        LBox.CursorPos = index - LBox.top;
     else 
     {
        LBox.CursorPos = SELBOX_HEIGHT - 2;
        LBox.top       = index - (SELBOX_HEIGHT - 2);
     }
  else
  {
     LBox.CursorPos = 0;
     LBox.top       = 0;
  }

  OpenWindow(&DriveBox);
  control = ControlWindow(&DriveBox);
  CloseWindow();
        
  PopHelpIndex();
  
  if ((control == OKBUTTON) || (control == DRIVEBOX)) 
     return DrvBuffer[LBox.top+LBox.CursorPos];
  
  return 0;
}
示例#25
0
void KeyCallback(int aIndex, int aState)
{
	if (aState == GLFW_PRESS)
	{
		input.OnPress(Input::TYPE_KEYBOARD, 0, aIndex);

		switch (aIndex)
		{
		case GLFW_KEY_F4:
			if (glfwGetKey(GLFW_KEY_LALT) || glfwGetKey(GLFW_KEY_RALT))
				setgamestate = STATE_QUIT;
			break;
		case GLFW_KEY_ENTER:
			if (glfwGetKey(GLFW_KEY_LALT) || glfwGetKey(GLFW_KEY_RALT))
			{
				CloseWindow();
				SCREEN_FULLSCREEN = !SCREEN_FULLSCREEN;
				OpenWindow();
			}
			break;
		case GLFW_KEY_ESC:
			if (curgamestate == STATE_PLAY)
			{
				if (escape)
					EscapeMenuExit();
				else
					EscapeMenuEnter();
			}
			break;
		case 'P':
			if (glfwGetKey(GLFW_KEY_LSHIFT) || glfwGetKey(GLFW_KEY_RSHIFT))
			{
				paused = true;
				singlestep = true;
			}
			else
			{
				paused = !paused;
			}

			if (paused)
				Pause();
			else
				Resume();
			break;
		}
	}
	else
	{
		input.OnRelease(Input::TYPE_KEYBOARD, 0, aIndex);
	}
}
示例#26
0
文件: dstar2.c 项目: meesokim/z88dk
void main()
{
	OpenWindow(); /* Open a window (if needed) */

	Level = (STARTLEV-1);
	SetupLevel(); /* Display the first level */

	/* Loop keyhandler till you finished the game */
	while (CheckNotFinished())
	  Gamekeys();

	MyExit();     /* Close the window (if needed) */
}
示例#27
0
void ShowEnvInfo()
{
	char *str;
	SetColor(LIGHTWHITE);
	SetBackColor(WHITE);
	OpenWindow(14,1,3,76);
	SetColor(LIGHTGREEN);
	Print_At(14,4," DOS/32A Environment String ");
	SetColor(LIGHTWHITE);
	str=getenv("DOS32A");
	if(str==NULL) Print_At(15,3,"(Not Defined)");
	else Print_At(15,3,"DOS32A=%.74s",str);
}
示例#28
0
void LayoutDesigner::Execute() {
//	frame.SetRect(100, 100, 700, 500);
#ifndef flagIDERW
	LoadFromFile(*this);
#endif
	OpenWindow();
	frame.Run();
#ifndef flagIDERW
	StoreToFile(*this);
#endif
	if(!alias_map.Save(alias_map_file))
		Exclamation(NFormat("Error updating alias file [* \1%s\1].", alias_map_file));
}
示例#29
0
文件: MSGBXS.C 项目: FDOS/defrag
static int MessageBox(char* msg, int btncount, char** buttons,
                      int forcolor, int backcolor,
                      int btnforc, int btnbackc, int btnhighc,
                      char* caption)
{
    int slen, dwidth, btnarea, dialog_x, text_x, i, btn_x, result;
    
    /* Calculate dialog width. */
    slen     = strlen(msg);
    btnarea  = ((btncount-1) * (BUTTON_LENGTH+2)) + BUTTON_LENGTH+1;
    dwidth   = max(btnarea, slen) + 4;
    dialog_x = (MAX_X / 2) - (dwidth / 2);
    
    GenericMsgBxs.caption       = caption;
    GenericMsgBxs.x             = dialog_x;
    GenericMsgBxs.xlen          = dwidth;
    GenericMsgBxs.SurfaceColor  = backcolor;
    GenericMsgBxs.FrameColor    = forcolor;
    GenericMsgBxs.AmofControls  = btncount+1;

    /* Put the text in the dialog. */
    text_x = (slen > btnarea)
           ? dialog_x + 2
           : dialog_x + ((btnarea / 2) - (slen / 2)) + 2;
    
    Controls[0] = CreateLabel(msg, forcolor, backcolor, text_x, TEXT_Y);

    /* Put the buttons on the screen. */
    btn_x = dialog_x + (dwidth / 2) - (btnarea / 2);
    
    for (i = 0; i < btncount; i++) 
    {
        CmdButtons[i].caption   = buttons[i];
        CmdButtons[i].highcolor = btnhighc;

        Controls[i+1] = CreateCommandButton(&CmdButtons[i], 
                                            btnforc, btnbackc,
                                            btn_x, BUTTON_Y,
                                            FALSE, FALSE,
                                            FALSE);
        
        btn_x += BUTTON_LENGTH + 2;
    }

    OpenWindow(&GenericMsgBxs);
    result = ControlWindow(&GenericMsgBxs);
    CloseWindow();

    return result;
}
示例#30
0
int
nsNativeViewerApp::Run()
{
  OpenWindow();
  // XXX mAppShell can be set to NULL while mAppShell->Run() is running
  // because nsViewerApp::Exit() is called.  I don't know what should
  // happen, but this is a workaround that neither crashes nor leaks.
  // See <URL: http://bugzilla.mozilla.org/show_bug.cgi?id=28557 >
  nsIAppShell* theAppShell = mAppShell;
  NS_ADDREF(theAppShell);
  theAppShell->Run();
  NS_RELEASE(theAppShell);
  return 0;
}