Serious retooling of the look of the app - much more Be-like and extensible

Better UI - not great, but getting there.
Haven't changed APRView's ColorWell look so Axel can shudder a little more. :P


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5412 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
DarkWyrm 2003-11-19 01:42:57 +00:00
parent 2c2d7c8bdb
commit 2a7b708cdd
10 changed files with 153 additions and 106 deletions

View File

@ -35,7 +35,7 @@ APRApplication::APRApplication()
BRect rect;
// This is just the size and location of the window when Show() is called
rect.Set(100,100,610,345);
rect.Set(100,100,540,410);
aprwin=new APRWindow(rect);
aprwin->Show();
}

View File

@ -48,7 +48,7 @@
#include "ColorWhichItem.h"
#include "ServerConfig.h"
#define DEBUG_COLORSET
//#define DEBUG_COLORSET
#ifdef DEBUG_COLORSET
#define STRACE(a) printf a
@ -56,9 +56,9 @@
#define STRACE(A) /* nothing */
#endif
#define SAVE_COLORSET 'svcs'
#define DELETE_COLORSET 'dlcs'
#define LOAD_COLORSET 'ldcs'
//#define SAVE_COLORSET 'svcs'
//#define DELETE_COLORSET 'dlcs'
//#define LOAD_COLORSET 'ldcs'
#define COLOR_DROPPED 'cldp'
APRView::APRView(const BRect &frame, const char *name, int32 resize, int32 flags)
@ -69,7 +69,7 @@ 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");
/* 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'));
@ -87,7 +87,7 @@ APRView::APRView(const BRect &frame, const char *name, int32 resize, int32 flags
mb->AddItem(colorset_menu);
}
AddChild(mb);
*/
BRect wellrect(0,0,20,20);
wellrect.OffsetTo(Bounds().Width()-(wellrect.Width()+10),25);
@ -96,12 +96,12 @@ APRView::APRView(const BRect &frame, const char *name, int32 resize, int32 flags
wellrect.OffsetTo(10,25);
wellrect.right=colorwell->Frame().left - 20;
colorset_label=new BStringView(wellrect,"colorset_label","Color Set: ");
AddChild(colorset_label);
colorset_label->ResizeToPreferred();
// colorset_label=new BStringView(wellrect,"colorset_label","Color Set: ");
// AddChild(colorset_label);
// colorset_label->ResizeToPreferred();
// Set up list of color attributes
BRect rect(10,60,200,160);
BRect rect(10,10,200,100);
attrlist=new BListView(rect,"AttributeList");
scrollview=new BScrollView("ScrollView",attrlist, B_FOLLOW_LEFT |
@ -137,15 +137,18 @@ APRView::APRView(const BRect &frame, const char *name, int32 resize, int32 flags
attrlist->AddItem(new ColorWhichItem((color_which)B_INACTIVE_WINDOW_TAB_COLOR));
attrlist->AddItem(new ColorWhichItem((color_which)B_INACTIVE_WINDOW_TAB_TEXT_COLOR));
picker=new BColorControl(BPoint(scrollview->Frame().right+20,scrollview->Frame().top),B_CELLS_32x8,5.0,"Picker",
picker=new BColorControl(BPoint(10,scrollview->Frame().bottom+20),B_CELLS_32x8,5.0,"Picker",
new BMessage(UPDATE_COLOR));
AddChild(picker);
BRect cvrect;
cvrect.Set(0,0,50,25);
cvrect.OffsetBy(scrollview->Frame().right+20,
scrollview->Frame().bottom-cvrect.Height());
cvrect=picker->Frame();
cvrect.right=cvrect.left+60;
cvrect.bottom=cvrect.top+30;
// 40 is 10 pixel space between buttons and other objects, such as the edge or another button
cvrect.OffsetTo( (Bounds().Width()-((cvrect.Width()*3)+40))/2,picker->Frame().bottom+10);
defaults=new BButton(cvrect,"DefaultsButton","Defaults",
new BMessage(DEFAULT_SETTINGS),B_FOLLOW_LEFT |B_FOLLOW_TOP,
@ -170,7 +173,7 @@ 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);
// savepanel=new BFilePanel(B_SAVE_PANEL, NULL, &ref, 0, false);
attribute=B_PANEL_BACKGROUND_COLOR;
attrstring="Panel Background";
@ -179,7 +182,7 @@ APRView::APRView(const BRect &frame, const char *name, int32 resize, int32 flags
APRView::~APRView(void)
{
delete savepanel;
// delete savepanel;
if(currentset)
delete currentset;
if(prevset)
@ -194,12 +197,12 @@ void APRView::AllAttached(void)
apply->SetTarget(this);
defaults->SetTarget(this);
revert->SetTarget(this);
settings_menu->SetTargetForItems(this);
colorset_menu->SetTargetForItems(this);
// settings_menu->SetTargetForItems(this);
// colorset_menu->SetTargetForItems(this);
colorwell->SetTarget(this);
BMessenger msgr(this);
savepanel->SetTarget(msgr);
// savepanel->SetTarget(msgr);
picker->SetValue(currentset->StringToColor(attrstring.String()).GetColor32());
}
@ -219,7 +222,7 @@ void APRView::MessageReceived(BMessage *msg)
switch(msg->what)
{
case DELETE_COLORSET:
/* case DELETE_COLORSET:
{
// We can't delete the Default set
if(currentset->name.Compare("Default")==0)
@ -290,7 +293,7 @@ void APRView::MessageReceived(BMessage *msg)
SaveColorSet(name);
break;
}
case UPDATE_COLOR:
*/ case UPDATE_COLOR:
{
// Received from the color picker when its color changes
if(!prevset)
@ -317,7 +320,7 @@ void APRView::MessageReceived(BMessage *msg)
if(!revert->IsEnabled())
revert->SetEnabled(true);
SetColorSetName("<untitled>");
// SetColorSetName("<untitled>");
Window()->PostMessage(SET_UI_COLORS);
break;
}
@ -376,7 +379,7 @@ void APRView::MessageReceived(BMessage *msg)
defaults->SetEnabled(false);
revert->SetEnabled(false);
SetColorSetName(currentset->name.String());
// SetColorSetName(currentset->name.String());
Window()->PostMessage(SET_UI_COLORS);
break;
}
@ -479,7 +482,7 @@ BMenu *APRView::LoadColorSets(void)
return menu;
}
int32 count=dir.CountEntries();
/* int32 count=dir.CountEntries();
BMessage *msg;
for(int32 i=0;i<count;i++)
@ -494,7 +497,7 @@ BMenu *APRView::LoadColorSets(void)
msg->AddString("name",name);
menu->AddItem(new BMenuItem(name.String(),msg));
}
*/
return menu;
}
@ -528,11 +531,12 @@ void APRView::LoadColorSet(const BString &name)
return;
}
currentset->ConvertFromMessage(&settings);
SetColorSetName(currentset->name.String());
// SetColorSetName(currentset->name.String());
UpdateControlsFromAttr(attrstring.String());
}
/*
void APRView::SaveColorSet(const BString &name)
{
@ -589,7 +593,7 @@ void APRView::SetColorSetName(const char *name)
colorset_label->ResizeToPreferred();
colorset_label->Invalidate();
}
*/
void APRView::SaveSettings(void)
{
// Save the current GUI color settings to the GUI colors file in the
@ -663,7 +667,7 @@ void APRView::LoadSettings(void)
currentset->ConvertFromMessage(&settings);
// }
SetColorSetName(currentset->name.String());
// SetColorSetName(currentset->name.String());
UpdateControlsFromAttr(attrstring.String());
@ -678,7 +682,7 @@ void APRView::SetDefaults(void)
currentset->name.SetTo("Default");
currentset->SetToDefaults();
SetColorSetName("Default");
// SetColorSetName("Default");
}
void APRView::NotifyServer(void)

View File

@ -62,18 +62,18 @@ protected:
friend APRWindow;
void UpdateControlsFromAttr(const char *string);
BMenu *LoadColorSets(void);
void SaveColorSet(const BString &name);
// void SaveColorSet(const BString &name);
void LoadColorSet(const BString &name);
void SetColorSetName(const char *name);
// void SetColorSetName(const char *name);
BColorControl *picker;
BButton *apply,*revert,*defaults;
BListView *attrlist;
color_which attribute;
BString attrstring;
BScrollView *scrollview;
BStringView *colorset_label;
BMenu *colorset_menu,*settings_menu;
BFilePanel *savepanel;
// BStringView *colorset_label;
// BMenu *colorset_menu,*settings_menu;
// BFilePanel *savepanel;
ColorWell *colorwell;
ColorSet *currentset,*prevset;

View File

@ -31,30 +31,51 @@
#include "DecView.h"
#include "CurView.h"
#include "defs.h"
#include <ScrollView.h>
#include <ListItem.h>
APRWindow::APRWindow(BRect frame)
: BWindow(frame, "Appearance", B_TITLED_WINDOW,
B_NOT_RESIZABLE | B_NOT_ZOOMABLE, B_ALL_WORKSPACES )
{
tabview=new BTabView(Bounds(),"TabView");
BTab *tab=NULL;
BView *topview=new BView(Bounds(),"topview",B_FOLLOW_ALL,B_WILL_DRAW);
topview->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(topview);
BRect r(10,10,110,Bounds().Height()-10);
listview=new BListView(r,"prefslist");
topview->AddChild(listview);
listview->SetSelectionMessage(new BMessage(PREFS_CHOSEN));
listview->AddItem(new BStringItem("Colors"));
listview->AddItem(new BStringItem("Cursors"));
listview->AddItem(new BStringItem("Decorators"));
r.Set(100,100,385,445);
r.OffsetTo(listview->Bounds().Width()+20,0);
r.right=Bounds().right;
colors=new APRView(r,"Colors",B_FOLLOW_ALL, B_WILL_DRAW);
topview->AddChild(colors);
colors->Hide();
// TODO: Finish CurView
cursors=new CurView(Bounds(),"Cursors",B_FOLLOW_ALL, B_WILL_DRAW);
tab=new BTab(cursors);
tabview->AddTab(cursors,tab);
cursors=new CurView(r,"Cursors",B_FOLLOW_ALL, B_WILL_DRAW);
topview->AddChild(cursors);
cursors->Hide();
colors=new APRView(Bounds(),"Colors",B_FOLLOW_ALL, B_WILL_DRAW);
tab=new BTab(colors);
tabview->AddTab(colors,tab);
decorators=new DecView(Bounds(),"Decorator",B_FOLLOW_ALL, B_WILL_DRAW);
tab=new BTab(decorators);
tabview->AddTab(decorators,tab);
AddChild(tabview);
decorators=new DecView(r,"Decorator",B_FOLLOW_ALL, B_WILL_DRAW);
topview->AddChild(decorators);
decorators->Hide();
decorators->SetColors(*colors->currentset);
prefsviews[0]=colors;
prefsviews[1]=cursors;
prefsviews[2]=decorators;
listview->Select(0);
}
bool APRWindow::QuitRequested()
@ -63,20 +84,34 @@ bool APRWindow::QuitRequested()
return(true);
}
void APRWindow::WorkspaceActivated(int32 wkspc, bool is_active)
{
if(is_active)
{
BMessenger notifier(colors);
notifier.SendMessage(new BMessage(B_WORKSPACE_ACTIVATED));
}
}
#include <stdio.h>
void APRWindow::MessageReceived(BMessage *msg)
{
if(msg->what==SET_UI_COLORS)
decorators->SetColors(*colors->currentset);
else
BWindow::MessageReceived(msg);
switch(msg->what)
{
case SET_UI_COLORS:
{
decorators->SetColors(*colors->currentset);
break;
}
case PREFS_CHOSEN:
{
int32 selectionindex=listview->CurrentSelection();
if(selectionindex==-1)
break;
for(int32 i=0; i<3; i++)
{
BView *v=prefsviews[i];
if(i!=selectionindex && !v->IsHidden())
v->Hide();
}
prefsviews[selectionindex]->Show();
break;
}
default:
BWindow::MessageReceived(msg);
break;
}
}

View File

@ -31,7 +31,7 @@
#include <Application.h>
#include <Window.h>
#include <Message.h>
#include <TabView.h>
#include <ListView.h>
class APRView;
class DecView;
@ -42,12 +42,12 @@ class APRWindow : public BWindow
public:
APRWindow(BRect frame);
virtual bool QuitRequested();
virtual void WorkspaceActivated(int32 wkspc, bool is_active);
virtual void MessageReceived(BMessage *msg);
BTabView *tabview;
BListView *listview;
APRView *colors;
DecView *decorators;
CurView *cursors;
BView *prefsviews[3];
};
#endif

View File

@ -56,7 +56,7 @@ 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");
/* 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'));
@ -74,18 +74,32 @@ CurView::CurView(const BRect &frame, const char *name, int32 resize, int32 flags
mb->AddItem(cursorset_menu);
}
AddChild(mb);
*/
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>";
// 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 rect(10,60,200,160);
BRect cvrect;
BRect rect;
cvrect.Set(0,0,75,75);
bmpview=new BitmapView(BPoint(10,10),new BMessage(CURSOR_UPDATED),this);
bmpview->MoveTo( (Bounds().Width()-bmpview->Bounds().Width())/2,30);
AddChild(bmpview);
rect.left=(Bounds().Width()-200)/2;
rect.right=rect.left+190;
rect.top=bmpview->Frame().bottom+30;
rect.bottom=rect.top+100;
attrlist=new BListView(rect,"AttributeList");
scrollview=new BScrollView("ScrollView",attrlist, B_FOLLOW_LEFT |
@ -105,11 +119,9 @@ CurView::CurView(const BRect &frame, const char *name, int32 resize, int32 flags
attrlist->AddItem(new CursorWhichItem(B_CURSOR_RESIZE_NS));
attrlist->AddItem(new CursorWhichItem(B_CURSOR_RESIZE_EW));
BRect cvrect;
cvrect.Set(0,0,50,25);
cvrect.OffsetBy(scrollview->Frame().right+20,
scrollview->Frame().bottom-cvrect.Height());
cvrect.Set(0,0,60,30);
cvrect.OffsetTo( (Bounds().Width()-200)/2,scrollview->Frame().bottom+20);
defaults=new BButton(cvrect,"DefaultsButton","Defaults",
new BMessage(DEFAULT_SETTINGS),B_FOLLOW_LEFT |B_FOLLOW_TOP,
@ -130,19 +142,10 @@ CurView::CurView(const BRect &frame, const char *name, int32 resize, int32 flags
AddChild(apply);
apply->SetEnabled(false);
cvrect.Set(0,0,75,75);
BPoint pt;
pt.x=scrollview->Frame().right+(Bounds().right-scrollview->Frame().right-cvrect.Width())/2;
pt.y=mb->Frame().bottom+(apply->Frame().top-mb->Frame().bottom-cvrect.Height())/2;
bmpview=new BitmapView(pt,new BMessage(CURSOR_UPDATED),this);
AddChild(bmpview);
BEntry entry(COLOR_SET_DIR);
entry_ref ref;
entry.GetRef(&ref);
savepanel=new BFilePanel(B_SAVE_PANEL, NULL,
&ref, 0, false);
// savepanel=new BFilePanel(B_SAVE_PANEL, NULL,&ref, 0, false);
attribute=B_PANEL_BACKGROUND_COLOR;
attrstring="Background";
@ -152,7 +155,7 @@ CurView::CurView(const BRect &frame, const char *name, int32 resize, int32 flags
CurView::~CurView(void)
{
delete savepanel;
// delete savepanel;
delete cursorset;
}
@ -163,11 +166,11 @@ void CurView::AllAttached(void)
apply->SetTarget(this);
defaults->SetTarget(this);
revert->SetTarget(this);
settings_menu->SetTargetForItems(this);
cursorset_menu->SetTargetForItems(this);
// settings_menu->SetTargetForItems(this);
// cursorset_menu->SetTargetForItems(this);
bmpview->SetTarget(this);
BMessenger msgr(this);
savepanel->SetTarget(msgr);
// savepanel->SetTarget(msgr);
}
void CurView::MessageReceived(BMessage *msg)
@ -203,6 +206,7 @@ void CurView::MessageReceived(BMessage *msg)
}
}
/*
BMenu *CurView::LoadCursorSets(void)
{
#ifdef DEBUG_CURSORSET
@ -323,6 +327,7 @@ void CurView::SetCursorSetName(const char *name)
cursorset_label->ResizeToPreferred();
cursorset_label->Invalidate();
}
*/
void CurView::SaveSettings(void)
{
@ -336,7 +341,7 @@ printf("SaveSettings: %s\n",path.String());
#endif
cursorset->Save(path.String(),B_CREATE_FILE|B_ERASE_FILE);
prev_set_name=cursorset_name;
// prev_set_name=cursorset_name;
revert->SetEnabled(false);
}
@ -374,9 +379,9 @@ printf("Couldn't open file %s for read\n",path.String());
return;
}
settings.FindString("name",&cursorset_name);
SetCursorSetName(cursorset_name.String());
prev_set_name=cursorset_name;
// settings.FindString("name",&cursorset_name);
// SetCursorSetName(cursorset_name.String());
// prev_set_name=cursorset_name;
return;
}

View File

@ -75,8 +75,8 @@ public:
void SetDefaults(void);
protected:
friend APRWindow;
BMenu *LoadCursorSets(void);
void SetCursorSetName(const char *name);
// BMenu *LoadCursorSets(void);
// void SetCursorSetName(const char *name);
BButton *apply,*revert,*defaults;
BListView *attrlist;
@ -84,11 +84,11 @@ protected:
BMessage settings;
BString attrstring;
BScrollView *scrollview;
BStringView *cursorset_label;
BMenu *cursorset_menu,*settings_menu;
BFilePanel *savepanel;
BString cursorset_name;
BString prev_set_name;
// BStringView *cursorset_label;
// BMenu *cursorset_menu,*settings_menu;
// BFilePanel *savepanel;
// BString cursorset_name;
// BString prev_set_name;
CursorSet *cursorset;
BitmapView *bmpview;
};

View File

@ -84,7 +84,9 @@ DecView::DecView(BRect frame, const char *name, int32 resize, int32 flags)
}
// Set up list of color attributes
cvrect.Set(10,10,preview->Frame().left-20-B_V_SCROLL_BAR_WIDTH, preview->Frame().bottom);
float top=preview->Frame().bottom+15;
cvrect.Set(10,top,Bounds().right-10-B_V_SCROLL_BAR_WIDTH, top+125);
declist=new BListView(cvrect,"DecoratorList");
scrollview=new BScrollView("ScrollView",declist, B_FOLLOW_LEFT |
@ -379,7 +381,7 @@ STRACE(("LoadDecorator(%s): Couldn't get version symbol\n",path));
// unload_add_on(decorator_id);
}
decorator_id=addon;
decorator=pcreatefunc(BRect(50,50,150,150),B_TITLED_WINDOW_LOOK,
decorator=pcreatefunc(BRect(25,25,125,125),B_TITLED_WINDOW_LOOK,
B_NORMAL_WINDOW_FEEL,0);
decorator->SetDriver(driver);
decorator->SetFocus(true);

View File

@ -58,7 +58,7 @@
#include "LayerData.h"
#include "ColorSet.h"
BRect preview_bounds(0,0,200,200);;
BRect preview_bounds(0,0,150,150);;
PVView::PVView(BRect bounds)
: BView(bounds,"previewdriver_view",B_FOLLOW_NONE, B_WILL_DRAW)

View File

@ -27,4 +27,5 @@
#define GET_DECORATOR 'gdec'
#define SET_UI_COLORS 'suic'
#define PREFS_CHOSEN 'prch'
#endif