JBoolean
JXFSBindingTable::ExtractInputData
	(
	const JPoint& cell
	)
{
	assert( itsTextInput != NULL );

	const JString& s = itsTextInput->GetText();
	JBoolean ok      = itsTextInput->InputValid();

	if (ok && cell.x == kPatternColumn)
		{
		const JFSBinding* b    = itsBindingList->GetBinding(cell.y);
		const JBoolean changed = JI2B(b->GetPattern() != s);

		if (JFSBinding::WillBeRegex(s))
			{
			const JError err = itsTestRegex->SetPattern(s);
			err.ReportIfError();
			ok = err.OK();
			}

		JIndex newIndex;
		if (ok && changed && itsBindingList->SetPattern(cell.y, s, &newIndex))
			{
			JTableSelection& s = GetTableSelection();
			s.ClearSelection();
			s.SelectCell(newIndex, kPatternColumn);
			Broadcast(DataChanged());
			}
		else if (ok && changed)
			{
			ok = kJFalse;

			const JCharacter* map[] =
				{
				"pattern", s.GetCString()
				};
			const JString msg = JGetString(kPatternUsedID, map, sizeof(map));
			(JGetUserNotification())->ReportError(msg);
			}
		}

	else if (ok && cell.x == kCommandColumn &&
			 itsBindingList->SetCommand(cell.y, s))
		{
		Broadcast(DataChanged());
		}

	return ok;
}
示例#2
0
void BaseTab::SetData(const TabRendererData& data)
{
    if(data_.Equals(data))
    {
        return;
    }

    TabRendererData old(data_);
    data_ = data;

    if(data_.IsCrashed())
    {
        if(!should_display_crashed_favicon_ && !IsPerformingCrashAnimation())
        {
            StartCrashAnimation();
        }
    }
    else
    {
        if(IsPerformingCrashAnimation())
        {
            StopCrashAnimation();
        }
        ResetCrashedFavicon();
    }

    DataChanged(old);

    Layout();
    SchedulePaint();
}
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : stringNumber - 
//			length - 
//			*userdata - 
//-----------------------------------------------------------------------------
void CNetworkStringTable::SetStringUserData( int stringNumber, int length /*=0*/, const void *userdata /*= 0*/ )
{
#ifdef _DEBUG
	if ( m_bLocked )
	{
		DevMsg("Warning! CNetworkStringTable::SetStringUserData: changing entry %i while locked.\n", stringNumber );
	}
#endif

	INetworkStringDict *dict = m_pItems;
	int saveStringNumber = stringNumber;
	if ( m_pItemsClientSide && stringNumber < -1 )
	{
		dict = m_pItemsClientSide;
		stringNumber = -stringNumber;
	}

	assert( (length == 0 && userdata == NULL) || ( length > 0 && userdata != NULL) );
	assert( stringNumber >= 0 && stringNumber < (int)dict->Count() );
	CNetworkStringTableItem *p = &dict->Element( stringNumber );
	assert( p );

	if ( p->SetUserData( m_nTickCount, length, userdata ) )
	{
		// Mark changed
		DataChanged( saveStringNumber, p );
	}
}
void
JXFSBindingTable::RemovePattern()
{
	JPoint cell;
	if ((GetTableSelection()).GetFirstSelectedCell(&cell))
		{
		if ((itsBindingList->GetBinding(cell.y))->IsSystemBinding())
			{
			JGetUserNotification()->ReportError(JGetString(kCantRemoveSystemBindingID));
			}
		else
			{
			CancelEditing();
			if (itsBindingList->DeleteBinding(cell.y))
				{
				RemoveRow(cell.y);
				}
			else
				{
				TableRefreshRow(cell.y);
				GetWindow()->Update();
				(JGetUserNotification())->DisplayMessage(JGetString(kReplacedBySystemID));
				}
			UpdateButtons();
			Broadcast(DataChanged());
			}
		}
}
void __fastcall TCustomerDataSource::DeleteRecord(void * ARecordHandle)
{
  FCustomers->Delete((int)ARecordHandle);
  DataChanged();
  if(!Modified)
    FModified = true;
}
void * __fastcall TCustomerDataSource::AppendRecord(void)
{
  TCustomer* ACustomer = new TCustomer(FCustomers->NextID);
  TcxDataRecordHandle* Result = (TcxDataRecordHandle*)FCustomers->Add(ACustomer);
  DataChanged();
  if (!Modified)
    FModified = true;
  return (Result);
}
void * __fastcall TCustomerDataSource::InsertRecord(void * ARecordHandle)
{
  TCustomer* ACustomer = new TCustomer(FCustomers->NextID);
  FCustomers->Insert((int)ARecordHandle, ACustomer);
  TcxDataRecordHandle* Result = (TcxDataRecordHandle*)ARecordHandle;
  DataChanged();
  if(!Modified)
    FModified = true;
  return (Result);
}
示例#8
0
void WorkThread::run()
{
    /*********************************************************/
    /* Read input file, and initialize params and vars. This */
    /* function calls SPECIES and LOAD or Restore            */
    start_(argc, argv);

   // init output file
    QString filename = "Qdust(t).txt";
    QFile file(filename);


   // InitWindows(argc, argv);

    history();
    fields();

    int step=0;
    float *pot = phi;
    if (file.open(QIODevice::WriteOnly)) {
        QTextStream stream(&file);
        stream.setRealNumberPrecision(20);

        while(True)
        {
          if(!stop){
//            mutex.lock();
              t += dt;

              move();
              adjust();
              mcc();
              fields();
              history();

              if(((int)(t/dt))%2==0) stream << t<<"\t"<< qdust << "\t"<< energy_flux[0] <<"\t"<<  energy_flux[1] << endl;

              updatePlasmaModel();

             if(step%200==0 && step>0) {
//                 stop=true;
                 std::cout<< "Step "<<step<<": a signal sent to save data\n"<<endl;
                 emit DataChanged();
             }

            } else{
                this->msleep(50);
            }
            step++;
        }
    }
}
示例#9
0
void SelectiveClustering::update()
{
	this->NumberOfObjects = this->ObjectTable->GetNumberOfRows();
	for ( vtkIdType currow = 0; currow < this->NumberOfObjects; currow++ )
	{
		vtkIdType rowObjId = this->ObjectTable->GetValue( currow, 0 ).ToTypeInt64();
		this->ObjectTableIDMap[ rowObjId ] = currow;
	}
	this->ClusterMap.clear();
	this->CreateClusterTableHeaders();
	this->ClusterTableIDMap.clear();
	emit DataChanged();
}
示例#10
0
VOID PlayerShop::CleanUp()
{
    __ENTER_FUNCTION

    m_pPlayerShopDB->CleanUp();

    //初始化摊位名,广告语
    sprintf(m_pPlayerShopDB->m_szShopName, "杂货摊位");

    m_PlayerShopRT.m_bSerial = 0;
    DataChanged();
    __LEAVE_FUNCTION
}
示例#11
0
void ClusterManager::setClusteringModel(SelectiveClustering * newClusterModel)
{
	/*! 
	* Create link to SelectiveClustering 
	*/
	if(this->ClusterModel)
	{
		delete this->ClusterModel;
	}
	this->ClusterModel = newClusterModel;
	connect(this->ClusterModel, SIGNAL(ClusterChanged()), this, SLOT(ChangeInClusters()));
	connect(this->ClusterModel, SIGNAL(DataChanged()), this, SLOT(ChangeInData()));
}
示例#12
0
void EditorLODData::ClearLODData()
{
    lodLayersCount = 0;

    for(DAVA::int32 i = 0; i < DAVA::LodComponent::MAX_LOD_LAYERS; ++i)
    {
        lodDistances[i] = 0;
        lodTriangles[i] = 0;
    }

    lodData.clear();

    emit DataChanged();
}
void MergedProxyModel::setSourceModel(QAbstractItemModel* source_model) {
  if (sourceModel()) {
    disconnect(sourceModel(), SIGNAL(modelReset()), this, SLOT(SourceModelReset()));
    disconnect(sourceModel(), SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)),
               this, SLOT(RowsAboutToBeInserted(QModelIndex,int,int)));
    disconnect(sourceModel(), SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
               this, SLOT(RowsAboutToBeRemoved(QModelIndex,int,int)));
    disconnect(sourceModel(), SIGNAL(rowsInserted(QModelIndex,int,int)),
               this, SLOT(RowsInserted(QModelIndex,int,int)));
    disconnect(sourceModel(), SIGNAL(rowsRemoved(QModelIndex,int,int)),
               this, SLOT(RowsRemoved(QModelIndex,int,int)));
    disconnect(sourceModel(), SIGNAL(dataChanged(QModelIndex,QModelIndex)),
               this, SLOT(DataChanged(QModelIndex,QModelIndex)));
    disconnect(sourceModel(), SIGNAL(layoutAboutToBeChanged()),
               this, SLOT(LayoutAboutToBeChanged()));
    disconnect(sourceModel(), SIGNAL(layoutChanged()),
               this, SLOT(LayoutChanged()));
  }

  QAbstractProxyModel::setSourceModel(source_model);

  connect(sourceModel(), SIGNAL(modelReset()), this, SLOT(SourceModelReset()));
  connect(sourceModel(), SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)),
          this, SLOT(RowsAboutToBeInserted(QModelIndex,int,int)));
  connect(sourceModel(), SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
          this, SLOT(RowsAboutToBeRemoved(QModelIndex,int,int)));
  connect(sourceModel(), SIGNAL(rowsInserted(QModelIndex,int,int)),
          this, SLOT(RowsInserted(QModelIndex,int,int)));
  connect(sourceModel(), SIGNAL(rowsRemoved(QModelIndex,int,int)),
          this, SLOT(RowsRemoved(QModelIndex,int,int)));
  connect(sourceModel(), SIGNAL(dataChanged(QModelIndex,QModelIndex)),
          this, SLOT(DataChanged(QModelIndex,QModelIndex)));
  connect(sourceModel(), SIGNAL(layoutAboutToBeChanged()),
          this, SLOT(LayoutAboutToBeChanged()));
  connect(sourceModel(), SIGNAL(layoutChanged()),
          this, SLOT(LayoutChanged()));
}
void
JXFSBindingTable::Receive
	(
	JBroadcaster*	sender,
	const Message&	message
	)
{
	if (sender == itsAddButton && message.Is(JXButton::kPushed))
		{
		AddPattern();
		}
	else if (sender == itsRemoveButton && message.Is(JXButton::kPushed))
		{
		RemovePattern();
		}
	else if (sender == itsDuplicateButton && message.Is(JXButton::kPushed))
		{
		DuplicatePattern();
		}

	else if (sender == itsTypeMenu && message.Is(JXMenu::kNeedsUpdate))
		{
		UpdateTypeMenu();
		}
	else if (sender == itsTypeMenu && message.Is(JXMenu::kItemSelected))
		{
		const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		HandleTypeMenu(selection->GetIndex());
		}

	else
		{
		if (sender == &(GetTableSelection()))
			{
			UpdateButtons();
			}
		else if (message.Is(JTextEditor::kTextChanged))
			{
			Broadcast(DataChanged());
			}

		JXEditTable::Receive(sender, message);
		}
}
void
JXFSBindingTable::AddPattern()
{
	if (EndEditing())
		{
		const JFSBinding* b = itsBindingList->GetDefaultCommand();
		JFSBinding::CommandType type;
		JBoolean singleFile;
		const JString& cmd = b->GetCommand(&type, &singleFile);

		const JIndex rowIndex =
			itsBindingList->AddBinding("", cmd, type, singleFile);
		InsertRows(rowIndex, 1);
		BeginEditing(JPoint(kPatternColumn, rowIndex));
		Broadcast(DataChanged());
		}
}
void
JXFSBindingTable::HandleTypeMenu
	(
	const JIndex index
	)
{
	JPoint cell;
	const JBoolean ok = (GetTableSelection()).GetFirstSelectedCell(&cell);
	assert( ok );

	const JFSBinding::CommandType newType = kMenuIndexToCmdType [ index-1 ];
	if (itsBindingList->SetCommandType(cell.y, newType))
		{
		TableRefreshRow(cell.y);
		Broadcast(DataChanged());
		}
}
void
JXFSBindingTable::DuplicatePattern()
{
	JPoint cell;
	if ((GetTableSelection()).GetFirstSelectedCell(&cell) && EndEditing())
		{
		const JFSBinding* b = itsBindingList->GetBinding(cell.y);

		JFSBinding::CommandType type;
		JBoolean singleFile;
		const JString& cmd = b->GetCommand(&type, &singleFile);

		const JIndex rowIndex =
			itsBindingList->AddBinding("", cmd, type, singleFile);
		InsertRows(rowIndex, 1);
		BeginEditing(JPoint(kPatternColumn, rowIndex));
		Broadcast(DataChanged());
		}
}
void
JXFSBindingTable::HandleMouseDown
	(
	const JPoint& pt,
	const JXMouseButton button,
	const JSize clickCount,
	const JXButtonStates& buttonStates,
	const JXKeyModifiers& modifiers
	)
{
	JTableSelection& s = GetTableSelection();
	s.ClearSelection();

	JPoint cell;
	if (button == kJXLeftButton && GetCell(pt, &cell))
		{
		s.SelectCell(cell);
		TableScrollToCell(cell);

		if (cell.x == kPatternColumn || cell.x == kCommandColumn)
			{
			BeginEditing(cell);
			}
		else if (cell.x == kTypeColumn)
			{
			itsTypeMenu->PopUp(this, pt, buttonStates, modifiers);
			}
		else if (cell.x == kSingleFileColumn)
			{
			itsBindingList->ToggleSingleFile(cell.y);
			TableRefreshRow(cell.y);
			Broadcast(DataChanged());
			}
		}
	else
		{
		ScrollForWheel(button, modifiers);
		}
}
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *value - 
// Output : int
//-----------------------------------------------------------------------------
int CNetworkStringTable::AddString( bool bIsServer, const char *string, int length /*= -1*/, const void *userdata /*= NULL*/ )
{
	bool bHasChanged;
	CNetworkStringTableItem *item;
	
	if ( !string )
	{
		Assert( string );
		ConMsg( "Warning:  Can't add NULL string to table %s\n", GetTableName() );
		return INVALID_STRING_INDEX;
	}

#ifdef _DEBUG
	if ( m_bLocked )
	{
		DevMsg("Warning! CNetworkStringTable::AddString: adding '%s' while locked.\n", string );
	}
#endif

	int i = m_pItems->Find( string );
	if ( !bIsServer )
	{
		if ( m_pItems->IsValidIndex( i ) && !m_pItemsClientSide )
		{
			bIsServer = true;
		}
	}

	if ( !bIsServer && m_pItemsClientSide )
	{
		i = m_pItemsClientSide->Find( string );

		if ( !m_pItemsClientSide->IsValidIndex( i ) )
		{
			// not in list yet, create it now
			if ( m_pItemsClientSide->Count() >= (unsigned int)GetMaxStrings() )
			{
				// Too many strings, FIXME: Print warning message
				ConMsg( "Warning:  Table %s is full, can't add %s\n", GetTableName(), string );
				return INVALID_STRING_INDEX;
			}

			// create new item
			{
			MEM_ALLOC_CREDIT();
			i = m_pItemsClientSide->Insert( string );
			}

			item = &m_pItemsClientSide->Element( i );

			// set changed ticks

			item->m_nTickChanged = m_nTickCount;

	#ifndef	SHARED_NET_STRING_TABLES
			item->m_nTickCreated = m_nTickCount;

			if ( m_bChangeHistoryEnabled )
			{
				item->EnableChangeHistory();
			}
	#endif

			bHasChanged = true;
		}
		else
		{
			item = &m_pItemsClientSide->Element( i ); // item already exists
			bHasChanged = false;  // not changed yet
		}

		if ( length > -1 )
		{
			if ( item->SetUserData( m_nTickCount, length, userdata ) )
			{
				bHasChanged = true;
			}
		}

		if ( bHasChanged && !m_bChangeHistoryEnabled )
		{
			DataChanged( -i, item );
		}

		// Negate i for returning to client
		i = -i;
	}
	else
	{
		// See if it's already there
		i = m_pItems->Find( string );

		if ( !m_pItems->IsValidIndex( i ) )
		{
			// not in list yet, create it now
			if ( m_pItems->Count() >= (unsigned int)GetMaxStrings() )
			{
				// Too many strings, FIXME: Print warning message
				ConMsg( "Warning:  Table %s is full, can't add %s\n", GetTableName(), string );
				return INVALID_STRING_INDEX;
			}

			// create new item
			{
			MEM_ALLOC_CREDIT();
			i = m_pItems->Insert( string );
			}

			item = &m_pItems->Element( i );

			// set changed ticks

			item->m_nTickChanged = m_nTickCount;

	#ifndef	SHARED_NET_STRING_TABLES
			item->m_nTickCreated = m_nTickCount;

			if ( m_bChangeHistoryEnabled )
			{
				item->EnableChangeHistory();
			}
	#endif

			bHasChanged = true;
		}
		else
		{
			item = &m_pItems->Element( i ); // item already exists
			bHasChanged = false;  // not changed yet
		}

		if ( length > -1 )
		{
			if ( item->SetUserData( m_nTickCount, length, userdata ) )
			{
				bHasChanged = true;
			}
		}

		if ( bHasChanged && !m_bChangeHistoryEnabled )
		{
			DataChanged( i, item );
		}
	}

	return i;
}
示例#20
0
void CGraphPlugIn::SetRange(range r)
{
	fRange = r;
	DataChanged();
} // CGraphPlugin::SetRange