'Defaults' and 'Revert' notify DecView + new RGBColor methods

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@866 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
DarkWyrm
2002-08-24 17:56:48 +00:00
parent 9f44244a66
commit edd1ec4517
3 changed files with 27 additions and 10 deletions
+20 -10
View File
@@ -149,7 +149,7 @@ APRView::~APRView(void)
delete colorset_name; delete colorset_name;
} }
void APRView::AttachedToWindow(void) void APRView::AllAttached(void)
{ {
picker->SetTarget(this); picker->SetTarget(this);
attrlist->Select(0); attrlist->Select(0);
@@ -271,6 +271,8 @@ printf("MSG: Save Request - couldn't find file name\n");
&col,sizeof(rgb_color)); &col,sizeof(rgb_color));
SetColorSetName("<untitled>"); SetColorSetName("<untitled>");
if(Window())
Window()->PostMessage(SET_UI_COLORS);
break; break;
} }
case ATTRIBUTE_CHOSEN: case ATTRIBUTE_CHOSEN:
@@ -284,7 +286,9 @@ printf("MSG: Save Request - couldn't find file name\n");
colorwell->SetColor(col); colorwell->SetColor(col);
colorwell->Invalidate(); colorwell->Invalidate();
SetColorSetName("<untitled>"); // SetColorSetName("<untitled>");
// if(Window())
// Window()->PostMessage(SET_UI_COLORS);
break; break;
} }
case APPLY_SETTINGS: case APPLY_SETTINGS:
@@ -308,6 +312,8 @@ printf("MSG: Save Request - couldn't find file name\n");
picker->SetValue(col); picker->SetValue(col);
colorwell->SetColor(col); colorwell->SetColor(col);
colorwell->Invalidate(); colorwell->Invalidate();
if(Window())
Window()->PostMessage(SET_UI_COLORS);
break; break;
} }
case DEFAULT_SETTINGS: case DEFAULT_SETTINGS:
@@ -317,6 +323,8 @@ printf("MSG: Save Request - couldn't find file name\n");
picker->SetValue(col); picker->SetValue(col);
colorwell->SetColor(col); colorwell->SetColor(col);
colorwell->Invalidate(); colorwell->Invalidate();
if(Window())
Window()->PostMessage(SET_UI_COLORS);
break; break;
} }
default: default:
@@ -519,13 +527,6 @@ printf("SaveColorSet: Error in adding item to menu\n");
SetColorSetName(name.String()); 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) color_which APRView::SelectionToAttribute(int32 index)
{ {
// This simply converts the selected index to the appropriate color_which // This simply converts the selected index to the appropriate color_which
@@ -578,7 +579,9 @@ void APRView::SaveSettings(void)
BString path(SETTINGS_DIR); BString path(SETTINGS_DIR);
path+=COLOR_SETTINGS_NAME; path+=COLOR_SETTINGS_NAME;
printf("%s\n",path.String()); #ifdef DEBUG_COLORSET
printf("SaveSettings: %s\n",path.String());
#endif
BFile file(path.String(),B_READ_WRITE|B_CREATE_FILE|B_ERASE_FILE); BFile file(path.String(),B_READ_WRITE|B_CREATE_FILE|B_ERASE_FILE);
settings.Flatten(&file); settings.Flatten(&file);
@@ -717,12 +720,19 @@ void APRView::NotifyServer(void)
// Set desktop color // Set desktop color
BScreen screen; BScreen screen;
col=GetColorFromMessage(&settings,"DESKTOP"); col=GetColorFromMessage(&settings,"DESKTOP");
#ifdef DEBUG_COLORSET
printf("NotifyServer: Setting Desktop color to "); PrintRGBColor(col);
#endif
if(col.alpha==0 && col.red==0 && col.green==0 && col.blue==0) if(col.alpha==0 && col.red==0 && col.green==0 && col.blue==0)
{ {
// do nothing // do nothing
} }
else else
screen.SetDesktopColor(col); screen.SetDesktopColor(col);
if(Window())
Window()->PostMessage(SET_UI_COLORS);
/* // Name taken from ServerProtocol.h /* // Name taken from ServerProtocol.h
port_id serverport=find_port("OBappserver"); port_id serverport=find_port("OBappserver");
+6
View File
@@ -3,6 +3,7 @@
Color encapsulation class for app_server. Color encapsulation class for app_server.
*/ */
#include <stdio.h>
#include "RGBColor.h" #include "RGBColor.h"
RGBColor::RGBColor(uint8 r, uint8 g, uint8 b, uint8 a=255) RGBColor::RGBColor(uint8 r, uint8 g, uint8 b, uint8 a=255)
@@ -155,3 +156,8 @@ printf("MakeBlendColor( {%u,%u,%u,%u}, {%u,%u,%u,%u}, %f) : {%u,%u,%u,%u}\n",
return RGBColor(newcol); return RGBColor(newcol);
} }
void RGBColor::PrintToStream(void)
{
printf("RGBColor (%u,%u,%u,%u)\n", color.red,color.green,color.blue,color.alpha);
}
+1
View File
@@ -12,6 +12,7 @@ public:
RGBColor(uint8 col); RGBColor(uint8 col);
RGBColor(const RGBColor &col); RGBColor(const RGBColor &col);
RGBColor(void); RGBColor(void);
void PrintToStream(void);
uint8 GetColor8(void); uint8 GetColor8(void);
uint16 GetColor16(void); uint16 GetColor16(void);
rgb_color GetColor32(void); rgb_color GetColor32(void);