Esempio n. 1
0
void CToolsHelper::AppendToolsToToolbar(const CUserToolArray& aTools, CToolBar& toolbar, UINT nCmdAfter)
{
	// remove tools first
	RemoveToolsFromToolbar(toolbar, nCmdAfter);
	
	// then re-add
	if (aTools.GetSize())
	{
		// figure out if we want the large or small images
		CSize sizeBtn(toolbar.GetToolBarCtrl().GetButtonSize());
		sizeBtn -= CSize(7, 7); // btn borders from BarTool.cpp

		CSysImageList sil((sizeBtn.cx > 16));
		VERIFY(sil.Initialize());
		
		// start adding after the pref button
		int nStartPos = toolbar.CommandToIndex(nCmdAfter) + 1;
		int nAdded = 0;
		
		for (int nTool = 0; nTool < aTools.GetSize(); nTool++)
		{
			const USERTOOL& tool = aTools[nTool];
			HICON hIcon = GetToolIcon(sil, tool);
				
			if (hIcon)
			{
				CImageList* pIL = toolbar.GetToolBarCtrl().GetImageList();
				int nImage = pIL->Add(hIcon);
				
				TBBUTTON tbb = { nImage, nTool + m_nStartID, 0, TBSTYLE_BUTTON, 0, 0, (UINT)-1 };
				
				if (toolbar.GetToolBarCtrl().InsertButton(nStartPos + nAdded, &tbb))
					nAdded++;
				else // remove image
					pIL->Remove(nImage);
				
				// cleanup
				::DestroyIcon(hIcon);
			}
		}
		
		// add a separator if any buttons added
		if (nAdded)
		{
			TBBUTTON tbb = { -1, 0, 0, TBSTYLE_SEP, 0, 0, (UINT)-1 };
			toolbar.GetToolBarCtrl().InsertButton(nStartPos, &tbb);
		}
	}
}
Esempio n. 2
0
float Taylor(x)
{
    int i=2,z=1, k=1;
    float e=0, cos1, cos;
    cos1=0;
    cos=0;
    while (e>=0.0001 || i<=10)
    {
    e=cos-cos1;
    cos1=cos;
    cos=pow(x,i)/sil();
    e=cos-cos1;
    printf("cos%d=%f\n", z,cos);
    z+=1;
    i+=2;
    }
    printf("cos=%0.1f\n", cos);
return cos;

}
Esempio n. 3
0
main()
{
    struct rehber kisi[30];
    int i;
    char karar;
	for(i=0;i<30;i++)
    {
        kisi[i].doluMu='H';
    }
	while(1==1)
    {
        karar=menu();
		switch(karar)
        {
            case '1': ekle(kisi); break;
            case '2': liste(kisi); break;
            case '3': sil(kisi); break;
            case '4': ara(kisi); break;
        }
    }
}
Esempio n. 4
0
int main(void)
{
	scanf("%d", &te);
	for(t = 0; t < te; ++ t)
	{
		scanf("%d", &si);
		if(!si)continue;
		if(!re[si - 1])
		{
			re[si - 1] = (char*)malloc((1 + 11 * sil(si)) * sizeof(char));
			do
			{
				for(d = 0; d < si; ++ d)
					re[si - 1][r[si - 1] ++] = da[d];

				re[si - 1][r[si - 1] ++] = '\n';
			}
			while(nP(da, da + si - 1));
		}
		puts(re[si - 1]);
	}

	return 0;
}
Esempio n. 5
0
void main()
{
system("color 3b");
char sec,menu;
while(true)	
{
printf("\t\t\t*******************\n\t\t\t*  1-> Kisi ekle  *\n\t\t\t*-----------------* \n\t\t\t*  2-> Goruntule  *\n\t\t\t*-----------------* \n\t\t\t*  3-> Guncelle   *\n\t\t\t*-----------------* \n\t\t\t*  4-> Sil        *\n\t\t\t*-----------------* \n\t\t\t*  5-> Arama      *\n\t\t\t*-----------------* \n\t\t\t*  6-> Cikis      *\n\t\t\t*******************");
sec=getch();
switch (sec)
{
case '1':
islemyapiliyor();
system("cls");
kisiekle();
islemyapiliyor();
break;
case '2':
islemyapiliyor();
system("cls");
goruntule();
printf("\n\nMenuye Donmek Icin => M ");
menu=getch();
fonksiyonmenu(menu);
islemyapiliyor();
break;
case '3':
islemyapiliyor();
system("cls");
guncelle();
system("cls");
islemyapiliyor();
break;
case '4':
islemyapiliyor();
system("cls");
sil();
printf("\n\nMenuye Donmek Icin => M ");
menu=getch();
fonksiyonmenu(menu);
islemyapiliyor();
break;
case '5':
islemyapiliyor();
system("cls");
arama();
printf("\n\nMenuye Donmek Icin => M ");
menu=getch();
fonksiyonmenu(menu);
islemyapiliyor();
break;
case '6':
islemyapiliyor();
exit(cikis());
break;
default:
islemyapiliyor();
system("cls");
system("color 3A"); 
printf("YANLIS SECIM YAPTINIZ!! LUTFEN TEKRAR DENEYINIZ ");
Sleep(750);
system("color 3B"); 
break;
}
system("cls");
}
}
Esempio n. 6
0
void
VisItDataServerPrivate::ReadData(const std::string &var)
{
    // Set some defaults.
    MaterialAttributes       mAtts;
    ExpressionList           combinedExprList(exprList);
    MeshManagementAttributes meshAtts;
    bool                     treatAllDbsAsTimeVarying = false;
    bool                     ignoreExtents = true;
    std::string              selectionName;
    int                      windowID = 0;

    //
    // Tickle the engine to create a vis window. Works around a bug in engine!
    //
    if(!createdVisWin)
    {
        createdVisWin = true;

        // Set some defaults.
        WindowAttributes     windowAtts;
        windowAtts.SetColorTables(*avtColorTables::Instance()->GetColorTables());
        AnnotationAttributes annotationAtts;
        AnnotationObjectList annotationObjectList;
        std::string          extStr("?");
        VisualCueList        visCues;
        int                  frameAndState[] = {0,0,0,0,0,0,0};
        double               viewExtents[] = {0., 1., 0., 1., 0., 1.};
        std::string          ctName("hot");

        engine.GetEngineMethods()->SetWinAnnotAtts(&windowAtts,
                               &annotationAtts,
                               &annotationObjectList,
                               extStr,
                               &visCues,
                               frameAndState,
                               viewExtents,
                               ctName,
                               windowID);
    }

    //
    // Determine the name of the mesh for this variable.
    //
    const avtDatabaseMetaData *md = GetMetaData(openFile);
    if(md == NULL)
    {
        EXCEPTION1(VisItException, "Can't get the metadata.");
    }
    std::string mesh = md->MeshForVar(var);
    // Add the metadata expressions to the known expressions.
    for(int i = 0; i < md->GetNumberOfExpressions(); ++i)
        combinedExprList.AddExpressions(*md->GetExpression(i));

    //
    // Get the SIL so we can make a SIL restriction.
    //
    const SILAttributes *silAtts = mdserver.GetMDServerMethods()->GetSIL(openFile, openTimeState,
                                                   treatAllDbsAsTimeVarying);
    if(silAtts == NULL)
    {
        EXCEPTION1(VisItException, "Can't get the SIL.");
    }
    avtSIL sil(*silAtts);
    avtSILRestriction_p silr = new avtSILRestriction(&sil);
    silr->SetTopSet(mesh.c_str());

    //
    // Start a new network
    //
    engine.GetEngineMethods()->ReadDataObject(openFileFormat,
                          openFile,
                          var,
                          openTimeState,
                          silr,
                          mAtts,  // lots of junk!
                          combinedExprList,
                          meshAtts,
                          treatAllDbsAsTimeVarying,
                          ignoreExtents,
                          selectionName,
                          windowID);
}
Esempio n. 7
0
int sil(int a){return !a?1:sil(a-1)*a;}