Disabled code for cursor config until API settles
Added low-level clipping support to decorator preview Added comments to clarify disabled cursor and color set support git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10215 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -28,10 +28,25 @@
|
|||||||
#include "APRMain.h"
|
#include "APRMain.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
#include "FontServer.h"
|
||||||
|
#include "ServerConfig.h"
|
||||||
|
|
||||||
APRApplication::APRApplication()
|
APRApplication::APRApplication()
|
||||||
:BApplication(APPEARANCE_APP_SIGNATURE)
|
:BApplication(APPEARANCE_APP_SIGNATURE)
|
||||||
{
|
{
|
||||||
|
fontserver=new FontServer();
|
||||||
|
fontserver->ScanDirectory("/boot/beos/etc/fonts/ttfonts/");
|
||||||
|
fontserver->ScanDirectory("/boot/beos/etc/fonts/PS-Type1/");
|
||||||
|
if(!fontserver->SetSystemPlain(DEFAULT_PLAIN_FONT_FAMILY,DEFAULT_PLAIN_FONT_STYLE,DEFAULT_PLAIN_FONT_SIZE))
|
||||||
|
printf("Couldn't set plain to %s, %s %d pt\n",DEFAULT_PLAIN_FONT_FAMILY,
|
||||||
|
DEFAULT_PLAIN_FONT_STYLE,DEFAULT_PLAIN_FONT_SIZE);
|
||||||
|
if(!fontserver->SetSystemBold(DEFAULT_BOLD_FONT_FAMILY,DEFAULT_BOLD_FONT_STYLE,DEFAULT_BOLD_FONT_SIZE))
|
||||||
|
printf("Couldn't set bold to %s, %s %d pt\n",DEFAULT_BOLD_FONT_FAMILY,
|
||||||
|
DEFAULT_BOLD_FONT_STYLE,DEFAULT_BOLD_FONT_SIZE);
|
||||||
|
if(!fontserver->SetSystemFixed(DEFAULT_FIXED_FONT_FAMILY,DEFAULT_FIXED_FONT_STYLE,DEFAULT_FIXED_FONT_SIZE))
|
||||||
|
printf("Couldn't set fixed to %s, %s %d pt\n",DEFAULT_FIXED_FONT_FAMILY,
|
||||||
|
DEFAULT_FIXED_FONT_STYLE,DEFAULT_FIXED_FONT_SIZE);
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
@@ -69,7 +69,9 @@ APRView::APRView(const BRect &frame, const char *name, int32 resize, int32 flags
|
|||||||
currentset=new ColorSet;
|
currentset=new ColorSet;
|
||||||
prevset=NULL;
|
prevset=NULL;
|
||||||
|
|
||||||
/* BMenuBar *mb=new BMenuBar(BRect(0,0,Bounds().Width(),16),"menubar");
|
/*
|
||||||
|
// This disabled code block is being saved for a color set app
|
||||||
|
BMenuBar *mb=new BMenuBar(BRect(0,0,Bounds().Width(),16),"menubar");
|
||||||
|
|
||||||
settings_menu=new BMenu("Settings");
|
settings_menu=new BMenu("Settings");
|
||||||
settings_menu->AddItem(new BMenuItem("Save Color Set",new BMessage(SAVE_COLORSET),'S'));
|
settings_menu->AddItem(new BMenuItem("Save Color Set",new BMessage(SAVE_COLORSET),'S'));
|
||||||
@@ -90,7 +92,7 @@ APRView::APRView(const BRect &frame, const char *name, int32 resize, int32 flags
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Set up list of color attributes
|
// Set up list of color attributes
|
||||||
BRect rect(10,10,200,100);
|
BRect rect(10,10,200,175);
|
||||||
attrlist=new BListView(rect,"AttributeList");
|
attrlist=new BListView(rect,"AttributeList");
|
||||||
|
|
||||||
scrollview=new BScrollView("ScrollView",attrlist, B_FOLLOW_LEFT |
|
scrollview=new BScrollView("ScrollView",attrlist, B_FOLLOW_LEFT |
|
||||||
@@ -169,7 +171,6 @@ APRView::APRView(const BRect &frame, const char *name, int32 resize, int32 flags
|
|||||||
BEntry entry(COLOR_SET_DIR);
|
BEntry entry(COLOR_SET_DIR);
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
entry.GetRef(&ref);
|
entry.GetRef(&ref);
|
||||||
// savepanel=new BFilePanel(B_SAVE_PANEL, NULL, &ref, 0, false);
|
|
||||||
|
|
||||||
attribute=B_PANEL_BACKGROUND_COLOR;
|
attribute=B_PANEL_BACKGROUND_COLOR;
|
||||||
attrstring="Panel Background";
|
attrstring="Panel Background";
|
||||||
@@ -178,7 +179,6 @@ APRView::APRView(const BRect &frame, const char *name, int32 resize, int32 flags
|
|||||||
|
|
||||||
APRView::~APRView(void)
|
APRView::~APRView(void)
|
||||||
{
|
{
|
||||||
// delete savepanel;
|
|
||||||
if(currentset)
|
if(currentset)
|
||||||
delete currentset;
|
delete currentset;
|
||||||
if(prevset)
|
if(prevset)
|
||||||
@@ -193,12 +193,9 @@ void APRView::AllAttached(void)
|
|||||||
apply->SetTarget(this);
|
apply->SetTarget(this);
|
||||||
defaults->SetTarget(this);
|
defaults->SetTarget(this);
|
||||||
revert->SetTarget(this);
|
revert->SetTarget(this);
|
||||||
// settings_menu->SetTargetForItems(this);
|
|
||||||
// colorset_menu->SetTargetForItems(this);
|
|
||||||
colorwell->SetTarget(this);
|
colorwell->SetTarget(this);
|
||||||
|
|
||||||
BMessenger msgr(this);
|
BMessenger msgr(this);
|
||||||
// savepanel->SetTarget(msgr);
|
|
||||||
picker->SetValue(currentset->StringToColor(attrstring.String()).GetColor32());
|
picker->SetValue(currentset->StringToColor(attrstring.String()).GetColor32());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,7 +215,10 @@ void APRView::MessageReceived(BMessage *msg)
|
|||||||
|
|
||||||
switch(msg->what)
|
switch(msg->what)
|
||||||
{
|
{
|
||||||
/* case DELETE_COLORSET:
|
/*
|
||||||
|
// More code being saved for a color set app
|
||||||
|
|
||||||
|
case DELETE_COLORSET:
|
||||||
{
|
{
|
||||||
// We can't delete the Default set
|
// We can't delete the Default set
|
||||||
if(currentset->name.Compare("Default")==0)
|
if(currentset->name.Compare("Default")==0)
|
||||||
@@ -289,7 +289,10 @@ void APRView::MessageReceived(BMessage *msg)
|
|||||||
SaveColorSet(name);
|
SaveColorSet(name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*/ case UPDATE_COLOR:
|
|
||||||
|
// end disabled colorset code
|
||||||
|
*/
|
||||||
|
case UPDATE_COLOR:
|
||||||
{
|
{
|
||||||
// Received from the color picker when its color changes
|
// Received from the color picker when its color changes
|
||||||
if(!prevset)
|
if(!prevset)
|
||||||
@@ -344,7 +347,7 @@ void APRView::MessageReceived(BMessage *msg)
|
|||||||
NotifyServer();
|
NotifyServer();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* case TRY_SETTINGS:
|
case TRY_SETTINGS:
|
||||||
{
|
{
|
||||||
// Tell server to apply settings here without saving them.
|
// Tell server to apply settings here without saving them.
|
||||||
// Theoretically, the user can set this temporarily and keep it
|
// Theoretically, the user can set this temporarily and keep it
|
||||||
@@ -352,7 +355,7 @@ void APRView::MessageReceived(BMessage *msg)
|
|||||||
NotifyServer();
|
NotifyServer();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*/ case REVERT_SETTINGS:
|
case REVERT_SETTINGS:
|
||||||
{
|
{
|
||||||
delete currentset;
|
delete currentset;
|
||||||
currentset=prevset;
|
currentset=prevset;
|
||||||
@@ -399,6 +402,10 @@ void APRView::MessageReceived(BMessage *msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
// This section is commented out because Appearance doesn't manage color sets. That
|
||||||
|
// task is better left to another application.
|
||||||
|
|
||||||
BMenu *APRView::LoadColorSets(void)
|
BMenu *APRView::LoadColorSets(void)
|
||||||
{
|
{
|
||||||
STRACE(("Loading color sets from disk\n"));
|
STRACE(("Loading color sets from disk\n"));
|
||||||
@@ -532,6 +539,7 @@ void APRView::LoadColorSet(const BString &name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
// More code being saved for a color set app
|
||||||
void APRView::SaveColorSet(const BString &name)
|
void APRView::SaveColorSet(const BString &name)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -577,6 +585,7 @@ void APRView::SaveColorSet(const BString &name)
|
|||||||
SaveSettings();
|
SaveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// More code being saved for a color set app
|
||||||
void APRView::SetColorSetName(const char *name)
|
void APRView::SetColorSetName(const char *name)
|
||||||
{
|
{
|
||||||
if(!name)
|
if(!name)
|
||||||
@@ -612,8 +621,7 @@ void APRView::LoadSettings(void)
|
|||||||
// Load the current GUI color settings from disk. This is done instead of
|
// Load the current GUI color settings from disk. This is done instead of
|
||||||
// getting them from the server at this point for testing purposes.
|
// getting them from the server at this point for testing purposes.
|
||||||
|
|
||||||
/* TODO: Uncomment the following disabled code when the app_server will handle the message
|
#ifndef RUN_WITHOUT_APP_SERVER
|
||||||
|
|
||||||
// Query the server for the current settings
|
// Query the server for the current settings
|
||||||
port_id port=find_port(SERVER_PORT_NAME);
|
port_id port=find_port(SERVER_PORT_NAME);
|
||||||
if(port!=B_NAME_NOT_FOUND)
|
if(port!=B_NAME_NOT_FOUND)
|
||||||
@@ -629,7 +637,7 @@ void APRView::LoadSettings(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*/
|
#endif
|
||||||
STRACE(("Loading settings from disk\n"));
|
STRACE(("Loading settings from disk\n"));
|
||||||
|
|
||||||
BDirectory dir,newdir;
|
BDirectory dir,newdir;
|
||||||
@@ -661,9 +669,12 @@ void APRView::LoadSettings(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
currentset->ConvertFromMessage(&settings);
|
currentset->ConvertFromMessage(&settings);
|
||||||
// }
|
|
||||||
|
#ifndef RUN_WITHOUT_APP_SERVER
|
||||||
|
}
|
||||||
|
|
||||||
// SetColorSetName(currentset->name.String());
|
// SetColorSetName(currentset->name.String());
|
||||||
|
#endif
|
||||||
|
|
||||||
UpdateControlsFromAttr(attrstring.String());
|
UpdateControlsFromAttr(attrstring.String());
|
||||||
|
|
||||||
@@ -678,11 +689,11 @@ void APRView::SetDefaults(void)
|
|||||||
currentset->name.SetTo("Default");
|
currentset->name.SetTo("Default");
|
||||||
|
|
||||||
currentset->SetToDefaults();
|
currentset->SetToDefaults();
|
||||||
// SetColorSetName("Default");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void APRView::NotifyServer(void)
|
void APRView::NotifyServer(void)
|
||||||
{
|
{
|
||||||
|
#ifndef RUN_WITHOUT_APP_SERVER
|
||||||
// Send a message to the app_server with the settings which we have.
|
// Send a message to the app_server with the settings which we have.
|
||||||
|
|
||||||
port_id port=find_port(SERVER_PORT_NAME);
|
port_id port=find_port(SERVER_PORT_NAME);
|
||||||
@@ -700,6 +711,7 @@ void APRView::NotifyServer(void)
|
|||||||
// We also need to send the message to the window so that the Decorators tab updates itself
|
// We also need to send the message to the window so that the Decorators tab updates itself
|
||||||
if(Window())
|
if(Window())
|
||||||
Window()->PostMessage(SET_UI_COLORS);
|
Window()->PostMessage(SET_UI_COLORS);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void APRView::UpdateControlsFromAttr(const char *string)
|
void APRView::UpdateControlsFromAttr(const char *string)
|
||||||
|
|||||||
@@ -61,11 +61,12 @@ APRWindow::APRWindow(BRect frame)
|
|||||||
colors->Hide();
|
colors->Hide();
|
||||||
|
|
||||||
// TODO: Finish CurView
|
// TODO: Finish CurView
|
||||||
listview->AddItem(new BStringItem("Cursors"));
|
/* listview->AddItem(new BStringItem("Cursors"));
|
||||||
cursors=new CurView(r,"Cursors",B_FOLLOW_ALL, B_WILL_DRAW);
|
cursors=new CurView(r,"Cursors",B_FOLLOW_ALL, B_WILL_DRAW);
|
||||||
topview->AddChild(cursors);
|
topview->AddChild(cursors);
|
||||||
viewlist.AddItem(cursors);
|
viewlist.AddItem(cursors);
|
||||||
cursors->Hide();
|
cursors->Hide();
|
||||||
|
*/
|
||||||
|
|
||||||
listview->AddItem(new BStringItem("Decorators"));
|
listview->AddItem(new BStringItem("Decorators"));
|
||||||
decorators=new DecView(r,"Decorator",B_FOLLOW_ALL, B_WILL_DRAW);
|
decorators=new DecView(r,"Decorator",B_FOLLOW_ALL, B_WILL_DRAW);
|
||||||
@@ -91,7 +92,7 @@ APRWindow::APRWindow(BRect frame)
|
|||||||
// viewlist.AddItem(menuview);
|
// viewlist.AddItem(menuview);
|
||||||
// menuview->Hide();
|
// menuview->Hide();
|
||||||
|
|
||||||
listview->Select(0);
|
listview->Select(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool APRWindow::QuitRequested()
|
bool APRWindow::QuitRequested()
|
||||||
|
|||||||
@@ -56,7 +56,9 @@ CurView::CurView(const BRect &frame, const char *name, int32 resize, int32 flags
|
|||||||
|
|
||||||
cursorset=new CursorSet("Default");
|
cursorset=new CursorSet("Default");
|
||||||
|
|
||||||
/* BMenuBar *mb=new BMenuBar(BRect(0,0,Bounds().Width(),16),"menubar");
|
/*
|
||||||
|
// Code disabled -- cursor set management belongs in another app
|
||||||
|
BMenuBar *mb=new BMenuBar(BRect(0,0,Bounds().Width(),16),"menubar");
|
||||||
|
|
||||||
settings_menu=new BMenu("Settings");
|
settings_menu=new BMenu("Settings");
|
||||||
settings_menu->AddItem(new BMenuItem("Save Cursor Set",new BMessage(SAVE_CURSORSET),'S'));
|
settings_menu->AddItem(new BMenuItem("Save Cursor Set",new BMessage(SAVE_CURSORSET),'S'));
|
||||||
@@ -78,11 +80,14 @@ CurView::CurView(const BRect &frame, const char *name, int32 resize, int32 flags
|
|||||||
BRect wellrect(0,0,20,20);
|
BRect wellrect(0,0,20,20);
|
||||||
wellrect.OffsetTo(10,25);
|
wellrect.OffsetTo(10,25);
|
||||||
wellrect.right=wellrect.left+50;
|
wellrect.right=wellrect.left+50;
|
||||||
// cursorset_label=new BStringView(wellrect,"cursorset_label","Cursor Set: ");
|
|
||||||
// AddChild(cursorset_label);
|
/*
|
||||||
// cursorset_label->ResizeToPreferred();
|
// Code disabled -- cursor set management belongs in another app
|
||||||
// cursorset_name="<untitled>";
|
cursorset_label=new BStringView(wellrect,"cursorset_label","Cursor Set: ");
|
||||||
|
AddChild(cursorset_label);
|
||||||
|
cursorset_label->ResizeToPreferred();
|
||||||
|
cursorset_name="<untitled>";
|
||||||
|
*/
|
||||||
|
|
||||||
// Set up list of cursor attributes
|
// Set up list of cursor attributes
|
||||||
BRect cvrect;
|
BRect cvrect;
|
||||||
@@ -145,7 +150,6 @@ CurView::CurView(const BRect &frame, const char *name, int32 resize, int32 flags
|
|||||||
BEntry entry(COLOR_SET_DIR);
|
BEntry entry(COLOR_SET_DIR);
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
entry.GetRef(&ref);
|
entry.GetRef(&ref);
|
||||||
// savepanel=new BFilePanel(B_SAVE_PANEL, NULL,&ref, 0, false);
|
|
||||||
|
|
||||||
attribute=B_PANEL_BACKGROUND_COLOR;
|
attribute=B_PANEL_BACKGROUND_COLOR;
|
||||||
attrstring="Background";
|
attrstring="Background";
|
||||||
@@ -155,7 +159,6 @@ CurView::CurView(const BRect &frame, const char *name, int32 resize, int32 flags
|
|||||||
|
|
||||||
CurView::~CurView(void)
|
CurView::~CurView(void)
|
||||||
{
|
{
|
||||||
// delete savepanel;
|
|
||||||
delete cursorset;
|
delete cursorset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,11 +169,8 @@ void CurView::AllAttached(void)
|
|||||||
apply->SetTarget(this);
|
apply->SetTarget(this);
|
||||||
defaults->SetTarget(this);
|
defaults->SetTarget(this);
|
||||||
revert->SetTarget(this);
|
revert->SetTarget(this);
|
||||||
// settings_menu->SetTargetForItems(this);
|
|
||||||
// cursorset_menu->SetTargetForItems(this);
|
|
||||||
bmpview->SetTarget(this);
|
bmpview->SetTarget(this);
|
||||||
BMessenger msgr(this);
|
BMessenger msgr(this);
|
||||||
// savepanel->SetTarget(msgr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CurView::MessageReceived(BMessage *msg)
|
void CurView::MessageReceived(BMessage *msg)
|
||||||
@@ -207,6 +207,7 @@ void CurView::MessageReceived(BMessage *msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
// Code disabled -- cursor set management belongs in another app
|
||||||
BMenu *CurView::LoadCursorSets(void)
|
BMenu *CurView::LoadCursorSets(void)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_CURSORSET
|
#ifdef DEBUG_CURSORSET
|
||||||
@@ -376,12 +377,7 @@ printf("Couldn't open file %s for read\n",path.String());
|
|||||||
#endif
|
#endif
|
||||||
SetDefaults();
|
SetDefaults();
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// settings.FindString("name",&cursorset_name);
|
|
||||||
// SetCursorSetName(cursorset_name.String());
|
|
||||||
// prev_set_name=cursorset_name;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -119,7 +119,6 @@ DecView::DecView(BRect frame, const char *name, int32 resize, int32 flags)
|
|||||||
decorator->SetDriver(driver);
|
decorator->SetDriver(driver);
|
||||||
decorator->SetTitle(path.String());
|
decorator->SetTitle(path.String());
|
||||||
decorator->SetColors(colorset);
|
decorator->SetColors(colorset);
|
||||||
decorator->Draw();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -137,6 +136,14 @@ void DecView::AllAttached(void)
|
|||||||
declist->SetTarget(this);
|
declist->SetTarget(this);
|
||||||
apply->SetTarget(this);
|
apply->SetTarget(this);
|
||||||
LoadSettings();
|
LoadSettings();
|
||||||
|
|
||||||
|
BRegion clip;
|
||||||
|
if(decorator)
|
||||||
|
{
|
||||||
|
decorator->GetFootprint(&clip);
|
||||||
|
driver->View()->ConstrainClippingRegion(&clip);
|
||||||
|
decorator->Draw();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DecView::MessageReceived(BMessage *msg)
|
void DecView::MessageReceived(BMessage *msg)
|
||||||
@@ -176,6 +183,10 @@ void DecView::MessageReceived(BMessage *msg)
|
|||||||
decorator->SetFocus(true);
|
decorator->SetFocus(true);
|
||||||
decorator->SetTitle(path.String());
|
decorator->SetTitle(path.String());
|
||||||
decorator->SetColors(colorset);
|
decorator->SetColors(colorset);
|
||||||
|
|
||||||
|
BRegion clip;
|
||||||
|
decorator->GetFootprint(&clip);
|
||||||
|
driver->View()->ConstrainClippingRegion(&clip);
|
||||||
decorator->Draw();
|
decorator->Draw();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user