Exemple #1
0
void MyView::MouseDown(BPoint where)
{
	SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS);
	int32		buttons;
	Looper()->CurrentMessage()->FindInt32("buttons", &buttons);
	fLastPos = where;
	if (buttons == B_PRIMARY_MOUSE_BUTTON)
	{
		fTracking = true;
		fMovingLayer = FindLayer(topLayer, where);
		if (fMovingLayer == topLayer)
			fMovingLayer = NULL;
		if (fMovingLayer)
		{
			BRect	bounds(fMovingLayer->Bounds());
			fMovingLayer->ConvertToScreen2(&bounds);
			BRect	resizeRect(bounds.right-10, bounds.bottom-10, bounds.right, bounds.bottom);
			if (resizeRect.Contains(where))
				fIsResize = true;
			else
				fIsResize = false;
		}
	}
	else if (buttons == B_SECONDARY_MOUSE_BUTTON)
	{
		fIs2ndButton = true;
	}
	else if (buttons == B_TERTIARY_MOUSE_BUTTON)
	{
		DrawSubTree(topLayer);
	}
}
Exemple #2
0
SDTSFeature *SDTSTransfer::GetIndexedFeatureRef( SDTSModId *poModId,
                                                 SDTSLayerType *peType )

{
/* -------------------------------------------------------------------- */
/*      Find the desired layer ... this is likely a significant slow    */
/*      point in the whole process ... perhaps the last found could     */
/*      be cached or something.                                         */
/* -------------------------------------------------------------------- */
    const int iLayer = FindLayer( poModId->szModule );
    if( iLayer == -1 )
        return nullptr;

/* -------------------------------------------------------------------- */
/*      Get the reader, and read a feature from it.                     */
/* -------------------------------------------------------------------- */
    SDTSIndexedReader *poReader = GetLayerIndexedReader( iLayer );
    if( poReader == nullptr )
        return nullptr;

/* -------------------------------------------------------------------- */
/*      return type, if requested.                                      */
/* -------------------------------------------------------------------- */
    if( peType != nullptr )
        *peType = GetLayerType(iLayer);

    return poReader->GetIndexedFeatureRef( poModId->nRecord );
}
Exemple #3
0
void View::RemoveContentLayer( Layer layer )
{
  // Check if layer was added in this view.
  LayerIt it = FindLayer( layer );
  if( it != mContentLayers.end() )
  {
    // Remove layer from custom actor.
    Self().Remove( layer );

    // Remove layer from layer map.
    mContentLayers.erase( it );
  }
}
Exemple #4
0
Layer* MyView::FindLayer(Layer *lay, BPoint &where) const
{
	if (lay->Visible()->Contains(where))
		return lay;
	else
		for (Layer *child = lay->BottomChild(); child; child = lay->UpperSibling())
		{
			Layer	*found = FindLayer(child, where);
			if (found)
				return found;
		}
	return NULL;
}
mpPointLayer* gpLineLayer::AddSinglePoint(wxString name, wxString SeriesLabel,
                                        wxWindow* parent)
{
    mpLayer *Series = FindLayer( SeriesLabel );
    mpPointLayer *point = new mpPointLayer(Series, name,wxLIGHT_GREY_BRUSH,
                                           0 ,PointId = wxNewId());
    point->SetVisible(true);
    point->EnableModify(true);
    point->DragOnlyPoint(true);
    point->SetShapeSize(5);
    point->SetShape(mpDIAMOND);
    point->SetTaggingShape(mpVERTICAL_LINE/*|mpHORIZONTAL_LINE|mpCROSS_LINES*/);
    point->SetParent(parent);
    pointList.push_back(point);
    this->AddLayer( point );
    return point;
}
Exemple #6
0
void MyView::MessageReceived(BMessage *msg)
{
	switch(msg->what)
	{
		case B_MOUSE_WHEEL_CHANGED:
		{
			float	dy;
			msg->FindFloat("be:wheel_delta_y", &dy);

			BPoint	pt;
			uint32	buttons;
			Layer	*lay;
			GetMouse(&pt, &buttons, false);
			if ((lay = FindLayer(topLayer, pt)))
				lay->ScrollBy(0, dy*5);
			break;
		}
		default:
			BView::MessageReceived(msg);
	}
}
Exemple #7
0
unsigned int View::AddContentLayer( Layer layer )
{
  // layer must exist.
  DALI_ASSERT_ALWAYS( layer );

  unsigned int index = mNextLayerIndex;
  LayerIt it = FindLayer( layer );

  if( it == mContentLayers.end() )
  {
    // Add layer to the custom actor.
    Self().Add( layer );

    // Store the layer.
    mContentLayers[mNextLayerIndex] = layer;

    // Increase the index.
    ++mNextLayerIndex;
  }

  return index;
}
Exemple #8
0
LAYER::LAYER( PODBC odbc, PLIST peices, INDEX iLoadLayer )
{
	if( !this )
		return;
	if( iLayer && iLayer != INVALID_INDEX )
	{
		lprintf( WIDE("Recovering prior layer") );
		return;
	}
	{
		CTEXTSTR *results;
		if( SQLRecordQueryf( odbc, NULL, &results, NULL
					  , WIDE("select x,y,min_x,min_y,width,height,linked_from_id,linked_from_x,linked_from_y,linked_to_id,linked_to_x,linked_to_y,route,peice_info_id,peice_type from board_layer where board_layer_id=%lu")
					  , iLoadLayer
					  ) && results )
		{
			PIPEICE peice_type = ::GetPeice( peices, results[14] );
			
			pLayerData->psvInstance = peice_type->Load( odbc, atoi( results[13] ) );//, pLayerData->psvInstance );
			pLayerData->SetPeice( peice_type );
			pds_path = CreateDataStack( sizeof( LAYER_PATH_NODE ) );
			x = atoi( results[0] );
			y = atoi( results[1] );
			min_x = atoi( results[2] );
			min_y = atoi( results[3] );
			w = IntCreateFromText( results[4] );
			h = IntCreateFromText( results[5] );
			flags.bRoute = atoi( results[12] );

		    iLayer = iLoadLayer;

			INDEX iStart = IntCreateFromText( results[6] );
			if( iStart != INVALID_INDEX )
			{
				int32_t x, y;
				x = atoi( results[7] );
				y = atoi( results[8] );
				PLAYER loaded_route_start_layer;
				loaded_route_start_layer = FindLayer( iStart );
				if( !loaded_route_start_layer )
					loaded_route_start_layer = GetFromSet( LAYER, pool ); //new(pool,pLayerData->pool) LAYER( odbc, peices, iStart );
				loaded_route_start_layer->pLayerData->peice->methods->ConnectBegin( loaded_route_start_layer->pLayerData->psvInstance
												, x, y // connect x, y
												, pLayerData->peice, pLayerData->psvInstance );
				loaded_route_start_layer->Link( this, LINK_VIA_START, x, y);
			}

			INDEX iEnd = IntCreateFromText( results[9] );
			if( iEnd != INVALID_INDEX )
			{
				int32_t x, y;
				x = atoi( results[10] );
				y = atoi( results[11] );
				PLAYER loaded_route_end_layer;
				loaded_route_end_layer = FindLayer( iEnd );
				if( !loaded_route_end_layer )
					loaded_route_end_layer = GetFromSet( LAYER, pool ); //new(pool,pLayerData->pool) LAYER( odbc, peices, iEnd );
				loaded_route_end_layer->pLayerData->peice->methods->ConnectEnd( loaded_route_end_layer->pLayerData->psvInstance
												, x, y // connect x, y
												, pLayerData->peice, pLayerData->psvInstance );
				loaded_route_end_layer->Link( this, LINK_VIA_END, x, y );
			}



			//}
		}
		SQLEndQuery( odbc );
		for( SQLRecordQueryf( odbc, NULL, &results, NULL, WIDE("select x,y,fore,back from board_layer_path where board_layer_id=%lu order by board_layer_path_id desc"), iLoadLayer );
			results;
			FetchSQLRecord( odbc, &results ) )
		{
			// add path node for a routed type peice
			LAYER_PATH_NODE node;
			node.x = atoi( results[0] );
			node.y = atoi( results[1] );
			node.flags.ForeDir = atoi( results[2] );
			node.flags.BackDir = atoi( results[3] );
			PushData( &pds_path, &node );
		}
	}
   //return iLayer;
}