Hello Devs,
I've started working on creating the deck editor for scrollrack and it's
going very well so far. I should have it finished by tomorrow night and i
can send a *.diff or a patch file to this list for approval. At the moment
i have a toolbar with no icons and i need the following:
- New (might just use the green refresh button)
- Load (maybe an open folder icon)
- Save (a disk)
- Print (a printer)
- Apply Filters (a tick)
- Clear Filters (a "no-go" sign or a red cross)
Do you know where i can find icons that will be suitable for ScrollRack?
Also, i've completed the card list searching feature but my algorithm needs
some serious work. I tried just searhcing from the start everytime but as
you can imagine with 8000+ items it can take ages in some cases. I present
my code for review;
txtCardName.addModifyListener(
*new* org.eclipse.swt.events.ModifyListener()
{
//internal class to handle the card search
/*
* handles the modify text event
*/
*public* *void* modifyText(org.eclipse.swt.events.ModifyEvent e)
{
*int* cardId;
CardBase cardBase = m_game.cardbase;
*if* (txtCardName.getText().length() <= 1)
{
//if this is a new search start from the beginning
*for* (cardId = 0; cardId < cardBase.size(); cardId++ )
{
*if* (cardBase.get(cardId).name.toUpperCase().startsWith(
txtCardName.getText().toUpperCase()))
{
lstCardList.setSelection(cardId);
m_numberOfPrevSearchChars = txtCardName.getText().length();
*return*;
}
}
}
*else
*
{
/*
* If it's not a new search start looking either forward
* or backwards of the current selection depending depending
* on the change to the search;
*
* remove a char = search backwards
* add a char = search forwards
*/
*if* (txtCardName.getText().length() > m_numberOfPrevSearchChars)
{
*for* (cardId = lstCardList.getSelectionIndex(); cardId < cardBase.size();
cardId++ )
{
*if* (cardBase.get(cardId).name.toUpperCase().startsWith(
txtCardName.getText().toUpperCase()))
{
lstCardList.setSelection(cardId);
m_numberOfPrevSearchChars = txtCardName.getText().length();
*return*;
}
}
}
*else
*
{
*for* (cardId = lstCardList.getSelectionIndex(); cardId > -1; cardId-- )
{
*if* (cardBase.get(cardId).name.toUpperCase().startsWith(
txtCardName.getText().toUpperCase()))
{
lstCardList.setSelection(cardId);
m_numberOfPrevSearchChars = txtCardName.getText().length();
*return*;
}
}
}
}
//if we get here we've found nothing. dont select anything
m_numberOfPrevSearchChars = txtCardName.getText().length();
lstCardList.setSelection(-1);
}
});
The general idea is to search forward only if the next character is
"greater" than the last one, searching backwards when you delete
characters. Any ideas for optimisation?
Also, anyone who wants to contact me can do so on MSN at "dafatdude" at
"hotmail" dot "com"
Cheers,
Aaron
|