Largely implemented SystemCursor API and updated application

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4062 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
DarkWyrm 2003-07-24 19:42:03 +00:00
parent 9cdc27451e
commit 9b15e4787a
17 changed files with 450 additions and 292 deletions

View File

@ -1,3 +1,30 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: APRMain.cpp
// Author: DarkWyrm <bpmagic@columbus.rr.com>
// Description: Main file for Appearance
//
//
//------------------------------------------------------------------------------
#include "APRMain.h"
#include <stdio.h>
@ -7,7 +34,7 @@ APRApplication::APRApplication()
BRect rect;
// This is just the size and location of the window when Show() is called
rect.Set(100,100,540,345);
rect.Set(100,100,610,345);
aprwin=new APRWindow(rect);
aprwin->Show();
}

View File

@ -1,3 +1,30 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: APRMain.h
// Author: DarkWyrm <bpmagic@columbus.rr.com>
// Description: Main header for Appearance
//
//
//------------------------------------------------------------------------------
#ifndef APR_WORLD_H
#define APR_WORLD_H

View File

@ -87,6 +87,7 @@ APRView::APRView(const BRect &frame, const char *name, int32 resize, int32 flags
wellrect.right=colorwell->Frame().left - 20;
colorset_label=new BStringView(wellrect,"colorset_label","Color Set: ");
AddChild(colorset_label);
colorset_label->ResizeToPreferred();
colorset_name=new BString("<untitled>");
@ -568,6 +569,7 @@ void APRView::SetColorSetName(const char *name)
colorset_name->SetTo(name);
namestr+=name;
colorset_label->SetText(namestr.String());
colorset_label->ResizeToPreferred();
colorset_label->Invalidate();
}

View File

@ -1,3 +1,30 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: APRWindow.cpp
// Author: DarkWyrm <bpmagic@columbus.rr.com>
// Description: basic Window class for Appearance
//
//
//------------------------------------------------------------------------------
#include <Messenger.h>
#include "APRWindow.h"
#include "APRView.h"
@ -13,17 +40,19 @@ APRWindow::APRWindow(BRect frame)
BTab *tab=NULL;
colors=new APRView(Bounds(),"Colors",B_FOLLOW_ALL, B_WILL_DRAW);
tab=new BTab(colors);
tabview->AddTab(colors,tab);
// TODO: Swap Cursors and Colors tabs when we're done developing it
cursors=new CurView(Bounds(),"Cursors",B_FOLLOW_ALL, B_WILL_DRAW);
tab=new BTab(cursors);
tabview->AddTab(cursors,tab);
decorators=new DecView(Bounds(),"Decorator",B_FOLLOW_ALL, B_WILL_DRAW);
tab=new BTab(decorators);
tabview->AddTab(decorators,tab);
cursors=new CurView(Bounds(),"Cursors",B_FOLLOW_ALL, B_WILL_DRAW);
tab=new BTab(cursors);
tabview->AddTab(cursors,tab);
colors=new APRView(Bounds(),"Colors",B_FOLLOW_ALL, B_WILL_DRAW);
tab=new BTab(colors);
tabview->AddTab(colors,tab);
AddChild(tabview);
decorators->SetColors(colors->settings);

View File

@ -1,3 +1,30 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: APRWindow.h
// Author: DarkWyrm <bpmagic@columbus.rr.com>
// Description: basic Window class for Appearance
//
//
//------------------------------------------------------------------------------
#ifndef APR_WINDOW_H
#define APR_WINDOW_H

View File

@ -1,3 +1,29 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: ColorWell.cpp
// Author: DarkWyrm <bpmagic@columbus.rr.com>
// Description: Color display class which accepts drops
//
//------------------------------------------------------------------------------
#include "ColorWell.h"
ColorWell::ColorWell(BRect frame, BMessage *msg, bool is_rectangle=false)

View File

@ -1,3 +1,29 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: ColorWell.h
// Author: DarkWyrm <bpmagic@columbus.rr.com>
// Description: Color display class which accepts drops
//
//------------------------------------------------------------------------------
#ifndef COLORWELL_H_
#define COLORWELL_H_

View File

@ -1,3 +1,29 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: ColorWhichItem.cpp
// Author: DarkWyrm <bpmagic@columbus.rr.com>
// Description: ListItem class for managing color_which specifiers
//
//------------------------------------------------------------------------------
#include "ColorWhichItem.h"
#include <stdio.h>

View File

@ -1,3 +1,29 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: ColorWhichItem.h
// Author: DarkWyrm <bpmagic@columbus.rr.com>
// Description: ListItem class for managing color_which specifiers
//
//------------------------------------------------------------------------------
#ifndef COLORWHICH_ITEM_H
#define COLORWHICH_ITEM_H

View File

@ -36,6 +36,8 @@
#include <PortLink.h>
#include "defs.h"
#include "ServerConfig.h"
#include <ServerProtocol.h>
#include <PortMessage.h>
#include <InterfaceDefs.h>
//#define DEBUG_CURSORSET
@ -49,6 +51,9 @@ CurView::CurView(const BRect &frame, const char *name, int32 resize, int32 flags
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
cursorset=new CursorSet("Default");
BMenuBar *mb=new BMenuBar(BRect(0,0,Bounds().Width(),16),"menubar");
settings_menu=new BMenu("Settings");
@ -73,6 +78,7 @@ CurView::CurView(const BRect &frame, const char *name, int32 resize, int32 flags
wellrect.right=wellrect.left+50;
cursorset_label=new BStringView(wellrect,"cursorset_label","Cursor Set: ");
AddChild(cursorset_label);
cursorset_label->ResizeToPreferred();
cursorset_name="<untitled>";
@ -122,6 +128,14 @@ CurView::CurView(const BRect &frame, const char *name, int32 resize, int32 flags
AddChild(apply);
apply->SetEnabled(false);
cvrect.Set(0,0,48,48);
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);
AddChild(bmpview);
BEntry entry(COLOR_SET_DIR);
entry_ref ref;
entry.GetRef(&ref);
@ -137,6 +151,7 @@ CurView::CurView(const BRect &frame, const char *name, int32 resize, int32 flags
CurView::~CurView(void)
{
delete savepanel;
delete cursorset;
}
void CurView::AllAttached(void)
@ -339,13 +354,25 @@ printf("Loading cursor sets from disk\n");
int32 count=dir.CountEntries();
BMessage *msg;
CursorSet cs(NULL);
for(int32 i=0;i<count;i++)
{
dir.GetNextEntry(&entry);
entry.GetPath(&path);
if(cs.Load(path.Path())!=B_OK)
continue;
// Don't include the default set in the menu
name=path.Leaf();
if(name.Compare("Default")==0)
continue;
name=path.Path();
name.Remove(0,name.FindLast('/')+1);
msg=new BMessage(LOAD_CURSORSET);
@ -356,103 +383,6 @@ printf("Loading cursor sets from disk\n");
return menu;
}
void CurView::LoadCursorSet(const BString &name)
{
/*
// Load the current GUI cursor settings from a cursor set file.
#ifdef DEBUG_CURSORSET
printf("LoadCursorSet: %s\n",name.String());
#endif
BDirectory dir,newdir;
if(dir.SetTo(CURSOR_SET_DIR)==B_ENTRY_NOT_FOUND)
{
#ifdef DEBUG_CURSORSET
printf("Cursor set folder not found. Creating %s\n",COLOR_SET_DIR);
#endif
create_directory(COLOR_SET_DIR,0777);
}
BString path(COLOR_SET_DIR);
path+=name.String();
BFile file(path.String(),B_READ_ONLY);
if(file.InitCheck()!=B_OK)
{
#ifdef DEBUG_CURSORSET
printf("Couldn't open file %s for read\n",path.String());
#endif
return;
}
if(settings.Unflatten(&file)==B_OK)
{
#ifdef DEBUG_CURSORSET
settings.PrintToStream();
#endif
BString internal_name;
settings.FindString("name",&internal_name);
// BString namestr("Cursor Set: ");
// namestr+=internal_name.String();
// cursorset_label->SetText(namestr.String());
SetCursorSetName(internal_name.String());
return;
}
#ifdef DEBUG_CURSORSET
printf("Error unflattening file %s\n",name.String());
#endif
*/
}
void CurView::SaveCursorSet(const BString &name)
{
/*
// Save the current cursor attributes as a flattened BMessage in the
// cursor set folder
BString path(COLOR_SET_DIR);
path+=name.String();
#ifdef DEBUG_CURSORSET
printf("SaveCursorSet: %s\n",path.String());
#endif
if(settings.ReplaceString("name",name.String())!=B_OK)
{
#ifdef DEBUG_CURSORSET
printf("SaveCursorSet: Couldn't replace set name in settings\n");
#endif
}
BFile file(path.String(),B_READ_WRITE|B_CREATE_FILE|B_ERASE_FILE);
if(file.InitCheck()!=B_OK)
{
#ifdef DEBUG_CURSORSET
printf("SaveCursorSet: Couldn't open settings file for write\n");
#endif
}
if(settings.Flatten(&file)!=B_OK)
{
#ifdef DEBUG_CURSORSET
printf("SaveCursorSet: Couldn't flatten settings to file\n");
#endif
return;
}
BMessage *msg=new BMessage(LOAD_CURSORSET);
msg->AddString("name",name.String());
if(cursorset_menu->AddItem(new BMenuItem(name.String(),msg))==false)
{
#ifdef DEBUG_CURSORSET
printf("SaveCursorSet: Error in adding item to menu\n");
#endif
}
SetCursorSetName(name.String());
*/
}
void CurView::SetCursorSetName(const char *name)
{
if(!name)
@ -461,6 +391,7 @@ void CurView::SetCursorSetName(const char *name)
cursorset_name=name;
namestr+=name;
cursorset_label->SetText(namestr.String());
cursorset_label->ResizeToPreferred();
cursorset_label->Invalidate();
}
@ -474,17 +405,15 @@ void CurView::SaveSettings(void)
#ifdef DEBUG_CURSORSET
printf("SaveSettings: %s\n",path.String());
#endif
BFile file(path.String(),B_READ_WRITE|B_CREATE_FILE|B_ERASE_FILE);
cursorset->Save(path.String(),B_CREATE_FILE|B_ERASE_FILE);
settings.Flatten(&file);
prev_set_name=cursorset_name;
revert->SetEnabled(false);
revert->SetEnabled(false);
}
void CurView::LoadSettings(void)
{
/* // Load the current GUI cursor settings from disk. This is done instead of
// Load the current GUI cursor settings from disk. This is done instead of
// getting them from the server at this point for testing purposes. Comment
// out the #define LOAD_SETTINGS_FROM_DISK line to use the server query code
#ifdef DEBUG_CURSORSET
@ -502,10 +431,11 @@ printf("Cursor set folder not found. Creating %s\n",SERVER_SETTINGS_DIR);
}
BString path(SERVER_SETTINGS_DIR);
path+=COLOR_SETTINGS_NAME;
BFile file(path.String(),B_READ_ONLY);
path+=CURSOR_SETTINGS_NAME;
if(file.InitCheck()!=B_OK)
status_t stat=cursorset->Load(path.String());
if(stat!=B_OK)
{
#ifdef DEBUG_CURSORSET
printf("Couldn't open file %s for read\n",path.String());
@ -514,166 +444,58 @@ printf("Couldn't open file %s for read\n",path.String());
SaveSettings();
return;
}
if(settings.Unflatten(&file)==B_OK)
{
settings.FindString("name",&cursorset_name);
SetCursorSetName(cursorset_name.String());
prev_set_name=cursorset_name;
picker->SetValue(GetCursorFromMessage(&settings,attrstring.String()));
#ifdef DEBUG_CURSORSET
settings.PrintToStream();
#endif
return;
}
#ifdef DEBUG_CURSORSET
printf("Error unflattening SystemCursors file %s\n",path.String());
#endif
// If we get this far, we have encountered an error, so reset the settings
// to the defaults
SetDefaults();
SaveSettings();
*/
settings.FindString("name",&cursorset_name);
SetCursorSetName(cursorset_name.String());
prev_set_name=cursorset_name;
return;
}
void CurView::SetDefaults(void)
{
/*
#ifdef DEBUG_CURSORSET
printf("Initializing cursor settings to defaults\n");
#endif
settings.MakeEmpty();
settings.AddString("name","Default");
cursorset_name="Default";
// The server will perform the necessary work to set defaults, so just ask it to do the
// work for us. It is a synchronous procedure, so we will notify the server and load the cursor
// set 'Default'.
BString string(CURSOR_SET_DIR);
string+="Default";
ColorWhichItem whichitem(B_PANEL_BACKGROUND_COLOR);
rgb_color col={216,216,216,255};
settings.AddData(whichitem.Text(),(type_code)'RGBC',&col,sizeof(rgb_color));
cursorset->Load(string.String());
SetRGBColor(&col,0,0,0);
whichitem.SetAttribute((color_which)B_PANEL_TEXT_COLOR);
settings.AddData(whichitem.Text(),(type_code)'RGBC',&col,sizeof(rgb_color));
port_id port=find_port(SERVER_PORT_NAME);
if(port==B_NAME_NOT_FOUND)
return;
SetRGBColor(&col,255,255,255);
whichitem.SetAttribute((color_which)B_DOCUMENT_BACKGROUND_COLOR);
settings.AddData(whichitem.Text(),(type_code)'RGBC',&col,sizeof(rgb_color));
PortLink link(port);
PortMessage pmsg;
SetRGBColor(&col,0,0,0);
whichitem.SetAttribute((color_which)B_DOCUMENT_TEXT_COLOR);
settings.AddData(whichitem.Text(),(type_code)'RGBC',&col,sizeof(rgb_color));
link.SetOpCode(AS_SET_SYSCURSOR_DEFAULTS);
link.FlushWithReply(&pmsg);
SetRGBColor(&col,245,245,245);
whichitem.SetAttribute((color_which)B_CONTROL_BACKGROUND_COLOR);
settings.AddData(whichitem.Text(),(type_code)'RGBC',&col,sizeof(rgb_color));
SetRGBColor(&col,0,0,0);
whichitem.SetAttribute((color_which)B_CONTROL_TEXT_COLOR);
settings.AddData(whichitem.Text(),(type_code)'RGBC',&col,sizeof(rgb_color));
SetRGBColor(&col,0,0,0);
whichitem.SetAttribute((color_which)B_CONTROL_BORDER_COLOR);
settings.AddData(whichitem.Text(),(type_code)'RGBC',&col,sizeof(rgb_color));
SetRGBColor(&col,115,120,184);
whichitem.SetAttribute((color_which)B_CONTROL_HIGHLIGHT_COLOR);
settings.AddData(whichitem.Text(),(type_code)'RGBC',&col,sizeof(rgb_color));
SetRGBColor(&col,170,50,184);
whichitem.SetAttribute((color_which)B_NAVIGATION_BASE_COLOR);
settings.AddData(whichitem.Text(),(type_code)'RGBC',&col,sizeof(rgb_color));
SetRGBColor(&col,0,0,0);
whichitem.SetAttribute((color_which)B_NAVIGATION_PULSE_COLOR);
settings.AddData(whichitem.Text(),(type_code)'RGBC',&col,sizeof(rgb_color));
SetRGBColor(&col,255,255,255);
whichitem.SetAttribute((color_which)B_SHINE_COLOR);
settings.AddData(whichitem.Text(),(type_code)'RGBC',&col,sizeof(rgb_color));
SetRGBColor(&col,0,0,0);
whichitem.SetAttribute((color_which)B_SHADOW_COLOR);
settings.AddData(whichitem.Text(),(type_code)'RGBC',&col,sizeof(rgb_color));
SetRGBColor(&col,0,0,0);
whichitem.SetAttribute((color_which)B_MENU_SELECTED_BORDER_COLOR);
settings.AddData(whichitem.Text(),(type_code)'RGBC',&col,sizeof(rgb_color));
SetRGBColor(&col,255,255,0);
whichitem.SetAttribute((color_which)B_TOOLTIP_BACKGROUND_COLOR);
settings.AddData(whichitem.Text(),(type_code)'RGBC',&col,sizeof(rgb_color));
SetRGBColor(&col,0,0,0);
whichitem.SetAttribute((color_which)B_TOOLTIP_TEXT_COLOR);
settings.AddData(whichitem.Text(),(type_code)'RGBC',&col,sizeof(rgb_color));
SetRGBColor(&col,0,255,0);
whichitem.SetAttribute((color_which)B_SUCCESS_COLOR);
settings.AddData(whichitem.Text(),(type_code)'RGBC',&col,sizeof(rgb_color));
SetRGBColor(&col,255,0,0);
whichitem.SetAttribute((color_which)B_FAILURE_COLOR);
settings.AddData(whichitem.Text(),(type_code)'RGBC',&col,sizeof(rgb_color));
SetRGBColor(&col,51,102,160);
whichitem.SetAttribute((color_which)B_MENU_SELECTED_BACKGROUND_COLOR);
settings.AddData(whichitem.Text(),(type_code)'RGBC',&col,sizeof(rgb_color));
whichitem.SetAttribute(B_PANEL_BACKGROUND_COLOR);
SetRGBColor(&col,216,216,216);
settings.AddData(whichitem.Text(),(type_code)'RGBC',&col,sizeof(rgb_color));
SetRGBColor(&col,216,216,216,0);
whichitem.SetAttribute(B_MENU_BACKGROUND_COLOR);
settings.AddData(whichitem.Text(),(type_code)'RGBC',&col,sizeof(rgb_color));
SetRGBColor(&col,0,0,0);
whichitem.SetAttribute(B_MENU_ITEM_TEXT_COLOR);
settings.AddData(whichitem.Text(),(type_code)'RGBC',&col,sizeof(rgb_color));
SetRGBColor(&col,255,255,255);
whichitem.SetAttribute(B_MENU_SELECTED_ITEM_TEXT_COLOR);
settings.AddData(whichitem.Text(),(type_code)'RGBC',&col,sizeof(rgb_color));
SetRGBColor(&col,255,203,0);
whichitem.SetAttribute(B_WINDOW_TAB_COLOR);
settings.AddData(whichitem.Text(),(type_code)'RGBC',&col,sizeof(rgb_color));
SetRGBColor(&col,0,0,0);
whichitem.SetAttribute((color_which)B_WINDOW_TAB_TEXT_COLOR);
settings.AddData(whichitem.Text(),(type_code)'RGBC',&col,sizeof(rgb_color));
SetRGBColor(&col,232,232,232);
whichitem.SetAttribute((color_which)B_INACTIVE_WINDOW_TAB_COLOR);
settings.AddData(whichitem.Text(),(type_code)'RGBC',&col,sizeof(rgb_color));
SetRGBColor(&col,80,80,80);
whichitem.SetAttribute((color_which)B_INACTIVE_WINDOW_TAB_TEXT_COLOR);
settings.AddData(whichitem.Text(),(type_code)'RGBC',&col,sizeof(rgb_color));
// BString labelstr("Color Set: ");
// labelstr+=cursorset_name;
// cursorset_label->SetText(labelstr.String());
SetCursorSetName("Default");
*/
}
void CurView::NotifyServer(void)
BitmapView::BitmapView(const BPoint &pt)
: BView(BRect(0,0,48,48).OffsetToCopy(pt),"bitmapview",B_FOLLOW_NONE,B_WILL_DRAW)
{
bitmap=NULL;
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
}
rgb_color CurView::GetColorFromMessage(BMessage *msg, const char *name, int32 index=0)
BitmapView::~BitmapView(void)
{
/*
// Simple function to do the dirty work of getting an rgb_color from
// a message
rgb_color *col,rcolor={0,0,0,0};
ssize_t size;
if(!msg || !name)
return rcolor;
if(msg->FindData(name,(type_code)'RGBC',index,(const void**)&col,&size)==B_OK)
rcolor=*col;
return rcolor;
*/
if(bitmap)
delete bitmap;
}
void BitmapView::SetBitmap(BBitmap *bmp)
{
if(bitmap)
delete bitmap;
bitmap=bmp;
}
void BitmapView::Draw(BRect r)
{
if(bitmap)
DrawBitmap(bitmap);
}

View File

@ -41,9 +41,22 @@
#include <StringView.h>
#include <FilePanel.h>
#include <Invoker.h>
#include <SysCursor.h>
#include <Bitmap.h>
class APRWindow;
class BitmapView : public BView
{
public:
BitmapView(const BPoint &pt);
~BitmapView(void);
void SetBitmap(BBitmap *bmp);
void Draw(BRect r);
protected:
BBitmap *bitmap;
};
class CurView : public BView
{
public:
@ -54,13 +67,9 @@ public:
void SaveSettings(void);
void LoadSettings(void);
void SetDefaults(void);
void NotifyServer(void);
rgb_color GetColorFromMessage(BMessage *msg, const char *name, int32 index=0);
protected:
friend APRWindow;
BMenu *LoadCursorSets(void);
void SaveCursorSet(const BString &name);
void LoadCursorSet(const BString &name);
void SetCursorSetName(const char *name);
BButton *apply,*revert,*defaults;
@ -74,6 +83,8 @@ protected:
BFilePanel *savepanel;
BString cursorset_name;
BString prev_set_name;
CursorSet *cursorset;
BitmapView *bmpview;
};
#endif

View File

@ -1,3 +1,29 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: CursorWhichItem.cpp
// Author: DarkWyrm <bpmagic@columbus.rr.com>
// Description: ListItem class for managing cursor_which specifiers
//
//------------------------------------------------------------------------------
#include "CursorWhichItem.h"
#include <stdio.h>

View File

@ -1,3 +1,29 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: CursorWhichItem.h
// Author: DarkWyrm <bpmagic@columbus.rr.com>
// Description: ListItem class for managing cursor_which specifiers
//
//------------------------------------------------------------------------------
#ifndef COLORWHICH_ITEM_H
#define COLORWHICH_ITEM_H

View File

@ -51,8 +51,32 @@ DecView::DecView(BRect frame, const char *name, int32 resize, int32 flags)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
BRect cvrect(0,0,50,25);
cvrect.OffsetTo(Bounds().right-60,10);
apply=new BButton(cvrect,"ApplyButton","Apply",
new BMessage(APPLY_SETTINGS),B_FOLLOW_LEFT |B_FOLLOW_TOP,
B_WILL_DRAW | B_NAVIGABLE);
AddChild(apply);
// set up app_server emulation
driver=new PreviewDriver();
if(!driver->Initialize())
printf("Uh-oh... Couldn't initialize graphics module for server emu!\n");
else
{
preview=driver->View();
AddChild(preview);
BRect temp(driver->View()->Bounds());
preview->MoveTo(apply->Frame().left-temp.Width()-20,apply->Frame().top);
}
// Set up list of color attributes
declist=new BListView(BRect(10,10,110,110),"DecoratorList");
cvrect.Set(10,10,preview->Frame().left-20-B_V_SCROLL_BAR_WIDTH, preview->Frame().bottom);
declist=new BListView(cvrect,"DecoratorList");
scrollview=new BScrollView("ScrollView",declist, B_FOLLOW_LEFT |
B_FOLLOW_TOP, 0, false, true);
@ -61,28 +85,8 @@ DecView::DecView(BRect frame, const char *name, int32 resize, int32 flags)
declist->SetSelectionMessage(new BMessage(DECORATOR_CHOSEN));
BRect cvrect(0,0,50,25);
cvrect.OffsetTo(Bounds().right-60,
scrollview->Frame().top);
apply=new BButton(cvrect,"ApplyButton","Apply",
new BMessage(APPLY_SETTINGS),B_FOLLOW_LEFT |B_FOLLOW_TOP,
B_WILL_DRAW | B_NAVIGABLE);
AddChild(apply);
// set up app_server emulation
driver=new PreviewDriver();
if(!driver->Initialize())
printf("Uh-oh... Couldn't initialize graphics module for server emu!\n");
else
{
preview=driver->View();
AddChild(preview);
preview->MoveTo(scrollview->Frame().right+20,scrollview->Frame().top);
}
// Finish setup
ldata.highcolor.SetColor(51,102,160);
pat_solid_high=0xFFFFFFFFFFFFFFFFLL;
driver->FillRect(preview_bounds,&ldata,(int8*)&pat_solid_high);

View File

@ -10,7 +10,7 @@ Preference Appearance :
CurView.cpp
DecView.cpp
PreviewDriver.cpp
SysCursorAPI.cpp
# SysCursorAPI.cpp
ColorWell.cpp
ColorWhichItem.cpp
CursorWhichItem.cpp

View File

@ -1,6 +1,33 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: PreviewDriver.cpp
// Author: DarkWyrm <bpmagic@columbus.rr.com>
// Description: Class to display decorators from regular BApplications
//
//------------------------------------------------------------------------------
/*
PreviewDriver:
Module based on proto6's ViewDriver for the purpose of Decorator previews.
Module based on app_server's ViewDriver for the purpose of Decorator previews.
The concept is to have a view draw a bitmap, which is a "frame buffer"
of sorts, utilize a second view to write to it. This cuts out

View File

@ -1,3 +1,29 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: PreviewDriver.cpp
// Author: DarkWyrm <bpmagic@columbus.rr.com>
// Description: Class to display decorators from regular BApplications
//
//------------------------------------------------------------------------------
#ifndef _PREVIEWDRIVER_H_
#define _PREVIEWDRIVER_H_