Delete Color Set now works

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@841 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
DarkWyrm 2002-08-20 13:26:20 +00:00
parent eb11b67370
commit 07c6c57ca0
2 changed files with 39 additions and 1 deletions

View File

@ -180,6 +180,37 @@ void APRView::MessageReceived(BMessage *msg)
switch(msg->what)
{
case DELETE_COLORSET:
{
// Construct the path and delete
BString path(COLOR_SET_DIR);
path+=*colorset_name;
BString printstring("Remove ");
printstring+=*colorset_name;
printstring+=" from disk permenantly?";
BAlert *a=new BAlert("OpenBeOS",printstring.String(),"Yes", "No");
if(a->Go()==0)
{
int stat=remove(path.String());
if(stat!=0)
{
#ifdef DEBUG_COLORSET
printf("MSG: Delete Request - couldn't delete file %s\n",path.String());
#endif
}
else
{
BMenuItem *item=colorset_menu->FindItem(colorset_name->String());
if(item!=NULL)
{
if(colorset_menu->RemoveItem(item))
delete item;
}
}
}
break;
}
case LOAD_COLORSET:
{
BString name;
@ -473,6 +504,13 @@ printf("SaveColorSet: Error in adding item to menu\n");
SetColorSetName(name.String());
}
void APRView::DeleteColorSet(const BString &name)
{
// Moves the current color set to the trash if it has been saved to disk
// Note that it also makes the name <untitled> once more.
}
color_which APRView::SelectionToAttribute(int32 index)
{
// This simply converts the selected index to the appropriate color_which
@ -763,4 +801,3 @@ void PrintRGBColor(rgb_color col)
{
printf("RGB Color (%d,%d,%d,%d)\n",col.red,col.green,col.blue,col.alpha);
}

View File

@ -38,6 +38,7 @@ protected:
BMenu *LoadColorSets(void);
void SaveColorSet(const BString &name);
void LoadColorSet(const BString &name);
void DeleteColorSet(const BString &name);
void SetColorSetName(const char *name);
BColorControl *picker;
BButton *apply,*revert,*defaults,*try_settings;