コード例 #1
0
ファイル: ChestEntity.cpp プロジェクト: ChriPiv/MCServer
void cChestEntity::UsedBy(cPlayer * a_Player)
{
	// If the window is not created, open it anew:
	cWindow * Window = GetWindow();
	if (Window == NULL)
	{
		OpenNewWindow();
		Window = GetWindow();
	}
	
	// Open the window for the player:
	if (Window != NULL)
	{
		if (a_Player->GetWindow() != Window)
		{
			a_Player->OpenWindow(Window);
		}
	}

	// This is rather a hack
	// Instead of marking the chunk as dirty upon chest contents change, we mark it dirty now
	// We cannot properly detect contents change, but such a change doesn't happen without a player opening the chest first.
	// The few false positives aren't much to worry about
	int ChunkX, ChunkZ;
	cChunkDef::BlockToChunk(m_PosX, m_PosZ, ChunkX, ChunkZ);
	m_World->MarkChunkDirty(ChunkX, ChunkZ, true);
}
コード例 #2
0
ファイル: EnderChestEntity.cpp プロジェクト: ChriPiv/MCServer
void cEnderChestEntity::UsedBy(cPlayer * a_Player)
{
	// If the window is not created, open it anew:
	cWindow * Window = GetWindow();
	if (Window == NULL)
	{
		OpenNewWindow();
		Window = GetWindow();
	}
	
	// Open the window for the player:
	if (Window != NULL)
	{
		if (a_Player->GetWindow() != Window)
		{
			a_Player->OpenWindow(Window);
		}
	}
}
コード例 #3
0
ファイル: Minecart.cpp プロジェクト: gjzskyland/cuberite
void cMinecartWithChest::OnRightClicked(cPlayer & a_Player)
{
	// If the window is not created, open it anew:
	cWindow * Window = GetWindow();
	if (Window == nullptr)
	{
		OpenNewWindow();
		Window = GetWindow();
	}

	// Open the window for the player:
	if (Window != nullptr)
	{
		if (a_Player.GetWindow() != Window)
		{
			a_Player.OpenWindow(Window);
		}
	}
}
コード例 #4
0
ファイル: mainwindow.cpp プロジェクト: huellif/svgb2svg
void MainWindow::createMyMenu()
{
    menu_ClearAction = new QAction("Show a SVG(B)", this);
    menuBar()->addAction(menu_ClearAction);
    connect(menu_ClearAction, SIGNAL(triggered()), this, SLOT(OpenNewWindow()));


    menu_ClearAction = new QAction("Clear", this);
    menuBar()->addAction(menu_ClearAction);
    connect(menu_ClearAction, SIGNAL(triggered()), this, SLOT(ClearAction()));

    menu_VersionAction = new QAction("About", this);
    menuBar()->addAction(menu_VersionAction);
    connect(menu_VersionAction, SIGNAL(triggered()), this, SLOT(VersionAction()));

    menu_exitAction = new QAction("Exit", this);
    menuBar()->addAction(menu_exitAction);
    connect(menu_exitAction, SIGNAL(triggered()), this, SLOT(close()));

}
コード例 #5
0
ファイル: ArgusWindow.cpp プロジェクト: cjpl/rome
//______________________________________________________________________________
Bool_t ArgusWindow::ProcessMessage(Long_t msg, Long_t param1, Long_t /*param2*/)
{
   ArgusTab    *tab       = 0;

//   cout << "ArgusWindow::ProcessMessage " << GET_MSG(msg) << " " << GET_SUBMSG(msg) << " " << param1 << endl;

   // Process messages coming from widgets associated with the dialog.  
   switch (GET_MSG(msg)) {
   case kC_COMMAND:    
      switch (GET_SUBMSG(msg)) {
      case kCM_MENU:
         tab  = GetTabObjectAt(fCurrentTabIndex);
         tab->BaseMenuClicked(0, param1);
         switch (param1) {
         case M_FILE_NEW_WINDOW:
            if (!OpenNewWindow(fCurrentTabIndex)) {
               return kFALSE;
            }
            break;
         case M_FILE_EXIT:
            CloseWindow();
            break;
         case M_FILE_CONTROLLER:
            if (fController->IsHidden()) {
               fController->ShowContainer();
            }
            break;
         default:
            ProcessMessageNetFolder(param1);
            break;
         }
         break;
      case kCM_BUTTON:
         break;
      case kCM_LISTBOX:
         break;      
      case kCM_TAB:
         if (param1 != fCurrentTabID) {
            ChangeTab(GetTabObjectIndex(param1));
            break;
         }
      }
      break;
   case kC_DOCK:
      switch (GET_SUBMSG(msg)) {
         // hide/show run# and event#
      case kDOCK_DOCK:
         ((TGCompositeFrame*)(fRunNumber->GetParent()->GetParent()))->HideFrame((TGFrame*)(fRunNumber->GetParent()));
         ((TGCompositeFrame*)(fEventNumber->GetParent()->GetParent()))->HideFrame((TGFrame*)(fEventNumber->GetParent()));
         break;
      case kDOCK_UNDOCK:
         ((TGCompositeFrame*)(fRunNumber->GetParent()->GetParent()))->ShowFrame((TGFrame*)(fRunNumber->GetParent()));
         ((TGCompositeFrame*)(fEventNumber->GetParent()->GetParent()))->ShowFrame((TGFrame*)(fEventNumber->GetParent()));
         break;
      case kDOCK_SHOW:
         ((TGCompositeFrame*)(fRunNumber->GetParent()->GetParent()))->HideFrame((TGFrame*)(fRunNumber->GetParent()));
         ((TGCompositeFrame*)(fEventNumber->GetParent()->GetParent()))->HideFrame((TGFrame*)(fEventNumber->GetParent()));
         break;
      case kDOCK_HIDE:
         ((TGCompositeFrame*)(fRunNumber->GetParent()->GetParent()))->ShowFrame((TGFrame*)(fRunNumber->GetParent()));
         ((TGCompositeFrame*)(fEventNumber->GetParent()->GetParent()))->ShowFrame((TGFrame*)(fEventNumber->GetParent()));
         break;
      }
      break;
   }
   return kTRUE;
}
コード例 #6
0
ファイル: ArgusWindow.cpp プロジェクト: cjpl/rome
//______________________________________________________________________________
void ArgusWindow::TriggerEventHandler()
{
   while (!IsMapped()) {
      return;
   }
   int          iSub;
   const Int_t  nSub = fSubWindows->GetEntriesFast();
   Int_t        tabLevel = 0;
   const Int_t  nTabs = fTabObjects->GetEntriesFast();
   Int_t        iTab;
   Int_t       *tabStack = new Int_t[nTabs];

   char         str[64];
   UInt_t       year, mon, day, hour, min, sec;
   const char   month[12][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
                                 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };

   const Bool_t iUTC = (fTimeZone == "utc");


   fWatchAll.Start(false);
   if (fController) {
      fController->Update();
   }

   static Bool_t firstCall = kTRUE;
   ArgusTab *tab;
   if (firstCall) {
      for (iTab = 0; iTab < nTabs; iTab++) {
         tab = GetTabObjectAt(iTab);
         if (tab && tab->IsNewWindow()) {
            OpenNewWindow(iTab);
         }
      }
      firstCall = kFALSE;
   }

   static Bool_t screenShot = kFALSE;
   if (fTabWindow) {
#if (ROOT_VERSION_CODE < ROOT_VERSION(5,27,6))
      ULong_t   currentTime = gROME->Now();
#else
      ULong64_t currentTime = gROME->Now();
#endif
      if(currentTime - fScreenShotLastTime > fScreenShotPeriod *1000 || !fScreenShotPeriod) {
         screenShot = kTRUE;
         fScreenShotLastTime = currentTime;
      }
   }

   // call event handlers for sub-windows
   for (iSub = 0; iSub < nSub; iSub++) {
      if (IsSubWindowRunningAt(iSub)) {
         static_cast<ArgusWindow*>(fSubWindows->At(iSub))->TriggerEventHandler();
      }
   }

   if (screenShot && fCurrentTabIndex >= 0) {
      if (GetTabObjectAt(fCurrentTabIndex)->GetScreenShotNameLength()) {
         RaiseWindow();
      }
   }

   SetStatus(0, "", 0);

   if (!gROME->IsStandAloneARGUS()) {
      // run#
#if defined(R__UNIX)
      sprintf(str, "%7lld", gROME->GetCurrentRunNumber());
#else
      sprintf(str, "%7I64d", gROME->GetCurrentRunNumber());
#endif
      fRunNumber  ->SetText(str);

      // event#
#if defined(R__UNIX)
      sprintf(str, "%7lld", gROME->GetCurrentEventNumber());
#else
      sprintf(str, "%7I64d", gROME->GetCurrentEventNumber());
#endif
      fEventNumber->SetText(str);

      // date and time
      TTimeStamp timeStamp(gROME->GetActiveDAQ()->GetTimeStamp(), 0);
      timeStamp.GetDate(iUTC, 0, &year, &mon, &day);
      timeStamp.GetTime(iUTC, 0, &hour, &min, &sec);

      sprintf(str, "%4d-%3s-%02d", year, month[mon-1], day);
      fYearMonDay->SetText(str);

      sprintf(str, "%02d:%02d:%02d", hour, min, sec);
      fHourMinSec->SetText(str);
   }

   // push parent tab's index to stack until reaching the top-level tab
   tabStack[tabLevel] = fCurrentTabIndex;
   while (tabLevel+1<nTabs && (tabStack[tabLevel+1]=fParentIndex[tabStack[tabLevel]]) != -1) {
      tabLevel++;
   }

   // call ArgusEventHandler() thru ancestry to descendant
   for ( ; tabLevel>=0; tabLevel--) {
      GetTabObjectAt(tabStack[tabLevel])->ArgusEventHandler();
   }
   delete [] tabStack;

   // call Layout() method to force updating of size of labels in the infoFrame, including UserInfoFrame
   ((TGCompositeFrame*)(fUserInfoFrame->GetParent()))->Layout();

   // clear requests
   ClearEventHandlingRequest();
   ClearEventHandlingForced();

   fWatchAll.Stop();
   SetStatus(2, "", 0);

   if (screenShot) {
      if (GetTabObjectAt(fCurrentTabIndex)->GetScreenShotNameLength()) {
         GetTabObjectAt(fCurrentTabIndex)->ScreenShot();
      }
   }

   if (fTabWindow) {
      screenShot = kFALSE;
   }

}
コード例 #7
0
HRESULT STDMETHODCALLTYPE CImageViewerPlugin::OnExecute(BSTR sFilePath)
{
	// The OnExecute method is invoked whenever Shareaza needs to execute (open) a file.  This can
	// be from the library, from the downloads list, the uploads list, etc.  The path of the file is
	// provided as an argument.  Return S_OK if you have handled the execution, or S_FALSE if Shareaza
	// should keep looking for someone to handle it (and potentially fall back to its internal handler).
	// Failure codes (E_*) are interpreted as an inability to open the file, and an error message will
	// be displayed.  So don't return failures (E_*) unless you should be able to open the file, but
	// can't.  S_FALSE is the correct code if you don't want to open this kind of file.
	
	// String conversion macros
	
	USES_CONVERSION;
	
	// Convert the BSTR to a LPCTSTR, and locate the file extension
	
	LPCTSTR pszFilePath = OLE2T( sFilePath );
	LPCTSTR pszFileType = _tcsrchr( pszFilePath, '.' );
	
	// If there was no file extension, this file is not for us
	
	if ( pszFileType == NULL ) return S_FALSE;
	
	// This image viewer plugin attempts to decide whether or not it should open the file
	// based on whether or not there is an ImageService plugin available for the image
	// file type.  HOWEVER -- there are ImageServices available for some video types, too
	// (they produce a thumbnail) -- but we DON'T want to open videos here -- they should
	// be left for the media player.
	//
	// SO, we check some common video file types here, and return S_FALSE if we get a match.
	
	if ( lstrcmpi( pszFileType, _T(".avi") ) == 0 ) return S_FALSE;
	if ( lstrcmpi( pszFileType, _T(".asf") ) == 0 ) return S_FALSE;
	if ( lstrcmpi( pszFileType, _T(".div") ) == 0 ) return S_FALSE;
	if ( lstrcmpi( pszFileType, _T(".divx") ) == 0 ) return S_FALSE;
	if ( lstrcmpi( pszFileType, _T(".mpg") ) == 0 ) return S_FALSE;
	if ( lstrcmpi( pszFileType, _T(".mpeg") ) == 0 ) return S_FALSE;
	if ( lstrcmpi( pszFileType, _T(".nsv") ) == 0 ) return S_FALSE;
	if ( lstrcmpi( pszFileType, _T(".mov") ) == 0 ) return S_FALSE;
	if ( lstrcmpi( pszFileType, _T(".ogm") ) == 0 ) return S_FALSE;
	if ( lstrcmpi( pszFileType, _T(".wmv") ) == 0 ) return S_FALSE;
	
	// Okay, so we're assuming now that it's not a video file.  The next (and primary) step
	// is to check if there is an ImageService plugin available for this file type.  This is
	// done by checking a registry key:
	
	if ( lstrcmpi( pszFileType, _T(".partial") ) != 0 )
	{
		DWORD dwCount = 128;
		TCHAR szValue[128];
		CRegKey pReg;

		if ( pReg.Open( HKEY_CURRENT_USER,
			_T("SOFTWARE\\Shareaza\\Shareaza\\Plugins\\ImageService") ) != ERROR_SUCCESS )
			return S_FALSE;

		if ( pReg.QueryValue( pszFileType, NULL, szValue, &dwCount ) != ERROR_SUCCESS )
			return S_FALSE;

		pReg.Close();
	}

	// If we made it to this point, there was indeed an ImageService plugin for the file type,
	// so we should have a go at opening it.  Delegate to our OpenNewWindow() function to
	// select or create the image window.
	
	OpenNewWindow( pszFilePath );
	
	// Return S_OK, because we have successfully opened this file (we hope).
	
	return S_OK;
}