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 <stdio.h>
|
||||
#include "defs.h"
|
||||
#include "FontServer.h"
|
||||
#include "ServerConfig.h"
|
||||
|
||||
APRApplication::APRApplication()
|
||||
: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;
|
||||
|
||||
// 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;
|
||||
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->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
|
||||
BRect rect(10,10,200,100);
|
||||
BRect rect(10,10,200,175);
|
||||
attrlist=new BListView(rect,"AttributeList");
|
||||
|
||||
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);
|
||||
entry_ref ref;
|
||||
entry.GetRef(&ref);
|
||||
// savepanel=new BFilePanel(B_SAVE_PANEL, NULL, &ref, 0, false);
|
||||
|
||||
attribute=B_PANEL_BACKGROUND_COLOR;
|
||||
attrstring="Panel Background";
|
||||
@@ -178,7 +179,6 @@ APRView::APRView(const BRect &frame, const char *name, int32 resize, int32 flags
|
||||
|
||||
APRView::~APRView(void)
|
||||
{
|
||||
// delete savepanel;
|
||||
if(currentset)
|
||||
delete currentset;
|
||||
if(prevset)
|
||||
@@ -193,12 +193,9 @@ void APRView::AllAttached(void)
|
||||
apply->SetTarget(this);
|
||||
defaults->SetTarget(this);
|
||||
revert->SetTarget(this);
|
||||
// settings_menu->SetTargetForItems(this);
|
||||
// colorset_menu->SetTargetForItems(this);
|
||||
colorwell->SetTarget(this);
|
||||
|
||||
BMessenger msgr(this);
|
||||
// savepanel->SetTarget(msgr);
|
||||
picker->SetValue(currentset->StringToColor(attrstring.String()).GetColor32());
|
||||
}
|
||||
|
||||
@@ -218,7 +215,10 @@ void APRView::MessageReceived(BMessage *msg)
|
||||
|
||||
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
|
||||
if(currentset->name.Compare("Default")==0)
|
||||
@@ -289,7 +289,10 @@ void APRView::MessageReceived(BMessage *msg)
|
||||
SaveColorSet(name);
|
||||
break;
|
||||
}
|
||||
*/ case UPDATE_COLOR:
|
||||
|
||||
// end disabled colorset code
|
||||
*/
|
||||
case UPDATE_COLOR:
|
||||
{
|
||||
// Received from the color picker when its color changes
|
||||
if(!prevset)
|
||||
@@ -344,7 +347,7 @@ void APRView::MessageReceived(BMessage *msg)
|
||||
NotifyServer();
|
||||
break;
|
||||
}
|
||||
/* case TRY_SETTINGS:
|
||||
case TRY_SETTINGS:
|
||||
{
|
||||
// Tell server to apply settings here without saving them.
|
||||
// Theoretically, the user can set this temporarily and keep it
|
||||
@@ -352,7 +355,7 @@ void APRView::MessageReceived(BMessage *msg)
|
||||
NotifyServer();
|
||||
break;
|
||||
}
|
||||
*/ case REVERT_SETTINGS:
|
||||
case REVERT_SETTINGS:
|
||||
{
|
||||
delete currentset;
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -577,6 +585,7 @@ void APRView::SaveColorSet(const BString &name)
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
// More code being saved for a color set app
|
||||
void APRView::SetColorSetName(const char *name)
|
||||
{
|
||||
if(!name)
|
||||
@@ -612,8 +621,7 @@ void APRView::LoadSettings(void)
|
||||
// Load the current GUI color settings from disk. This is done instead of
|
||||
// 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
|
||||
port_id port=find_port(SERVER_PORT_NAME);
|
||||
if(port!=B_NAME_NOT_FOUND)
|
||||
@@ -629,7 +637,7 @@ void APRView::LoadSettings(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
*/
|
||||
#endif
|
||||
STRACE(("Loading settings from disk\n"));
|
||||
|
||||
BDirectory dir,newdir;
|
||||
@@ -661,9 +669,12 @@ void APRView::LoadSettings(void)
|
||||
}
|
||||
|
||||
currentset->ConvertFromMessage(&settings);
|
||||
// }
|
||||
|
||||
#ifndef RUN_WITHOUT_APP_SERVER
|
||||
}
|
||||
|
||||
// SetColorSetName(currentset->name.String());
|
||||
#endif
|
||||
|
||||
UpdateControlsFromAttr(attrstring.String());
|
||||
|
||||
@@ -678,11 +689,11 @@ void APRView::SetDefaults(void)
|
||||
currentset->name.SetTo("Default");
|
||||
|
||||
currentset->SetToDefaults();
|
||||
// SetColorSetName("Default");
|
||||
}
|
||||
|
||||
void APRView::NotifyServer(void)
|
||||
{
|
||||
#ifndef RUN_WITHOUT_APP_SERVER
|
||||
// Send a message to the app_server with the settings which we have.
|
||||
|
||||
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
|
||||
if(Window())
|
||||
Window()->PostMessage(SET_UI_COLORS);
|
||||
#endif
|
||||
}
|
||||
|
||||
void APRView::UpdateControlsFromAttr(const char *string)
|
||||
|
||||
@@ -61,11 +61,12 @@ APRWindow::APRWindow(BRect frame)
|
||||
colors->Hide();
|
||||
|
||||
// TODO: Finish CurView
|
||||
listview->AddItem(new BStringItem("Cursors"));
|
||||
/* listview->AddItem(new BStringItem("Cursors"));
|
||||
cursors=new CurView(r,"Cursors",B_FOLLOW_ALL, B_WILL_DRAW);
|
||||
topview->AddChild(cursors);
|
||||
viewlist.AddItem(cursors);
|
||||
cursors->Hide();
|
||||
*/
|
||||
|
||||
listview->AddItem(new BStringItem("Decorators"));
|
||||
decorators=new DecView(r,"Decorator",B_FOLLOW_ALL, B_WILL_DRAW);
|
||||
@@ -91,7 +92,7 @@ APRWindow::APRWindow(BRect frame)
|
||||
// viewlist.AddItem(menuview);
|
||||
// menuview->Hide();
|
||||
|
||||
listview->Select(0);
|
||||
listview->Select(1);
|
||||
}
|
||||
|
||||
bool APRWindow::QuitRequested()
|
||||
|
||||
@@ -56,7 +56,9 @@ CurView::CurView(const BRect &frame, const char *name, int32 resize, int32 flags
|
||||
|
||||
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->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);
|
||||
wellrect.OffsetTo(10,25);
|
||||
wellrect.right=wellrect.left+50;
|
||||
// cursorset_label=new BStringView(wellrect,"cursorset_label","Cursor Set: ");
|
||||
// AddChild(cursorset_label);
|
||||
// cursorset_label->ResizeToPreferred();
|
||||
// cursorset_name="<untitled>";
|
||||
|
||||
|
||||
/*
|
||||
// Code disabled -- cursor set management belongs in another app
|
||||
cursorset_label=new BStringView(wellrect,"cursorset_label","Cursor Set: ");
|
||||
AddChild(cursorset_label);
|
||||
cursorset_label->ResizeToPreferred();
|
||||
cursorset_name="<untitled>";
|
||||
*/
|
||||
|
||||
// Set up list of cursor attributes
|
||||
BRect cvrect;
|
||||
@@ -145,7 +150,6 @@ CurView::CurView(const BRect &frame, const char *name, int32 resize, int32 flags
|
||||
BEntry entry(COLOR_SET_DIR);
|
||||
entry_ref ref;
|
||||
entry.GetRef(&ref);
|
||||
// savepanel=new BFilePanel(B_SAVE_PANEL, NULL,&ref, 0, false);
|
||||
|
||||
attribute=B_PANEL_BACKGROUND_COLOR;
|
||||
attrstring="Background";
|
||||
@@ -155,7 +159,6 @@ CurView::CurView(const BRect &frame, const char *name, int32 resize, int32 flags
|
||||
|
||||
CurView::~CurView(void)
|
||||
{
|
||||
// delete savepanel;
|
||||
delete cursorset;
|
||||
}
|
||||
|
||||
@@ -166,11 +169,8 @@ void CurView::AllAttached(void)
|
||||
apply->SetTarget(this);
|
||||
defaults->SetTarget(this);
|
||||
revert->SetTarget(this);
|
||||
// settings_menu->SetTargetForItems(this);
|
||||
// cursorset_menu->SetTargetForItems(this);
|
||||
bmpview->SetTarget(this);
|
||||
BMessenger msgr(this);
|
||||
// savepanel->SetTarget(msgr);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
#ifdef DEBUG_CURSORSET
|
||||
@@ -376,12 +377,7 @@ printf("Couldn't open file %s for read\n",path.String());
|
||||
#endif
|
||||
SetDefaults();
|
||||
SaveSettings();
|
||||
return;
|
||||
}
|
||||
|
||||
// settings.FindString("name",&cursorset_name);
|
||||
// SetCursorSetName(cursorset_name.String());
|
||||
// prev_set_name=cursorset_name;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,6 @@ DecView::DecView(BRect frame, const char *name, int32 resize, int32 flags)
|
||||
decorator->SetDriver(driver);
|
||||
decorator->SetTitle(path.String());
|
||||
decorator->SetColors(colorset);
|
||||
decorator->Draw();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -137,6 +136,14 @@ void DecView::AllAttached(void)
|
||||
declist->SetTarget(this);
|
||||
apply->SetTarget(this);
|
||||
LoadSettings();
|
||||
|
||||
BRegion clip;
|
||||
if(decorator)
|
||||
{
|
||||
decorator->GetFootprint(&clip);
|
||||
driver->View()->ConstrainClippingRegion(&clip);
|
||||
decorator->Draw();
|
||||
}
|
||||
}
|
||||
|
||||
void DecView::MessageReceived(BMessage *msg)
|
||||
@@ -176,6 +183,10 @@ void DecView::MessageReceived(BMessage *msg)
|
||||
decorator->SetFocus(true);
|
||||
decorator->SetTitle(path.String());
|
||||
decorator->SetColors(colorset);
|
||||
|
||||
BRegion clip;
|
||||
decorator->GetFootprint(&clip);
|
||||
driver->View()->ConstrainClippingRegion(&clip);
|
||||
decorator->Draw();
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user