예제 #1
0
파일: bv2recents.c 프로젝트: apla/beevee
void AddRecentFile (const char *filename)
{
    int i;
    char mf[256];
    char mf2[256];
    sdata_init(&myrecents.rct);
    ReadRecentFilesInReg();
    strcpy (mf2, filename);
    UpperText (mf2);
    for (i=0;i<sdata_jumlahdata(&myrecents.rct);i++)
    {
        sdata_ambildatanomor(&myrecents.rct, i, mf);
        UpperText (mf);
        if (strcmp(mf,mf2)==0)
        {
            sdata_hapusini(&myrecents.rct);
            break;
        }
    }
    if (sdata_jumlahdata(&myrecents.rct)>=MAX_RECENTSLIST)
        sdata_hapusekor (&myrecents.rct);
    sdata_sisipkepala (&myrecents.rct, (void *)filename, strlen(filename)+1);
    WriteRecentFilesIntoReg();
    sdata_hapussemua (&myrecents.rct);
}
예제 #2
0
파일: fabfile.c 프로젝트: apla/beevee
int fabmaster_baca_fab (const char *namafile, boardptr bptr)
{
	FILE *f;
	char teks[256];
	char line[256];
	//char nama[64];
	int p=0;
	//int i=0;
	FABM_AKSI2 aksi = FABM_NONE;
	//int node_id = -1;

#ifdef _BEEVEE_VERBOSE_
printf ("fabmaster_baca_fab %s ...\n", namafile);
#endif

	if ( (f=fopen(namafile,"r"))!=NULL )
	{
		//nama[0] = 0;
		line[0] = 0;
		while (1)
		{
			if (p==0 || line[p]==0)
			{
                p = 0;
                memset (line,0,256);
                fgets (line, 255, f);
                if (line[0]==0 && line[1]!=0)
                    line[0] = ' ';
                //if (i++<4) printf ("%d: %s",i,line);
                if (feof(f))
                    break;
			}
			//else
            //    printf (line);

			ReplaceChar (line, '\t',' ');
			ReplaceChar (line, 0xa, 0xd);
			TrimLeft(line);
			TrimRight(line);
			UpperText(line);


			if (GetLine(line,teks,&p))
			{
				if (teks[0]=='R')
                    aksi = FABM_HEADER;
				else if (teks[0]=='A')
				{
					if (strcmp (teks, FABM_PLACES_STR)==0)
						aksi = FABM_PLACES;
					else if (strcmp (teks, FABM_CONNECTIONS_STR)==0)
						aksi = FABM_CONNECTIONS;
                    else if (strcmp (teks, FABM_ASSEMBLY_STR)==0)
                        aksi = FABM_ASSEMBLY;
                    else if (strcmp (teks, FABM_PINS_STR)==0)
                        aksi = FABM_PINS;
                    else if (strcmp (teks, FABM_VIAS_STR)==0)
                        aksi = FABM_VIAS;
                    else if (strcmp (teks, FABM_TRACES_STR)==0)
                        aksi = FABM_TRACES;
					else
						aksi = FABM_NONE;

					//printf ("%d %s\n",aksi,teks);


					teks[0] = 0;
				}

				//if (aksi == FABM_NONE)
				//	printf ("%s\n", teks);

				if (aksi != FABM_NONE && teks[0]=='S')
				{
					//printf (teks);
					switch (aksi)
					{
					case FABM_PLACES:
						fabmaster_baca_fab_place (teks, &bptr->skomp);
						break;
                    case FABM_CONNECTIONS:
                        fabmaster_baca_fab_connection (teks, &bptr->snode, &bptr->skonek);
                        break;
                    case FABM_ASSEMBLY:
                        fabmaster_baca_fab_assembly (teks, &bptr->skomp);
                        break;
                    case FABM_PINS:
                        fabmaster_baca_fab_pins (teks, &bptr->skonek, &bptr->stestpoint);
                        break;
                    case FABM_VIAS:
                        fabmaster_baca_fab_vias (teks, &bptr->snode, &bptr->stestpoint, &bptr->strace);
                        break;
                    case FABM_TRACES:
                        fabmaster_baca_fab_traces (teks, &bptr->snode, &bptr->strace);
                        break;
					}
				}
				else if (aksi==FABM_HEADER)
				{
				    fabmaster_baca_fab_header (teks, bptr);
				}

			}
			else
			{
				//aksi = FABM_NONE;
				p = 0;
			}
		}
		fclose (f);

	}
	else
	{
#ifdef _BEEVEE_VERBOSE_
		printf ("Ga bisa baca %s\n", namafile);
#endif
		return 0;
	}


#ifdef _BEEVEE_VERBOSE_
    printf ("Jumlah Node %d\n", sdata_jumlahdata(&bptr->snode));
    printf ("Jumlah Komponen %d\n", sdata_jumlahdata(&bptr->skomp));
    printf ("Jumlah Trace %d\n", sdata_jumlahdata(&bptr->strace));
    printf ("Jumlah Koneksi %d\n", sdata_jumlahdata(&bptr->skonek));
#endif


    if (sdata_jumlahdata(&bptr->snode)==0 ||
        sdata_jumlahdata(&bptr->skomp)==0 ||
        sdata_jumlahdata(&bptr->strace)==0 ||
        sdata_jumlahdata(&bptr->skonek)==0)
        {
            board_hapus(bptr);
            return 0;
        }
    board_hitung_ataskiri (bptr);
	bptr->punya_tempat = 1;

    return 1;
}
예제 #3
0
Boolean OverridePopClick(DialogPtr theDialog, short itemHit, long *result)
{
	GrafPtr				savePort;
	MenuHandle			theMenu;
	short				count;
	char				name[256],str[256];
	short				i;
	
	if(gVUTrick == gVUTrick2) return false; // we will not override PopClick
	
	for ( i = 0 ; i < sa_numPopUps ; i++ )
		if ( sa_popTable[i].dialogPtr == theDialog && sa_popTable[i].popupItemNum == itemHit )
			break;
	
	if (i == sa_numPopUps || sa_popTable[i].bStatic) {
		*result = 0;
		return false; // we will not override PopClick
	}
	
	// else we have found the i value
	
	theMenu = GetMenuHandle(sa_popTable[i].menuID);
	GetMenuItemText(theMenu, sa_popTable[i].lastItemSelected, (StringPtr)str); 
	my_p2cstr((StringPtr)str); 
	GetPortGrafPtr(&savePort);
	if(REQUEST("enter value to select",str,str) == ok)
	{
		short numItems = CountMenuItems(theMenu);
		UpperText(str,strlen(str));
		//UppercaseText(str,strlen(str),smSystemScript);	//smCurrentScript
		// find the string	
		for ( count = numItems ; count >= 1 ; count-- ) 
		{
			GetMenuItemText(theMenu, count, (StringPtr)name);
			my_p2cstr((StringPtr)name); 
			UpperText(name,strlen(name));
			//UppercaseText(name,strlen(name),smSystemScript);	//smCurrentScript
			if (strcmp(str,name) == 0) {
				if (!MenuItemEnabled(theMenu, count)) {
					REQUEST("Item found but disabled",str,str);
					*result = 0;
					SetPortGrafPort(savePort);
					return false;
				}
				else
					break; // we found it
			}
		}
		if(count == 0) 
		{
			// we did not find the string
			REQUEST("Could not find string in Menu",str,str);
			*result = 0;
			SetPortGrafPort(savePort);
			return false;
		}
		else
		{
			// count holds the menuItem Num we want
			SetItemMark(theMenu, sa_popTable[i].lastItemSelected, noMark);
			sa_popTable[i].lastItemSelected = count;
			SetItemMark(theMenu, sa_popTable[i].lastItemSelected, kCheckMark);
			*result = sa_popTable[i].menuID*0x10000 + sa_popTable[i].lastItemSelected;
		}
	
	}
	SetPortGrafPort(savePort);
	PopDraw(sa_popTable[i].dialogPtr, sa_popTable[i].popupItemNum);
	return(true); //we have overriden PopClick
}