*Major* update
Bugfixes galore, updated support sources Works very nicely with the supplied decorators git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3892 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -7,7 +7,7 @@ APRApplication::APRApplication()
|
|||||||
BRect rect;
|
BRect rect;
|
||||||
|
|
||||||
// This is just the size and location of the window when Show() is called
|
// This is just the size and location of the window when Show() is called
|
||||||
rect.Set(100,100,520,345);
|
rect.Set(100,100,540,345);
|
||||||
aprwin=new APRWindow(rect);
|
aprwin=new APRWindow(rect);
|
||||||
aprwin->Show();
|
aprwin->Show();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,25 +146,14 @@ APRView::APRView(const BRect &frame, const char *name, int32 resize, int32 flags
|
|||||||
new BMessage(REVERT_SETTINGS),B_FOLLOW_LEFT |B_FOLLOW_TOP,
|
new BMessage(REVERT_SETTINGS),B_FOLLOW_LEFT |B_FOLLOW_TOP,
|
||||||
B_WILL_DRAW | B_NAVIGABLE);
|
B_WILL_DRAW | B_NAVIGABLE);
|
||||||
AddChild(revert);
|
AddChild(revert);
|
||||||
// Eventually we might want to have this disabled at the start and
|
revert->SetEnabled(false);
|
||||||
// enabled when the user makes changes and such. Then again, maybe we won't.
|
|
||||||
// revert->SetEnabled(false);
|
|
||||||
|
|
||||||
cvrect.OffsetBy(70,0);
|
|
||||||
try_settings=new BButton(cvrect,"TryButton","Try",
|
|
||||||
new BMessage(TRY_SETTINGS),B_FOLLOW_LEFT |B_FOLLOW_TOP,
|
|
||||||
B_WILL_DRAW | B_NAVIGABLE);
|
|
||||||
AddChild(try_settings);
|
|
||||||
|
|
||||||
// Eventually we might want to have this disabled at the start and
|
|
||||||
// enabled when the user makes changes and such. Then again, maybe we won't.
|
|
||||||
// try_settings->SetEnabled(false);
|
|
||||||
|
|
||||||
cvrect.OffsetBy(70,0);
|
cvrect.OffsetBy(70,0);
|
||||||
apply=new BButton(cvrect,"ApplyButton","Apply",
|
apply=new BButton(cvrect,"ApplyButton","Apply",
|
||||||
new BMessage(APPLY_SETTINGS),B_FOLLOW_LEFT |B_FOLLOW_TOP,
|
new BMessage(APPLY_SETTINGS),B_FOLLOW_LEFT |B_FOLLOW_TOP,
|
||||||
B_WILL_DRAW | B_NAVIGABLE);
|
B_WILL_DRAW | B_NAVIGABLE);
|
||||||
AddChild(apply);
|
AddChild(apply);
|
||||||
|
apply->SetEnabled(false);
|
||||||
|
|
||||||
BEntry entry(COLOR_SET_DIR);
|
BEntry entry(COLOR_SET_DIR);
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
@@ -173,9 +162,8 @@ APRView::APRView(const BRect &frame, const char *name, int32 resize, int32 flags
|
|||||||
&ref, 0, false);
|
&ref, 0, false);
|
||||||
|
|
||||||
attribute=B_PANEL_BACKGROUND_COLOR;
|
attribute=B_PANEL_BACKGROUND_COLOR;
|
||||||
attrstring="PANEL_BACKGROUND";
|
attrstring="Background";
|
||||||
LoadSettings();
|
LoadSettings();
|
||||||
picker->SetValue(GetColorFromMessage(&settings,attrstring.String()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
APRView::~APRView(void)
|
APRView::~APRView(void)
|
||||||
@@ -191,7 +179,6 @@ void APRView::AllAttached(void)
|
|||||||
attrlist->SetTarget(this);
|
attrlist->SetTarget(this);
|
||||||
apply->SetTarget(this);
|
apply->SetTarget(this);
|
||||||
defaults->SetTarget(this);
|
defaults->SetTarget(this);
|
||||||
try_settings->SetTarget(this);
|
|
||||||
revert->SetTarget(this);
|
revert->SetTarget(this);
|
||||||
settings_menu->SetTargetForItems(this);
|
settings_menu->SetTargetForItems(this);
|
||||||
colorset_menu->SetTargetForItems(this);
|
colorset_menu->SetTargetForItems(this);
|
||||||
@@ -199,6 +186,7 @@ void APRView::AllAttached(void)
|
|||||||
|
|
||||||
BMessenger msgr(this);
|
BMessenger msgr(this);
|
||||||
savepanel->SetTarget(msgr);
|
savepanel->SetTarget(msgr);
|
||||||
|
picker->SetValue(GetColorFromMessage(&settings,attrstring.String()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void APRView::MessageReceived(BMessage *msg)
|
void APRView::MessageReceived(BMessage *msg)
|
||||||
@@ -302,11 +290,14 @@ printf("MSG: Save Request - couldn't find file name\n");
|
|||||||
colorwell->Invalidate();
|
colorwell->Invalidate();
|
||||||
|
|
||||||
// Update current attribute in the settings
|
// Update current attribute in the settings
|
||||||
settings.ReplaceData(attrstring.String(),(type_code)'RGBC',
|
settings.ReplaceData(attrstring.String(),(type_code)'RGBC',&col,sizeof(rgb_color));
|
||||||
&col,sizeof(rgb_color));
|
|
||||||
|
if(apply->IsEnabled()==false)
|
||||||
|
apply->SetEnabled(true);
|
||||||
|
if(revert->IsEnabled()==false)
|
||||||
|
revert->SetEnabled(true);
|
||||||
|
|
||||||
SetColorSetName("<untitled>");
|
SetColorSetName("<untitled>");
|
||||||
if(Window())
|
|
||||||
Window()->PostMessage(SET_UI_COLORS);
|
Window()->PostMessage(SET_UI_COLORS);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -316,7 +307,7 @@ printf("MSG: Save Request - couldn't find file name\n");
|
|||||||
ColorWhichItem *whichitem=(ColorWhichItem*)attrlist->ItemAt(attrlist->CurrentSelection());
|
ColorWhichItem *whichitem=(ColorWhichItem*)attrlist->ItemAt(attrlist->CurrentSelection());
|
||||||
if(!whichitem)
|
if(!whichitem)
|
||||||
break;
|
break;
|
||||||
|
attrstring=whichitem->Text();
|
||||||
rgb_color col=GetColorFromMessage(&settings,whichitem->Text(),0);
|
rgb_color col=GetColorFromMessage(&settings,whichitem->Text(),0);
|
||||||
picker->SetValue(col);
|
picker->SetValue(col);
|
||||||
colorwell->SetColor(col);
|
colorwell->SetColor(col);
|
||||||
@@ -343,13 +334,18 @@ printf("MSG: Save Request - couldn't find file name\n");
|
|||||||
}
|
}
|
||||||
case REVERT_SETTINGS:
|
case REVERT_SETTINGS:
|
||||||
{
|
{
|
||||||
LoadSettings();
|
/* LoadSettings();
|
||||||
rgb_color col=GetColorFromMessage(&settings,attrstring.String(),0);
|
rgb_color col=GetColorFromMessage(&settings,attrstring.String(),0);
|
||||||
picker->SetValue(col);
|
picker->SetValue(col);
|
||||||
colorwell->SetColor(col);
|
colorwell->SetColor(col);
|
||||||
colorwell->Invalidate();
|
colorwell->Invalidate();
|
||||||
if(Window())
|
if(Window())
|
||||||
Window()->PostMessage(SET_UI_COLORS);
|
Window()->PostMessage(SET_UI_COLORS);
|
||||||
|
*/
|
||||||
|
if(prev_set_name=="Default")
|
||||||
|
SetDefaults();
|
||||||
|
|
||||||
|
LoadColorSet(prev_set_name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DEFAULT_SETTINGS:
|
case DEFAULT_SETTINGS:
|
||||||
@@ -587,6 +583,9 @@ printf("SaveSettings: %s\n",path.String());
|
|||||||
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);
|
||||||
|
prev_set_name=*colorset_name;
|
||||||
|
revert->SetEnabled(false);
|
||||||
|
revert->SetEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void APRView::LoadSettings(void)
|
void APRView::LoadSettings(void)
|
||||||
@@ -625,7 +624,7 @@ 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());
|
||||||
|
prev_set_name=*colorset_name;
|
||||||
picker->SetValue(GetColorFromMessage(&settings,attrstring.String()));
|
picker->SetValue(GetColorFromMessage(&settings,attrstring.String()));
|
||||||
colorwell->SetColor(picker->ValueAsColor());
|
colorwell->SetColor(picker->ValueAsColor());
|
||||||
#ifdef DEBUG_COLORSET
|
#ifdef DEBUG_COLORSET
|
||||||
@@ -805,40 +804,6 @@ printf("NotifyServer: Setting Desktop color to "); PrintRGBColor(col);
|
|||||||
|
|
||||||
if(Window())
|
if(Window())
|
||||||
Window()->PostMessage(SET_UI_COLORS);
|
Window()->PostMessage(SET_UI_COLORS);
|
||||||
|
|
||||||
/* // Name taken from ServerProtocol.h
|
|
||||||
port_id serverport=find_port("OBappserver");
|
|
||||||
|
|
||||||
if(serverport==B_NAME_NOT_FOUND)
|
|
||||||
return;
|
|
||||||
|
|
||||||
PortLink *pl=new PortLink(serverport);
|
|
||||||
|
|
||||||
// 'suic'==SET_UI_COLORS message from ServerProtocol.h
|
|
||||||
pl->SetOpCode('suic');
|
|
||||||
|
|
||||||
rgb_color col;
|
|
||||||
col=GetColorFromMessage(&settings,"PANEL_BACKGROUND");
|
|
||||||
pl->Attach(&col,sizeof(rgb_color));
|
|
||||||
col=GetColorFromMessage(&settings,"MENU_BACKGROUND");
|
|
||||||
pl->Attach(&col,sizeof(rgb_color));
|
|
||||||
col=GetColorFromMessage(&settings,"MENU_SELECTION_BACKGROUND");
|
|
||||||
pl->Attach(&col,sizeof(rgb_color));
|
|
||||||
col=GetColorFromMessage(&settings,"MENU_ITEM_TEXT");
|
|
||||||
pl->Attach(&col,sizeof(rgb_color));
|
|
||||||
col=GetColorFromMessage(&settings,"MENU_SELECTED_ITEM_TEXT");
|
|
||||||
pl->Attach(&col,sizeof(rgb_color));
|
|
||||||
col=GetColorFromMessage(&settings,"WINDOW_TAB");
|
|
||||||
pl->Attach(&col,sizeof(rgb_color));
|
|
||||||
col=GetColorFromMessage(&settings,"KEYBOARD_NAVIGATION");
|
|
||||||
pl->Attach(&col,sizeof(rgb_color));
|
|
||||||
col=GetColorFromMessage(&settings,"DESKTOP");
|
|
||||||
pl->Attach(&col,sizeof(rgb_color));
|
|
||||||
|
|
||||||
pl->Flush();
|
|
||||||
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)
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ protected:
|
|||||||
void LoadColorSet(const BString &name);
|
void LoadColorSet(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;
|
||||||
BListView *attrlist;
|
BListView *attrlist;
|
||||||
color_which attribute;
|
color_which attribute;
|
||||||
BMessage settings;
|
BMessage settings;
|
||||||
@@ -76,6 +76,7 @@ protected:
|
|||||||
BFilePanel *savepanel;
|
BFilePanel *savepanel;
|
||||||
ColorWell *colorwell;
|
ColorWell *colorwell;
|
||||||
BString *colorset_name;
|
BString *colorset_name;
|
||||||
|
BString prev_set_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -43,9 +43,7 @@ void APRWindow::WorkspaceActivated(int32 wkspc, bool is_active)
|
|||||||
void APRWindow::MessageReceived(BMessage *msg)
|
void APRWindow::MessageReceived(BMessage *msg)
|
||||||
{
|
{
|
||||||
if(msg->what==SET_UI_COLORS)
|
if(msg->what==SET_UI_COLORS)
|
||||||
{
|
|
||||||
decorators->SetColors(colors->settings);
|
decorators->SetColors(colors->settings);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
BWindow::MessageReceived(msg);
|
BWindow::MessageReceived(msg);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#define B_WINDOW_TAB_TEXT_COLOR 'wttx'
|
#define B_WINDOW_TAB_TEXT_COLOR 'wttx'
|
||||||
#define B_INACTIVE_WINDOW_TAB_COLOR 'iwtb'
|
#define B_INACTIVE_WINDOW_TAB_COLOR 'iwtb'
|
||||||
|
|
||||||
#ifdef BUILD_UNDER_R5
|
//#ifdef BUILD_UNDER_R5
|
||||||
#define B_MENU_SELECTED_BACKGROUND_COLOR B_MENU_SELECTION_BACKGROUND_COLOR
|
#define B_MENU_SELECTED_BACKGROUND_COLOR B_MENU_SELECTION_BACKGROUND_COLOR
|
||||||
#define B_PANEL_TEXT_COLOR 'ptxt'
|
#define B_PANEL_TEXT_COLOR 'ptxt'
|
||||||
#define B_DOCUMENT_BACKGROUND_COLOR 'dbgc'
|
#define B_DOCUMENT_BACKGROUND_COLOR 'dbgc'
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
#define B_TOOLTIP_TEXT_COLOR 'tttx'
|
#define B_TOOLTIP_TEXT_COLOR 'tttx'
|
||||||
#define B_SUCCESS_COLOR 'sucs'
|
#define B_SUCCESS_COLOR 'sucs'
|
||||||
#define B_FAILURE_COLOR 'fail'
|
#define B_FAILURE_COLOR 'fail'
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
class ColorWhichItem : public BStringItem
|
class ColorWhichItem : public BStringItem
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
#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)
|
||||||
@@ -89,6 +89,21 @@ DecView::DecView(BRect frame, const char *name, int32 resize, int32 flags)
|
|||||||
decorator_id=-1;
|
decorator_id=-1;
|
||||||
GetDecorators();
|
GetDecorators();
|
||||||
LoadSettings();
|
LoadSettings();
|
||||||
|
|
||||||
|
BString path(ConvertIndexToPath(0L));
|
||||||
|
if(LoadDecorator(path.String()))
|
||||||
|
{
|
||||||
|
driver->FillRect(preview_bounds,&ldata,(int8*)&pat_solid_high);
|
||||||
|
if(decorator)
|
||||||
|
{
|
||||||
|
BStringItem *item=(BStringItem*)declist->ItemAt(declist->CurrentSelection());
|
||||||
|
path=(item)?item->Text():path="Title";
|
||||||
|
decorator->SetDriver(driver);
|
||||||
|
decorator->SetTitle(path.String());
|
||||||
|
decorator->SetColors(colorset);
|
||||||
|
decorator->Draw();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DecView::~DecView(void)
|
DecView::~DecView(void)
|
||||||
@@ -138,10 +153,13 @@ printf("MSG: Decorator NOT Chosen - couldn't load decorator\n");
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ldata.highcolor.SetColor(colorset.desktop);
|
|
||||||
driver->FillRect(preview_bounds,&ldata,(int8*)&pat_solid_high);
|
driver->FillRect(preview_bounds,&ldata,(int8*)&pat_solid_high);
|
||||||
if(decorator)
|
if(decorator)
|
||||||
{
|
{
|
||||||
|
BStringItem *item=(BStringItem*)declist->ItemAt(declist->CurrentSelection());
|
||||||
|
path=(item)?item->Text():path="Title";
|
||||||
|
decorator->SetDriver(driver);
|
||||||
|
decorator->SetTitle(path.String());
|
||||||
decorator->SetColors(colorset);
|
decorator->SetColors(colorset);
|
||||||
decorator->Draw();
|
decorator->Draw();
|
||||||
}
|
}
|
||||||
@@ -375,7 +393,7 @@ void DecView::SetColors(const BMessage &message)
|
|||||||
#ifdef DEBUG_DECORATOR
|
#ifdef DEBUG_DECORATOR
|
||||||
printf("DecView::SetColors\n");
|
printf("DecView::SetColors\n");
|
||||||
#endif
|
#endif
|
||||||
if(UnpackSettings(&colorset,&message))
|
if(UnpackSettings(&colorset,message))
|
||||||
{
|
{
|
||||||
if(decorator)
|
if(decorator)
|
||||||
{
|
{
|
||||||
@@ -399,36 +417,68 @@ printf("DecView::SetColors: UnpackSetting returned false\n");
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DecView::UnpackSettings(ColorSet *set, const BMessage *msg)
|
bool DecView::UnpackSettings(ColorSet *set, const BMessage &msg)
|
||||||
{
|
{
|
||||||
if(!set || !msg)
|
if(!set)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_DECORATOR
|
#ifdef DEBUG_DECORATOR
|
||||||
printf("UnpackSettings(): NULL parameter\n");
|
printf("UnpackSettings(): NULL parameter\n");
|
||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
rgb_color *col;
|
rgb_color *col;
|
||||||
ssize_t size;
|
ssize_t size;
|
||||||
|
|
||||||
// Once the OBOS app_server is in place, there will be more attributes
|
if(msg.FindData("Background",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
||||||
|
set->panel_background=*col;
|
||||||
|
if(msg.FindData("Panel Text",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
||||||
|
set->panel_text=*col;
|
||||||
|
if(msg.FindData("Document Background",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
||||||
|
set->document_background=*col;
|
||||||
|
if(msg.FindData("Document Text",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
||||||
|
set->document_text=*col;
|
||||||
|
if(msg.FindData("Control Background",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
||||||
|
set->control_background=*col;
|
||||||
|
if(msg.FindData("Control Text",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
||||||
|
set->control_text=*col;
|
||||||
|
if(msg.FindData("Control Highlight",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
||||||
|
set->control_highlight=*col;
|
||||||
|
if(msg.FindData("Control Border",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
||||||
|
set->control_border=*col;
|
||||||
|
if(msg.FindData("Tooltip Background",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
||||||
|
set->tooltip_background=*col;
|
||||||
|
if(msg.FindData("Tooltip Text",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
||||||
|
set->tooltip_text=*col;
|
||||||
|
if(msg.FindData("Menu Background",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
||||||
|
set->menu_background=*col;
|
||||||
|
if(msg.FindData("Selected Menu Item Background",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
||||||
|
set->menu_selected_background=*col;
|
||||||
|
if(msg.FindData("Navigation Base",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
||||||
|
set->keyboard_navigation_base=*col;
|
||||||
|
if(msg.FindData("Navigation Pulse",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
||||||
|
set->keyboard_navigation_pulse=*col;
|
||||||
|
if(msg.FindData("Menu Item Text",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
||||||
|
set->menu_text=*col;
|
||||||
|
if(msg.FindData("Selected Menu Item Text",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
||||||
|
set->menu_selected_text=*col;
|
||||||
|
if(msg.FindData("Selected Menu Item Border",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
||||||
|
set->menu_selected_border=*col;
|
||||||
|
if(msg.FindData("Success",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
||||||
|
set->success=*col;
|
||||||
|
if(msg.FindData("Failure",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
||||||
|
set->failure=*col;
|
||||||
|
if(msg.FindData("Shine",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
||||||
|
set->shine=*col;
|
||||||
|
if(msg.FindData("Shadow",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
||||||
|
set->shadow=*col;
|
||||||
|
if(msg.FindData("Window Tab",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
||||||
|
set->window_tab=*col;
|
||||||
|
if(msg.FindData("Window Tab Text",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
||||||
|
set->window_tab_text=*col;
|
||||||
|
if(msg.FindData("Inactive Window Tab",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
||||||
|
set->inactive_window_tab=*col;
|
||||||
|
if(msg.FindData("Inactive Window Tab Text",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
||||||
|
set->inactive_window_tab_text=*col;
|
||||||
|
|
||||||
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_BASE",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
|
||||||
set->keyboard_navigation_base.SetColor(*col);
|
|
||||||
if(msg->FindData("KEYBOARD_NAVIGATION_PULSE",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
|
||||||
set->keyboard_navigation_pulse.SetColor(*col);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public:
|
|||||||
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);
|
bool UnpackSettings(ColorSet *set, const BMessage &msg);
|
||||||
BButton *apply;
|
BButton *apply;
|
||||||
BListView *declist;
|
BListView *declist;
|
||||||
BMessage settings;
|
BMessage settings;
|
||||||
|
|||||||
@@ -44,7 +44,8 @@ Decorator::Decorator(BRect rect, int32 wlook, int32 wfeel, int32 wflags)
|
|||||||
_close_state=false;
|
_close_state=false;
|
||||||
_minimize_state=false;
|
_minimize_state=false;
|
||||||
_zoom_state=false;
|
_zoom_state=false;
|
||||||
_title_string=new BString;
|
_has_focus=false;
|
||||||
|
_title_string=new BString("");
|
||||||
_driver=NULL;
|
_driver=NULL;
|
||||||
|
|
||||||
_closerect.Set(0,0,1,1);
|
_closerect.Set(0,0,1,1);
|
||||||
@@ -83,8 +84,8 @@ Decorator::~Decorator(void)
|
|||||||
*/
|
*/
|
||||||
void Decorator::SetColors(const ColorSet &cset)
|
void Decorator::SetColors(const ColorSet &cset)
|
||||||
{
|
{
|
||||||
if(_colors)
|
|
||||||
_colors->SetColors(cset);
|
_colors->SetColors(cset);
|
||||||
|
_SetColors();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -232,6 +233,7 @@ int32 Decorator::GetFlags(void)
|
|||||||
void Decorator::SetTitle(const char *string)
|
void Decorator::SetTitle(const char *string)
|
||||||
{
|
{
|
||||||
_title_string->SetTo(string);
|
_title_string->SetTo(string);
|
||||||
|
_DoLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -330,7 +332,7 @@ void Decorator::MoveBy(BPoint pt)
|
|||||||
necessarily reflect _tabrect offset by the amount given - few people want to
|
necessarily reflect _tabrect offset by the amount given - few people want to
|
||||||
slide a tab right off the window - that would be a Bad Thing (TM).
|
slide a tab right off the window - that would be a Bad Thing (TM).
|
||||||
*/
|
*/
|
||||||
BRect Decorator::SlideTab(float dx, float dy=0)
|
BRect Decorator::SlideTab(float dx, float dy)
|
||||||
{
|
{
|
||||||
return BRect(0,0,0,0);
|
return BRect(0,0,0,0);
|
||||||
}
|
}
|
||||||
@@ -486,6 +488,16 @@ void Decorator::_DrawZoom(BRect r)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Hook function for when the color set is updated
|
||||||
|
|
||||||
|
This function is called after the decorator's color set is updated. Quite useful
|
||||||
|
if the decorator uses colors based on those in the system.
|
||||||
|
*/
|
||||||
|
void Decorator::_SetColors(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Returns the "footprint" of the entire window, including decorator
|
\brief Returns the "footprint" of the entire window, including decorator
|
||||||
\return Region representing the window's screen footprint
|
\return Region representing the window's screen footprint
|
||||||
|
|||||||
@@ -95,6 +95,11 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
int32 _ClipTitle(float width);
|
int32 _ClipTitle(float width);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Returns the number of characters in the title
|
||||||
|
\return The title character count
|
||||||
|
*/
|
||||||
int32 _TitleWidth(void) { return (_title_string)?_title_string->CountChars():0; }
|
int32 _TitleWidth(void) { return (_title_string)?_title_string->CountChars():0; }
|
||||||
|
|
||||||
virtual void _DrawClose(BRect r);
|
virtual void _DrawClose(BRect r);
|
||||||
@@ -105,6 +110,7 @@ protected:
|
|||||||
virtual void _DrawZoom(BRect r);
|
virtual void _DrawZoom(BRect r);
|
||||||
virtual void _SetFocus(void)=0;
|
virtual void _SetFocus(void)=0;
|
||||||
virtual void _DoLayout(void)=0;
|
virtual void _DoLayout(void)=0;
|
||||||
|
virtual void _SetColors(void);
|
||||||
|
|
||||||
ColorSet *_colors;
|
ColorSet *_colors;
|
||||||
DisplayDriver *_driver;
|
DisplayDriver *_driver;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#define LAYERDATA_H_
|
#define LAYERDATA_H_
|
||||||
|
|
||||||
#include <Point.h>
|
#include <Point.h>
|
||||||
|
#include <View.h>
|
||||||
class ServerBitmap;
|
class ServerBitmap;
|
||||||
|
|
||||||
class LayerData
|
class LayerData
|
||||||
@@ -11,9 +12,9 @@ LayerData(void)
|
|||||||
{
|
{
|
||||||
pensize=1.0;
|
pensize=1.0;
|
||||||
penlocation.Set(0,0);
|
penlocation.Set(0,0);
|
||||||
drawing_mode=0;
|
draw_mode=B_OP_COPY;
|
||||||
bitmap_background=NULL;
|
background=NULL;
|
||||||
bitmap_overlay=NULL;
|
overlay=NULL;
|
||||||
highcolor.SetColor(0,0,0,255);
|
highcolor.SetColor(0,0,0,255);
|
||||||
lowcolor.SetColor(255,255,255,255);
|
lowcolor.SetColor(255,255,255,255);
|
||||||
//SFont font;
|
//SFont font;
|
||||||
@@ -23,13 +24,15 @@ LayerData(void)
|
|||||||
|
|
||||||
float pensize;
|
float pensize;
|
||||||
BPoint penlocation;
|
BPoint penlocation;
|
||||||
int32 drawing_mode;
|
drawing_mode draw_mode;
|
||||||
ServerBitmap *bitmap_background;
|
source_alpha alpha_mode;
|
||||||
ServerBitmap *bitmap_overlay;
|
alpha_function blending_mode;
|
||||||
RGBColor highcolor, lowcolor;
|
ServerBitmap *background;
|
||||||
//SFont font;
|
ServerBitmap *overlay;
|
||||||
//bool antialias_text;
|
RGBColor highcolor, lowcolor, viewcolor;
|
||||||
|
// ServerFont *font;
|
||||||
float scale;
|
float scale;
|
||||||
|
escapement_delta edelta;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include <Region.h>
|
#include <Region.h>
|
||||||
#include <Bitmap.h>
|
#include <Bitmap.h>
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
|
#include <Font.h>
|
||||||
#include <GraphicsDefs.h>
|
#include <GraphicsDefs.h>
|
||||||
#include "PortLink.h"
|
#include "PortLink.h"
|
||||||
#include "PreviewDriver.h"
|
#include "PreviewDriver.h"
|
||||||
@@ -115,11 +116,36 @@ void PreviewDriver::DrawChar(char c, BPoint pt)
|
|||||||
void DrawPicture(SPicture *pic, BPoint pt)
|
void DrawPicture(SPicture *pic, BPoint pt)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawString(const char *string, int32 length, BPoint pt, escapement_delta *delta=NULL)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
|
void PreviewDriver::DrawString(const char *string, int32 length, BPoint pt, LayerData *d, escapement_delta *delta=NULL)
|
||||||
|
{
|
||||||
|
if(!d)
|
||||||
|
return;
|
||||||
|
BRect r;
|
||||||
|
|
||||||
|
view->viewbmp->Lock();
|
||||||
|
|
||||||
|
drawview->SetHighColor(d->highcolor.GetColor32());
|
||||||
|
drawview->SetLowColor(d->lowcolor.GetColor32());
|
||||||
|
drawview->SetPenSize(d->pensize);
|
||||||
|
pt.y--;
|
||||||
|
drawview->DrawString(string,length,pt,delta);
|
||||||
|
drawview->Sync();
|
||||||
|
|
||||||
|
// calculate the invalid rectangle
|
||||||
|
font_height fh;
|
||||||
|
BFont font;
|
||||||
|
drawview->GetFont(&font);
|
||||||
|
drawview->GetFontHeight(&fh);
|
||||||
|
r.left=pt.x;
|
||||||
|
r.right=pt.x+font.StringWidth(string);
|
||||||
|
r.top=pt.y-fh.ascent;
|
||||||
|
r.bottom=pt.y+fh.descent;
|
||||||
|
view->Invalidate(r);
|
||||||
|
|
||||||
|
view->viewbmp->Unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void PreviewDriver::InvertRect(BRect r)
|
void PreviewDriver::InvertRect(BRect r)
|
||||||
{
|
{
|
||||||
@@ -337,3 +363,18 @@ bool PreviewDriver::DumpToFile(const char *path)
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float PreviewDriver::StringWidth(const char *string, int32 length, LayerData *d)
|
||||||
|
{
|
||||||
|
view->viewbmp->Lock();
|
||||||
|
float returnval=drawview->StringWidth(string,length);
|
||||||
|
view->viewbmp->Unlock();
|
||||||
|
return returnval;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreviewDriver::GetTruncatedStrings( const char **instrings, int32 stringcount, uint32 mode, float maxwidth, char **outstrings)
|
||||||
|
{
|
||||||
|
view->viewbmp->Lock();
|
||||||
|
be_plain_font->GetTruncatedStrings(instrings,stringcount,mode,maxwidth,outstrings);
|
||||||
|
view->viewbmp->Unlock();
|
||||||
|
}
|
||||||
|
|||||||
@@ -35,34 +35,36 @@ public:
|
|||||||
PreviewDriver(void);
|
PreviewDriver(void);
|
||||||
~PreviewDriver(void);
|
~PreviewDriver(void);
|
||||||
|
|
||||||
virtual bool Initialize(void);
|
bool Initialize(void);
|
||||||
virtual void Shutdown(void);
|
void Shutdown(void);
|
||||||
virtual void CopyBits(BRect src, BRect dest);
|
void CopyBits(BRect src, BRect dest);
|
||||||
virtual void DrawBitmap(ServerBitmap *bmp, BRect src, BRect dest, LayerData *d);
|
void DrawBitmap(ServerBitmap *bmp, BRect src, BRect dest, LayerData *d);
|
||||||
virtual void DrawChar(char c, BPoint pt);
|
void DrawChar(char c, BPoint pt);
|
||||||
// virtual void DrawPicture(SPicture *pic, BPoint pt);
|
// void DrawPicture(SPicture *pic, BPoint pt);
|
||||||
// virtual void DrawString(const char *string, int32 length, BPoint pt, escapement_delta *delta=NULL);
|
void DrawString(const char *string, int32 length, BPoint pt, LayerData *d, escapement_delta *delta=NULL);
|
||||||
virtual void InvertRect(BRect r);
|
void InvertRect(BRect r);
|
||||||
virtual void StrokeBezier(BPoint *pts, LayerData *d, int8 *pat);
|
void StrokeBezier(BPoint *pts, LayerData *d, int8 *pat);
|
||||||
virtual void FillBezier(BPoint *pts, LayerData *d, int8 *pat);
|
void FillBezier(BPoint *pts, LayerData *d, int8 *pat);
|
||||||
virtual void StrokeEllipse(BRect r, LayerData *d, int8 *pat);
|
void StrokeEllipse(BRect r, LayerData *d, int8 *pat);
|
||||||
virtual void FillEllipse(BRect r, LayerData *d, int8 *pat);
|
void FillEllipse(BRect r, LayerData *d, int8 *pat);
|
||||||
virtual void StrokeArc(BRect r, float angle, float span, LayerData *d, int8 *pat);
|
void StrokeArc(BRect r, float angle, float span, LayerData *d, int8 *pat);
|
||||||
virtual void FillArc(BRect r, float angle, float span, LayerData *d, int8 *pat);
|
void FillArc(BRect r, float angle, float span, LayerData *d, int8 *pat);
|
||||||
virtual void StrokeLine(BPoint start, BPoint end, LayerData *d, int8 *pat);
|
void StrokeLine(BPoint start, BPoint end, LayerData *d, int8 *pat);
|
||||||
virtual void StrokePolygon(BPoint *ptlist, int32 numpts, BRect rect, LayerData *d, int8 *pat, bool is_closed=true);
|
void StrokePolygon(BPoint *ptlist, int32 numpts, BRect rect, LayerData *d, int8 *pat, bool is_closed=true);
|
||||||
virtual void FillPolygon(BPoint *ptlist, int32 numpts, BRect rect, LayerData *d, int8 *pat);
|
void FillPolygon(BPoint *ptlist, int32 numpts, BRect rect, LayerData *d, int8 *pat);
|
||||||
virtual void StrokeRect(BRect r, LayerData *d, int8 *pat);
|
void StrokeRect(BRect r, LayerData *d, int8 *pat);
|
||||||
virtual void FillRect(BRect r, LayerData *d, int8 *pat);
|
void FillRect(BRect r, LayerData *d, int8 *pat);
|
||||||
virtual void StrokeRoundRect(BRect r, float xrad, float yrad, LayerData *d, int8 *pat);
|
void StrokeRoundRect(BRect r, float xrad, float yrad, LayerData *d, int8 *pat);
|
||||||
virtual void FillRoundRect(BRect r, float xrad, float yrad, LayerData *d, int8 *pat);
|
void FillRoundRect(BRect r, float xrad, float yrad, LayerData *d, int8 *pat);
|
||||||
// virtual void StrokeShape(SShape *sh, LayerData *d, int8 *pat);
|
// void StrokeShape(SShape *sh, LayerData *d, int8 *pat);
|
||||||
// virtual void FillShape(SShape *sh, LayerData *d, int8 *pat);
|
// void FillShape(SShape *sh, LayerData *d, int8 *pat);
|
||||||
virtual void StrokeTriangle(BPoint *pts, BRect r, LayerData *d, int8 *pat);
|
void StrokeTriangle(BPoint *pts, BRect r, LayerData *d, int8 *pat);
|
||||||
virtual void FillTriangle(BPoint *pts, BRect r, LayerData *d, int8 *pat);
|
void FillTriangle(BPoint *pts, BRect r, LayerData *d, int8 *pat);
|
||||||
virtual void StrokeLineArray(BPoint *pts, int32 numlines, RGBColor *colors, LayerData *d);
|
void StrokeLineArray(BPoint *pts, int32 numlines, RGBColor *colors, LayerData *d);
|
||||||
virtual void SetMode(int32 mode);
|
void SetMode(int32 mode);
|
||||||
virtual bool DumpToFile(const char *path);
|
float StringWidth(const char *string, int32 length, LayerData *d);
|
||||||
|
void GetTruncatedStrings( const char **instrings, int32 stringcount, uint32 mode, float maxwidth, char **outstrings);
|
||||||
|
bool DumpToFile(const char *path);
|
||||||
|
|
||||||
BView *View(void) { return (BView*)view; };
|
BView *View(void) { return (BView*)view; };
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
Reference in New Issue
Block a user