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:
@@ -35,7 +35,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,610,345);
|
rect.Set(100,100,540,410);
|
||||||
aprwin=new APRWindow(rect);
|
aprwin=new APRWindow(rect);
|
||||||
aprwin->Show();
|
aprwin->Show();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
#include "ColorWhichItem.h"
|
#include "ColorWhichItem.h"
|
||||||
#include "ServerConfig.h"
|
#include "ServerConfig.h"
|
||||||
|
|
||||||
#define DEBUG_COLORSET
|
//#define DEBUG_COLORSET
|
||||||
|
|
||||||
#ifdef DEBUG_COLORSET
|
#ifdef DEBUG_COLORSET
|
||||||
#define STRACE(a) printf a
|
#define STRACE(a) printf a
|
||||||
@@ -56,9 +56,9 @@
|
|||||||
#define STRACE(A) /* nothing */
|
#define STRACE(A) /* nothing */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SAVE_COLORSET 'svcs'
|
//#define SAVE_COLORSET 'svcs'
|
||||||
#define DELETE_COLORSET 'dlcs'
|
//#define DELETE_COLORSET 'dlcs'
|
||||||
#define LOAD_COLORSET 'ldcs'
|
//#define LOAD_COLORSET 'ldcs'
|
||||||
#define COLOR_DROPPED 'cldp'
|
#define COLOR_DROPPED 'cldp'
|
||||||
|
|
||||||
APRView::APRView(const BRect &frame, const char *name, int32 resize, int32 flags)
|
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;
|
currentset=new ColorSet;
|
||||||
prevset=NULL;
|
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=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'));
|
||||||
@@ -87,7 +87,7 @@ APRView::APRView(const BRect &frame, const char *name, int32 resize, int32 flags
|
|||||||
mb->AddItem(colorset_menu);
|
mb->AddItem(colorset_menu);
|
||||||
}
|
}
|
||||||
AddChild(mb);
|
AddChild(mb);
|
||||||
|
*/
|
||||||
BRect wellrect(0,0,20,20);
|
BRect wellrect(0,0,20,20);
|
||||||
wellrect.OffsetTo(Bounds().Width()-(wellrect.Width()+10),25);
|
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.OffsetTo(10,25);
|
||||||
wellrect.right=colorwell->Frame().left - 20;
|
wellrect.right=colorwell->Frame().left - 20;
|
||||||
colorset_label=new BStringView(wellrect,"colorset_label","Color Set: ");
|
// colorset_label=new BStringView(wellrect,"colorset_label","Color Set: ");
|
||||||
AddChild(colorset_label);
|
// AddChild(colorset_label);
|
||||||
colorset_label->ResizeToPreferred();
|
// colorset_label->ResizeToPreferred();
|
||||||
|
|
||||||
// Set up list of color attributes
|
// Set up list of color attributes
|
||||||
BRect rect(10,60,200,160);
|
BRect rect(10,10,200,100);
|
||||||
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 |
|
||||||
@@ -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_COLOR));
|
||||||
attrlist->AddItem(new ColorWhichItem((color_which)B_INACTIVE_WINDOW_TAB_TEXT_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));
|
new BMessage(UPDATE_COLOR));
|
||||||
AddChild(picker);
|
AddChild(picker);
|
||||||
|
|
||||||
BRect cvrect;
|
BRect cvrect;
|
||||||
|
|
||||||
cvrect.Set(0,0,50,25);
|
cvrect=picker->Frame();
|
||||||
cvrect.OffsetBy(scrollview->Frame().right+20,
|
cvrect.right=cvrect.left+60;
|
||||||
scrollview->Frame().bottom-cvrect.Height());
|
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",
|
defaults=new BButton(cvrect,"DefaultsButton","Defaults",
|
||||||
new BMessage(DEFAULT_SETTINGS),B_FOLLOW_LEFT |B_FOLLOW_TOP,
|
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);
|
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);
|
// 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";
|
||||||
@@ -179,7 +182,7 @@ APRView::APRView(const BRect &frame, const char *name, int32 resize, int32 flags
|
|||||||
|
|
||||||
APRView::~APRView(void)
|
APRView::~APRView(void)
|
||||||
{
|
{
|
||||||
delete savepanel;
|
// delete savepanel;
|
||||||
if(currentset)
|
if(currentset)
|
||||||
delete currentset;
|
delete currentset;
|
||||||
if(prevset)
|
if(prevset)
|
||||||
@@ -194,12 +197,12 @@ 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);
|
// settings_menu->SetTargetForItems(this);
|
||||||
colorset_menu->SetTargetForItems(this);
|
// colorset_menu->SetTargetForItems(this);
|
||||||
colorwell->SetTarget(this);
|
colorwell->SetTarget(this);
|
||||||
|
|
||||||
BMessenger msgr(this);
|
BMessenger msgr(this);
|
||||||
savepanel->SetTarget(msgr);
|
// savepanel->SetTarget(msgr);
|
||||||
picker->SetValue(currentset->StringToColor(attrstring.String()).GetColor32());
|
picker->SetValue(currentset->StringToColor(attrstring.String()).GetColor32());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,7 +222,7 @@ void APRView::MessageReceived(BMessage *msg)
|
|||||||
|
|
||||||
switch(msg->what)
|
switch(msg->what)
|
||||||
{
|
{
|
||||||
case DELETE_COLORSET:
|
/* 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)
|
||||||
@@ -290,7 +293,7 @@ void APRView::MessageReceived(BMessage *msg)
|
|||||||
SaveColorSet(name);
|
SaveColorSet(name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case UPDATE_COLOR:
|
*/ 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)
|
||||||
@@ -317,7 +320,7 @@ void APRView::MessageReceived(BMessage *msg)
|
|||||||
if(!revert->IsEnabled())
|
if(!revert->IsEnabled())
|
||||||
revert->SetEnabled(true);
|
revert->SetEnabled(true);
|
||||||
|
|
||||||
SetColorSetName("<untitled>");
|
// SetColorSetName("<untitled>");
|
||||||
Window()->PostMessage(SET_UI_COLORS);
|
Window()->PostMessage(SET_UI_COLORS);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -376,7 +379,7 @@ void APRView::MessageReceived(BMessage *msg)
|
|||||||
defaults->SetEnabled(false);
|
defaults->SetEnabled(false);
|
||||||
revert->SetEnabled(false);
|
revert->SetEnabled(false);
|
||||||
|
|
||||||
SetColorSetName(currentset->name.String());
|
// SetColorSetName(currentset->name.String());
|
||||||
Window()->PostMessage(SET_UI_COLORS);
|
Window()->PostMessage(SET_UI_COLORS);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -479,7 +482,7 @@ BMenu *APRView::LoadColorSets(void)
|
|||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 count=dir.CountEntries();
|
/* int32 count=dir.CountEntries();
|
||||||
|
|
||||||
BMessage *msg;
|
BMessage *msg;
|
||||||
for(int32 i=0;i<count;i++)
|
for(int32 i=0;i<count;i++)
|
||||||
@@ -494,7 +497,7 @@ BMenu *APRView::LoadColorSets(void)
|
|||||||
msg->AddString("name",name);
|
msg->AddString("name",name);
|
||||||
menu->AddItem(new BMenuItem(name.String(),msg));
|
menu->AddItem(new BMenuItem(name.String(),msg));
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -528,11 +531,12 @@ void APRView::LoadColorSet(const BString &name)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
currentset->ConvertFromMessage(&settings);
|
currentset->ConvertFromMessage(&settings);
|
||||||
SetColorSetName(currentset->name.String());
|
// SetColorSetName(currentset->name.String());
|
||||||
|
|
||||||
UpdateControlsFromAttr(attrstring.String());
|
UpdateControlsFromAttr(attrstring.String());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
void APRView::SaveColorSet(const BString &name)
|
void APRView::SaveColorSet(const BString &name)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -589,7 +593,7 @@ void APRView::SetColorSetName(const char *name)
|
|||||||
colorset_label->ResizeToPreferred();
|
colorset_label->ResizeToPreferred();
|
||||||
colorset_label->Invalidate();
|
colorset_label->Invalidate();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
void APRView::SaveSettings(void)
|
void APRView::SaveSettings(void)
|
||||||
{
|
{
|
||||||
// Save the current GUI color settings to the GUI colors file in the
|
// Save the current GUI color settings to the GUI colors file in the
|
||||||
@@ -663,7 +667,7 @@ void APRView::LoadSettings(void)
|
|||||||
currentset->ConvertFromMessage(&settings);
|
currentset->ConvertFromMessage(&settings);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
SetColorSetName(currentset->name.String());
|
// SetColorSetName(currentset->name.String());
|
||||||
|
|
||||||
UpdateControlsFromAttr(attrstring.String());
|
UpdateControlsFromAttr(attrstring.String());
|
||||||
|
|
||||||
@@ -678,7 +682,7 @@ void APRView::SetDefaults(void)
|
|||||||
currentset->name.SetTo("Default");
|
currentset->name.SetTo("Default");
|
||||||
|
|
||||||
currentset->SetToDefaults();
|
currentset->SetToDefaults();
|
||||||
SetColorSetName("Default");
|
// SetColorSetName("Default");
|
||||||
}
|
}
|
||||||
|
|
||||||
void APRView::NotifyServer(void)
|
void APRView::NotifyServer(void)
|
||||||
|
|||||||
@@ -62,18 +62,18 @@ protected:
|
|||||||
friend APRWindow;
|
friend APRWindow;
|
||||||
void UpdateControlsFromAttr(const char *string);
|
void UpdateControlsFromAttr(const char *string);
|
||||||
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 SetColorSetName(const char *name);
|
// void SetColorSetName(const char *name);
|
||||||
BColorControl *picker;
|
BColorControl *picker;
|
||||||
BButton *apply,*revert,*defaults;
|
BButton *apply,*revert,*defaults;
|
||||||
BListView *attrlist;
|
BListView *attrlist;
|
||||||
color_which attribute;
|
color_which attribute;
|
||||||
BString attrstring;
|
BString attrstring;
|
||||||
BScrollView *scrollview;
|
BScrollView *scrollview;
|
||||||
BStringView *colorset_label;
|
// BStringView *colorset_label;
|
||||||
BMenu *colorset_menu,*settings_menu;
|
// BMenu *colorset_menu,*settings_menu;
|
||||||
BFilePanel *savepanel;
|
// BFilePanel *savepanel;
|
||||||
ColorWell *colorwell;
|
ColorWell *colorwell;
|
||||||
|
|
||||||
ColorSet *currentset,*prevset;
|
ColorSet *currentset,*prevset;
|
||||||
|
|||||||
@@ -31,30 +31,51 @@
|
|||||||
#include "DecView.h"
|
#include "DecView.h"
|
||||||
#include "CurView.h"
|
#include "CurView.h"
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
#include <ScrollView.h>
|
||||||
|
#include <ListItem.h>
|
||||||
|
|
||||||
APRWindow::APRWindow(BRect frame)
|
APRWindow::APRWindow(BRect frame)
|
||||||
: BWindow(frame, "Appearance", B_TITLED_WINDOW,
|
: BWindow(frame, "Appearance", B_TITLED_WINDOW,
|
||||||
B_NOT_RESIZABLE | B_NOT_ZOOMABLE, B_ALL_WORKSPACES )
|
B_NOT_RESIZABLE | B_NOT_ZOOMABLE, B_ALL_WORKSPACES )
|
||||||
{
|
{
|
||||||
tabview=new BTabView(Bounds(),"TabView");
|
BView *topview=new BView(Bounds(),"topview",B_FOLLOW_ALL,B_WILL_DRAW);
|
||||||
|
topview->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
BTab *tab=NULL;
|
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
|
// TODO: Finish CurView
|
||||||
cursors=new CurView(Bounds(),"Cursors",B_FOLLOW_ALL, B_WILL_DRAW);
|
cursors=new CurView(r,"Cursors",B_FOLLOW_ALL, B_WILL_DRAW);
|
||||||
tab=new BTab(cursors);
|
topview->AddChild(cursors);
|
||||||
tabview->AddTab(cursors,tab);
|
cursors->Hide();
|
||||||
|
|
||||||
colors=new APRView(Bounds(),"Colors",B_FOLLOW_ALL, B_WILL_DRAW);
|
decorators=new DecView(r,"Decorator",B_FOLLOW_ALL, B_WILL_DRAW);
|
||||||
tab=new BTab(colors);
|
topview->AddChild(decorators);
|
||||||
tabview->AddTab(colors,tab);
|
decorators->Hide();
|
||||||
|
|
||||||
decorators=new DecView(Bounds(),"Decorator",B_FOLLOW_ALL, B_WILL_DRAW);
|
|
||||||
tab=new BTab(decorators);
|
|
||||||
tabview->AddTab(decorators,tab);
|
|
||||||
|
|
||||||
AddChild(tabview);
|
|
||||||
decorators->SetColors(*colors->currentset);
|
decorators->SetColors(*colors->currentset);
|
||||||
|
|
||||||
|
prefsviews[0]=colors;
|
||||||
|
prefsviews[1]=cursors;
|
||||||
|
prefsviews[2]=decorators;
|
||||||
|
|
||||||
|
listview->Select(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool APRWindow::QuitRequested()
|
bool APRWindow::QuitRequested()
|
||||||
@@ -63,20 +84,34 @@ bool APRWindow::QuitRequested()
|
|||||||
return(true);
|
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)
|
void APRWindow::MessageReceived(BMessage *msg)
|
||||||
{
|
{
|
||||||
if(msg->what==SET_UI_COLORS)
|
switch(msg->what)
|
||||||
decorators->SetColors(*colors->currentset);
|
{
|
||||||
else
|
case SET_UI_COLORS:
|
||||||
BWindow::MessageReceived(msg);
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
#include <TabView.h>
|
#include <ListView.h>
|
||||||
|
|
||||||
class APRView;
|
class APRView;
|
||||||
class DecView;
|
class DecView;
|
||||||
@@ -42,12 +42,12 @@ class APRWindow : public BWindow
|
|||||||
public:
|
public:
|
||||||
APRWindow(BRect frame);
|
APRWindow(BRect frame);
|
||||||
virtual bool QuitRequested();
|
virtual bool QuitRequested();
|
||||||
virtual void WorkspaceActivated(int32 wkspc, bool is_active);
|
|
||||||
virtual void MessageReceived(BMessage *msg);
|
virtual void MessageReceived(BMessage *msg);
|
||||||
BTabView *tabview;
|
BListView *listview;
|
||||||
APRView *colors;
|
APRView *colors;
|
||||||
DecView *decorators;
|
DecView *decorators;
|
||||||
CurView *cursors;
|
CurView *cursors;
|
||||||
|
BView *prefsviews[3];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ 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");
|
/* 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'));
|
||||||
@@ -74,18 +74,32 @@ CurView::CurView(const BRect &frame, const char *name, int32 resize, int32 flags
|
|||||||
mb->AddItem(cursorset_menu);
|
mb->AddItem(cursorset_menu);
|
||||||
}
|
}
|
||||||
AddChild(mb);
|
AddChild(mb);
|
||||||
|
*/
|
||||||
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: ");
|
// cursorset_label=new BStringView(wellrect,"cursorset_label","Cursor Set: ");
|
||||||
AddChild(cursorset_label);
|
// AddChild(cursorset_label);
|
||||||
cursorset_label->ResizeToPreferred();
|
// cursorset_label->ResizeToPreferred();
|
||||||
cursorset_name="<untitled>";
|
// cursorset_name="<untitled>";
|
||||||
|
|
||||||
|
|
||||||
// Set up list of cursor attributes
|
// 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");
|
attrlist=new BListView(rect,"AttributeList");
|
||||||
|
|
||||||
scrollview=new BScrollView("ScrollView",attrlist, B_FOLLOW_LEFT |
|
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_NS));
|
||||||
attrlist->AddItem(new CursorWhichItem(B_CURSOR_RESIZE_EW));
|
attrlist->AddItem(new CursorWhichItem(B_CURSOR_RESIZE_EW));
|
||||||
|
|
||||||
BRect cvrect;
|
|
||||||
|
|
||||||
cvrect.Set(0,0,50,25);
|
cvrect.Set(0,0,60,30);
|
||||||
cvrect.OffsetBy(scrollview->Frame().right+20,
|
cvrect.OffsetTo( (Bounds().Width()-200)/2,scrollview->Frame().bottom+20);
|
||||||
scrollview->Frame().bottom-cvrect.Height());
|
|
||||||
|
|
||||||
defaults=new BButton(cvrect,"DefaultsButton","Defaults",
|
defaults=new BButton(cvrect,"DefaultsButton","Defaults",
|
||||||
new BMessage(DEFAULT_SETTINGS),B_FOLLOW_LEFT |B_FOLLOW_TOP,
|
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);
|
AddChild(apply);
|
||||||
apply->SetEnabled(false);
|
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);
|
BEntry entry(COLOR_SET_DIR);
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
entry.GetRef(&ref);
|
entry.GetRef(&ref);
|
||||||
savepanel=new BFilePanel(B_SAVE_PANEL, NULL,
|
// savepanel=new BFilePanel(B_SAVE_PANEL, NULL,&ref, 0, false);
|
||||||
&ref, 0, false);
|
|
||||||
|
|
||||||
attribute=B_PANEL_BACKGROUND_COLOR;
|
attribute=B_PANEL_BACKGROUND_COLOR;
|
||||||
attrstring="Background";
|
attrstring="Background";
|
||||||
@@ -152,7 +155,7 @@ CurView::CurView(const BRect &frame, const char *name, int32 resize, int32 flags
|
|||||||
|
|
||||||
CurView::~CurView(void)
|
CurView::~CurView(void)
|
||||||
{
|
{
|
||||||
delete savepanel;
|
// delete savepanel;
|
||||||
delete cursorset;
|
delete cursorset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,11 +166,11 @@ 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);
|
// settings_menu->SetTargetForItems(this);
|
||||||
cursorset_menu->SetTargetForItems(this);
|
// cursorset_menu->SetTargetForItems(this);
|
||||||
bmpview->SetTarget(this);
|
bmpview->SetTarget(this);
|
||||||
BMessenger msgr(this);
|
BMessenger msgr(this);
|
||||||
savepanel->SetTarget(msgr);
|
// savepanel->SetTarget(msgr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CurView::MessageReceived(BMessage *msg)
|
void CurView::MessageReceived(BMessage *msg)
|
||||||
@@ -203,6 +206,7 @@ void CurView::MessageReceived(BMessage *msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
BMenu *CurView::LoadCursorSets(void)
|
BMenu *CurView::LoadCursorSets(void)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_CURSORSET
|
#ifdef DEBUG_CURSORSET
|
||||||
@@ -323,6 +327,7 @@ void CurView::SetCursorSetName(const char *name)
|
|||||||
cursorset_label->ResizeToPreferred();
|
cursorset_label->ResizeToPreferred();
|
||||||
cursorset_label->Invalidate();
|
cursorset_label->Invalidate();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
void CurView::SaveSettings(void)
|
void CurView::SaveSettings(void)
|
||||||
{
|
{
|
||||||
@@ -336,7 +341,7 @@ printf("SaveSettings: %s\n",path.String());
|
|||||||
#endif
|
#endif
|
||||||
cursorset->Save(path.String(),B_CREATE_FILE|B_ERASE_FILE);
|
cursorset->Save(path.String(),B_CREATE_FILE|B_ERASE_FILE);
|
||||||
|
|
||||||
prev_set_name=cursorset_name;
|
// prev_set_name=cursorset_name;
|
||||||
revert->SetEnabled(false);
|
revert->SetEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,9 +379,9 @@ printf("Couldn't open file %s for read\n",path.String());
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.FindString("name",&cursorset_name);
|
// settings.FindString("name",&cursorset_name);
|
||||||
SetCursorSetName(cursorset_name.String());
|
// SetCursorSetName(cursorset_name.String());
|
||||||
prev_set_name=cursorset_name;
|
// prev_set_name=cursorset_name;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,8 +75,8 @@ public:
|
|||||||
void SetDefaults(void);
|
void SetDefaults(void);
|
||||||
protected:
|
protected:
|
||||||
friend APRWindow;
|
friend APRWindow;
|
||||||
BMenu *LoadCursorSets(void);
|
// BMenu *LoadCursorSets(void);
|
||||||
void SetCursorSetName(const char *name);
|
// void SetCursorSetName(const char *name);
|
||||||
|
|
||||||
BButton *apply,*revert,*defaults;
|
BButton *apply,*revert,*defaults;
|
||||||
BListView *attrlist;
|
BListView *attrlist;
|
||||||
@@ -84,11 +84,11 @@ protected:
|
|||||||
BMessage settings;
|
BMessage settings;
|
||||||
BString attrstring;
|
BString attrstring;
|
||||||
BScrollView *scrollview;
|
BScrollView *scrollview;
|
||||||
BStringView *cursorset_label;
|
// BStringView *cursorset_label;
|
||||||
BMenu *cursorset_menu,*settings_menu;
|
// BMenu *cursorset_menu,*settings_menu;
|
||||||
BFilePanel *savepanel;
|
// BFilePanel *savepanel;
|
||||||
BString cursorset_name;
|
// BString cursorset_name;
|
||||||
BString prev_set_name;
|
// BString prev_set_name;
|
||||||
CursorSet *cursorset;
|
CursorSet *cursorset;
|
||||||
BitmapView *bmpview;
|
BitmapView *bmpview;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -84,7 +84,9 @@ DecView::DecView(BRect frame, const char *name, int32 resize, int32 flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set up list of color attributes
|
// 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");
|
declist=new BListView(cvrect,"DecoratorList");
|
||||||
|
|
||||||
scrollview=new BScrollView("ScrollView",declist, B_FOLLOW_LEFT |
|
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);
|
// unload_add_on(decorator_id);
|
||||||
}
|
}
|
||||||
decorator_id=addon;
|
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);
|
B_NORMAL_WINDOW_FEEL,0);
|
||||||
decorator->SetDriver(driver);
|
decorator->SetDriver(driver);
|
||||||
decorator->SetFocus(true);
|
decorator->SetFocus(true);
|
||||||
|
|||||||
@@ -58,7 +58,7 @@
|
|||||||
#include "LayerData.h"
|
#include "LayerData.h"
|
||||||
#include "ColorSet.h"
|
#include "ColorSet.h"
|
||||||
|
|
||||||
BRect preview_bounds(0,0,200,200);;
|
BRect preview_bounds(0,0,150,150);;
|
||||||
|
|
||||||
PVView::PVView(BRect bounds)
|
PVView::PVView(BRect bounds)
|
||||||
: BView(bounds,"previewdriver_view",B_FOLLOW_NONE, B_WILL_DRAW)
|
: BView(bounds,"previewdriver_view",B_FOLLOW_NONE, B_WILL_DRAW)
|
||||||
|
|||||||
@@ -27,4 +27,5 @@
|
|||||||
#define GET_DECORATOR 'gdec'
|
#define GET_DECORATOR 'gdec'
|
||||||
|
|
||||||
#define SET_UI_COLORS 'suic'
|
#define SET_UI_COLORS 'suic'
|
||||||
|
#define PREFS_CHOSEN 'prch'
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user