示例#1
0
void wxMenuBar::Refresh()
{
    if ( IsFrozen() )
        return;

    wxCHECK_RET( IsAttached(), wxT("can't refresh unattached menubar") );

#if defined(WINCE_WITHOUT_COMMANDBAR)
    if (GetToolBar())
    {
        CommandBar_DrawMenuBar((HWND) GetToolBar()->GetHWND(), 0);
    }
#elif defined(WINCE_WITH_COMMANDBAR)
    if (m_commandBar)
        DrawMenuBar((HWND) m_commandBar);
#else
    DrawMenuBar(GetHwndOf(GetFrame()));
#endif
}
示例#2
0
// Input: direction in ship's frame, doesn't need to be normalized
// Approximate positive angular velocity at match point
// Applies thrust directly
// old: returns whether it can reach that direction in this frame
// returns angle to target
double Ship::AIFaceDirection(const vector3d &dir, double av)
{
	double timeStep = Pi::game->GetTimeStep();
	double maxAccel = GetShipType().angThrust / GetAngularInertia();		// should probably be in stats anyway
	if (maxAccel <= 0.0) return 0.0;
	double frameAccel = maxAccel * timeStep;

	matrix4x4d rot; GetRotMatrix(rot);
	vector3d head = (dir * rot).Normalized();		// create desired object-space heading
	vector3d dav(0.0, 0.0, 0.0);	// desired angular velocity

	double ang = 0.0;
	if (head.z > -0.99999999)			
	{
		ang = acos (Clamp(-head.z, -1.0, 1.0));		// scalar angle from head to curhead
		double iangvel = av + sqrt (2.0 * maxAccel * ang);	// ideal angvel at current time

		double frameEndAV = iangvel - frameAccel;
		if (frameEndAV <= 0.0) iangvel = ang / timeStep;	// last frame discrete correction
		else iangvel = (iangvel + frameEndAV) * 0.5;		// discrete overshoot correction

		// Normalize (head.x, head.y) to give desired angvel direction
		if (head.z > 0.999999) head.x = 1.0;
		double head2dnorm = 1.0 / sqrt(head.x*head.x + head.y*head.y);		// NAN fix shouldn't be necessary if inputs are normalized
		dav.x = head.y * head2dnorm * iangvel;
		dav.y = -head.x * head2dnorm * iangvel;
	}
	vector3d cav = (GetAngVelocity() - GetFrame()->GetAngVelocity()) * rot;		// current obj-rel angvel
//	vector3d cav = GetAngVelocity() * rot;				// current obj-rel angvel
	vector3d diff = (dav - cav) / frameAccel;					// find diff between current & desired angvel

	// If the player is pressing a roll key, don't override roll.
	// XXX this really shouldn't be here. a better way would be to have a
	// field in Ship describing the wanted angvel adjustment from input. the
	// baseclass version in Ship would always be 0. the version in Player
	// would be constructed from user input. that adjustment could then be
	// considered by this method when computing the required change
	if (IsType(Object::PLAYER) && (KeyBindings::rollLeft.IsActive() || KeyBindings::rollRight.IsActive()))
		diff.z = m_angThrusters.z;
	SetAngThrusterState(diff);
	return ang;
}
示例#3
0
void SpaceStation::DoLawAndOrder()
{
	Sint64 fine, crimeBitset;
	Polit::GetCrime(&crimeBitset, &fine);
	bool isDocked = static_cast<Ship*>(Pi::player)->GetDockedWith() ? true : false;
	if (Pi::player->GetFlightState() != Ship::DOCKED
			&& m_numPoliceDocked
			&& (fine > 1000)
			&& (GetPositionRelTo(static_cast<Body*>(Pi::player)).Length() < 100000.0)) {
		int port = GetFreeDockingPort();
		if (port != -1) {
			m_numPoliceDocked--;
			// Make police ship intent on killing the player
			Ship *ship = new Ship(ShipType::LADYBIRD);
			ship->AIKill(Pi::player);
			ship->SetFrame(GetFrame());
			ship->SetDockedWith(this, port);
			Space::AddBody(ship);
			{ // blue and white thang
				ShipFlavour f;
				f.type = ShipType::LADYBIRD;
				strncpy(f.regid, "POLICE", 16);
				f.price = ship->GetFlavour()->price;
				LmrMaterial m;
				m.diffuse[0] = 0.0f; m.diffuse[1] = 0.0f; m.diffuse[2] = 1.0f; m.diffuse[3] = 1.0f;
				m.specular[0] = 0.0f; m.specular[1] = 0.0f; m.specular[2] = 1.0f; m.specular[3] = 1.0f;
				m.emissive[0] = 0.0f; m.emissive[1] = 0.0f; m.emissive[2] = 0.0f; m.emissive[3] = 0.0f;
				m.shininess = 50.0f;
				f.primaryColor = m;
				m.shininess = 0.0f;
				m.diffuse[0] = 1.0f; m.diffuse[1] = 1.0f; m.diffuse[2] = 1.0f; m.diffuse[3] = 1.0f;
				f.secondaryColor = m;
				ship->ResetFlavour(&f);
			}
			ship->m_equipment.Set(Equip::SLOT_LASER, 0, Equip::PULSECANNON_DUAL_1MW);
			ship->m_equipment.Add(Equip::SHIELD_GENERATOR);
			ship->m_equipment.Add(Equip::LASER_COOLING_BOOSTER);
			ship->m_equipment.Add(Equip::ATMOSPHERIC_SHIELDING);
			ship->UpdateMass();
		}
	}
}
示例#4
0
void DynamicBody::TimeStepUpdate(const float timeStep)
{
	if (m_enabled) {
		m_force += m_externalForce;

		m_oldOrient = m_orient;
		m_vel += double(timeStep) * m_force * (1.0 / m_mass);
		m_angVel += double(timeStep) * m_torque * (1.0 / m_angInertia);
		// angvel is always relative to non-rotating frame, so need to counter frame angvel
		vector3d consideredAngVel = m_angVel - GetFrame()->GetAngVelocity();
		
		vector3d pos = GetPosition();
		// applying angular velocity :-/
		{
			double len = consideredAngVel.Length();
			if (len > 1e-16) {
				vector3d rotAxis = consideredAngVel * (1.0 / len);
				matrix4x4d rotMatrix = matrix4x4d::RotateMatrix(len * timeStep,
						rotAxis.x, rotAxis.y, rotAxis.z);
				m_orient = rotMatrix * m_orient;
			}
		}
		m_oldAngDisplacement = consideredAngVel * timeStep;

		pos += m_vel * double(timeStep);
		m_orient[12] = pos.x;
		m_orient[13] = pos.y;
		m_orient[14] = pos.z;
		TriMeshUpdateLastPos(m_orient);

//printf("vel = %.1f,%.1f,%.1f, force = %.1f,%.1f,%.1f, external = %.1f,%.1f,%.1f\n",
//	m_vel.x, m_vel.y, m_vel.z, m_force.x, m_force.y, m_force.z,
//	m_externalForce.x, m_externalForce.y, m_externalForce.z);

		m_force = vector3d(0.0);
		m_torque = vector3d(0.0);
		CalcExternalForce();			// regenerate for new pos/vel
	} else {
		m_oldOrient = m_orient;
		m_oldAngDisplacement = vector3d(0.0);
	}
}
nsAccessible*
nsXULTreeAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY,
                                     EWhichChildAtPoint aWhichChild)
{
  nsIFrame *frame = GetFrame();
  if (!frame)
    return nsnull;

  nsPresContext *presContext = frame->PresContext();
  nsCOMPtr<nsIPresShell> presShell = presContext->PresShell();

  nsIFrame *rootFrame = presShell->GetRootFrame();
  NS_ENSURE_TRUE(rootFrame, nsnull);

  nsIntRect rootRect = rootFrame->GetScreenRectExternal();

  PRInt32 clientX = presContext->DevPixelsToIntCSSPixels(aX - rootRect.x);
  PRInt32 clientY = presContext->DevPixelsToIntCSSPixels(aY - rootRect.y);

  PRInt32 row = -1;
  nsCOMPtr<nsITreeColumn> column;
  nsCAutoString childEltUnused;
  mTree->GetCellAt(clientX, clientY, &row, getter_AddRefs(column),
                   childEltUnused);

  // If we failed to find tree cell for the given point then it might be
  // tree columns.
  if (row == -1 || !column)
    return nsAccessibleWrap::GetChildAtPoint(aX, aY, aWhichChild);

  nsAccessible *child = GetTreeItemAccessible(row);
  if (aWhichChild == eDeepestChild && child) {
    // Look for accessible cell for the found item accessible.
    nsRefPtr<nsXULTreeItemAccessibleBase> treeitem = do_QueryObject(child);

    nsAccessible *cell = treeitem->GetCellAccessible(column);
    if (cell)
      child = cell;
  }

  return child;
}
示例#6
0
NS_IMETHODIMP
nsMenuBoxObject::GetOpenedWithKey(bool* aOpenedWithKey)
{
  *aOpenedWithKey = PR_FALSE;

  nsIFrame* frame = GetFrame(PR_FALSE);
  if (!frame || frame->GetType() != nsGkAtoms::menuFrame)
    return NS_OK;

  frame = frame->GetParent();
  while (frame) {
    if (frame->GetType() == nsGkAtoms::menuBarFrame) {
      *aOpenedWithKey = (static_cast<nsMenuBarFrame *>(frame))->IsActiveByKeyboard();
      return NS_OK;
    }
    frame = frame->GetParent();
  }

  return NS_OK;
}
示例#7
0
void Missile::Explode()
{
	Pi::game->GetSpace()->KillBody(this);

	const double damageRadius = 200.0;
	const double kgDamage = 10000.0;

	for (Space::BodyIterator i = Pi::game->GetSpace()->BodiesBegin(); i != Pi::game->GetSpace()->BodiesEnd(); ++i) {
		if ((*i)->GetFrame() != GetFrame()) continue;
		double dist = ((*i)->GetPosition() - GetPosition()).Length();
		if (dist < damageRadius) {
			// linear damage decay with distance
			(*i)->OnDamage(m_owner, kgDamage * (damageRadius - dist) / damageRadius);
			if ((*i)->IsType(Object::SHIP))
				Pi::luaOnShipHit->Queue(dynamic_cast<Ship*>(*i), m_owner);
		}
	}

	Sfx::Add(this, Sfx::TYPE_EXPLOSION);
}
/**
  * Our action name is the reverse of our state: 
  *     if we are closed -> open is our name.
  *     if we are open -> closed is our name.
  * Uses the frame to get the state, updated on every click
  */
NS_IMETHODIMP nsHTMLComboboxAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
{
  if (aIndex != nsHTMLComboboxAccessible::eAction_Click) {
    return NS_ERROR_INVALID_ARG;
  }
  nsIFrame *frame = GetFrame();
  if (!frame) {
    return NS_ERROR_FAILURE;
  }
  nsIComboboxControlFrame *comboFrame = do_QueryFrame(frame);
  if (!comboFrame) {
    return NS_ERROR_FAILURE;
  }
  if (comboFrame->IsDroppedDown())
    aName.AssignLiteral("close"); 
  else
    aName.AssignLiteral("open"); 

  return NS_OK;
}
示例#9
0
NS_IMETHODIMP
nsAccessNode::ScrollTo(PRUint32 aScrollType)
{
  if (IsDefunct())
    return NS_ERROR_FAILURE;

  nsCOMPtr<nsIPresShell> shell(GetPresShell());
  NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE);

  nsIFrame *frame = GetFrame();
  NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);

  nsCOMPtr<nsIContent> content = frame->GetContent();
  NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);

  PRInt16 vPercent, hPercent;
  nsCoreUtils::ConvertScrollTypeToPercents(aScrollType, &vPercent, &hPercent);
  return shell->ScrollContentIntoView(content, vPercent, hPercent,
                                      nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
}
示例#10
0
// Clean up windows used for displaying the view.
bool TableView::OnClose(bool deleteWindow)
{
    if( !wxView::OnClose( deleteWindow ) )
        return false;

    Activate( false );

    if( deleteWindow )
    {
        GetFrame()->Destroy();
        SetFrame( NULL );
    }
    wxDocManager *manager = GetDocumentManager();
    if( manager->GetDocumentsVector().size() == 0 )
    {
        delete m_tb;
        m_tb = NULL;
    }
    return true;
}
示例#11
0
void FGearVR::GetCurrentPose(FQuat& CurrentHmdOrientation, FVector& CurrentHmdPosition, bool bUseOrienationForPlayerCamera, bool bUsePositionForPlayerCamera)
{
	check(IsInGameThread());

	auto frame = GetFrame();
	check(frame);

	if (bUseOrienationForPlayerCamera || bUsePositionForPlayerCamera)
	{
		// if this pose is going to be used for camera update then save it.
		// This matters only if bUpdateOnRT is OFF.
		frame->EyeRenderPose[0] = frame->CurEyeRenderPose[0];
		frame->EyeRenderPose[1] = frame->CurEyeRenderPose[1];
		frame->HeadPose = frame->CurSensorState.Predicted.Pose;
	}

	frame->PoseToOrientationAndPosition(frame->CurSensorState.Predicted.Pose, CurrentHmdOrientation, CurrentHmdPosition);
	//UE_LOG(LogHMD, Log, TEXT("CRPOSE: Pos %.3f %.3f %.3f"), CurrentHmdPosition.X, CurrentHmdPosition.Y, CurrentHmdPosition.Z);
	//UE_LOG(LogHMD, Log, TEXT("CRPOSE: Yaw %.3f Pitch %.3f Roll %.3f"), CurrentHmdOrientation.Rotator().Yaw, CurrentHmdOrientation.Rotator().Pitch, CurrentHmdOrientation.Rotator().Roll);
}
示例#12
0
void EnviroGUI::SetTerrainToGUI(vtTerrain *pTerrain)
{
	GetFrame()->SetTerrainToGUI(pTerrain);

	if (pTerrain)
	{
		if (m_pJFlyer)
		{
			float speed = pTerrain->GetParams().GetValueFloat(STR_NAVSPEED);
			m_pJFlyer->SetSpeed(speed);
		}
		ShowMapOverview(pTerrain->GetParams().GetValueBool(STR_OVERVIEW));
		ShowCompass(pTerrain->GetParams().GetValueBool(STR_COMPASS));
	}
	else
	{
		ShowMapOverview(false);
		ShowCompass(false);
	}
}
示例#13
0
void AudioView::Import()
{
  wxString fileName =
	wxFileSelector("Select an audio file...",
				   "", // Path
				   "", // Name
				   "", // Extension
				   "", // Wildcard
				   0, // Flags
				   GetFrame()); // Parent

  if (fileName == "")
    return;

  WaveTrack *left = 0;
  WaveTrack *right = 0;
  
  if (ImportWAV(fileName, &left, &right, &((AudioDoc *)GetDocument())->dirManager)) {

	if (left || right) {
	  SelectNone();
	}

    if (left) {
      GetTracks()->Add(left);
	  left->selected = true;
    }

    if (right) {
      GetTracks()->Add(right);
	  right->selected = true;
    }

    PushState();

    FixScrollbars();
    REDRAW(trackPanel);
    REDRAW(rulerPanel);
  }
  
}
示例#14
0
// What to do when a view is created. Creates actual
// windows for displaying the view.
bool TableView::OnCreate(wxDocument *doc, long flags)
{
    m_isCreated = false;
    if( !wxView::OnCreate( doc, flags ) )
        return false;
    wxDocMDIParentFrame *parent = wxStaticCast( wxTheApp->GetTopWindow(), wxDocMDIParentFrame );
    wxWindowList children = parent->GetChildren();
    bool found = false;
    int height = 0;
    for( wxWindowList::iterator it = children.begin(); it != children.end() && !found; it++ )
    {
        m_tb = wxDynamicCast( *it, wxToolBar );
        if( m_tb && m_tb->GetName() == "Second Toolbar" )
        {
            found = true;
            height = m_tb->GetSize().GetHeight();
        }
    }
    wxPoint start( 0, height );
    wxRect clientRect = parent->GetClientRect();
    clientRect.height -= height;
    m_frame = new wxDocMDIChildFrame( doc, this, parent, wxID_ANY, _T( "Database" ), /*wxDefaultPosition*/start, wxSize( clientRect.GetWidth(), clientRect.GetHeight() ) );
#ifdef __WXOSX__
    wxRect parentRect = parent->GetRect();
    wxSize parentClientSize = parent->GetClientSize();
    wxPoint pt;
    pt.x = -1;
    pt.y = parentRect.height - parentClientSize.GetHeight();
    m_frame->Move( pt.x, pt.y );
    m_tb = new wxToolBar( m_frame, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTB_FLAT | wxTB_TOP, "Second Toolbar" );
    wxBitmap tmp = wxBitmap( database_profile );
    m_tb->AddTool( wxID_DATABASEWINDOW, _( "Database Profile" ), wxBitmap( database_profile ), wxBitmap( database_profile ), wxITEM_NORMAL, _( "DB Profile" ), _( "Select database profile" ) );
    m_tb->AddTool( wxID_SELECTTABLE, _( "Select Table" ), wxBitmap( table ), wxBitmap( table ), wxITEM_NORMAL, _( "Select Table" ), _( "Select Table" ) );
    m_tb->AddTool( wxID_PROPERTIES, _( "Properties" ), wxBitmap( properties ), wxBitmap( properties ), wxITEM_NORMAL, _( "Properties" ), _( "Proerties" ) );
    m_tb->Realize();
    m_frame->SetToolBar( m_tb );
#endif
    wxASSERT( m_frame == GetFrame() );
    m_frame->Show();
    return true;
}
示例#15
0
bool TextEditView::OnClose(bool deleteWindow)
{
    if ( !wxView::OnClose(deleteWindow) )
        return false;

    Activate(false);

    if ( wxGetApp().GetMode() == MyApp::Mode_Single )
    {
        m_text->Clear();
    }
    else // not single window mode
    {
        if ( deleteWindow )
        {
            GetFrame()->Destroy();
            SetFrame(NULL);
        }
    }
    return true;
}
示例#16
0
bool ImageView::OnClose(bool deleteWindow)
{
    if ( !wxView::OnClose(deleteWindow) )
        return false;

    Activate(false);

    if ( wxGetApp().GetMode() == MyApp::Mode_Single )
    {
        GetDocument()->DeleteContents();
    }
    else // not single window mode
    {
        if ( deleteWindow )
        {
            GetFrame()->Destroy();
            SetFrame(NULL);
        }
    }
    return true;
}
NS_IMETHODIMP
nsMenuBoxObject::GetOpenedWithKey(bool* aOpenedWithKey)
{
  *aOpenedWithKey = false;

  nsMenuFrame* menuframe = do_QueryFrame(GetFrame(false));
  if (!menuframe)
    return NS_OK;

  nsIFrame* frame = menuframe->GetParent();
  while (frame) {
    nsMenuBarFrame* menubar = do_QueryFrame(frame);
    if (menubar) {
      *aOpenedWithKey = menubar->IsActiveByKeyboard();
      return NS_OK;
    }
    frame = frame->GetParent();
  }

  return NS_OK;
}
void SDIOAnalyzerResults::GenerateBubbleText( U64 frame_index, Channel& channel, DisplayBase display_base )
{
	ClearResultStrings();
	Frame frame = GetFrame( frame_index );

    // if this is command data
    if (frame.mType == FRAME_TYPE_CMD_DATA)
    {
        SdioCmd *tmp = SdioCmd::CreateSdioCmd(frame.mData1);
        string *s = tmp->getShortString();
		AddResultString( s->c_str() );
        delete s;
    }
    // else, this is data line data, should be partitioned into bytes
    else
    {
        char number_str[128] = {0};
        sprintf(number_str, "0x%02X", frame.mData1);
        AddResultString( number_str );
    }
}
示例#19
0
void sPerfMonGpu::Flip()
{
    if(Current)
    {
        //    Leave(&MasterSection);
        Current->FrequencyQuery->End(Adapter->ImmediateContext);
        PendingFrames.AddTail(Current);
        Current = 0;
        uint64 freq;
        while(PendingFrames.GetCount()>History)
            GetLastFrame(freq);
    }
    if(sPerfMonEnable)
    {
        Current = GetFrame();
        Current->Data.Clear();
        sASSERT(Current->Queries.IsEmpty());
        Current->FrequencyQuery->Begin(Adapter->ImmediateContext);
        //  Enter(&MasterSection);
    }
}
示例#20
0
void CPlasmaShot::Collide(const CGameObject *obj)
{ 
   // Object is the terrain 
   if(!obj)
   {
      // create terrain deformation
      CVector2f Center;
      Center.x = m_RenderObj.GetSphere()->Center.x;
      Center.y = m_RenderObj.GetSphere()->Center.z;
      g_pCurrLevel->DeformCircle(&Center, m_DamageRadius * 0.5f, m_Damage * -.05f);

      Color3F Color = { .6274f, .4274f, .1412f};
      g_pCurrLevel->ColorCircle(&Center, m_DamageRadius * 0.5f, &Color);

      CParticleSystem *dirt = g_ParticleManager.ObtainSystem();

      if(dirt)
         g_ParticleManager.CreateSystem(dirt, *(GetFrame(0)->GetPosition()), NULL, g_ParticleManager.DIRT, LOD_BOTH, 20.0f, 200.0f);
      
      // Kill the shot
      Die();
   }
   
   // Object is a game object
   else
   {
      if(m_ShotOwner == ENEMY_SHOT && obj->m_RadarType != RADAR_ENEMY && obj->m_RadarType != RADAR_PROJECTILE)
          Die();
      if(m_ShotOwner == PLAYER_SHOT && obj->GetType() != OBJ_PLAYER && obj->m_RadarType != RADAR_PROJECTILE)
      {
         Die();
         if(obj->m_RadarType == RADAR_ENEMY)
            g_Player.m_HitsWithPlasma++;
      }
      if(m_ShotOwner == FRIENDLY_SHOT && obj->GetType() != OBJ_FTURRET && obj->m_RadarType != RADAR_PROJECTILE)
      {
         Die();
      }
   } 
}
示例#21
0
// Input: direction in ship's frame, doesn't need to be normalized
// Approximate positive angular velocity at match point
// Applies thrust directly
// old: returns whether it can reach that direction in this frame
// returns angle to target
double Ship::AIFaceDirection(const vector3d &dir, double av)
{
	double timeStep = Pi::GetTimeStep();

	double maxAccel = GetShipType().angThrust / GetAngularInertia();		// should probably be in stats anyway
	if (maxAccel <= 0.0)
		// happens if no angular thrust is set for the model eg MISSILE_UNGUIDED
		return 0.0;
	double frameAccel = maxAccel * timeStep;

	matrix4x4d rot; GetRotMatrix(rot);

	vector3d head = (dir * rot).Normalized();		// create desired object-space heading
	vector3d dav(0.0, 0.0, 0.0);	// desired angular velocity

	double ang = 0.0;
	if (head.z > -0.99999999)			
	{
		ang = acos (Clamp(-head.z, -1.0, 1.0));		// scalar angle from head to curhead
		double iangvel = av + sqrt (2.0 * maxAccel * ang);	// ideal angvel at current time

		double frameEndAV = iangvel - frameAccel;
		if (frameEndAV <= 0.0) iangvel = ang / timeStep;	// last frame discrete correction
		else iangvel = (iangvel + frameEndAV) * 0.5;		// discrete overshoot correction

		// Normalize (head.x, head.y) to give desired angvel direction
		if (head.z > 0.9999) head.x = 1.0;
		double head2dnorm = 1.0 / sqrt(head.x*head.x + head.y*head.y);		// NAN fix shouldn't be necessary if inputs are normalized
		dav.x = head.y * head2dnorm * iangvel;
		dav.y = -head.x * head2dnorm * iangvel;
	}
	vector3d cav = (GetAngVelocity() - GetFrame()->GetAngVelocity()) * rot;		// current obj-rel angvel
//	vector3d cav = GetAngVelocity() * rot;				// current obj-rel angvel
	vector3d diff = (dav - cav) / frameAccel;					// find diff between current & desired angvel

	SetAngThrusterState(diff);
	return ang;
//if (diff.x*diff.x > 1.0 || diff.y*diff.y > 1.0 || diff.z*diff.z > 1.0) return false;
//	else return true;
}
示例#22
0
bool BrowserWindow::QuitRequested( void )
{
	if ( s_nWndCount == 1 ) {
		printf("Window closed\n" );
#warning Does not work!
		be_app_messenger.SendMessage( B_QUIT_REQUESTED );
	}
#if 0
	if ( m_pcSearchDialog != NULL ) {
		if ( m_pcSearchDialog->SafeLock() >= 0 ) {
			m_pcSearchDialog->PostMessage( M_QUIT );
			m_pcSearchDialog->Unlock();
			m_pcSearchDialog = NULL;
		}
	}
	if ( s_nWndCount == 1 ) {
		if ( m_bSaveSize ) {
			char*	pzHome = getenv( "HOME" );
	
			if ( NULL != pzHome ) {
				FILE*	hFile;
				char	zPath[ 256 ];
					
				strcpy( zPath, pzHome );
				strcat( zPath, "/config/abrowse.cfg" );
		
				hFile = fopen( zPath, "wb" );
		
				if ( hFile != NULL ) {
					Rect cFrame = GetFrame();
					fwrite( &cFrame, sizeof( cFrame ), 1, hFile );
					fclose( hFile );
				}
			}
		}
		Application::GetInstance()->PostMessage( M_QUIT );
	}
#endif
	return( true );
}
示例#23
0
/* void openMenu (in boolean openFlag); */
NS_IMETHODIMP nsMenuBoxObject::OpenMenu(bool aOpenFlag)
{
  nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
  if (pm) {
    nsIFrame* frame = GetFrame(PR_FALSE);
    if (frame) {
      if (aOpenFlag) {
        nsCOMPtr<nsIContent> content = mContent;
        pm->ShowMenu(content, PR_FALSE, PR_FALSE);
      }
      else {
        if (frame->GetType() == nsGkAtoms::menuFrame) {
          nsMenuPopupFrame* popupFrame = (static_cast<nsMenuFrame *>(frame))->GetPopup();
          if (popupFrame)
            pm->HidePopup(popupFrame->GetContent(), PR_FALSE, PR_TRUE, PR_FALSE);
        }
      }
    }
  }

  return NS_OK;
}
示例#24
0
/* boolean handleKeyPress (in nsIDOMKeyEvent keyEvent); */
NS_IMETHODIMP nsMenuBoxObject::HandleKeyPress(nsIDOMKeyEvent* aKeyEvent, PRBool* aHandledFlag)
{
  *aHandledFlag = PR_FALSE;
  NS_ENSURE_ARG(aKeyEvent);

  // if event has already been handled, bail
  nsCOMPtr<nsIDOMNSUIEvent> uiEvent(do_QueryInterface(aKeyEvent));
  if (!uiEvent)
    return NS_OK;

  PRBool eventHandled = PR_FALSE;
  uiEvent->GetPreventDefault(&eventHandled);
  if (eventHandled)
    return NS_OK;

  if (nsMenuBarListener::IsAccessKeyPressed(aKeyEvent))
    return NS_OK;

  nsIFrame* frame = GetFrame();
  if (!frame)
    return NS_OK;

  nsIMenuFrame* menuFrame;
  CallQueryInterface(frame, &menuFrame);
  if (!menuFrame)
    return NS_OK;

  PRUint32 keyCode;
  aKeyEvent->GetKeyCode(&keyCode);
  switch (keyCode) {
    case NS_VK_UP:
    case NS_VK_DOWN:
    case NS_VK_HOME:
    case NS_VK_END:
      return menuFrame->KeyboardNavigation(keyCode, *aHandledFlag);
    default:
      return menuFrame->ShortcutNavigation(aKeyEvent, *aHandledFlag);
  }
}
示例#25
0
//called to save the current state out to a file
bool CSpriteFile::Save(const char* pszFilename) const
{
	//open up the file
#if _MSC_VER >= 1300
	std::ofstream OutFile(pszFilename, std::ios::out | std::ios::binary);
#else
	ofstream OutFile(pszFilename, ios::out | ios::binary);
#endif

	//check the open
	if(!OutFile)
		return false;

	//write out the header
	uint32 nTempVal;

	OutFile.write((char*)&m_nNumFrames, sizeof(m_nNumFrames));
	OutFile.write((char*)&m_nFrameRate, sizeof(m_nFrameRate));
	
	nTempVal = m_bTransparent ? 1 : 0;
	OutFile.write((char*)&nTempVal, sizeof(nTempVal));
	nTempVal = m_bTranslucent ? 1 : 0;
	OutFile.write((char*)&nTempVal, sizeof(nTempVal));

	OutFile.write((char*)&m_nKey, sizeof(m_nKey));

	//now write out all the strings
	for(uint32 nCurrFrame = 0; nCurrFrame < GetNumFrames(); nCurrFrame++)
	{
		const char* pszFrame = GetFrame(nCurrFrame);

		uint16 nStrLen = pszFrame ? strlen(pszFrame) : 0;
		OutFile.write((char*)&nStrLen, sizeof(nStrLen));
		OutFile.write(pszFrame, nStrLen);
	}

	//success
	return true;
}
示例#26
0
vector3d SpaceStation::GetTargetIndicatorPosition(const Frame *relTo) const
{
	// return the next waypoint if permission has been granted for player,
	// and the docking point's position once the docking anim starts
	for (int i=0; i<MAX_DOCKING_PORTS; i++) {
		if (i >= m_type->numDockingPorts) break;
		if ((m_shipDocking[i].ship == Pi::player) && (m_shipDocking[i].stage > 0)) {

			SpaceStationType::positionOrient_t dport;
			if (!m_type->GetShipApproachWaypoints(i, m_shipDocking[i].stage+1, dport))
				PiVerify(m_type->GetDockAnimPositionOrient(i, m_type->numDockingStages,
				1.0f, vector3d(0.0), dport, m_shipDocking[i].ship));
			matrix4x4d rot;
			GetRotMatrix(rot);

			matrix4x4d m;
			Frame::GetFrameRenderTransform(GetFrame(), relTo, m);
			return m * (GetInterpolatedPosition() + (rot*dport.pos));
		}
	}
	return GetInterpolatedPositionRelTo(relTo);
}
示例#27
0
wxWindow* RoundingView::CreateChildWindow()
{
    wxWindow* frame = GetFrame();
    wxPanel* main_panel = wxXmlResource::Get()->LoadPanel
        (frame
        ,"rounding_view_panel"
        );
    if(!main_panel)
        {
        fatal_error() << "Unable to load xml resource." << LMI_FLUSH;
        }

    typedef RoundingDocument::values_type::const_iterator value_const_iterator;
    for
        (value_const_iterator cit = document().values().begin()
        ,end = document().values().end()
        ;cit != end
        ;++cit
        )
        {
        RoundingButtons* control = dynamic_cast<RoundingButtons*>
            (wxWindow::FindWindowById
                (wxXmlResource::GetXRCID(cit->first.c_str())
                ,frame
                )
            );
        if(!control)
            {
            fatal_error()
                << "Required text control '"
                << cit->first
                << "' not found."
                << LMI_FLUSH
                ;
            }
        controls_[cit->first] = control;
        }
    return main_panel;
}
示例#28
0
uint32 GlLineScanner::CountSteps(	GlDegreeLine line, int32 w, int32 h,
									int32 prevX, int32 prevY) const
{
	int32			l, t, r, b, x, y;
	uint32			c = 0;
	GetFrame(&l, &t, &r, &b);
	while (!(w < l || h < t || 0 > r || 0 > b)) {
		c++;
		line.GetNext(&x, &y);
		int32			offsetX = x - prevX, offsetY = y - prevY;

		l += offsetX;
		t += offsetY;
		r += offsetX;
		b += offsetY;
//printf("\t1: w %ld h %ld x %ld y %ld  (%ld, %ld, %ld, %ld)\n", w, h, cx, cy, cl, ct, cr, cb);

		prevX = x;
		prevY = y;
	}
	return c;
}
void PJONAnalyzerResults::GenerateBubbleText( U64 frame_index, Channel& channel, DisplayBase display_base )
{
	ClearResultStrings();
	Frame frame = GetFrame( frame_index );
 
	char number_str[128];
    switch (frame.mType) {
        case Sync: {
            char* str = PJONPacketState::asDisplayString(frame.mFlags);
            AddResultString("s");
            AddResultString("Sync");
            AddResultString("Sync ", str);
            break;
        }
            
        case Data: {
            UILabel label = GetAckNackLabels(frame_index);
            AnalyzerHelpers::GetNumberString( frame.mData1, display_base, 8, number_str, 128 );
            AddResultString(label.tiny.c_str());
            AddResultString(label.medium.c_str());
            AddResultString("Data ", label.full.c_str(), " ", number_str);
            break;
        }
            
        case Error: {
            AddResultString("e");
            AddResultString("Error");
            break;
        }
            
        default: {
           	AnalyzerHelpers::GetNumberString( frame.mData1, display_base, 8, number_str, 128 );
            AddResultString( number_str );
            break;
        }
    }

}
/* void openMenu (in boolean openFlag); */
NS_IMETHODIMP nsMenuBoxObject::OpenMenu(bool aOpenFlag)
{
  nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
  if (pm) {
    nsIFrame* frame = GetFrame(false);
    if (frame) {
      if (aOpenFlag) {
        nsCOMPtr<nsIContent> content = mContent;
        pm->ShowMenu(content, false, false);
      }
      else {
        nsMenuFrame* menu = do_QueryFrame(frame);
        if (menu) {
          nsMenuPopupFrame* popupFrame = menu->GetPopup();
          if (popupFrame)
            pm->HidePopup(popupFrame->GetContent(), false, true, false);
        }
      }
    }
  }

  return NS_OK;
}