Пример #1
0
void
NetPrefsServerView::RemoveServer ()
{
  BAutolock lock (Looper ());

  if (!lock.IsLocked ())
    return;

  BRow *row (fServerList->CurrentSelection ());
  if (row)
  {
    BStringField *field ((BStringField *) row->GetField (1));

    int32 count;
    ssize_t size;
    type_code type;
    fActiveNetwork->GetInfo ("server", &type, &count);

    const ServerData *data;
    for (int32 i = 0; i < count; i++)
    {
      fActiveNetwork->FindData ("server", B_ANY_TYPE, i, reinterpret_cast < const void **>(&data),
        &size);

      if (!strcmp (data->serverName, field->String ()))
      {
        fActiveNetwork->RemoveData ("server", i);
        break;
      }
	}
    fServerList->RemoveRow (row);
    delete row;
  }
}
Пример #2
0
void AddTorrentWindow::UpdateFileList()
{	
	//
	//
	int 	 fileCount = fTorrent->Info()->fileCount;
	tr_file* fileList  = fTorrent->Info()->files;
	
	for( int i = 0; i < fileCount; i++ )
	{
		char FormatBuffer[128] = { 0 };
		BRow* row = new BRow(FILE_COLUMN_HEIGHT);
		
		const char* name = fTorrent->IsFolder() ? (strchr(fileList[i].name, '/') + 1) : fileList[i].name;
		
		//
		//
		//
		BString FileExtension = B_EMPTY_STRING;
		BString FilePath = fileList[i].name;
		FilePath.CopyInto(FileExtension, FilePath.FindLast('.') + 1, FilePath.CountChars());
		
		
		const char* info = tr_formatter_mem_B(FormatBuffer, fileList[i].length, sizeof(FormatBuffer));;
		const BBitmap* icon = GetIconFromExtension(FileExtension);
		
		row->SetField(new FileField(icon, name, info), COLUMN_FILE_NAME);
		row->SetField(new CheckBoxField(true), COLUMN_FILE_DOWNLOAD);
		////row->SetField(new BIntegerField(PeerStatus[i].progress * 100.0), COLUMN_PEER_PROGRESS);
		
		fFileList->AddRow(row, i);

	} 	
}
Пример #3
0
void
NotificationsView::MessageReceived(BMessage* msg)
{
	switch (msg->what) {
		case kApplicationSelected:
		{
			BRow* row = fApplications->CurrentSelection();
			if (row == NULL)
				return;
			BStringField* appName
				= dynamic_cast<BStringField*>(row->GetField(kAppIndex));
			if (appName == NULL)
				break;

			appusage_t::iterator it = fAppFilters.find(appName->String());
			if (it != fAppFilters.end())
				_Populate(it->second);

			break;
		}
		case kNotificationSelected:
			break;
		default:
			BView::MessageReceived(msg);
			break;
	}
}
Пример #4
0
void
SearchView::MessageReceived(BMessage* message)
{
    switch (message->what) {
        case M_START:
        {
        	fSearchTC->MakeFocus(false);
        	fSearchListView->Clear();
        	int32 flag = 0;
        	
        	if (fMatchCaseCB->Value() != false)
        		flag |= SEARCH_MATCH_CASE;
        		
        	if (fWholeWordCB->Value() != false)
        		flag |= SEARCH_WHOLE_WORD;
        	
        	fEngine->FindString(fSearchTC->Text(), Window(), this, flag);
        	break;
        }
        
        case M_TEXT_CHANGED:
        {
        	fSearchListView->Clear();
        	int32 flag = 0;
        	
        	if (fMatchCaseCB->Value() != false)
        		flag |= SEARCH_MATCH_CASE;
        		
        	if (fWholeWordCB->Value() != false)
        		flag |= SEARCH_WHOLE_WORD;
        	
        	fEngine->FindString(fSearchTC->Text(), Window(), this, flag);
        	break;
        }
        	
      	case MSG_SEARCH_RESULT:
      	{
      		int32 page = 0;
      		message->FindInt32("page", &page);
      		BString context;
      		message->FindString("context", &context);
      		BRect rect;
      		message->FindRect("rect", &rect);
      		fSearchListView->fRectVec.push_back(rect);
      		
      		BRow*	row = new BRow();
			row->SetField(new BIntegerField(page + 1), 0);
			row->SetField(new BStringField(context), 1);
			fSearchListView->AddRow(row);
      		
      		break;
      	}
        
        default:
        	BGroupView::MessageReceived(message);
        	break;
    }
}
/**
 *	@brief	Gets a string at specified index from the control.
 *	@param[in]	rowIndex		row index
 *	@param[in]	columnIndex		column index
 *	@param[out]	text	a string value is returned.
 */
void BeColumnListViewAdapter::GetItemText(SInt32 rowIndex, SInt32 columnIndex, MBCString& text)
{
	BColumnListView* listView = getColumnListView();
	BRow* row = listView->RowAt(rowIndex);
	BStringField* field = dynamic_cast<BStringField*>(row->GetField(columnIndex));
	if (NULL != field)
	{
		text = field->String();
	}
}
Пример #6
0
void MainWindow::DoResume(void)
{
	BRow*		selected = NULL;
	while ((selected = teamView->CurrentSelection(selected))) {
		// is a team or thread?
		if (selected->HasLatch())
			for (int i = 0; i < teamView->CountRows(selected); i++)
				resume_thread(((ThreadItem *)teamView->RowAt(i, selected))->thread);
		else
			resume_thread(((ThreadItem *)selected)->thread);
	}
}
Пример #7
0
void MainWindow::DoPriority(int32 priority)
{
	BRow*		selected = NULL;
	while ((selected = teamView->CurrentSelection(selected))) {
		// is a team or thread?
		if (selected->HasLatch())
			for (int i = 0; i < teamView->CountRows(selected); i++)
				set_thread_priority(((ThreadItem *)teamView->RowAt(i, selected))->thread, priority);
		else
			set_thread_priority(((ThreadItem *)selected)->thread, priority);
	}
}
Пример #8
0
void
NotificationsView::_PopulateApplications()
{
	appusage_t::iterator it;

	fApplications->Clear();

	for (it = fAppFilters.begin(); it != fAppFilters.end(); ++it) {
		BRow* row = new BRow();
		row->SetField(new BStringField(it->first.String()), kAppIndex);
		fApplications->AddRow(row);
	}
}
Пример #9
0
void MainWindow::DoKill(void)
{
	BRow*		selected = NULL;
	while ((selected = teamView->CurrentSelection(selected))) {
		if (selected->HasLatch())
			kill_team(((TeamItem *)selected)->team);
		else
			kill_thread(((ThreadItem *)selected)->thread);

		if (teamView->IndexOf(selected) == teamView->CountRows() - 1)
			teamView->MoveToRow(teamView->IndexOf(selected) - 1);
		else
			teamView->MoveToRow(teamView->IndexOf(selected) + 1);
	}
}
Пример #10
0
void BudgetWindow::RefreshCategories(void)
{
	fCategoryList->Clear();
	fIncomeRow = new BRow();
	fCategoryList->AddRow(fIncomeRow);
	fSpendingRow = new BRow();
	fCategoryList->AddRow(fSpendingRow);
	fIncomeRow->SetField(new BStringField(TRANSLATE("Income")),0);
	fSpendingRow->SetField(new BStringField(TRANSLATE("Spending")),0);

	CppSQLite3Query query = gDatabase.DBQuery("select category,amount,period,isexpense from "
											"budgetlist order by category",
											"BudgetWindow::RefreshCategories");
	float maxwidth=fCategoryList->StringWidth("Category");
	while(!query.eof())
	{
		BString cat = DeescapeIllegalCharacters(query.getStringField(0));
		Fixed amount;
		amount.SetPremultiplied(query.getInt64Field(1));
		BudgetPeriod period = (BudgetPeriod)query.getIntField(2);

		BRow *row = new BRow();

		if(query.getIntField(3)==0)
			fCategoryList->AddRow(row,fIncomeRow);
		else
			fCategoryList->AddRow(row,fSpendingRow);

		row->SetField(new BStringField(cat.String()),0);

		BString amountstr;
		gDefaultLocale.CurrencyToString(amount.AbsoluteValue(),amountstr);
		amountstr.Truncate(amountstr.FindFirst(gDefaultLocale.CurrencyDecimal()));
		amountstr.RemoveFirst(gDefaultLocale.CurrencySymbol());

		row->SetField(new BStringField(amountstr.String()),1);

		float tempwidth = fCategoryList->StringWidth(cat.String());
		maxwidth = MAX(tempwidth,maxwidth);

		row->SetField(new BStringField(BudgetPeriodToString(period).String()),2);

		query.nextRow();
	}
	fCategoryList->ColumnAt(0)->SetWidth(maxwidth+30);
	fCategoryList->ExpandOrCollapse(fIncomeRow,true);
	fCategoryList->ExpandOrCollapse(fSpendingRow,true);
}
Пример #11
0
void
NotificationsView::_Populate(AppUsage* usage)
{
	// Sanity check
	if (!usage)
		return;

	int32 size = usage->Notifications();

	if (usage->Allowed() == false)
		fBlockAll->SetValue(B_CONTROL_ON);

	fNotifications->Clear();

	for (int32 i = 0; i < size; i++) {
		NotificationReceived* notification = usage->NotificationAt(i);
		time_t updated = notification->LastReceived();
		const char* allow = notification->Allowed() ? B_TRANSLATE("Yes")
			: B_TRANSLATE("No");
		const char* type = "";

		switch (notification->Type()) {
			case B_INFORMATION_NOTIFICATION:
				type = B_TRANSLATE("Information");
				break;
			case B_IMPORTANT_NOTIFICATION:
				type = B_TRANSLATE("Important");
				break;
			case B_ERROR_NOTIFICATION:
				type = B_TRANSLATE("Error");
				break;
			case B_PROGRESS_NOTIFICATION:
				type = B_TRANSLATE("Progress");
				break;
			default:
				type = B_TRANSLATE("Unknown");
		}

		BRow* row = new BRow();
		row->SetField(new BStringField(notification->Title()), kTitleIndex);
		row->SetField(new BDateField(&updated), kDateIndex);
		row->SetField(new BStringField(type), kTypeIndex);
		row->SetField(new BStringField(allow), kAllowIndex);

		fNotifications->AddRow(row);
	}
}
Пример #12
0
InfoPeerView::InfoPeerView(const TorrentObject* torrent)
	:
	BColumnListView("InfoPeerView", 0, B_PLAIN_BORDER, true),
	fTorrent(torrent)
{
	SetColumnFlags(B_ALLOW_COLUMN_RESIZE);
	
	GraphColumn* fProgressColumn = NULL;
	
	AddColumn(new BStringColumn("IP Address", 180, 50, 500, B_TRUNCATE_MIDDLE), COLUMN_PEER_ADDRESS);
	AddColumn(new BStringColumn("Client", 140, 50, 500, B_TRUNCATE_MIDDLE), COLUMN_PEER_CLIENT);
	AddColumn(fProgressColumn = new GraphColumn("Progress", 80, 80, 140), COLUMN_PEER_PROGRESS);
	AddColumn(new BIntegerColumn("Port", 60, 60, 60), COLUMN_PEER_PORT);

	//
	//
	//
	fProgressColumn->SetTextColor(make_color(0, 0, 0));
	fProgressColumn->SetBackgroundColor(make_color(77, 164, 255));

	
	//
	//
	//
	int peerCount = 0;
	tr_peer_stat* PeerStatus = tr_torrentPeers( fTorrent->Handle(), &peerCount );
	
	
	
	for( int i = 0; i < peerCount; i++ )
	{
		const tr_peer_stat* peer = &PeerStatus[i];
		BRow* row = new BRow();
		
		
		row->SetField(new BStringField(peer->addr), COLUMN_PEER_ADDRESS);
		row->SetField(new BStringField(peer->client), COLUMN_PEER_CLIENT);
		row->SetField(new BIntegerField(peer->progress * 100.0), COLUMN_PEER_PROGRESS);
		row->SetField(new BIntegerField(peer->port), COLUMN_PEER_PORT);
		
		AddRow(row);
	}
	tr_torrentPeersFree( PeerStatus, peerCount );
}
Пример #13
0
void
NetPrefsServerView::AddServer (const ServerData * data)
{
  BAutolock lock (Looper ());
  if (!lock.IsLocked ())
    return;

  BRow *row (new BRow);
  switch (data->state)
    {
      case SERVER_PRIMARY:
        row->SetField (new BStringField ("*"), 0);
        break;

      case SERVER_SECONDARY:
        row->SetField (new BStringField ("+"), 0);
        break;

      case SERVER_DISABLED:
        row->SetField (new BStringField ("-"), 0);
        break;
    }
  BString server ("");
  server = data->serverName;
  BStringField *serverField (new BStringField (server.String ()));
  row->SetField (serverField, 1);
  server = "";
  server << data->port;
  BStringField *portField (new BStringField (server.String ()));
  row->SetField (portField, 2);
  fServerList->AddRow (row);
}
Пример #14
0
void AddTorrentWindow::OnButtonAddClick()
{
	tr_file_index_t* files = new tr_file_index_t[ fTorrent->Info()->fileCount ];
	uint32 fileCount = 0;
	
	//
	// Just for test.
	//
	int32 RowCount = fFileList->CountRows();
	
	for( int32 i = 0; i < RowCount; i++ )
	{
		BRow* row = fFileList->RowAt( i );

		CheckBoxField* checkField = static_cast<CheckBoxField*>(row->GetField(COLUMN_FILE_DOWNLOAD));
		
		if( !checkField->Selected() )
			files[fileCount++] = i;
	}
	tr_torrentSetFileDLs(const_cast<tr_torrent*>(fTorrent->Handle()), files, fileCount, false);
	
	//
	//
	//
	BMessage* message = new BMessage(MSG_OPEN_TORRENT_RESULT);
	
	message->AddBool("add", true);
	message->AddBool("start", fStartCheckBox->Value() == B_CONTROL_ON);
	message->AddPointer("torrent", fTorrent);
	
	be_app->PostMessage(message);
	
	delete[] files;
	
	//
	// 
	//
	fCancelAdd = false;
	Quit();
}
Пример #15
0
void
PriorityMenu::Update()
{
	BRow* selected = fTeamListView->CurrentSelection(NULL);
	int32 priority;
	bool enabled = selected != NULL;
	
	if (enabled && fTeamListView->CurrentSelection(selected) == NULL && !selected->HasLatch()) 
		priority = ((ThreadItem *)selected)->priority;
	else 
		priority = -1;

	if (priority != fPriority || fEnabled != enabled)
	{   
		fPriority = priority;
		fEnabled = enabled;
		if (CountItems() > 0) 
			RemoveItems(0, CountItems(), true);
		if (CountItems() < 1)
			BuildMenu();
	}

}
Пример #16
0
void
NetPrefsServerView::MessageReceived (BMessage * msg)
{
  switch (msg->what)
  {
    case M_SERVER_ITEM_SELECTED:
      {
        BRow *row (fServerList->CurrentSelection ());
        if (row)
        {
          fEditButton->SetEnabled (true);
          fRemoveButton->SetEnabled (true);
        }
        else
        {
          fEditButton->SetEnabled (false);
          fRemoveButton->SetEnabled (false);
        }
      }
      break;

    case M_SERVER_ADD_ITEM:
      {
        BMessenger msgr (fEntryWin);
        if (msgr.IsValid ())
          fEntryWin->Activate ();
        else
        {
          fEntryWin = new ServerEntryWindow (this, new BMessage (M_SERVER_RECV_DATA), NULL, 0);
          fEntryWin->Show ();
        }
      }
      break;

    case M_SERVER_EDIT_ITEM:
      {
        BMessenger msgr (fEntryWin);
        if (msgr.IsValid ())
          fEntryWin->Activate ();
        else
        {
          BRow *row (fServerList->CurrentSelection ());
          if (!row)
            break;
          int32 count (0);
          ssize_t size (0);
          type_code type;
          fActiveNetwork->GetInfo ("server", &type, &count);
          const ServerData *compData;
          for (int32 i = 0; i < count; i++)
          {
            fActiveNetwork->FindData ("server", B_RAW_TYPE, i, reinterpret_cast < const void **>(&compData), &size);
            if (!strcmp (compData->serverName, ((BStringField *) row->GetField (1))->String ()))
              break;
	      }
          BMessage *invoke (new BMessage (M_SERVER_RECV_DATA));
          invoke->AddBool ("edit", true);
          fEntryWin = new ServerEntryWindow (this, invoke, compData, size);
          fEntryWin->Show ();
          }
      }
      break;


    case M_SERVER_REMOVE_ITEM:
      {
        RemoveServer ();
        fNetWin.SendMessage (M_SERVER_DATA_CHANGED);
      }
      break;

    case M_SERVER_RECV_DATA:
      {
        const ServerData *data;
        ssize_t size;
        Window ()->DisableUpdates ();
        msg->FindData ("server", B_RAW_TYPE, reinterpret_cast < const void **>(&data), &size);
        if (msg->HasBool ("edit"))
          RemoveServer ();
        UpdateNetworkData (data);
        AddServer (data);
        Window ()->EnableUpdates ();
        fNetWin.SendMessage (M_SERVER_DATA_CHANGED);
      }
      break;

    default:
      BView::MessageReceived (msg);
      break;
  }
}
Пример #17
0
void
ResView::MessageReceived(BMessage *msg)
{
	switch (msg->what) {
		case M_NEW_FILE: {
			BRect r(100, 100, 400, 400);
			if (Window())
				r = Window()->Frame().OffsetByCopy(10, 10);
			ResWindow *win = new ResWindow(r);
			win->Show();
			break;
		}
		case M_OPEN_FILE: {
			be_app->PostMessage(M_SHOW_OPEN_PANEL);
			break;
		}
		case B_CANCEL: {
			if (fSaveStatus == FILE_QUIT_AFTER_SAVE)
				SetSaveStatus(FILE_DIRTY);
			break;
		}
		case B_SAVE_REQUESTED: {
			entry_ref saveDir;
			BString name;
			if (msg->FindRef("directory",&saveDir) == B_OK &&
				msg->FindString("name",&name) == B_OK) {
				SetTo(saveDir,name);
				SaveFile();
			}
			break;
		}
		case M_SAVE_FILE: {
			if (!fRef)
				fSavePanel->Show();
			else
				SaveFile();
			break;
		}
		case M_SHOW_SAVE_PANEL: {
			fSavePanel->Show();
			break;
		}
		case M_QUIT: {
			be_app->PostMessage(B_QUIT_REQUESTED);
			break;
		}
		case B_REFS_RECEIVED: {
			int32 i = 0;
			entry_ref ref;
			while (msg->FindRef("refs", i++, &ref) == B_OK)
				AddResource(ref);
			break;
		}
		case M_SELECT_FILE: {
			fOpenPanel->Show();
			break;
		}
		case M_DELETE_RESOURCE: {
			DeleteSelectedResources();
			break;
		}
		case M_EDIT_RESOURCE: {
			BRow *row = fListView->CurrentSelection();
			TypeCodeField *field = (TypeCodeField*)row->GetField(1);
			gResRoster.SpawnEditor(field->GetResourceData(), this);
			break;
		}
		case M_UPDATE_RESOURCE: {
			ResourceData *item;
			if (msg->FindPointer("item", (void **)&item) != B_OK)
				break;
			
			for (int32 i = 0; i < fListView->CountRows(); i++) {
				BRow *row = fListView->RowAt(i);
				TypeCodeField *field = (TypeCodeField*)row->GetField(1);
				if (!field || field->GetResourceData() != item)
					continue;
				
				UpdateRow(row);
				break;
			}
			break;
		}
		default:
			BView::MessageReceived(msg);
	}
}
Пример #18
0
void ReportWindow::ComputeNetWorth(void)
{
	// Total of all accounts
	// Calculate the number of columns and the starting date for each one
	BObjectList<time_t> timelist(20,true);
	
	if(fSubtotalMode != SUBTOTAL_NONE)
	{
		for(time_t t=fStartDate; t<fEndDate; )
		{
			time_t *item = new time_t(t);
			timelist.AddItem(item);
			
			switch(fSubtotalMode)
			{
				case SUBTOTAL_MONTH:
				{
					t = IncrementDateByMonth(t);
					break;
				}
				case SUBTOTAL_QUARTER:
				{
					t = IncrementDateByQuarter(t);
					break;
				}
				case SUBTOTAL_YEAR:
				{
					t = IncrementDateByYear(t);
					break;
				}
				default:
				{
					t = fEndDate;
					break;
				}
			}
		}
	}
	timelist.AddItem(new time_t(fEndDate));
	
	ReportGrid	accountgrid(1, timelist.CountItems());
	
	BString longestname(TRANSLATE("Total Worth"));
	int longestnamelength = longestname.CountChars();
			

	for(int32 subtotal_index=0; subtotal_index<timelist.CountItems(); subtotal_index++)
	{
		time_t subtotal_start = *((time_t*)timelist.ItemAt(subtotal_index));
		
		char rowtitle[128];
		struct tm *timestruct = localtime(&subtotal_start);
		
		BString formatstring;
		if(gCurrentLocale.DateFormat()==DATE_MDY)
		{
			formatstring << "%m" << gCurrentLocale.DateSeparator()
				<< "%d" << gCurrentLocale.DateSeparator() << "%Y";
		}
		else
		{
			formatstring << "%d" << gCurrentLocale.DateSeparator()
				<< "%m" << gCurrentLocale.DateSeparator() << "%Y";
		}
		strftime(rowtitle,128,formatstring.String(),timestruct);
		accountgrid.SetRowTitle(subtotal_index,rowtitle);
		
		int length = strlen(rowtitle);
		if(length > longestnamelength)
		{
			longestname = rowtitle;
			longestnamelength = length;
		}
		
		
		Fixed accounttotal;
		
		for(int32 i=0; i<fAccountList->CountItems(); i++)
		{
			AccountItem *item = (AccountItem*)fAccountList->ItemAt(i);
			if(!item)
				continue;
			
			accounttotal += item->account->BalanceAt(subtotal_start);
		} // end for each account
		
		accountgrid.SetValue(0,subtotal_index,accounttotal);
	}
	
	if(fGraphView->IsHidden())
	{
		// Now that we have all the data, we need to set up the rows and columns for the report grid
		
		BColumn *col = new BStringColumn(TRANSLATE("Date"),fGridView->StringWidth(longestname.String())+20,10,300,B_TRUNCATE_END);
		fGridView->AddColumn(col,0);
		col = new BStringColumn(TRANSLATE("Total"),75,10,300,B_TRUNCATE_END);
		fGridView->AddColumn(col,1);
		
		fGridView->AddRow(new BRow());
		BRow *titlerow = new BRow();
		fGridView->AddRow(titlerow);
		titlerow->SetField(new BStringField(TRANSLATE("Total Worth")),0);
		fGridView->AddRow(new BRow());
		
		// Now that the grid is set up, start adding data to the grid
		for(int32 rowindex=0; rowindex<accountgrid.CountItems(); rowindex++)
		{
			BRow *row = new BRow();
			fGridView->AddRow(row);
			
			BStringField *catname = new BStringField(accountgrid.RowTitle(rowindex));
			row->SetField(catname,0);
					
			BString temp;
			Fixed f;
			
			accountgrid.ValueAt(0,rowindex,f);
			gCurrentLocale.CurrencyToString(f,temp);
			
			BStringField *amountfield = new BStringField(temp.String());
			row->SetField(amountfield,1);
		}
	}
}
Пример #19
0
/***** Constructor ****/
DisplayView::DisplayView(BRect frame,const char *name, float tabHeight)
	: BView(frame, name, B_FOLLOW_NONE, B_WILL_DRAW)//,
{
	SetViewColor(216, 216, 216);
	int space = 5;
	int boxHight = 200;
	int boxWidth = (Bounds().Width() / 2) / 2;
	int chkBoxWidth = 15;
	int chkBoxHight = 15;
	
// ---------------------
	BRect boxRect = BRect(Bounds().left + space, Bounds().top + space, Bounds().left + boxWidth, Bounds().top + boxHight);
	fBoxGeneral = new BBox(boxRect, "fBoxGeneral", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE, B_FANCY_BORDER);
	fBoxGeneral->SetLabel("General");
	
	BRect rect = BRect(boxRect.left + space, boxRect.top + space, boxRect.Width() - space, boxRect.top + chkBoxWidth);
	
/*	fChkboxFulscreen = new BCheckBox(rect, "fChkboxFulscreen", "Full Screen", new BMessage(S9x_FULLSCREEN),B_FOLLOW_LEFT | B_FOLLOW_TOP,B_WILL_DRAW | B_NAVIGABLE);
	fChkboxFulscreen->SetValue(settings.ui.S9x_FULLSCREEN);
	fBoxGeneral->AddChild(fChkboxFulscreen);*/
	
//	rect.OffsetBy(0, space + chkBoxHight);
	fChkboxBiLiner = new BCheckBox(rect, "fChkboxBiLiner", "Bi-Linear Mode 7", new BMessage(S9x_BILINER7), B_FOLLOW_LEFT | B_FOLLOW_TOP,B_WILL_DRAW | B_NAVIGABLE);	
	fChkboxBiLiner->SetValue(settings.graphics.s9x_Mode7Interpolate);
	fBoxGeneral->AddChild(fChkboxBiLiner);

	rect.OffsetBy(0, space + chkBoxHight);	
	fChkboxShowFrameRate = new BCheckBox(rect, "fChkboxShowFrameRate", "Show Frame Rate", new BMessage(S9x_SHOWFRAMERATE), B_FOLLOW_LEFT | B_FOLLOW_TOP,B_WILL_DRAW | B_NAVIGABLE);	
	fChkboxShowFrameRate->SetValue(settings.graphics.s9x_DisplayFrameRate);
	fBoxGeneral->AddChild(fChkboxShowFrameRate);

/*	rect.OffsetBy(0, space + chkBoxHight);
	fChkboxStretchImage = new BCheckBox(rect, "fChkboxStretchImage", "Stretch Image", new BMessage(S9x_STRETSHIMAGE), B_FOLLOW_LEFT | B_FOLLOW_TOP,B_WILL_DRAW | B_NAVIGABLE);	
//	fChkboxStretchImage->SetValue(settings.ui.s9x_extended);
	fBoxGeneral->AddChild(fChkboxStretchImage);*/

	AddChild(fBoxGeneral);

// ---------------------
	boxRect.OffsetBy(space + boxRect.Width(), 0);
	fBoxSnesImage = new BBox(boxRect, "fBoxSnesImage", B_FOLLOW_LEFT | B_FOLLOW_TOP,B_WILL_DRAW | B_NAVIGABLE, B_FANCY_BORDER);
	fBoxSnesImage->SetLabel("Snes Image");

	boxRect.OffsetBy(-(boxRect.Width()+ space), 0);
	rect = BRect(boxRect.left + space, boxRect.top + space, boxRect.Width() - space, boxRect.top + chkBoxHight);
	fChkboxExtendHeight = new BCheckBox(rect, "fChkboxExtendHeight", "Extend Height", new BMessage(S9x_EXTENDED), B_FOLLOW_LEFT | B_FOLLOW_TOP,B_WILL_DRAW | B_NAVIGABLE);	
	fChkboxExtendHeight->SetValue(settings.ui.s9x_extended);
	fBoxSnesImage->AddChild(fChkboxExtendHeight);


	rect.OffsetBy(0, space + chkBoxHight);
	fChkboxRender16Bit = new BCheckBox(rect, "fChkboxRender16Bit", "Render 16-bit", new BMessage(S9x_RENDER16BIT), B_FOLLOW_LEFT | B_FOLLOW_TOP,B_WILL_DRAW | B_NAVIGABLE);	
	fChkboxRender16Bit->SetValue(settings.graphics.s9x_SixteenBit);
	fBoxSnesImage->AddChild(fChkboxRender16Bit);


	rect.OffsetBy(0, space + chkBoxHight);
	fChkboxTransparency = new BCheckBox(rect, "fChkboxTransparency", "Transparency", new BMessage(S9x_TRANSPARENCY), B_FOLLOW_LEFT | B_FOLLOW_TOP,B_WILL_DRAW | B_NAVIGABLE);	
	fChkboxTransparency->SetValue(settings.graphics.s9x_Transparency);
	fBoxSnesImage->AddChild(fChkboxTransparency);

	rect.OffsetBy(0, space + chkBoxHight);
	fChkboxHiRes = new BCheckBox(rect, "fChkboxHiRes", "Support Hi Res", new BMessage(S9x_HIRES), B_FOLLOW_LEFT | B_FOLLOW_TOP,B_WILL_DRAW | B_NAVIGABLE);	
	fChkboxHiRes->SetValue(settings.graphics.s9x_SupportHiRes);
	fBoxSnesImage->AddChild(fChkboxHiRes);

	AddChild(fBoxSnesImage);

// ---------------------
//	Lock();	
	boxRect.OffsetBy(space + boxRect.Width(), 0);
	boxRect = BRect(boxRect.left, boxRect.top, boxRect.right + boxWidth - space * 3, Bounds().bottom - (tabHeight + (space*2)));
	boxRect.OffsetBy(space + boxWidth, 0);
	fBoxFullScreen = new BBox(boxRect, "fBoxFullScreen", B_FOLLOW_LEFT | B_FOLLOW_TOP,B_WILL_DRAW | B_NAVIGABLE, B_FANCY_BORDER);
	fBoxFullScreen->SetLabel("Fullscreen Display Settings");
	
	rect.OffsetTo(space, space*4);
	rect = BRect(rect.left, rect.top - space, (rect.left + boxRect.Width())- space*2 , boxRect.bottom - space*2);	
	fColumnList = new DisplayModeColumnListView (rect, "ColumnList", B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP_BOTTOM, B_WILL_DRAW |B_NAVIGABLE);
	fColumnList->AddColumn(new DisplayModeColumn("Video Mode", 200, 10, 150, 0),0);
	fColumnList->AddColumn(new BStringColumn("Status", 100, 10, 100, 0),1);

	fBoxFullScreen->AddChild(fColumnList);
	AddChild(fBoxFullScreen);

	display_mode *modes;
	uint32 mode_count;
	BRow *cRow;
	if (BScreen().GetModeList(&modes, &mode_count) == B_NO_ERROR) {
		qsort(modes, mode_count, sizeof(display_mode), compare_mode);
		
		display_mode prevDisplayMode;
		
		for(unsigned int i = 0; i < mode_count; i++) {			
			if(compare_mode(&prevDisplayMode, &modes[i])){
				cRow = new BRow();
				cRow->SetField(new DisplayModeField(modes[i]), 0);
				cRow->SetField(new BStringField("Supported"), 1);
				fColumnList->AddRow(cRow, (int32)i);
				prevDisplayMode = modes[i];
			}
		}
	}
//	BMessage *m = new BMessage(ID_REFRESH);
//	m->AddPointer("ColumnList", fColumnList);
//	message->AddInt32("width", mode.width);
//	message->AddInt32("height", mode.height);
//	fColumnList->SetSelectionMessage(m);
	
// ---------------------
	boxRect = BRect(Bounds().left + space, Bounds().top + boxHight + space*2, boxRect.left - space, boxHight);
	fBoxOutputImageProcessing = new BBox(boxRect, "boxOutputImageProcessing", B_FOLLOW_LEFT | B_FOLLOW_TOP,B_WILL_DRAW | B_NAVIGABLE, B_FANCY_BORDER);
	fBoxOutputImageProcessing->SetLabel("Output Image Processing");
	AddChild(fBoxOutputImageProcessing);	
}
Пример #20
0
void BudgetWindow::SetPeriod(const BudgetPeriod &period)
{
	BRow *row = fCategoryList->CurrentSelection();
	if(!row)
		return;

	BudgetEntry entry;
	BStringField *strfield = (BStringField*)row->GetField(0);
	if(!gDatabase.GetBudgetEntry(strfield->String(),entry))
		return;

	// Convert the amount to reflect the change in period
	switch(entry.period)
	{
		case BUDGET_WEEKLY:
		{
			entry.amount *= 52;
			break;
		}
		case BUDGET_QUARTERLY:
		{
			entry.amount *= 4;
			break;
		}
		case BUDGET_ANNUALLY:
		{
			break;
		}
		default:
		{
			entry.amount *= 12;
			break;
		}
	}
	entry.period = period;

	switch(entry.period)
	{
		case BUDGET_WEEKLY:
		{
			entry.amount /= 52;
			break;
		}
		case BUDGET_QUARTERLY:
		{
			entry.amount /= 4;
			break;
		}
		case BUDGET_ANNUALLY:
		{
			break;
		}
		default:
		{
			entry.amount /= 12;
			break;
		}
	}
	// yeah, yeah, I know about rounding errors. It's not that big of a deal,
	// so deal with it. *famous last words*
	entry.amount.Round();

	gDatabase.AddBudgetEntry(entry);
	RefreshBudgetGrid();
	RefreshBudgetSummary();

	BString str;
	gDefaultLocale.CurrencyToString(entry.amount,str);
	str.Truncate(str.FindFirst(gDefaultLocale.CurrencyDecimal()));
	str.RemoveFirst(gDefaultLocale.CurrencySymbol());

	row->SetField(new BStringField(str.String()),1);
	fAmountBox->SetText(str.String());

	row->SetField(new BStringField(BudgetPeriodToString(entry.period).String()),2);
	fCategoryList->UpdateRow(row);
}
Пример #21
0
void BudgetWindow::RefreshBudgetSummary(void)
{
	Fixed itotal,stotal,mtotal,f;
	Fixed irowtotal,srowtotal, ttotal;
	for(int32 i=0; i<12; i++)
	{
		itotal = stotal = mtotal = 0;

		for(int32 j=0; j<fIncomeGrid.CountItems(); j++)
		{
			fIncomeGrid.ValueAt(i,j,f);
			itotal += f;
			irowtotal += f;
		}

		for(int32 j=0; j<fSpendingGrid.CountItems(); j++)
		{
			fSpendingGrid.ValueAt(i,j,f);
			stotal += f.AbsoluteValue();
			srowtotal += f;
		}

		mtotal = itotal - stotal;
		ttotal += mtotal;

		itotal.Round();
		stotal.Round();
		mtotal.Round();

		BString itemp,stemp,mtemp;
		gDefaultLocale.CurrencyToString(itotal,itemp);
		gDefaultLocale.CurrencyToString(stotal,stemp);
		gDefaultLocale.CurrencyToString(mtotal,mtemp);

		itemp.Truncate(itemp.FindFirst(gDefaultLocale.CurrencyDecimal()));
		stemp.Truncate(stemp.FindFirst(gDefaultLocale.CurrencyDecimal()));
		mtemp.Truncate(mtemp.FindFirst(gDefaultLocale.CurrencyDecimal()));

		itemp.RemoveFirst(gDefaultLocale.CurrencySymbol());
		stemp.RemoveFirst(gDefaultLocale.CurrencySymbol());
		mtemp.RemoveFirst(gDefaultLocale.CurrencySymbol());

		BRow *irow = fBudgetSummary->RowAt(0);
		BRow *srow = fBudgetSummary->RowAt(1);
		BRow *mrow = fBudgetSummary->RowAt(2);

		irow->SetField(new BStringField(itemp.String()),i+1);
		srow->SetField(new BStringField(stemp.String()),i+1);
		mrow->SetField(new BStringField(mtemp.String()),i+1);

		float colwidth = fBudgetSummary->StringWidth(itemp.String()) + 20;
		if(fBudgetSummary->ColumnAt(i+1)->Width() < colwidth)
			fBudgetSummary->ColumnAt(i+1)->SetWidth(colwidth);

		colwidth = fBudgetSummary->StringWidth(stemp.String()) + 20;
		if(fBudgetSummary->ColumnAt(i+1)->Width() < colwidth)
			fBudgetSummary->ColumnAt(i+1)->SetWidth(colwidth);

		colwidth = fBudgetSummary->StringWidth(mtemp.String()) + 20;
		if(fBudgetSummary->ColumnAt(i+1)->Width() < colwidth)
			fBudgetSummary->ColumnAt(i+1)->SetWidth(colwidth);
	}

	BString ttemp;

	gDefaultLocale.CurrencyToString(irowtotal,ttemp);
	ttemp.Truncate(ttemp.FindFirst(gDefaultLocale.CurrencyDecimal()));
	ttemp.RemoveFirst(gDefaultLocale.CurrencySymbol());
	fBudgetSummary->RowAt(0)->SetField(new BStringField(ttemp.String()),13);

	gDefaultLocale.CurrencyToString(srowtotal,ttemp);
	ttemp.Truncate(ttemp.FindFirst(gDefaultLocale.CurrencyDecimal()));
	ttemp.RemoveFirst(gDefaultLocale.CurrencySymbol());
	fBudgetSummary->RowAt(1)->SetField(new BStringField(ttemp.String()),13);

	gDefaultLocale.CurrencyToString(ttotal,ttemp);
	ttemp.Truncate(ttemp.FindFirst(gDefaultLocale.CurrencyDecimal()));
	ttemp.RemoveFirst(gDefaultLocale.CurrencySymbol());
	fBudgetSummary->RowAt(2)->SetField(new BStringField(ttemp.String()),13);

	fBudgetSummary->Invalidate();
}
Пример #22
0
void BudgetWindow::HandleCategorySelection(void)
{
	BRow *row = fCategoryList->CurrentSelection();
	if(!row)
	{
		fAmountBox->SetText("");
		fMonthly->SetValue(B_CONTROL_ON);
		fStatAverageRow->SetField(new BStringField(""),1);
		fStatHighestRow->SetField(new BStringField(""),1);
		fStatLowestRow->SetField(new BStringField(""),1);
	}

	BudgetEntry entry;
	BStringField *strfield = (BStringField*)row->GetField(0);
	if(!gDatabase.GetBudgetEntry(strfield->String(),entry))
		return;

	switch(entry.period)
	{
		case BUDGET_WEEKLY:
		{
			fWeekly->SetValue(B_CONTROL_ON);
			break;
		}
		case BUDGET_QUARTERLY:
		{
			fQuarterly->SetValue(B_CONTROL_ON);
			break;
		}
		case BUDGET_ANNUALLY:
		{
			fAnnually->SetValue(B_CONTROL_ON);
			break;
		}
		default:
		{
			fMonthly->SetValue(B_CONTROL_ON);
			break;
		}
	}

	BString str;
	gDefaultLocale.CurrencyToString(entry.amount.AbsoluteValue(),str);
	str.Truncate(str.FindFirst(gDefaultLocale.CurrencyDecimal()));
	str.RemoveFirst(gDefaultLocale.CurrencySymbol());
	fAmountBox->SetText(str.String());

	Fixed high,low,avg;
	CalcStats(entry.name.String(),high,low,avg);

	gDefaultLocale.CurrencyToString(high.AbsoluteValue(),str);
	str.RemoveFirst(gDefaultLocale.CurrencySymbol());
	fStatHighestRow->SetField(new BStringField(str.String()),1);

	gDefaultLocale.CurrencyToString(low.AbsoluteValue(),str);
	str.RemoveFirst(gDefaultLocale.CurrencySymbol());
	fStatLowestRow->SetField(new BStringField(str.String()),1);

	gDefaultLocale.CurrencyToString(avg.AbsoluteValue(),str);
	str.RemoveFirst(gDefaultLocale.CurrencySymbol());
	fStatAverageRow->SetField(new BStringField(str.String()),1);

	fCatStat->Invalidate();
}
Пример #23
0
void BudgetWindow::MessageReceived(BMessage *msg)
{
	switch(msg->what)
	{
		case M_SELECT_CATEGORY:
		{
			HandleCategorySelection();
			fAmountBox->MakeFocus(true);
			break;
		}
		case M_AMOUNT_CHANGED:
		{
			BString str(fAmountBox->Text());
			if(str.CountChars()<1)
				str = "0";

			Fixed f;
			if(gDefaultLocale.StringToCurrency(str.String(),f)!=B_OK)
				break;
			f.Round();
			gDefaultLocale.CurrencyToString(f,str);
			str.Truncate(str.FindFirst(gDefaultLocale.CurrencyDecimal()));
			str.RemoveFirst(gDefaultLocale.CurrencySymbol());

			BRow *row = fCategoryList->CurrentSelection();
			if(!row)
				break;

			row->SetField(new BStringField(str.String()),1);
			fCategoryList->UpdateRow(row);

			BudgetEntry entry;
			gDatabase.GetBudgetEntry( ((BStringField*)row->GetField(0))->String(),entry );
			entry.amount = f;
			if(entry.isexpense)
				entry.amount.Invert();
			gDatabase.AddBudgetEntry(entry);

			RefreshBudgetGrid();
			RefreshBudgetSummary();

			fBudgetSummary->SetFocusRow( entry.isexpense ? 1 : 0);
			fBudgetSummary->SetFocusRow(2);
			break;
		}
		case M_BUDGET_RECALCULATE:
		{
			GenerateBudget(false);
			RefreshBudgetGrid();
			RefreshBudgetSummary();
			RefreshCategories();
			break;
		}
		case M_BUDGET_ZERO:
		{
			GenerateBudget(true);
			RefreshBudgetGrid();
			RefreshBudgetSummary();
			RefreshCategories();
			break;
		}
		case M_SET_PERIOD_MONTH:
		{
			SetPeriod(BUDGET_MONTHLY);
			break;
		}
		case M_SET_PERIOD_WEEK:
		{
			SetPeriod(BUDGET_WEEKLY);
			break;
		}
		case M_SET_PERIOD_QUARTER:
		{
			SetPeriod(BUDGET_QUARTERLY);
			break;
		}
		case M_SET_PERIOD_YEAR:
		{
			SetPeriod(BUDGET_ANNUALLY);
			break;
		}
		case M_NEXT_FIELD:
		{
			if(fAmountBox->ChildAt(0)->IsFocus())
				fMonthly->MakeFocus(true);
			break;
		}
		case M_PREVIOUS_FIELD:
		{
			if(fAmountBox->ChildAt(0)->IsFocus())
				fCategoryList->MakeFocus(true);
			break;
		}
		default:
			BWindow::MessageReceived(msg);
	}
}
Пример #24
0
void
ListAgent::MessageReceived (BMessage *msg)
{
  switch (msg->what)
  {
    case M_THEME_FONT_CHANGE:
      {
        int32 which (msg->FindInt16 ("which"));
        if (which == F_LISTAGENT)
        {
          activeTheme->ReadLock();
          listView->SetFont (B_FONT_ROW, &activeTheme->FontAt (F_LISTAGENT));
          activeTheme->ReadUnlock();
          listView->Invalidate();
        }
      }
      break;
      
    case M_THEME_FOREGROUND_CHANGE:
      {
        int32 which (msg->FindInt16 ("which"));
        bool refresh (false);
        switch (which)
        {
          case C_BACKGROUND:
            activeTheme->ReadLock();
            listView->SetColor (B_COLOR_BACKGROUND, activeTheme->ForegroundAt (C_BACKGROUND));
            activeTheme->ReadUnlock();
            refresh = true;
            break;
            
          case C_TEXT:
            activeTheme->ReadLock();
            listView->SetColor (B_COLOR_TEXT, activeTheme->ForegroundAt (C_TEXT));
            activeTheme->ReadUnlock();
            refresh = true;
            break;

          case C_SELECTION:             
            activeTheme->ReadLock();
            listView->SetColor (B_COLOR_SELECTION, activeTheme->ForegroundAt (C_SELECTION));
            activeTheme->ReadUnlock();
            refresh = true;
            break;
            
          default:
            break;
        }
        if (refresh)
          Invalidate();
      }
      break;
      
    case M_STATUS_ADDITEMS:
      {
        vision_app->pClientWin()->pStatusView()->AddItem (new StatusItem (S_STATUS_LISTCOUNT, ""), true);
        vision_app->pClientWin()->pStatusView()->AddItem (new StatusItem (S_STATUS_LISTSTAT, ""), true);
        vision_app->pClientWin()->pStatusView()->AddItem (new StatusItem (S_STATUS_LISTFILTER, "", STATUS_ALIGN_LEFT), true);
 
        BString cString;
        cString << listView->CountRows();
        vision_app->pClientWin()->pStatusView()->SetItemValue (0, cString.String(), false);
        vision_app->pClientWin()->pStatusView()->SetItemValue (1, statusStr.String(), false);
        vision_app->pClientWin()->pStatusView()->SetItemValue (2, filter.String(), true);
      }
      break;

    case M_LIST_COMMAND:
      {
        if (!processing)
        {
          BMessage sMsg (M_SERVER_SEND);
          
          BString command ("LIST");
          
          BString params (msg->FindString ("cmd"));
          if (params != "-9z99")
          {
            command.Append (" ");
            command.Append (params);
          }

          sMsg.AddString ("data", command.String());

          fSMsgr->SendMessage (&sMsg);
          processing = true;

          if (!IsHidden())
            vision_app->pClientWin()->pStatusView()->SetItemValue (0, "0", true);
        }
      }
      break;

    case M_LIST_BEGIN:
      {
        BMessage msg (M_LIST_UPDATE);
        listUpdateTrigger = new BMessageRunner (BMessenger(this), &msg, 3000000); 
        statusStr = S_LIST_STATUS_LOADING;
        if (!IsHidden())
          vision_app->pClientWin()->pStatusView()->SetItemValue (1, statusStr.String(), true);
      }
      break;
      
    case M_LIST_DONE:
      {
        if (listUpdateTrigger)
        {
          delete listUpdateTrigger;
          listUpdateTrigger = 0;
        }
        statusStr = S_LIST_STATUS_DONE;

        listView->SetSortingEnabled (true);
        listView->SetSortColumn (channelColumn, true, true);
        
        if (!IsHidden())
          vision_app->pClientWin()->pStatusView()->SetItemValue (1, statusStr.String(), true);

        mFind->SetEnabled (true);
        mFindAgain->SetEnabled (true);
        mFilter->SetEnabled (true);

        processing = false;
        
        // empty out any remaining channels that fell below the batch cut off
        AddBatch();

        BString cString;
        cString << listView->CountRows();
        if (!IsHidden())
          vision_app->pClientWin()->pStatusView()->SetItemValue (0, cString.String(), true);
      }
      break;

    case M_LIST_EVENT:
      {
        const char *channel, *users, *topic;

        msg->FindString ("channel", &channel);
        msg->FindString ("users", &users);
        msg->FindString ("topic", &topic);
        
        BRow *row (new BRow ());
        
        
        BStringField *channelField (new BStringField (channel));
        BIntegerField *userField (new BIntegerField (atoi(users)));
        BStringField *topicField (new BStringField (topic));
        
        row->SetField (channelField, channelColumn->LogicalFieldNum());
        row->SetField (userField, usersColumn->LogicalFieldNum());
        row->SetField (topicField, topicColumn->LogicalFieldNum());

        fBuildList.AddItem (row);
        
        if (fBuildList.CountItems() == LIST_BATCH_SIZE)
          AddBatch();
      }
      break;

#ifdef __INTEL__

		case M_LIST_FILTER:
			if (msg->HasString ("text"))
			{
				const char *buffer;

				msg->FindString ("text", &buffer);
				if (filter != buffer)
				{
					filter = buffer;

					if (!IsHidden())
					  vision_app->pClientWin()->pStatusView()->SetItemValue (2, filter.String(), true);

					regfree (&re);
					memset (&re, 0, sizeof (re));
					regcomp (
						&re,
						filter.String(),
						REG_EXTENDED | REG_ICASE | REG_NOSUB);
					
					BRow *currentRow;	
					BStringField *channel,
					             *topic;

					while (hiddenItems.CountItems() != 0)
					{
					  currentRow = hiddenItems.RemoveItemAt (0L);
					  listView->AddRow (currentRow);
					}

					if (filter != NULL)
					{
  					  int32 k (0);
  					    					  					
					  while (k < listView->CountRows())
					  {
					     currentRow = listView->RowAt (k);
					     channel = (BStringField *)currentRow->GetField (0);
					     topic = (BStringField *)currentRow->GetField (2);
       				  	 if ((regexec (&re, channel->String(), 0, 0, 0) != REG_NOMATCH)
       				  	    || (regexec (&re, topic->String(), 0, 0, 0) != REG_NOMATCH))
       				  	  {
       				  	    k++;
       					    continue;
       					  }
       					 else
       					 {
       					   listView->RemoveRow (currentRow);
       					   hiddenItems.AddItem (currentRow);
       					 }
					  }
					}
					fMsgr.SendMessage (M_LIST_DONE);
					processing = true;
				}
			}
			else
			{
				PromptWindow *prompt (new PromptWindow (
					BPoint ((Window()->Frame().right/2) - 100, (Window()->Frame().bottom/2) - 50),
					"  Filter:",
					"List Filter",
					filter.String(),
					this,
					new BMessage (M_LIST_FILTER),
					new RegExValidate ("Filter"),
					true));
				prompt->Show();
			}

			break;

		case M_LIST_FIND:
			if (msg->HasString ("text"))
			{
				int32 selection (listView->IndexOf(listView->CurrentSelection()));
				const char *buffer;

				msg->FindString ("text", &buffer);

				if (strlen (buffer) == 0)
				{
					find = buffer;
					break;
				}

				if (selection < 0)
				{
					selection = 0;
				}
				else
				{
					++selection;
				}

				if (find != buffer)
				{
					regfree (&fre);
					memset (&fre, 0, sizeof (fre));
					regcomp (
						&fre,
						buffer,
						REG_EXTENDED | REG_ICASE | REG_NOSUB);
					find = buffer;
				}

				BStringField *field;
				int32 i;
				for (i = selection; i < listView->CountRows(); ++i)
				{
					field = (BStringField *)listView->RowAt (i)->GetField (0);

					if (regexec (&fre, field->String(), 0, 0, 0) != REG_NOMATCH)
						break;
				}

				if (i < listView->CountRows())
				{
					BRow* row = listView->RowAt (i);
					listView->DeselectAll();
					listView->AddToSelection (row);
					listView->ScrollTo(row);
					listView->Refresh();
				}
				else
				{
					listView->DeselectAll();
				}
			}
			else
			{
				PromptWindow *prompt (new PromptWindow (
					BPoint ((Window()->Frame().right / 2) - 100, (Window()->Frame().bottom/2) - 50),
					S_LIST_PROMPT_LABEL,
					S_LIST_PROMPT_TITLE,
					find.String(),
					this,
					new BMessage (M_LIST_FIND),
					new RegExValidate ("Find:"),
					true));
				prompt->Show();
			} 
			break;

		case M_LIST_FAGAIN:
			if (find.Length())
			{
				msg->AddString ("text", find.String());
				msg->what = M_LIST_FIND;
				fMsgr.SendMessage (msg);
			}
			break;
#endif

		case M_LIST_INVOKE:
		{
			BMessage msg (M_SUBMIT);
			BString buffer;
				
			BRow *row (listView->CurrentSelection());
				
			if (row)
			{
                 buffer = "/JOIN ";
                 buffer += ((BStringField *)row->GetField(0))->String();
                 msg.AddBool ("history", false);
                 msg.AddBool ("clear", false);
                 msg.AddString ("input", buffer.String());
                 fSMsgr->SendMessage (&msg);
            }
		}
		break;
		
		case M_CLIENT_QUIT:
		{
		  fSMsgr->SendMessage(M_LIST_SHUTDOWN);
		  BMessage deathchant (M_OBITUARY);
          deathchant.AddPointer ("agent", this);
          deathchant.AddPointer ("item", fAgentWinItem);
          vision_app->pClientWin()->PostMessage (&deathchant);
		}
		break;
		
		default:
			BView::MessageReceived (msg);
	}
}