示例#1
0
CGeometricObjects::~CGeometricObjects()
{
	toBeDeleted.clear();
	while (!geoGroups.empty()) {
		DeleteGroup(geoGroups.begin()->first);
	}
}
示例#2
0
void CGeometricObjects::Update()
{
	while(!toBeDeleted.empty() && (toBeDeleted.begin()->first <= gs->frameNum)) {
		DeleteGroup(toBeDeleted.begin()->second);
		toBeDeleted.erase(toBeDeleted.begin());
	}
}
void CObjectProperty::Clear ( void )
{
    if ( m_pEditItem )
    {
        m_pEditItem->OnEndEdit();
        m_pEditItem->Enable ( FALSE );
    }
    SetCurSel (  NULL,TRUE);

    int iGroupSize = m_pGroups.size ( );
    for ( int iGroup = iGroupSize; iGroup > 0; iGroup-- )
    {
        int iSubSize = m_pGroups [ iGroup - 1 ].pProperty->GetSubItemsCount ( );
        for ( int iControl = iSubSize; iControl > 0; iControl-- )
        {
            DeleteControl ( iGroup - 1, iControl - 1 );
        }
        DeleteGroup ( iGroup );
    }

    AdjustLayout ( );

    m_iGroupCount = 0;

    m_bModified = false;
    m_iGroup	= 0;
    m_iIndex	= 0;

    m_pGroups.clear ( );
}
示例#4
0
void CGeometricObjects::Update()
{
	const auto iter = timedGroups.find(gs->frameNum);

	if (iter == timedGroups.end())
		return;

	for (const int groupID: iter->second) {
		DeleteGroup(groupID);
	}

	timedGroups.erase(iter->first);
}
void CBase_SampleChart::ClearTemporary()
{
	DeleteGroup(m_nTemporaryGroupID, false, false);
}
示例#6
0
void PeepsWindow::MessageReceived(BMessage *msg)
{
	switch(msg->what)
	{
		case B_ABOUT_REQUESTED:
		{
			be_app->PostMessage(msg);
			break;
		}
		case M_RUN_TOOL:
		{
			BString sig;
			if(msg->FindString("signature",&sig)==B_OK)
			{
				if(strcmp(sig.String(),"application/x-vnd.wgp-PeopleMover")==0)
				{
					be_roster->Launch(sig.String());
					break;
				}
				
				// Get the filename for the currently-selected person
				int32 selection=fPeopleList->CurrentSelection();
				if(selection<0)
					break;
				
				PeepsListItem *peepsitem=(PeepsListItem*)fPeopleList->ItemAt(selection);
				if(!peepsitem || peepsitem->IsGroup())
					break;
				
				PersonItem *personitem=(PersonItem*)peepsitem;
				PersonData *persondata=personitem->GetData();
				
				if(!persondata)
					break;
				
				entry_ref ref=persondata->FileRef();
				BPath path(&ref);
				
				char *launchv[1];
				launchv[0]=new char[255];
				
				sprintf(launchv[0],"%s",path.Path());
				
				be_roster->Launch(sig.String(),1,launchv,NULL);
				
				delete [] launchv[0];
			}
			break;
		}
		case M_SHOW_ACTIONS:
		{
			uint32 buttons;
			BPoint pt;
			
			fPeopleList->GetMouse(&pt,&buttons,false);
			pt.x=(pt.x>5)?pt.x-5:0;
			pt.y=(pt.y>5)?pt.y-5:0;
			fPeopleList->ShowContextMenu(fPeopleList->ConvertToScreen(pt));
			
			break;
		}
		case M_BITMAP_REMOVED:
		case M_PHOTO_MODIFIED:
		{
			fPeopleList->SaveImageData();
			break;
		}
		case B_REFS_RECEIVED:
		case B_SIMPLE_DATA:
		{
			entry_ref ref;
			if(msg->FindRef("refs",0,&ref)==B_OK)
			{
				if(!IsPerson(ref))
				{
					// Might be an image dropped on the photo view. find out which child is the
					// target
					BPoint pt;
					if(msg->FindPoint("_drop_offset",&pt)!=B_OK)
						break;
					
					BView *target=FindView(pt);
					if(!target || strcmp(target->Name(),"photoview")!=0)
						break;
					
					// This will set the image, if possible
					target->MessageReceived(msg);
					
					// Save the image data to a real file and attach the Person attributes
					// to it
					fPeopleList->SaveImageData();
				}
				
				// Offer to move/copy file if not in People directory
				BDirectory dir,peopledir("/boot/home/people");
				BEntry entry(&ref);
				entry.GetParent(&dir);
				if(dir!=peopledir)
				{
					BString refname(ref.name);
					BString errstr=TRANSLATE("%s is not currently stored in the People folder. Mr. Peeps! will not"
						" see it on startup unless it is stored there. Would you like to move it"
						" there?");
					char errmsg[errstr.CountChars() - 2 + refname.CountChars() + 1];
					sprintf(errmsg,errstr.String(),refname.String());
					
					BAlert *alert=new BAlert("Mr. Peeps!",errmsg,TRANSLATE("Move"),TRANSLATE("Don't Move"));
					if(alert->Go()==0)
					{
						entry.MoveTo(&peopledir);
						entry.GetRef(&ref);
					}
				}
				if(!SelectPerson(ref))
					AddPerson(ref,true);
			}
			break;
		}
		case M_PREV_ITEM:
		{
			if(fPeopleList->CountItems()==0)
				break;
				
			int32 selection=fPeopleList->CurrentSelection();

			if(!fPeopleList->IsFocus())
			{
				fPeopleList->MakeFocus(true);
				PeepsListItem *pitem=(PeepsListItem*)fPeopleList->ItemAt(selection);
				if(!pitem->IsGroup())
				{
					fPeopleList->SyncData((PersonItem*)pitem);
//					fPeopleList->SaveData();
				}
				fPeopleList->SaveData();
			}

			if(selection>=0)
			{
				if(selection>0)
					fPeopleList->Select(selection-1);
			}
			else
			{
				fPeopleList->Select(0L);
			}
			break;
		}
		case M_NEXT_ITEM:
		{
			if(fPeopleList->CountItems()==0)
				break;
				
			int32 selection=fPeopleList->CurrentSelection();

			if(!fPeopleList->IsFocus())
			{
				fPeopleList->MakeFocus(true);
				PeepsListItem *pitem=(PeepsListItem*)fPeopleList->ItemAt(selection);
				if(!pitem->IsGroup())
				{
					fPeopleList->SyncData((PersonItem*)pitem);
//					fPeopleList->SaveData();
				}
				fPeopleList->SaveData();
			}
			
			if(selection==fPeopleList->CountItems()-1 || selection<0)
				fPeopleList->Select(fPeopleList->CountItems()-1);
			else
				fPeopleList->Select(selection+1);
			
			break;
		}
		case M_MOD_DATA:
		case M_SAVE:
		{
			fPeopleList->SyncData(NULL);
			fPeopleList->SaveData();
			break;
		}
		case M_ADD_PERSON:
		{
			entry_ref ref;
			
			status_t stat=CreatePerson(&ref);
			if(stat==B_FILE_EXISTS)
			{
				for(int32 i=0;i<gPeopleData.CountItems(); i++)
				{
					PersonData *pdata=(PersonData*)gPeopleData.ItemAt(i);
					
					if(BString(TRANSLATE("New Person")).ICompare(pdata->Name())==0)
					{
						int32 selection=fPeopleList->CurrentSelection();
						if(selection>=0)
						{
							PeepsListItem *peepsitem=(PeepsListItem*)fPeopleList->ItemAt(selection);
							if(peepsitem && !peepsitem->IsGroup())
								fPeopleList->Collapse(fPeopleList->Superitem(peepsitem));
						}
						PersonItem *pitem=pdata->InstanceAt(0);
						GroupItem *gitem=(GroupItem*)fPeopleList->Superitem(pitem);
						if(!gitem->IsExpanded())
							fPeopleList->Expand(gitem);
						fPeopleList->Select(fPeopleList->IndexOf(pitem));
						fPeopleList->ScrollToSelection();
						break;
					}
				}
			}
			else
			{
				// Add the current group to the New Person's file so that we end up staying
				// in the current group.
				if(stat==B_OK)
				{
					int32 selection=fPeopleList->CurrentSelection();
					BString groupstr(TRANSLATE("Ungrouped"));

					if(selection>=0)
					{
						PeepsListItem *currentitem=(PeepsListItem*)fPeopleList->ItemAt(selection);
						if(currentitem->IsGroup())
							groupstr=currentitem->Name();
						else
							groupstr=((PersonItem*)currentitem)->Group();
					}
					PersonData *pdata=new PersonData(ref);
					pdata->SetGroup(groupstr.String());
					pdata->SetName(TRANSLATE("New Person"));
					pdata->SaveToFile();
					delete pdata;
					AddPerson(ref,true);
					SortList();
					SelectPerson(TRANSLATE("New Person"));
					dataview->SetFirstFieldFocus();
				}
			}
			break;
		}
		case M_DELETE_PERSON:
		{
			int32 selection=fPeopleList->CurrentSelection();
			if(selection<0)
				break;
			PeepsListItem *item=(PeepsListItem*)fPeopleList->ItemAt(selection);
			if(item->IsGroup())
				DeleteGroup((GroupItem*)item);
			else
			{
				DeletePerson(((PersonItem*)item)->GetData());
			}
			break;
		}
		case M_DISABLE_DELETE:
		{
			BMenuItem *item=fPeopleMenu->FindItem(TRANSLATE("Move To Trash"));
			if(item)
				item->SetEnabled(false);
			break;
		}	
		case M_ENABLE_DELETE:
		{
			BMenuItem *item=fPeopleMenu->FindItem(TRANSLATE("Move To Trash"));
			if(item)
				item->SetEnabled(true);
			break;
		}	
		case M_SET_LANGUAGE:
		{
			// Restart MrPeeps!
			gRestartApp=true;
			
			int32 language;
			if(msg->FindInt32("index",&language)!=B_OK)
				break;
			
			BMenuItem *item = fLanguageMenu->ItemAt(language);
			if(!item)
				break;
			
			fLocale = item->Label();
			WriteLocaleSettings();
			
			be_app->PostMessage(B_QUIT_REQUESTED);
			break;
		}
		case M_HANDLE_NO_SELECTION:
		{
			// This is the initial case. No selection means quite a few different
			// menu items are disabled.
			fTabMenu->SetEnabled(false);
			fEditMenu->SetEnabled(false);
			
			if(fToolPeopleAtAGlance)
				fToolPeopleAtAGlance->SetEnabled(false);
			
			if(fToolVCardExport)
				fToolVCardExport->SetEnabled(false);
			
			UpdateActions(true);
			break;
		}	
		case M_HANDLE_GROUP_SELECTION:
		{
			// This is the initial case. No selection means quite a few different
			// menu items are disabled.
			fTabMenu->SetEnabled(false);
			fEditMenu->SetEnabled(true);
			
			if(fToolPeopleAtAGlance)
				fToolPeopleAtAGlance->SetEnabled(false);
			
			if(fToolVCardExport)
				fToolVCardExport->SetEnabled(false);
			
			UpdateActions(true);
			break;
		}	
		case M_HANDLE_PERSON_SELECTION:
		{
			// This is the initial case. No selection means quite a few different
			// menu items are disabled.
			fTabMenu->SetEnabled(true);
			fEditMenu->SetEnabled(true);
			
			if(fToolPeopleAtAGlance)
				fToolPeopleAtAGlance->SetEnabled(true);
			
			if(fToolVCardExport)
				fToolVCardExport->SetEnabled(true);
			
			UpdateActions(false);
			break;
		}	
		case M_SEND_PERSONAL_EMAIL:
		{
			if(dataview->Email())
			{
				BMessage *emailmsg=new BMessage(M_SEND_EMAIL);
				emailmsg->AddString("address",dataview->Email());
				be_app->PostMessage(emailmsg);
			}
			break;
		}
		case M_SEND_WORK_EMAIL:
		{
			if(dataview->WorkEmail())
			{
				BMessage *emailmsg=new BMessage(M_SEND_EMAIL);
				emailmsg->AddString("address",dataview->WorkEmail());
				be_app->PostMessage(emailmsg);
			}
			break;
		}
		case M_SEND_ALT_EMAIL:
		{
			if(dataview->Email3())
			{
				BMessage *emailmsg=new BMessage(M_SEND_EMAIL);
				emailmsg->AddString("address",dataview->Email3());
				be_app->PostMessage(emailmsg);
			}
			break;
		}
		case M_BROWSE_WWW_HOME:
		{
			if(dataview->URL())
			{
				BMessage *wwwmsg=new BMessage(M_LAUNCH_BROWSER);
				wwwmsg->AddString("address",dataview->URL());
				be_app->PostMessage(wwwmsg);
			}
			break;
		}
		case M_BROWSE_WWW_WORK:
		{
			if(dataview->WorkURL())
			{
				BMessage *wwwmsg=new BMessage(M_LAUNCH_BROWSER);
				wwwmsg->AddString("address",dataview->WorkURL());
				be_app->PostMessage(wwwmsg);
			}
			break;
		}
		case M_BROWSE_WWW_ALT:
		{
			if(dataview->OtherURL())
			{
				BMessage *wwwmsg=new BMessage(M_LAUNCH_BROWSER);
				wwwmsg->AddString("address",dataview->OtherURL());
				be_app->PostMessage(wwwmsg);
			}
			break;
		}
		case M_TAB_1:
		{
			fPeopleList->SyncData();
			fPeopleList->SaveData();
			dataview->ShowTab(0);
			if(!fPeopleList->IsFocus())
				dataview->SetFirstFieldFocus();
			break;
		}
		case M_TAB_2:
		{
			fPeopleList->SyncData();
			fPeopleList->SaveData();
			dataview->ShowTab(1);
			if(!fPeopleList->IsFocus())
				dataview->SetFirstFieldFocus();
			break;
		}
		case M_TAB_3:
		{
			fPeopleList->SyncData();
			fPeopleList->SaveData();
			dataview->ShowTab(2);
			if(!fPeopleList->IsFocus())
				dataview->SetFirstFieldFocus();
			break;
		}
		case M_TAB_4:
		{
			fPeopleList->SyncData();
			fPeopleList->SaveData();
			dataview->ShowTab(3);
			if(!fPeopleList->IsFocus())
				dataview->SetFirstFieldFocus();
			break;
		}
		case M_TAB_5:
		{
			fPeopleList->SyncData();
			fPeopleList->SaveData();
			dataview->ShowTab(4);
			if(!fPeopleList->IsFocus())
				dataview->SetFirstFieldFocus();
			break;
		}
		case M_UNDO:
		{
			dataview->UndoField();
			break;
		}
		case M_CUT:
		{
			dataview->CutField();
			break;
		}
		case M_COPY:
		{
			dataview->CopyField();
			break;
		}
		case M_PASTE:
		{
			dataview->PasteField();
			break;
		}
		case B_NODE_MONITOR:
		{
			HandleNodeMonitoring(msg);
			break;
		}
		default:
		{
			BWindow::MessageReceived(msg);
			break;
		}
	}
}