Fully updated sources and jamfile. Added icon to app
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@875 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -18,13 +18,14 @@
|
|||||||
#include <Invoker.h>
|
#include <Invoker.h>
|
||||||
|
|
||||||
class ColorWell;
|
class ColorWell;
|
||||||
|
class APRWindow;
|
||||||
|
|
||||||
class APRView : public BView
|
class APRView : public BView
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
APRView(const BRect &frame, const char *name, int32 resize, int32 flags);
|
APRView(const BRect &frame, const char *name, int32 resize, int32 flags);
|
||||||
~APRView(void);
|
~APRView(void);
|
||||||
void AttachedToWindow(void);
|
void AllAttached(void);
|
||||||
void MessageReceived(BMessage *msg);
|
void MessageReceived(BMessage *msg);
|
||||||
color_which SelectionToAttribute(int32 index);
|
color_which SelectionToAttribute(int32 index);
|
||||||
const char *AttributeToString(const color_which &attr);
|
const char *AttributeToString(const color_which &attr);
|
||||||
@@ -35,10 +36,10 @@ public:
|
|||||||
void NotifyServer(void);
|
void NotifyServer(void);
|
||||||
rgb_color GetColorFromMessage(BMessage *msg, const char *name, int32 index=0);
|
rgb_color GetColorFromMessage(BMessage *msg, const char *name, int32 index=0);
|
||||||
protected:
|
protected:
|
||||||
|
friend APRWindow;
|
||||||
BMenu *LoadColorSets(void);
|
BMenu *LoadColorSets(void);
|
||||||
void SaveColorSet(const BString &name);
|
void SaveColorSet(const BString &name);
|
||||||
void LoadColorSet(const BString &name);
|
void LoadColorSet(const BString &name);
|
||||||
void DeleteColorSet(const BString &name);
|
|
||||||
void SetColorSetName(const char *name);
|
void SetColorSetName(const char *name);
|
||||||
BColorControl *picker;
|
BColorControl *picker;
|
||||||
BButton *apply,*revert,*defaults,*try_settings;
|
BButton *apply,*revert,*defaults,*try_settings;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include "APRWindow.h"
|
#include "APRWindow.h"
|
||||||
#include "APRView.h"
|
#include "APRView.h"
|
||||||
#include "DecView.h"
|
#include "DecView.h"
|
||||||
|
#include "defs.h"
|
||||||
|
|
||||||
APRWindow::APRWindow(BRect frame)
|
APRWindow::APRWindow(BRect frame)
|
||||||
: BWindow(frame, "Appearance", B_TITLED_WINDOW,
|
: BWindow(frame, "Appearance", B_TITLED_WINDOW,
|
||||||
@@ -20,6 +21,7 @@ APRWindow::APRWindow(BRect frame)
|
|||||||
tabview->AddTab(decorators,tab);
|
tabview->AddTab(decorators,tab);
|
||||||
|
|
||||||
AddChild(tabview);
|
AddChild(tabview);
|
||||||
|
decorators->SetColors(colors->settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool APRWindow::QuitRequested()
|
bool APRWindow::QuitRequested()
|
||||||
@@ -36,3 +38,14 @@ void APRWindow::WorkspaceActivated(int32 wkspc, bool is_active)
|
|||||||
notifier.SendMessage(new BMessage(B_WORKSPACE_ACTIVATED));
|
notifier.SendMessage(new BMessage(B_WORKSPACE_ACTIVATED));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
void APRWindow::MessageReceived(BMessage *msg)
|
||||||
|
{
|
||||||
|
if(msg->what==SET_UI_COLORS)
|
||||||
|
{
|
||||||
|
decorators->SetColors(colors->settings);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
BWindow::MessageReceived(msg);
|
||||||
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ public:
|
|||||||
APRWindow(BRect frame);
|
APRWindow(BRect frame);
|
||||||
virtual bool QuitRequested();
|
virtual bool QuitRequested();
|
||||||
virtual void WorkspaceActivated(int32 wkspc, bool is_active);
|
virtual void WorkspaceActivated(int32 wkspc, bool is_active);
|
||||||
|
virtual void MessageReceived(BMessage *msg);
|
||||||
BTabView *tabview;
|
BTabView *tabview;
|
||||||
APRView *colors;
|
APRView *colors;
|
||||||
DecView *decorators;
|
DecView *decorators;
|
||||||
|
|||||||
Binary file not shown.
@@ -3,8 +3,15 @@
|
|||||||
|
|
||||||
#include "RGBColor.h"
|
#include "RGBColor.h"
|
||||||
|
|
||||||
typedef struct
|
class ColorSet
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
ColorSet(void);
|
||||||
|
ColorSet(const ColorSet &cs);
|
||||||
|
ColorSet & operator=(const ColorSet &cs);
|
||||||
|
void SetColors(const ColorSet &cs);
|
||||||
|
void PrintToStream(void);
|
||||||
|
|
||||||
RGBColor panel_background,
|
RGBColor panel_background,
|
||||||
panel_text,
|
panel_text,
|
||||||
document_background,
|
document_background,
|
||||||
@@ -21,7 +28,11 @@ typedef struct
|
|||||||
menu_selected_text,
|
menu_selected_text,
|
||||||
menu_separator_high,
|
menu_separator_high,
|
||||||
menu_separator_low,
|
menu_separator_low,
|
||||||
menu_triggers;
|
menu_triggers,
|
||||||
} ColorSet;
|
window_tab,
|
||||||
|
window_tab_text,
|
||||||
|
keyboard_navigation,
|
||||||
|
desktop;
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -16,11 +16,12 @@
|
|||||||
#include <Directory.h>
|
#include <Directory.h>
|
||||||
#include <File.h>
|
#include <File.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include "RGBColor.h"
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "PreviewDriver.h"
|
#include "PreviewDriver.h"
|
||||||
#include "Decorator.h"
|
#include "Decorator.h"
|
||||||
|
|
||||||
//#define DEBUG_DECORATOR
|
#define DEBUG_DECORATOR
|
||||||
|
|
||||||
DecView::DecView(BRect frame, const char *name, int32 resize, int32 flags)
|
DecView::DecView(BRect frame, const char *name, int32 resize, int32 flags)
|
||||||
:BView(frame,name,resize,flags)
|
:BView(frame,name,resize,flags)
|
||||||
@@ -59,10 +60,9 @@ DecView::DecView(BRect frame, const char *name, int32 resize, int32 flags)
|
|||||||
preview->MoveTo(scrollview->Frame().right+20,scrollview->Frame().top);
|
preview->MoveTo(scrollview->Frame().right+20,scrollview->Frame().top);
|
||||||
}
|
}
|
||||||
|
|
||||||
LayerData ldata;
|
|
||||||
ldata.highcolor.SetColor(51,102,160);
|
ldata.highcolor.SetColor(51,102,160);
|
||||||
uint64 pat=0xFFFFFFFFFFFFFFFFLL;
|
pat_solid_high=0xFFFFFFFFFFFFFFFFLL;
|
||||||
driver->FillRect(preview_bounds,&ldata,(int8*)&pat);
|
driver->FillRect(preview_bounds,&ldata,(int8*)&pat_solid_high);
|
||||||
|
|
||||||
decorator=NULL;
|
decorator=NULL;
|
||||||
decorator_id=-1;
|
decorator_id=-1;
|
||||||
@@ -78,7 +78,7 @@ DecView::~DecView(void)
|
|||||||
delete decorator;
|
delete decorator;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DecView::AttachedToWindow(void)
|
void DecView::AllAttached(void)
|
||||||
{
|
{
|
||||||
declist->SetTarget(this);
|
declist->SetTarget(this);
|
||||||
apply->SetTarget(this);
|
apply->SetTarget(this);
|
||||||
@@ -117,12 +117,13 @@ printf("MSG: Decorator NOT Chosen - couldn't load decorator\n");
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
LayerData ldata;
|
ldata.highcolor.SetColor(colorset.desktop);
|
||||||
ldata.highcolor.SetColor(ui_color(B_DESKTOP_COLOR));
|
driver->FillRect(preview_bounds,&ldata,(int8*)&pat_solid_high);
|
||||||
uint64 pat=0xFFFFFFFFFFFFFFFFLL;
|
|
||||||
driver->FillRect(preview_bounds,&ldata,(int8*)&pat);
|
|
||||||
if(decorator)
|
if(decorator)
|
||||||
|
{
|
||||||
|
decorator->SetColors(colorset);
|
||||||
decorator->Draw();
|
decorator->Draw();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@@ -313,7 +314,13 @@ printf("LoadDecorator(%s): Couldn't get allocation symbol\n",path);
|
|||||||
printf("LoadDecorator(): Deleting old decorator\n");
|
printf("LoadDecorator(): Deleting old decorator\n");
|
||||||
#endif
|
#endif
|
||||||
delete decorator;
|
delete decorator;
|
||||||
unload_add_on(decorator_id);
|
decorator=NULL;
|
||||||
|
|
||||||
|
// NEVER, *EVER*, call unload_add_on() if there is _any_ possibility,
|
||||||
|
// no matter remote, that memory might still be in use when it is called.
|
||||||
|
// It wll lead to unpredictable crashes which have almost nothing to
|
||||||
|
// do with the *real* cause.
|
||||||
|
// unload_add_on(decorator_id);
|
||||||
}
|
}
|
||||||
decorator_id=addon;
|
decorator_id=addon;
|
||||||
decorator=pcreatefunc(SRect(50,50,150,150),WLOOK_TITLED,WFEEL_NORMAL,0);
|
decorator=pcreatefunc(SRect(50,50,150,150),WLOOK_TITLED,WFEEL_NORMAL,0);
|
||||||
@@ -340,3 +347,66 @@ printf("ConvertIndexToPath(): returned %s\n",path.String());
|
|||||||
#endif
|
#endif
|
||||||
return BString(path.String());
|
return BString(path.String());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DecView::SetColors(const BMessage &message)
|
||||||
|
{
|
||||||
|
#ifdef DEBUG_DECORATOR
|
||||||
|
printf("DecView::SetColors\n");
|
||||||
|
#endif
|
||||||
|
if(UnpackSettings(&colorset,&message))
|
||||||
|
{
|
||||||
|
if(decorator)
|
||||||
|
{
|
||||||
|
ldata.highcolor.SetColor(colorset.desktop);
|
||||||
|
driver->FillRect(preview_bounds,&ldata,(int8*)&pat_solid_high);
|
||||||
|
decorator->SetColors(colorset);
|
||||||
|
decorator->Draw();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#ifdef DEBUG_DECORATOR
|
||||||
|
printf("DecView::SetColors: NULL decorator\n");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#ifdef DEBUG_DECORATOR
|
||||||
|
printf("DecView::SetColors: UnpackSetting returned false\n");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DecView::UnpackSettings(ColorSet *set, const BMessage *msg)
|
||||||
|
{
|
||||||
|
if(!set || !msg)
|
||||||
|
{
|
||||||
|
#ifdef DEBUG_DECORATOR
|
||||||
|
printf("UnpackSettings(): NULL parameter\n");
|
||||||
|
#endif
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
rgb_color *col;
|
||||||
|
ssize_t size;
|
||||||
|
|
||||||
|
// Once the OBOS app_server is in place, there will be more attributes
|
||||||
|
|
||||||
|
if(msg->FindData("PANEL_BACKGROUND",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
||||||
|
set->panel_background.SetColor(*col);
|
||||||
|
if(msg->FindData("MENU_BACKGROUND",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
||||||
|
set->menu_background.SetColor(*col);
|
||||||
|
if(msg->FindData("MENU_SELECTION_BACKGROUND",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
||||||
|
set->menu_selected_background.SetColor(*col);
|
||||||
|
if(msg->FindData("MENU_ITEM_TEXT",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
||||||
|
set->menu_text.SetColor(*col);
|
||||||
|
if(msg->FindData("MENU_SELECTED_ITEM_TEXT",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
||||||
|
set->menu_selected_text.SetColor(*col);
|
||||||
|
if(msg->FindData("WINDOW_TAB",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
||||||
|
set->window_tab.SetColor(*col);
|
||||||
|
if(msg->FindData("KEYBOARD_NAVIGATION",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
||||||
|
set->keyboard_navigation.SetColor(*col);
|
||||||
|
if(msg->FindData("DESKTOP",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
||||||
|
set->desktop.SetColor(*col);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|||||||
@@ -9,7 +9,8 @@
|
|||||||
#include <ScrollView.h>
|
#include <ScrollView.h>
|
||||||
#include <ScrollBar.h>
|
#include <ScrollBar.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
|
#include "ColorSet.h"
|
||||||
|
#include "LayerData.h"
|
||||||
class PreviewDriver;
|
class PreviewDriver;
|
||||||
class Decorator;
|
class Decorator;
|
||||||
|
|
||||||
@@ -18,16 +19,18 @@ class DecView : public BView
|
|||||||
public:
|
public:
|
||||||
DecView(BRect frame, const char *name, int32 resize, int32 flags);
|
DecView(BRect frame, const char *name, int32 resize, int32 flags);
|
||||||
~DecView(void);
|
~DecView(void);
|
||||||
void AttachedToWindow(void);
|
void AllAttached(void);
|
||||||
void MessageReceived(BMessage *msg);
|
void MessageReceived(BMessage *msg);
|
||||||
void SaveSettings(void);
|
void SaveSettings(void);
|
||||||
void LoadSettings(void);
|
void LoadSettings(void);
|
||||||
void SetDefaults(void);
|
void SetDefaults(void);
|
||||||
void NotifyServer(void);
|
void NotifyServer(void);
|
||||||
void GetDecorators(void);
|
void GetDecorators(void);
|
||||||
|
void SetColors(const BMessage &message);
|
||||||
bool LoadDecorator(const char *path);
|
bool LoadDecorator(const char *path);
|
||||||
BString ConvertIndexToPath(int32 index);
|
BString ConvertIndexToPath(int32 index);
|
||||||
protected:
|
protected:
|
||||||
|
bool UnpackSettings(ColorSet *set, const BMessage *msg);
|
||||||
BButton *apply;
|
BButton *apply;
|
||||||
BListView *declist;
|
BListView *declist;
|
||||||
BMessage settings;
|
BMessage settings;
|
||||||
@@ -37,6 +40,9 @@ protected:
|
|||||||
Decorator *decorator;
|
Decorator *decorator;
|
||||||
image_id decorator_id;
|
image_id decorator_id;
|
||||||
BString decpath;
|
BString decpath;
|
||||||
|
LayerData ldata;
|
||||||
|
uint64 pat_solid_high;
|
||||||
|
ColorSet colorset;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -25,14 +25,18 @@ Decorator::Decorator(SRect rect, int32 wlook, int32 wfeel, int32 wflags)
|
|||||||
|
|
||||||
Decorator::~Decorator(void)
|
Decorator::~Decorator(void)
|
||||||
{
|
{
|
||||||
delete colors;
|
if(colors!=NULL)
|
||||||
|
{
|
||||||
|
delete colors;
|
||||||
|
colors=NULL;
|
||||||
|
}
|
||||||
if(title_string)
|
if(title_string)
|
||||||
delete title_string;
|
delete title_string;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Decorator::SetColors(ColorSet cset)
|
void Decorator::SetColors(ColorSet cset)
|
||||||
{
|
{
|
||||||
*colors=cset;
|
colors->SetColors(cset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Decorator::SetDriver(DisplayDriver *d)
|
void Decorator::SetDriver(DisplayDriver *d)
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ public:
|
|||||||
const char *GetTitle(void);
|
const char *GetTitle(void);
|
||||||
// void SetFont(SFont *sf);
|
// void SetFont(SFont *sf);
|
||||||
void _ClipTitle(void);
|
void _ClipTitle(void);
|
||||||
|
ColorSet GetColors(void) { if(colors) return *colors; else return ColorSet(); }
|
||||||
|
|
||||||
virtual void MoveBy(float x, float y);
|
virtual void MoveBy(float x, float y);
|
||||||
virtual void MoveBy(SPoint pt);
|
virtual void MoveBy(SPoint pt);
|
||||||
|
|||||||
@@ -4,4 +4,4 @@ AddResources Appearance : Appearance.rsrc ;
|
|||||||
|
|
||||||
Preference Appearance : APRMain.cpp APRView.cpp APRWindow.cpp Decorator.cpp DecView.cpp DisplayDriver.cpp PortLink.cpp PreviewDriver.cpp RGBColor.cpp SPoint.cpp SRect.cpp ColorWell.cpp ;
|
Preference Appearance : APRMain.cpp APRView.cpp APRWindow.cpp Decorator.cpp DecView.cpp DisplayDriver.cpp PortLink.cpp PreviewDriver.cpp RGBColor.cpp SPoint.cpp SRect.cpp ColorWell.cpp ;
|
||||||
|
|
||||||
LinkSharedOSLibs Appearance : be ;
|
LinkSharedOSLibs Appearance : be tracker ;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#ifndef LAYERDATA_H_
|
#ifndef LAYERDATA_H_
|
||||||
#define LAYERDATA_H_
|
#define LAYERDATA_H_
|
||||||
|
|
||||||
|
#include "SPoint.h"
|
||||||
class ServerBitmap;
|
class ServerBitmap;
|
||||||
|
|
||||||
class LayerData
|
class LayerData
|
||||||
|
|||||||
@@ -159,5 +159,5 @@ printf("MakeBlendColor( {%u,%u,%u,%u}, {%u,%u,%u,%u}, %f) : {%u,%u,%u,%u}\n",
|
|||||||
|
|
||||||
void RGBColor::PrintToStream(void)
|
void RGBColor::PrintToStream(void)
|
||||||
{
|
{
|
||||||
printf("RGBColor (%u,%u,%u,%u)\n", color.red,color.green,color.blue,color.alpha);
|
printf("RGBColor (%u,%u,%u,%u)\n", color32.red,color32.green,color32.blue,color32.alpha);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user