Added some real GUI color changes for R5
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@842 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
#include <Entry.h>
|
#include <Entry.h>
|
||||||
#include <File.h>
|
#include <File.h>
|
||||||
|
#include <Screen.h> // for settings Desktop color
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "APRView.h"
|
#include "APRView.h"
|
||||||
@@ -606,9 +607,11 @@ printf("Couldn't open file %s for read\n",path.String());
|
|||||||
{
|
{
|
||||||
settings.FindString("name",colorset_name);
|
settings.FindString("name",colorset_name);
|
||||||
SetColorSetName(colorset_name->String());
|
SetColorSetName(colorset_name->String());
|
||||||
// BString namestr("Color Set: ");
|
|
||||||
// namestr+=colorset_name->String();
|
BScreen screen;
|
||||||
// colorset_label->SetText(namestr.String());
|
rgb_color col=screen.GetDesktopColor();
|
||||||
|
settings.ReplaceData("DESKTOP",(type_code)'RGBC',
|
||||||
|
&col,sizeof(rgb_color));
|
||||||
|
|
||||||
picker->SetValue(GetColorFromMessage(&settings,attrstring.String()));
|
picker->SetValue(GetColorFromMessage(&settings,attrstring.String()));
|
||||||
colorwell->SetColor(picker->ValueAsColor());
|
colorwell->SetColor(picker->ValueAsColor());
|
||||||
@@ -678,7 +681,36 @@ void APRView::NotifyServer(void)
|
|||||||
// done. Extract all the colors from the settings BMessage, attach them
|
// done. Extract all the colors from the settings BMessage, attach them
|
||||||
// to a PortLink message and fire it off to the server.
|
// to a PortLink message and fire it off to the server.
|
||||||
|
|
||||||
// Name taken from ServerProtocol.h
|
// For now, we do not have the OBOS app_server, so we simply do what
|
||||||
|
// we can with tbe R5 server
|
||||||
|
|
||||||
|
rgb_color col;
|
||||||
|
|
||||||
|
// Set menu color
|
||||||
|
menu_info minfo;
|
||||||
|
get_menu_info(&minfo);
|
||||||
|
col=GetColorFromMessage(&settings,"MENU_BACKGROUND");
|
||||||
|
if(col.alpha==0 && col.red==0 && col.green==0 && col.blue==0)
|
||||||
|
{
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
minfo.background_color=col;
|
||||||
|
set_menu_info(&minfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set desktop color
|
||||||
|
BScreen screen;
|
||||||
|
col=GetColorFromMessage(&settings,"DESKTOP");
|
||||||
|
if(col.alpha==0 && col.red==0 && col.green==0 && col.blue==0)
|
||||||
|
{
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
else
|
||||||
|
screen.SetDesktopColor(col);
|
||||||
|
|
||||||
|
/* // Name taken from ServerProtocol.h
|
||||||
port_id serverport=find_port("OBappserver");
|
port_id serverport=find_port("OBappserver");
|
||||||
|
|
||||||
if(serverport==B_NAME_NOT_FOUND)
|
if(serverport==B_NAME_NOT_FOUND)
|
||||||
@@ -704,11 +736,13 @@ void APRView::NotifyServer(void)
|
|||||||
pl->Attach(&col,sizeof(rgb_color));
|
pl->Attach(&col,sizeof(rgb_color));
|
||||||
col=GetColorFromMessage(&settings,"KEYBOARD_NAVIGATION");
|
col=GetColorFromMessage(&settings,"KEYBOARD_NAVIGATION");
|
||||||
pl->Attach(&col,sizeof(rgb_color));
|
pl->Attach(&col,sizeof(rgb_color));
|
||||||
col=GetColorFromMessage(&settings,"DESKTOP_COLOR");
|
col=GetColorFromMessage(&settings,"DESKTOP");
|
||||||
pl->Attach(&col,sizeof(rgb_color));
|
pl->Attach(&col,sizeof(rgb_color));
|
||||||
|
|
||||||
pl->Flush();
|
pl->Flush();
|
||||||
delete pl;
|
delete pl;
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rgb_color APRView::GetColorFromMessage(BMessage *msg, const char *name, int32 index=0)
|
rgb_color APRView::GetColorFromMessage(BMessage *msg, const char *name, int32 index=0)
|
||||||
@@ -716,14 +750,10 @@ rgb_color APRView::GetColorFromMessage(BMessage *msg, const char *name, int32 in
|
|||||||
// Simple function to do the dirty work of getting an rgb_color from
|
// Simple function to do the dirty work of getting an rgb_color from
|
||||||
// a message
|
// a message
|
||||||
rgb_color *col,rcolor={0,0,0,0};
|
rgb_color *col,rcolor={0,0,0,0};
|
||||||
uint8 *ptr;
|
|
||||||
ssize_t size;
|
ssize_t size;
|
||||||
|
|
||||||
if(msg->FindData(name,(type_code)'RGBC',index,(const void**)&ptr,&size)==B_OK)
|
if(msg->FindData(name,(type_code)'RGBC',index,(const void**)&col,&size)==B_OK)
|
||||||
{
|
|
||||||
col=(rgb_color*)ptr;
|
|
||||||
rcolor=*col;
|
rcolor=*col;
|
||||||
}
|
|
||||||
return rcolor;
|
return rcolor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -753,7 +783,7 @@ const char *APRView::AttributeToString(const color_which &attr)
|
|||||||
return "KEYBOARD_NAVIGATION";
|
return "KEYBOARD_NAVIGATION";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return "DESKTOP_COLOR";
|
return "DESKTOP";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -784,7 +814,7 @@ const char *APRView::SelectionToString(int32 index)
|
|||||||
return "KEYBOARD_NAVIGATION";
|
return "KEYBOARD_NAVIGATION";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return "DESKTOP_COLOR";
|
return "DESKTOP";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user