Beispiel #1
0
void CPrefsDialog::GetDefPageSetup()
{
	BPrintJob prJob("a page setup job");
	
	if (fPageSetup)
	{
		BMessage *s = new BMessage;
		if (s && s->Unflatten(fPageSetup) == B_NO_ERROR)
			prJob.SetSettings(s);
	}
	
	int result = prJob.ConfigPage();
	
	if (result == B_NO_ERROR)
	{
		BMessage * s(prJob.Settings());

		fPageSetupSize = s->FlattenedSize();
		if (fPageSetup) FREE(fPageSetup);
		fPageSetup = (char *)MALLOC(fPageSetupSize);
		FailNil(fPageSetup);
		result = s->Flatten(fPageSetup, fPageSetupSize);
		FailOSErr(result, "error flattening (%d)");
		
		UpdateFields();
	}
} /* CPrefsDialog::GetDefPageSetup */
Beispiel #2
0
void wxStatusBar::DoUpdateStatusText(int number)
{
    if ( m_qtPanes->count() != m_panes.GetCount() )
        UpdateFields();

    (*m_qtPanes)[number]->setText( wxQtConvertString( m_panes[number].GetText() ) );
}
Beispiel #3
0
void CSourcePanel::SetVisible(bool bVis)
{
	if (bVis && !IsVisible())
		UpdateFields();

	BaseClass::SetVisible(bVis);
}
Beispiel #4
0
bool cConfMySQL::UpdatePK(cQuery &Query)
{
	UpdateFields(Query.OStream());
	WherePKey(Query.OStream());
	bool ret = Query.Query();
	Query.Clear();
	return ret;
}
void Dlg_Palette::DeleteCurMaterial(void)
{
	int CurMat = GetCurMat();
	if (CurMat > 0) Palette_Model->removeRows(CurMat,CurMat); //don't remove the null material, or try to remove -1
	emit RequestUpdateGL();
	UpdateFields();

	
}
Beispiel #6
0
void CSmartFieldsDialog::RestoreState(void)
{
	m_pList->RestoreState();
	UpdateFields(TRUE);
	if (m_fOriginalModified != -1)
	{
		m_pDoc->SetModifiedFlag(m_fOriginalModified);
	}
}
void Dlg_Palette::Mat2IndexChanged(int NewMatIndex)
{
	if (NewMatIndex>=0 && NewMatIndex != GetCurMat() && MatIsEditable(NewMatIndex)){ //filter for selecting anything not allowed, since its a pain to disable in QComboBox
		GetPCurMat()->SetRandInd2(NewMatIndex);
		emit RequestUpdateGL();
	}
	UpdateFields();

}
Beispiel #8
0
void CSmartFieldsDialog::OnSender()
{
/*
// Finish up any current edit.
*/

	if (m_pList->Editing())
	{
		m_pList->FinishEdit();
		GetDlgItem(IDC_SENDER)->SetFocus();
	}
	
/*
// Make sure the configuration supports address books.
*/

	if (!GetConfiguration()->SupportsAddressBook())
	{
		return;
	}

	// Allow the user to edit the sender record for the current address book.
   
   if (m_pDoc->EditSender())
   {
		// Reset all the sender fields back to their database values.
		
		int nItem = 0;
		int nItems = m_pList->GetCount();
		
		while (nItem < nItems)
		{
			CSmartFieldListBoxItem* pItem = (CSmartFieldListBoxItem*)m_pList->GetItemData(nItem);
			if (pItem != NULL)
			{
				CMacro* pMacro = pItem->Macro();
				
				if (pMacro != NULL)
				{
					if (pMacro->MacroType() == CMacro::MACRO_TYPE_Sender)
					{
						// We have a sender field, reset it back to its database value.
						pMacro->MacroValueType(CMacro::VALUE_TYPE_Field);
						pMacro->Value("");
					}
				}
			}
			
			nItem++;
		}
		
		UpdateFields(TRUE);
		m_pList->Invalidate();
   }
}
int main(int argc, char* argv[])
{
  MPI_Init(&argc, &argv);
  Grid grid = (Grid) { .NumberOfPoints = 0, .Points = 0, .NumberOfCells = 0, .Cells = 0};
  unsigned int numPoints[3] = {70, 60, 44};
  double spacing[3] = {1, 1.1, 1.3};
  InitializeGrid(&grid, numPoints, spacing);
  Attributes attributes;
  InitializeAttributes(&attributes, &grid);

#ifdef USE_CATALYST
  int fileNameLength = 0;
  fileNameLength = strlen(argv[1]);
  coprocessorinitializewithpython(argv[1], &fileNameLength);
  int i;
  for(i=2;i<argc;i++)
    {
    // Add in any other Python script pipelines that are passed in.
    fileNameLength = strlen(argv[i]);
    coprocessoraddpythonscript(argv[i], &fileNameLength);
    }
#endif
  unsigned int numberOfTimeSteps = 100;
  unsigned int timeStep;
  for(timeStep=0;timeStep<numberOfTimeSteps;timeStep++)
    {
    // use a time step length of 0.1
    double time = timeStep * 0.1;
    UpdateFields(&attributes, time);
#ifdef USE_CATALYST
    int lastTimeStep = 0;
    if(timeStep == numberOfTimeSteps-1)
      {
      lastTimeStep = 1;
      }
    CatalystCoProcess(grid.NumberOfPoints, grid.Points, grid.NumberOfCells, grid.Cells,
                      attributes.Velocity, attributes.Pressure, time, timeStep, lastTimeStep);
#endif
    }

#ifdef USE_CATALYST
  coprocessorfinalize();
#endif
  MPI_Finalize();

  return 0;
}
void Dlg_Palette::ClickedImport(void) //does not currently support material recursion within the imported VXC (flattens it)
{
	QVX_Object tmpObj;
	std::string RetMsg;
	tmpObj.Open();
	int MatShiftNum = pObj->GetNumMaterials()-1; //amound to shift materials indices from imported VXC
	for (int i=1; i<tmpObj.GetNumMaterials(); i++){
		if (pObj->AddMat(tmpObj.Palette[i], true, &RetMsg) == -1){
			QMessageBox::warning(NULL, "Warning", "Could not add material. Aborting import.");
			return;
		}
	}

	for (int i=tmpObj.GetNumMaterials()-1; i>0; i--) //go backwards to avoid doubling up indices
		tmpObj.Structure.ReplaceMaterial(i, MatShiftNum+i); //temporarily creates bad indices, but they'll drop right in when we put this in our material structure

	GetPCurMat()->GetStructure() = tmpObj.Structure; //set the structure!
	UpdateFields(); //update the dimension sizes
	emit RequestUpdateGL();
}
// Init initializes the PSObject with the given information
// identification : the id of the object
// called : the name of the object
// points : a vector of Points that define the PhaseSpace Object
// t : the type_ of object
bool PSObject::Init(int ident, string call,
                    vector<Point> points, string t, bool rigid) {
  Point p;
  p.Init();
  center_ = p;
  angle_.push_back(1);
  angle_.push_back(0);
  angle_.push_back(0);
  angle_.push_back(0);
  Point x_axis;
  x_axis.Init(1, 0, 0);
  Point y_axis;
  y_axis.Init(0, 1, 0);
  Point z_axis;
  z_axis.Init(0, 0, 1);
  axes_.push_back(x_axis);
  axes_.push_back(y_axis);
  axes_.push_back(z_axis);
  dim_.push_back(.1);
  dim_.push_back(.1);
  dim_.push_back(.1);
  
  name_ = call;
  id_ = ident;
  bool success;
  if (t == "glove") {
    GloveType* g = new GloveType;
    success = g->Init(points, rigid);
    type_ = static_cast<ObjectType*>(g);
    ext_ = "glove";
  } else {
    DefaultType* d = new DefaultType;
    success = d->Init(points, rigid);
    type_ = static_cast<ObjectType*>(d);
    ext_ = "default";
  }
  UpdateFields();
  return success;
}
Beispiel #12
0
void HDialog::MessageReceived(BMessage *inMessage)
{
	switch (inMessage->what)
	{
		case msg_OK:
			if (OkClicked())
				Close();
			break;

		case msg_FieldChanged:
			UpdateFields();
			break;

		case msg_Cancel:
			if (CancelClicked())
				Close();
			break;

		default:
			BWindow::MessageReceived(inMessage);
	}
} /* HDialog::MessageReceived */
BOOL CFilterSearchDlg::OnInitDialog()
{
	CSkinDialog::OnInitDialog();

	SkinMe( _T("CFilterSearchDlg"), IDR_SEARCHFRAME );

	if ( m_pMatches != NULL ) 
	{
		m_pResultFilters = m_pMatches->m_pResultFilters;
		m_pResultFilters->Load();
		UpdateList();
		UpdateFields();
	}

	ASSERT( m_pResultFilters != NULL );

	m_wndSources.SetRange( 0, 256 );

	UpdateData( FALSE );

	return TRUE;
}
Beispiel #14
0
void SeriesTab::Init(ScatterCtrl& scatter) {
	CtrlLayout(*this);
	SizePos();
	
	pscatter = &scatter;
	
	list.Reset();
	list.SetLineCy(EditField::GetStdHeight());
	list.AddColumn(t_("Name"));
	for(int i = 0; i < scatter.GetCount(); i++) 
		list.Add(scatter.GetLegend(i));
	list.SetCursor(0);
	list.WhenSel = THISBACK(UpdateFields);

	markstyle.Add(t_("No mark"));
	for(int i = 0; i < MarkPlot::GetCount(); i++)
		markstyle.Add(MarkPlot::TypeName(i));
	
	markstyle.SetIndex(0);
	UpdateFields();

	linecolor <<= THISBACK(Change);
	fillcolor <<= THISBACK(Change);
	visible <<= THISBACK(Change);
	dash <<= THISBACK(Change);
	linethickness <<= THISBACK(Change);

	markstyle <<= THISBACK(Change);
	markcolor <<= THISBACK(Change);
	markwidth <<= THISBACK(Change);

	unitsY <<= THISBACK(Change);
	unitsX <<= THISBACK(Change);

	name <<= THISBACK(Change);
	primary <<= THISBACK(Change);
	
	name.SetFocus();
}
bool emNetwalkControlPanel::Cycle()
{
	if (IsSignaled(Mdl->GetChangeSignal())) {
		UpdateFields();
	}

	if (IsSignaled(BtStart->GetClickSignal())) {
		if (
			Mdl->GetFileState()==emFileModel::FS_LOADED ||
			Mdl->GetFileState()==emFileModel::FS_UNSAVED
		) {
			try {
				Mdl->TrySetup(
					(int)SfSize->GetValue(),
					(int)SfSize->GetValue(),
					CbBorderless->IsChecked(),
					CbNoFourWayJunctions->IsChecked(),
					(int)SfComplexity->GetValue(),
					CbDigMode->IsChecked(),
					CbAutoMark->IsChecked()
				);
			}
			catch (emString errorMessage) {
				emTkDialog::ShowMessage(ContentView,"Error",errorMessage);
			}
		}
	}

	if (IsSignaled(CbAutoMark->GetCheckSignal())) {
		Mdl->SetAutoMark(CbAutoMark->IsChecked());
	}

	if (IsSignaled(BtUnmarkAll->GetClickSignal())) {
		Mdl->UnmarkAll();
	}

	return emTkGroup::Cycle();
}
Beispiel #16
0
// Called each time number/size of panes changes
void wxStatusBar::Refresh( bool eraseBackground, const wxRect *rect )
{
    UpdateFields();

    wxWindow::Refresh( eraseBackground, rect );
}
emNetwalkControlPanel::emNetwalkControlPanel(
	ParentArg parent, const emString & name, emView & contentView,
	emNetwalkModel * fileModel
)
	: emTkGroup(parent,name,"emNetwalk"),
	ContentView(contentView)
{
	emTkTiling * t1, * t2, * t3, * t4;
	Mdl=fileModel;

	SetPrefChildTallness(1.0);
	SetPrefChildTallness(0.3,1);
	SetPrefChildTallness(0.5,2);

	GrAbout=new emTkGroup(this,"about","About emNetwalk");
	LbAbout=new emTkLabel(GrAbout,"text",
		"emNetwalk is a clone of the addictive Netwalk puzzle game where pieces of a\n"
		"computer network have to be rotated in order to connect terminals to a server.\n"
		"In contrast to other implementations, emNetwalk has a very sophisticated random\n"
		"network generator which allows a more free and exact game configuration. In\n"
		"addition, emNetwalk provides a special option for making the game even more fun:\n"
		"The Dig Mode forbids to rotate pieces that are not yet near a server connection.\n"
		"\n"
		"How to play\n"
		"-----------\n"
		"\n"
		"In order to solve the puzzle, you have to connect all the terminals to the\n"
		"server. You can do this by rotating pieces of the network (cable segments,\n"
		"junctions, terminals, and the server). The solution must not contain any loops\n"
		"or islands, so that there is always exactly one path from the server to each\n"
		"terminal. Every game has exactly one such solution.\n"
		"\n"
		"Mouse functions:\n"
		"\n"
		"  Left button: Rotate piece counterclockwise.\n"
		"\n"
		"  Shift + left button: Rotate piece clockwise.\n"
		"\n"
		"  Right button: Mark or unmark a piece. A marked piece cannot be rotated.\n"
		"\n"
		"  Ctrl + left button + movement: Scroll board (only in borderless mode)\n"
		"\n"
		"Here are some tips for beginners:\n"
		"\n"
		"4-way junctions are always correct and must not be rotated.\n"
		"\n"
		"A straight segment besides a border must point along the border.\n"
		"\n"
		"One or more straight segments between two terminals must not connect the\n"
		"terminals.\n"
		"\n"
		"An arc segment between two straight segments requires that the straight\n"
		"segments have different orientations."
	);

	GrStart=new emTkGroup(this,"start","New Game");
	GrStart->SetFixedColumnCount(1);
	GrStart->SetPrefChildTallness(0.2);
	GrStart->SetPrefChildTallness(0.12,-1);
	t1=new emTkTiling(GrStart,"t1");
	t1->SetPrefChildTallness(0.2);
	t2=new emTkTiling(t1,"t2");
	t2->SetPrefChildTallness(0.1);
	t3=new emTkTiling(t1,"t3");
	t3->SetPrefChildTallness(0.1);
	SfSize=new emTkScalarField(
		t2,"size","Size",
		"Here you can set the size of the board as the number\n"
		"of pieces in horizontal and vertical direction."
	);
	SfSize->SetMinMaxValues(5,25);
	SfSize->SetScaleMarkIntervals(5,1,0);
	SfSize->SetEditable();
	SfComplexity=new emTkScalarField(
		t2,"complexity","Complexity",
		"This is the difficulty of the network. The higher the value,\n"
		"the more junctions and terminals are generated per area."
	);
	SfComplexity->SetMinMaxValues(1,5);
	SfComplexity->SetScaleMarkIntervals(1,0);
	SfComplexity->SetEditable();
	CbBorderless=new emTkCheckBox(
		t3,"borderless","Borderless",
		"If this is enabled, connections can wrap from one edge to the\n"
		"opposite edge so that there are no borders. This makes the game\n"
		"more difficult. Remember that you can scroll the whole board\n"
		"with Ctrl + left mouse button + mouse movement."
	);
	CbBorderless->SetNoEOI();
	CbNoFourWayJunctions=new emTkCheckBox(
		t3,"no4wayjunctions","No 4-Way Junctions",
		"If this is enabled, the network will not contain any 4-way\n"
		"junctions. This makes the game more difficult."
	);
	CbNoFourWayJunctions->SetNoEOI();
	CbDigMode=new emTkCheckBox(
		t3,"digmode","Dig Mode",
		"If this is enabled, pieces that are not near a server connection\n"
		"are dug in and cannot be rotated, so that the puzzle has to be\n"
		"solved by \"digging\" from server to terminals. This makes the\n"
		"game more difficult."
	);
	CbDigMode->SetNoEOI();
	BtStart=new emTkButton(
		GrStart,"start","Start New Game",
		"Start a new game with the given settings.\n"
		"\n"
		"Hotkey: Ctrl+N"
	);

	t4=new emTkTiling(this,"t4");
	t4->SetPrefChildTallness(0.07);
	t4->SetPrefChildTallness(0.33,-1);
	GrExtra=new emTkGroup(t4,"extra","Extra");
	GrExtra->SetBorderScaling(2.0);
	CbAutoMark=new emTkCheckBox(
		GrExtra,"automark","Auto Mark",
		"Whether to mark pieces automatically after rotating them."
	);
	CbAutoMark->SetNoEOI();
	BtUnmarkAll=new emTkButton(
		GrExtra,"unmarkall","Unmark All",
		"Unmark all pieces.\n"
		"\n"
		"Hotkey: Ctrl+U"
	);
	TfPenalty=new emTkTextField(
		t4,"penalty","Penalty Points",
		"A penalty point is given whenever you rotate a piece once again\n"
		"after rotating at least one other piece in between. Advanced players\n"
		"should try to solve the puzzle without getting any penalty points."
	);

	UpdateFields();

	AddWakeUpSignal(Mdl->GetChangeSignal());
	AddWakeUpSignal(BtStart->GetClickSignal());
	AddWakeUpSignal(CbAutoMark->GetCheckSignal());
	AddWakeUpSignal(BtUnmarkAll->GetClickSignal());
}
void Dlg_Palette::AddMaterial(void)
{
	Palette_Model->insertRows(0,0);
	UpdateFields();

}
Beispiel #19
0
void CSmartFieldsDialog::OnReceivers()
{
/*
// Finish up any current edit.
*/
	if (m_pList->Editing())
	{
		m_pList->FinishEdit();
		GetDlgItem(IDC_RECEIVERS)->SetFocus();
	}
	
/*
// Make sure the configuration supports address books.
*/

	if (!GetConfiguration()->SupportsAddressBook())
	{
		return;
	}

	if (m_pDoc->EditNameList(TRUE))
	{
		/*
		// Make a local copy of the macros.
		*/

		m_pMacros = &m_pMacroServer->MacroList();

		/*
		// Bind the fields to the list.
		// This rebuilds the list as well.
		*/
		m_pList->Fields(m_pMacroServer, m_pMacros, &m_cwaMacrosInUse);

		// Reset all the receiver fields back to their database values.
		
		int nItem = 0;
		int nItems = m_pList->GetCount();
		
		while (nItem < nItems)
		{
			CSmartFieldListBoxItem* pItem = (CSmartFieldListBoxItem*)m_pList->GetItemData(nItem);
			if (pItem != NULL)
			{
				CMacro* pMacro = pItem->Macro();
				
				if (pMacro != NULL)
				{
					if (pMacro->MacroType() == CMacro::MACRO_TYPE_Receiver)
					{
						// We have a receiver field, reset it back to its database value.
						pMacro->MacroValueType(CMacro::VALUE_TYPE_Field);
						pMacro->Value("");
					}
				}
			}
			
			nItem++;
		}
		
		UpdateFields(TRUE);
		m_pList->Invalidate();
	}
}
// Update updates the PhaseSpace Object
// Uses updated PhaseSpace OWLMarker s to update points
// n : the number of markers that have been updated
bool PSObject::Update(OWLMarker *markers, int n) {
  type_->Update(markers, n);
  UpdateFields();
  return true;
}