Example #1
0
void		monitor_graphic(t_graphic mn, t_data_serv ds, t_player p)
{
  t_iter	*it;
  t_iter	*it2;
  t_map		map;

  map = get_map(NULL);
  msz(mn, map->size_x, map->size_y);
  sgt(mn, ds->t);
  bct_all(mn, map);
  tna(mn, ds->teams);
  it = ds->player->head;
  while (it)
    {
      if ((*(t_player*)it->data)->welcome)
	  pnw(mn, (*(t_player*)it->data));
      it = it->next;
    }
  it2 = ds->egg->head;
  while (it2)
    {
      enw(mn, ((t_egg)it2->data)->id,
	  p->lvl, &((t_egg)it2->data)->fetus->pos);
      it2 = it2->next;
    }
}
Example #2
0
static int	handle_graphic_(t_ctrl *c, t_jm_list *cli)
{
  ((t_handler*)cli->data)->t = GFX;
  ((t_handler*)cli->data)->handler = handle_gfx;
  msz(c, cli);
  sgt(c, cli);
  mct(c, cli);
  tna(c, cli);
  list_eggs_and_players(c, cli);
  return (1);
}
Example #3
0
void RelativeMaxSize::set(PropertyReceiver* receiver, const String& value)
{
	CEGUI::Size msz(PropertyHelper::stringToSize(value));

	if (static_cast<Window*>(receiver)->getMetricsMode() == Absolute)
	{
		CEGUI::Size dsz(System::getSingleton().getRenderer()->getSize());

		msz.d_width	 *= dsz.d_width;
		msz.d_height *= dsz.d_height;
	}

	static_cast<Window*>(receiver)->setMaximumSize(msz);
}
Example #4
0
String RelativeMaxSize::get(const PropertyReceiver* receiver) const
{
	CEGUI::Size msz(static_cast<const Window*>(receiver)->getMaximumSize());

	if (static_cast<const Window*>(receiver)->getMetricsMode() == Absolute)
	{
		CEGUI::Size dsz(System::getSingleton().getRenderer()->getSize());

		msz.d_width	 /= dsz.d_width;
		msz.d_height /= dsz.d_height;
	}

	return PropertyHelper::sizeToString(msz);
}
Example #5
0
void			gfx_connection(t_env *e, int fd)
{
	t_iterator		iter_t;
	t_team			*t;

	e->fds[fd].type = FD_GFX_CLIENT;
	ft_lst_pushend(e->gfx_lst, gfx_new(fd));
	printf("Client #%d: Connected as GFX\n", fd);
	msz(e, fd);
	sgt(e, fd);
	mct(e, fd);
	tna(e, fd);
	iter_t = NULL;
	while ((t = (t_team *)ft_lst_iter_next_content(e->team, &iter_t)))
		notify_bot_for_connected_gfx(e, fd, t);
}
 void putNext(const void *prev)
 {
     if (nextPut) return;
     nextPut = true;
     if (global && !lastNode())
     {
         CMessageBuffer msg;
         msg.append(count);
         if (prev)
         {
             CMemoryRowSerializer msz(msg);
             ::queryRowSerializer(input)->serialize(msz, (const byte *)prev);
         }
         if (!queryJobChannel().queryJobComm().send(msg, queryJobChannel().queryMyRank()+1, mpTag)) // to next
             return;
     }
 }
    void process()
    {
        start();
        processed = 0;

        processed = THORDATALINK_STARTED;

        OwnedConstThorRow row = inputStream->ungroupedNextRow();
        CMessageBuffer mb;
        DelayedSizeMarker sizeMark(mb);
        if (row)
        {
            CMemoryRowSerializer msz(mb);
            ::queryRowSerializer(input)->serialize(msz,(const byte *)row.get());
            sizeMark.write();
            processed++;
        }
        queryJobChannel().queryJobComm().send(mb, 0, masterMpTag);
    }
Example #8
0
    void process()
    {
        processed = 0;

        input = inputs.item(0);
        startInput(input);

        processed = THORDATALINK_STARTED;

        OwnedConstThorRow row = input->ungroupedNextRow();
        CMessageBuffer mb;
        size32_t lenpos = mb.length(); // its 0 really
        mb.append((size32_t)0);
        if (row) {
            CMemoryRowSerializer msz(mb);
            ::queryRowSerializer(input)->serialize(msz,(const byte *)row.get());
            size32_t sz = mb.length()-lenpos-sizeof(size32_t);
            mb.writeDirect(lenpos,sizeof(size32_t),&sz);
            processed++;
        }
        container.queryJob().queryJobComm().send(mb, 0, masterMpTag);
    }
Example #9
0
//
// Read the toolbar states
//
void ToolManager::ReadConfig()
{
   wxString oldpath = gPrefs->GetPath();
   wxArrayInt unordered[ DockCount ];
   bool show[ ToolBarCount ];
   int width[ ToolBarCount ];
   int height[ ToolBarCount ];
   int x, y;
   int dock, ndx;
   bool someFound { false };

#if defined(__WXMAC__)
   // Disable window animation
   wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 );
#endif

   // Change to the bar root
   gPrefs->SetPath( wxT("/GUI/ToolBars") );

   ToolBarConfiguration::Legacy topLegacy, botLegacy;

   // Load and apply settings for each bar
   for( ndx = 0; ndx < ToolBarCount; ndx++ )
   {
      ToolBar *bar = mBars[ ndx ].get();
      //wxPoint Center = mParent->GetPosition() + (mParent->GetSize() * 0.33);
      //wxPoint Center( 
      //   wxSystemSettings::GetMetric( wxSYS_SCREEN_X ) /2 ,
      //   wxSystemSettings::GetMetric( wxSYS_SCREEN_Y ) /2 );

      // Change to the bar subkey
      gPrefs->SetPath( bar->GetSection() );

      bool bShownByDefault = true;
      int defaultDock = TopDockID;
      
      if( ndx == SelectionBarID )
         defaultDock = BotDockID;
      if( ndx == MeterBarID )
         bShownByDefault = false;
      if( ndx == ScrubbingBarID )
         bShownByDefault = false;

#ifdef EXPERIMENTAL_SPECTRAL_EDITING
      if( ndx == SpectralSelectionBarID ){
         defaultDock = BotDockID;
         bShownByDefault = false; // Only show if asked for.  
      }
#endif

      // Read in all the settings
      gPrefs->Read( wxT("Dock"), &dock, -1);
      const bool found = (dock != -1);
      if (found)
         someFound = true;
      if (!found)
         dock = defaultDock;
      
      ToolDock *d;
      ToolBarConfiguration::Legacy *pLegacy;
      switch(dock)
      {
         case TopDockID: d = mTopDock; pLegacy = &topLegacy; break;
         case BotDockID: d = mBotDock; pLegacy = &botLegacy;  break;
         default:        d = nullptr; pLegacy = nullptr; break;
      }

      bool ordered = ToolBarConfiguration::Read
         (d ? &d->GetConfiguration() : nullptr,
          pLegacy,
          bar, show[ ndx ], bShownByDefault)
      && found;

      gPrefs->Read( wxT("X"), &x, -1 );
      gPrefs->Read( wxT("Y"), &y, -1 );
      gPrefs->Read( wxT("W"), &width[ ndx ], -1 );
      gPrefs->Read( wxT("H"), &height[ ndx ], -1 );

      bar->SetVisible( show[ ndx ] );

      // Docked or floating?
      if( dock )
      {
         // Default to top dock if the ID isn't valid
         if( dock < NoDockID || dock > DockCount ) {
            dock = TopDockID;
         }

         // Create the bar with the correct parent
         if( dock == TopDockID )
         {
            bar->Create( mTopDock );
         }
         else
         {
            bar->Create( mBotDock );
         }

         // Set the width and height
         if( width[ ndx ] != -1 && height[ ndx ] != -1 )
         {
            wxSize sz( width[ ndx ], height[ ndx ] );
            bar->SetSize( sz );
         }

#ifdef EXPERIMENTAL_SYNC_LOCK
         // Set the width
         if( width[ ndx ] >= bar->GetSize().x )
         {
            wxSize sz( width[ ndx ], bar->GetSize().y );
            bar->SetSize( sz );
            bar->Layout();
         }
#else
         // note that this section is here because if you had been using sync-lock and now you aren't,
         // the space for the extra button is stored in audacity.cfg, and so you get an extra space
         // in the EditToolbar.
         // It is needed so that the meterToolbar size gets preserved.
         // Longer-term we should find a better fix for this.
         wxString thisBar = bar->GetSection();
         if( thisBar != wxT("Edit"))
         {
            // Set the width
            if( width[ ndx ] >= bar->GetSize().x )
            {
               wxSize sz( width[ ndx ], bar->GetSize().y );
               bar->SetSize( sz );
               bar->Layout();
            }
         }
#endif

         if (!ordered)
         {
            // These must go at the end
            unordered[ dock - 1 ].Add( ndx );
         }
      }
      else
      {
         // Create the bar (with the top dock being temporary parent)
         bar->Create( mTopDock );

         // Construct a NEW floater
         wxASSERT(mParent);
         ToolFrame *f = safenew ToolFrame( mParent, this, bar, wxPoint( x, y ) );

         // Set the width and height
         if( width[ ndx ] != -1 && height[ ndx ] != -1 )
         {
            wxSize sz( width[ ndx ], height[ ndx ] );
            f->SetSizeHints( sz );
            f->SetSize( sz );
            f->Layout();
            if( (x!=-1) && (y!=-1) )
               bar->SetPositioned();
         }

         // Required on Linux Xfce
         wxSize msz(width[ndx],height[ndx]-1);
         bar->GetParent()->SetMinSize(msz);

         // Inform toolbar of change
         bar->SetDocked( NULL, false );

         // Show or hide it
         Expose( ndx, show[ ndx ] );
      }

      // Change back to the bar root
      //gPrefs->SetPath( wxT("..") );  <-- Causes a warning...
      // May or may not have gone into a subdirectory,
      // so use an absolute path.
      gPrefs->SetPath( wxT("/GUI/ToolBars") );
   }

   mTopDock->GetConfiguration().PostRead(topLegacy);
   mBotDock->GetConfiguration().PostRead(botLegacy);

   // Add all toolbars to their target dock
   for( dock = 0; dock < DockCount; dock++ )
   {
      ToolDock *d = ( dock + 1 == TopDockID ? mTopDock : mBotDock );

      d->LoadConfig();

      // Add all unordered toolbars
      bool deviceWasPositioned = false;
      for( int ord = 0; ord < (int) unordered[ dock ].GetCount(); ord++ )
      {
         ToolBar *t = mBars[ unordered[ dock ][ ord ] ].get();

         if (deviceWasPositioned &&
             t->GetType() == DeviceBarID)
            continue;

         if (someFound &&
             t->GetType() == ScrubbingBarID) {
            // Special case code to put the NEW scrubbing toolbar where we
            // want it, when audacity.cfg is present from an older version
            ToolBar *lastRoot {};

            // Change from the ideal configuration to the constrained one,
            // just as when dragging and dropping
            ToolBarConfiguration dummy;
            mTopDock->WrapConfiguration(dummy);

            // Start a NEW row with just the scrubbing toolbar
            auto &configuration = mTopDock->GetConfiguration();
            for (const auto place : configuration)
               if (place.position.rightOf == nullptr)
                  lastRoot = place.pTree->pBar;
            ToolBarConfiguration::Position position {
               nullptr, lastRoot, false
            };
            mTopDock->Dock(t, false, position);

            // Reposition the device toolbar, if it was docked above,
            // right of scrubbing
            const auto deviceToolBar = mBars[ DeviceBarID ].get();
            if (deviceToolBar->GetDock() == mTopDock) {
               deviceToolBar->GetDock()->Undock(deviceToolBar);
               position = { t, nullptr };
               mTopDock->Dock(deviceToolBar, false, position);

               // Remember not to place the device toolbar again
               deviceWasPositioned = true;
            }
            Expose( t->GetId(), show[ t->GetId() ] );
            continue;
         }

         // Dock it
         d->Dock( t, false );

         // Show or hide the bar
         Expose( t->GetId(), show[ t->GetId() ] );
      }
   }

   // Restore original config path
   gPrefs->SetPath( oldpath );

#if defined(__WXMAC__)
   // Reinstate original transition
   wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, mTransition );
#endif

   if (!someFound)
      Reset();
}