Some guidelinization...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27808 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+17
-4
@@ -37,6 +37,10 @@ static const deskbar_location kDeskbarLocationMap[] = {
|
|||||||
B_DESKBAR_LEFT_BOTTOM, B_DESKBAR_RIGHT_BOTTOM, B_DESKBAR_BOTTOM
|
B_DESKBAR_LEFT_BOTTOM, B_DESKBAR_RIGHT_BOTTOM, B_DESKBAR_BOTTOM
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
BeThemeImporter::BeThemeImporter()
|
BeThemeImporter::BeThemeImporter()
|
||||||
:ThemeImporter("BeTheme")
|
:ThemeImporter("BeTheme")
|
||||||
{
|
{
|
||||||
@@ -50,25 +54,32 @@ BeThemeImporter::BeThemeImporter()
|
|||||||
fQuery.SetPredicate(QSTR);
|
fQuery.SetPredicate(QSTR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BeThemeImporter::~BeThemeImporter()
|
BeThemeImporter::~BeThemeImporter()
|
||||||
{
|
{
|
||||||
FENTRY;
|
FENTRY;
|
||||||
fQuery.Clear();
|
fQuery.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *BeThemeImporter::Description()
|
|
||||||
|
const char *
|
||||||
|
BeThemeImporter::Description()
|
||||||
{
|
{
|
||||||
FENTRY;
|
FENTRY;
|
||||||
return "Imports BeTheme themes";
|
return "Imports BeTheme themes";
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t BeThemeImporter::FetchThemes()
|
|
||||||
|
status_t
|
||||||
|
BeThemeImporter::FetchThemes()
|
||||||
{
|
{
|
||||||
FENTRY;
|
FENTRY;
|
||||||
return fQuery.Fetch();
|
return fQuery.Fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t BeThemeImporter::ImportNextTheme(BMessage **theme)
|
|
||||||
|
status_t
|
||||||
|
BeThemeImporter::ImportNextTheme(BMessage **theme)
|
||||||
{
|
{
|
||||||
FENTRY;
|
FENTRY;
|
||||||
status_t err;
|
status_t err;
|
||||||
@@ -268,7 +279,9 @@ status_t BeThemeImporter::ImportNextTheme(BMessage **theme)
|
|||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t BeThemeImporter::EndImports()
|
|
||||||
|
status_t
|
||||||
|
BeThemeImporter::EndImports()
|
||||||
{
|
{
|
||||||
FENTRY;
|
FENTRY;
|
||||||
fQuery.Clear();
|
fQuery.Clear();
|
||||||
|
|||||||
+23
-6
@@ -178,24 +178,33 @@ static struct sounds_map {
|
|||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
MSThemeImporter::MSThemeImporter()
|
MSThemeImporter::MSThemeImporter()
|
||||||
:ThemeImporter("MSTheme")
|
:ThemeImporter("MSTheme")
|
||||||
{
|
{
|
||||||
FENTRY;
|
FENTRY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MSThemeImporter::~MSThemeImporter()
|
MSThemeImporter::~MSThemeImporter()
|
||||||
{
|
{
|
||||||
FENTRY;
|
FENTRY;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *MSThemeImporter::Description()
|
|
||||||
|
const char *
|
||||||
|
MSThemeImporter::Description()
|
||||||
{
|
{
|
||||||
FENTRY;
|
FENTRY;
|
||||||
return "Imports MSTheme themes";
|
return "Imports MSTheme themes";
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t MSThemeImporter::FetchThemes()
|
|
||||||
|
status_t
|
||||||
|
MSThemeImporter::FetchThemes()
|
||||||
{
|
{
|
||||||
FENTRY;
|
FENTRY;
|
||||||
status_t err = ENOENT;
|
status_t err = ENOENT;
|
||||||
@@ -238,7 +247,9 @@ status_t MSThemeImporter::FetchThemes()
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t MSThemeImporter::ImportNextTheme(BMessage **theme)
|
|
||||||
|
status_t
|
||||||
|
MSThemeImporter::ImportNextTheme(BMessage **theme)
|
||||||
{
|
{
|
||||||
FENTRY;
|
FENTRY;
|
||||||
status_t err;
|
status_t err;
|
||||||
@@ -545,13 +556,17 @@ status_t MSThemeImporter::ImportNextTheme(BMessage **theme)
|
|||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t MSThemeImporter::EndImports()
|
|
||||||
|
status_t
|
||||||
|
MSThemeImporter::EndImports()
|
||||||
{
|
{
|
||||||
FENTRY;
|
FENTRY;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MSThemeImporter::ScanDirectory(BDirectory &dir, int depth)
|
|
||||||
|
bool
|
||||||
|
MSThemeImporter::ScanDirectory(BDirectory &dir, int depth)
|
||||||
{
|
{
|
||||||
//FENTRY;
|
//FENTRY;
|
||||||
BEntry ent;
|
BEntry ent;
|
||||||
@@ -582,7 +597,9 @@ bool MSThemeImporter::ScanDirectory(BDirectory &dir, int depth)
|
|||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t MSThemeImporter::ParseWinPath(BDirectory &rootDir, const char *from, BPath &to)
|
|
||||||
|
status_t
|
||||||
|
MSThemeImporter::ParseWinPath(BDirectory &rootDir, const char *from, BPath &to)
|
||||||
{
|
{
|
||||||
status_t err;
|
status_t err;
|
||||||
//FENTRY;
|
//FENTRY;
|
||||||
|
|||||||
+4
-1
@@ -18,7 +18,9 @@
|
|||||||
// PRIVATE: in libzeta for now.
|
// PRIVATE: in libzeta for now.
|
||||||
extern status_t ScaleBitmap(const BBitmap& inBitmap, BBitmap& outBitmap);
|
extern status_t ScaleBitmap(const BBitmap& inBitmap, BBitmap& outBitmap);
|
||||||
|
|
||||||
status_t MakeScreenshot(BBitmap **here)
|
|
||||||
|
status_t
|
||||||
|
MakeScreenshot(BBitmap **here)
|
||||||
{
|
{
|
||||||
status_t err;
|
status_t err;
|
||||||
BScreen bs;
|
BScreen bs;
|
||||||
@@ -73,3 +75,4 @@ status_t MakeScreenshot(BBitmap **here)
|
|||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -5,7 +5,7 @@
|
|||||||
#include <TextControl.h>
|
#include <TextControl.h>
|
||||||
|
|
||||||
class TextInputAlert : public BAlert {
|
class TextInputAlert : public BAlert {
|
||||||
public:
|
public:
|
||||||
TextInputAlert(const char *title,
|
TextInputAlert(const char *title,
|
||||||
const char *text,
|
const char *text,
|
||||||
const char *initial, /* initial input value */
|
const char *initial, /* initial input value */
|
||||||
@@ -21,7 +21,7 @@ class TextInputAlert : public BAlert {
|
|||||||
BTextControl *TextControl() const { return fText; };
|
BTextControl *TextControl() const { return fText; };
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BTextControl *fText;
|
BTextControl *fText;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+104
-64
@@ -64,32 +64,44 @@ static const uint32 skOnlineThemes = 'TmOL';
|
|||||||
static char* skThemeURL = "http://www.zeta-os.com/cms/download.php?list.4";
|
static char* skThemeURL = "http://www.zeta-os.com/cms/download.php?list.4";
|
||||||
|
|
||||||
#define HIDESS_OFFSET (Bounds().Width()/2 - 130)
|
#define HIDESS_OFFSET (Bounds().Width()/2 - 130)
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
filter_result refs_filter(BMessage *message, BHandler **handler, BMessageFilter *filter)
|
|
||||||
|
// #pragma mark - refs_filter
|
||||||
|
|
||||||
|
|
||||||
|
filter_result
|
||||||
|
refs_filter(BMessage *message, BHandler **handler, BMessageFilter *filter)
|
||||||
{
|
{
|
||||||
(void)handler;
|
(void)handler;
|
||||||
(void)filter;
|
(void)filter;
|
||||||
switch (message->what) {
|
switch (message->what) {
|
||||||
case B_REFS_RECEIVED:
|
case B_REFS_RECEIVED:
|
||||||
message->PrintToStream();
|
message->PrintToStream();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return B_DISPATCH_MESSAGE;
|
return B_DISPATCH_MESSAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
|
// #pragma mark - MyInvoker
|
||||||
|
|
||||||
|
|
||||||
class MyInvoker : public BInvoker {
|
class MyInvoker : public BInvoker {
|
||||||
public:
|
public:
|
||||||
MyInvoker(BMessage* message, const BHandler* handler, const BLooper* looper = NULL);
|
MyInvoker(BMessage* message,
|
||||||
virtual ~MyInvoker();
|
const BHandler* handler,
|
||||||
virtual status_t Invoke(BMessage* message = NULL);
|
const BLooper* looper = NULL);
|
||||||
void SetOwner(TextInputAlert *alert);
|
virtual ~MyInvoker();
|
||||||
private:
|
virtual status_t Invoke(BMessage* message = NULL);
|
||||||
TextInputAlert *fOwner;
|
void SetOwner(TextInputAlert *alert);
|
||||||
|
private:
|
||||||
|
TextInputAlert* fOwner;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
MyInvoker::MyInvoker(BMessage* message, const BHandler* handler, const BLooper* looper)
|
MyInvoker::MyInvoker(BMessage* message,
|
||||||
|
const BHandler* handler,
|
||||||
|
const BLooper* looper)
|
||||||
: BInvoker(message, handler, looper)
|
: BInvoker(message, handler, looper)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -120,21 +132,27 @@ MyInvoker::SetOwner(TextInputAlert *alert)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
//extern "C" BView *get_pref_view(const BRect& Bounds)
|
//extern "C" BView *get_pref_view(const BRect& Bounds)
|
||||||
extern "C" BView *themes_pref(const BRect& Bounds)
|
extern "C" BView *
|
||||||
|
themes_pref(const BRect& Bounds)
|
||||||
{
|
{
|
||||||
return new ThemeInterfaceView(Bounds);
|
return new ThemeInterfaceView(Bounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
|
// #pragma mark - ThemeInterfaceView
|
||||||
|
|
||||||
|
|
||||||
ThemeInterfaceView::ThemeInterfaceView(BRect _bounds)
|
ThemeInterfaceView::ThemeInterfaceView(BRect _bounds)
|
||||||
: BView(_bounds, "Themes", B_FOLLOW_ALL_SIDES, B_WILL_DRAW)
|
: BView(_bounds, "Themes", B_FOLLOW_ALL_SIDES, B_WILL_DRAW),
|
||||||
, fThemeManager(NULL)
|
fThemeManager(NULL),
|
||||||
, fScreenshotPaneHidden(false)
|
fScreenshotPaneHidden(false),
|
||||||
, fHasScreenshot(false)
|
fHasScreenshot(false),
|
||||||
, fPopupInvoker(NULL)
|
fPopupInvoker(NULL),
|
||||||
, fBox(NULL)
|
fBox(NULL)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
BMessageFilter *filt = new BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE, refs_filter);
|
BMessageFilter *filt = new BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE, refs_filter);
|
||||||
@@ -144,14 +162,14 @@ ThemeInterfaceView::ThemeInterfaceView(BRect _bounds)
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
ThemeInterfaceView::~ThemeInterfaceView()
|
ThemeInterfaceView::~ThemeInterfaceView()
|
||||||
{
|
{
|
||||||
delete fPopupInvoker;
|
delete fPopupInvoker;
|
||||||
delete fThemeManager;
|
delete fThemeManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
void
|
void
|
||||||
ThemeInterfaceView::AllAttached()
|
ThemeInterfaceView::AllAttached()
|
||||||
{
|
{
|
||||||
@@ -280,14 +298,14 @@ ThemeInterfaceView::AllAttached()
|
|||||||
PopulateThemeList();
|
PopulateThemeList();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
void
|
void
|
||||||
ThemeInterfaceView::MessageReceived(BMessage *_msg)
|
ThemeInterfaceView::MessageReceived(BMessage *_msg)
|
||||||
{
|
{
|
||||||
ThemeManager *tman;
|
ThemeManager *tman;
|
||||||
int32 value;
|
int32 value;
|
||||||
int32 id;
|
int32 id;
|
||||||
//_msg->PrintToStream();
|
|
||||||
switch(_msg->what)
|
switch(_msg->what)
|
||||||
{
|
{
|
||||||
case B_REFS_RECEIVED:
|
case B_REFS_RECEIVED:
|
||||||
@@ -424,14 +442,16 @@ ThemeInterfaceView::MessageReceived(BMessage *_msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
ThemeManager* ThemeInterfaceView::GetThemeManager()
|
ThemeManager*
|
||||||
|
ThemeInterfaceView::GetThemeManager()
|
||||||
{
|
{
|
||||||
return fThemeManager;
|
return fThemeManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
void ThemeInterfaceView::HideScreenshotPane(bool hide)
|
void
|
||||||
|
ThemeInterfaceView::HideScreenshotPane(bool hide)
|
||||||
{
|
{
|
||||||
BString lbl;
|
BString lbl;
|
||||||
if (IsScreenshotPaneHidden() && hide)
|
if (IsScreenshotPaneHidden() && hide)
|
||||||
@@ -462,14 +482,16 @@ void ThemeInterfaceView::HideScreenshotPane(bool hide)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
bool ThemeInterfaceView::IsScreenshotPaneHidden()
|
bool
|
||||||
|
ThemeInterfaceView::IsScreenshotPaneHidden()
|
||||||
{
|
{
|
||||||
return fScreenshotPaneHidden;
|
return fScreenshotPaneHidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
void ThemeInterfaceView::PopulateThemeList()
|
void
|
||||||
|
ThemeInterfaceView::PopulateThemeList()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
BControl *c;
|
BControl *c;
|
||||||
@@ -478,20 +500,23 @@ void ThemeInterfaceView::PopulateThemeList()
|
|||||||
if (c)
|
if (c)
|
||||||
c->SetEnabled(false);
|
c->SetEnabled(false);
|
||||||
}
|
}
|
||||||
thread_id tid = spawn_thread(_ThemeListPopulatorTh, "ThemeListPopulator", B_LOW_PRIORITY, this);
|
thread_id tid = spawn_thread(_ThemeListPopulatorTh, "ThemeListPopulator",
|
||||||
|
B_LOW_PRIORITY, this);
|
||||||
resume_thread(tid);
|
resume_thread(tid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
int32 ThemeInterfaceView::_ThemeListPopulatorTh(void *arg)
|
int32
|
||||||
|
ThemeInterfaceView::_ThemeListPopulatorTh(void *arg)
|
||||||
{
|
{
|
||||||
ThemeInterfaceView *_this = (ThemeInterfaceView *)arg;
|
ThemeInterfaceView *_this = (ThemeInterfaceView *)arg;
|
||||||
_this->_ThemeListPopulator();
|
_this->_ThemeListPopulator();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
void ThemeInterfaceView::_ThemeListPopulator()
|
void
|
||||||
|
ThemeInterfaceView::_ThemeListPopulator()
|
||||||
{
|
{
|
||||||
status_t err;
|
status_t err;
|
||||||
int32 i, count;
|
int32 i, count;
|
||||||
@@ -548,6 +573,8 @@ void ThemeInterfaceView::_ThemeListPopulator()
|
|||||||
LockLooper();
|
LockLooper();
|
||||||
fThemeList->AddItem(ti);
|
fThemeList->AddItem(ti);
|
||||||
UnlockLooper();
|
UnlockLooper();
|
||||||
|
// rest a bit
|
||||||
|
snooze(1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// enable controls again
|
// enable controls again
|
||||||
@@ -561,8 +588,9 @@ void ThemeInterfaceView::_ThemeListPopulator()
|
|||||||
UnlockLooper();
|
UnlockLooper();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
void ThemeInterfaceView::PopulateAddonList()
|
void
|
||||||
|
ThemeInterfaceView::PopulateAddonList()
|
||||||
{
|
{
|
||||||
int32 i, count;
|
int32 i, count;
|
||||||
ViewItem *vi;
|
ViewItem *vi;
|
||||||
@@ -575,8 +603,9 @@ void ThemeInterfaceView::PopulateAddonList()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
status_t ThemeInterfaceView::Revert()
|
status_t
|
||||||
|
ThemeInterfaceView::Revert()
|
||||||
{
|
{
|
||||||
status_t err = B_OK;
|
status_t err = B_OK;
|
||||||
ThemeManager* tman = GetThemeManager();
|
ThemeManager* tman = GetThemeManager();
|
||||||
@@ -589,8 +618,9 @@ status_t ThemeInterfaceView::Revert()
|
|||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
status_t ThemeInterfaceView::ApplyDefaults()
|
status_t
|
||||||
|
ThemeInterfaceView::ApplyDefaults()
|
||||||
{
|
{
|
||||||
status_t err = B_OK;
|
status_t err = B_OK;
|
||||||
ThemeManager* tman = GetThemeManager();
|
ThemeManager* tman = GetThemeManager();
|
||||||
@@ -601,8 +631,9 @@ status_t ThemeInterfaceView::ApplyDefaults()
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
status_t ThemeInterfaceView::ApplySelected()
|
status_t
|
||||||
|
ThemeInterfaceView::ApplySelected()
|
||||||
{
|
{
|
||||||
status_t err;
|
status_t err;
|
||||||
ThemeManager* tman = GetThemeManager();
|
ThemeManager* tman = GetThemeManager();
|
||||||
@@ -623,8 +654,9 @@ status_t ThemeInterfaceView::ApplySelected()
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
status_t ThemeInterfaceView::CreateNew(const char *name)
|
status_t
|
||||||
|
ThemeInterfaceView::CreateNew(const char *name)
|
||||||
{
|
{
|
||||||
status_t err;
|
status_t err;
|
||||||
ThemeManager* tman = GetThemeManager();
|
ThemeManager* tman = GetThemeManager();
|
||||||
@@ -649,8 +681,9 @@ status_t ThemeInterfaceView::CreateNew(const char *name)
|
|||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
status_t ThemeInterfaceView::SaveSelected()
|
status_t
|
||||||
|
ThemeInterfaceView::SaveSelected()
|
||||||
{
|
{
|
||||||
status_t err;
|
status_t err;
|
||||||
ThemeManager* tman = GetThemeManager();
|
ThemeManager* tman = GetThemeManager();
|
||||||
@@ -680,8 +713,9 @@ status_t ThemeInterfaceView::SaveSelected()
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
status_t ThemeInterfaceView::DeleteSelected()
|
status_t
|
||||||
|
ThemeInterfaceView::DeleteSelected()
|
||||||
{
|
{
|
||||||
status_t err;
|
status_t err;
|
||||||
ThemeManager* tman = GetThemeManager();
|
ThemeManager* tman = GetThemeManager();
|
||||||
@@ -710,8 +744,9 @@ status_t ThemeInterfaceView::DeleteSelected()
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
status_t ThemeInterfaceView::AddScreenshot()
|
status_t
|
||||||
|
ThemeInterfaceView::AddScreenshot()
|
||||||
{
|
{
|
||||||
status_t err;
|
status_t err;
|
||||||
ThemeManager* tman = GetThemeManager();
|
ThemeManager* tman = GetThemeManager();
|
||||||
@@ -739,8 +774,9 @@ status_t ThemeInterfaceView::AddScreenshot()
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
status_t ThemeInterfaceView::ThemeSelected()
|
status_t
|
||||||
|
ThemeInterfaceView::ThemeSelected()
|
||||||
{
|
{
|
||||||
status_t err;
|
status_t err;
|
||||||
ThemeManager* tman = GetThemeManager();
|
ThemeManager* tman = GetThemeManager();
|
||||||
@@ -795,18 +831,21 @@ status_t ThemeInterfaceView::ThemeSelected()
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
void ThemeInterfaceView::SetIsRevertable()
|
void
|
||||||
|
ThemeInterfaceView::SetIsRevertable()
|
||||||
{
|
{
|
||||||
BMessenger msgr(Parent());
|
BMessenger msgr(Parent());
|
||||||
msgr.SendMessage(B_PREF_APP_ENABLE_REVERT);
|
msgr.SendMessage(B_PREF_APP_ENABLE_REVERT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// PRIVATE: in libzeta for now.
|
// PRIVATE: in libzeta for now.
|
||||||
extern status_t ScaleBitmap(const BBitmap& inBitmap, BBitmap& outBitmap);
|
extern status_t ScaleBitmap(const BBitmap& inBitmap, BBitmap& outBitmap);
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
void ThemeInterfaceView::SetScreenshot(BBitmap *shot)
|
void
|
||||||
|
ThemeInterfaceView::SetScreenshot(BBitmap *shot)
|
||||||
{
|
{
|
||||||
// no screenshotpanel
|
// no screenshotpanel
|
||||||
if(NULL == fScreenshotPane)
|
if(NULL == fScreenshotPane)
|
||||||
@@ -837,8 +876,9 @@ void ThemeInterfaceView::SetScreenshot(BBitmap *shot)
|
|||||||
delete shot;
|
delete shot;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
status_t ThemeInterfaceView::AError(const char *func, status_t err)
|
status_t
|
||||||
|
ThemeInterfaceView::AError(const char *func, status_t err)
|
||||||
{
|
{
|
||||||
BAlert *alert;
|
BAlert *alert;
|
||||||
BString msg;
|
BString msg;
|
||||||
|
|||||||
+2
-2
@@ -20,7 +20,7 @@ class MyInvoker;
|
|||||||
|
|
||||||
class ThemeInterfaceView : public BView
|
class ThemeInterfaceView : public BView
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ThemeInterfaceView(BRect _bounds);
|
ThemeInterfaceView(BRect _bounds);
|
||||||
virtual ~ThemeInterfaceView();
|
virtual ~ThemeInterfaceView();
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ class ThemeInterfaceView : public BView
|
|||||||
void SetScreenshot(BBitmap *shot);
|
void SetScreenshot(BBitmap *shot);
|
||||||
status_t AError(const char *func, status_t err);
|
status_t AError(const char *func, status_t err);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static int32 _ThemeListPopulatorTh(void *arg);
|
static int32 _ThemeListPopulatorTh(void *arg);
|
||||||
void _ThemeListPopulator();
|
void _ThemeListPopulator();
|
||||||
|
|
||||||
|
|||||||
+23
-6
@@ -3,6 +3,10 @@
|
|||||||
#include <Font.h>
|
#include <Font.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
ThemeItem::ThemeItem(int32 id, const char *name, bool ro)
|
ThemeItem::ThemeItem(int32 id, const char *name, bool ro)
|
||||||
: BStringItem(name)
|
: BStringItem(name)
|
||||||
{
|
{
|
||||||
@@ -11,11 +15,14 @@ ThemeItem::ThemeItem(int32 id, const char *name, bool ro)
|
|||||||
fRo = ro;
|
fRo = ro;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ThemeItem::~ThemeItem()
|
ThemeItem::~ThemeItem()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThemeItem::DrawItem(BView *owner, BRect frame, bool complete)
|
|
||||||
|
void
|
||||||
|
ThemeItem::DrawItem(BView *owner, BRect frame, bool complete)
|
||||||
{
|
{
|
||||||
rgb_color col;
|
rgb_color col;
|
||||||
if (fCurrent || fRo)
|
if (fCurrent || fRo)
|
||||||
@@ -44,27 +51,37 @@ void ThemeItem::DrawItem(BView *owner, BRect frame, bool complete)
|
|||||||
owner->PopState();
|
owner->PopState();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 ThemeItem::ThemeId()
|
|
||||||
|
int32
|
||||||
|
ThemeItem::ThemeId()
|
||||||
{
|
{
|
||||||
return fId;
|
return fId;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ThemeItem::IsCurrent()
|
|
||||||
|
bool
|
||||||
|
ThemeItem::IsCurrent()
|
||||||
{
|
{
|
||||||
return fCurrent;
|
return fCurrent;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThemeItem::SetCurrent(bool set)
|
|
||||||
|
void
|
||||||
|
ThemeItem::SetCurrent(bool set)
|
||||||
{
|
{
|
||||||
fCurrent = set;
|
fCurrent = set;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ThemeItem::IsReadOnly()
|
|
||||||
|
bool
|
||||||
|
ThemeItem::IsReadOnly()
|
||||||
{
|
{
|
||||||
return fRo;
|
return fRo;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThemeItem::SetReadOnly(bool set)
|
|
||||||
|
void
|
||||||
|
ThemeItem::SetReadOnly(bool set)
|
||||||
{
|
{
|
||||||
fRo = set;
|
fRo = set;
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+2
-2
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
class ThemeItem : public BStringItem
|
class ThemeItem : public BStringItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ThemeItem(int32 id, const char *name, bool ro = false);
|
ThemeItem(int32 id, const char *name, bool ro = false);
|
||||||
~ThemeItem();
|
~ThemeItem();
|
||||||
void DrawItem(BView *owner, BRect frame, bool complete = false);
|
void DrawItem(BView *owner, BRect frame, bool complete = false);
|
||||||
@@ -15,7 +15,7 @@ class ThemeItem : public BStringItem
|
|||||||
bool IsReadOnly();
|
bool IsReadOnly();
|
||||||
void SetReadOnly(bool set);
|
void SetReadOnly(bool set);
|
||||||
int32 ThemeId();
|
int32 ThemeId();
|
||||||
private:
|
private:
|
||||||
int32 fId;
|
int32 fId;
|
||||||
bool fRo;
|
bool fRo;
|
||||||
bool fCurrent;
|
bool fCurrent;
|
||||||
|
|||||||
Vendored
+14
-7
@@ -16,6 +16,7 @@ typedef struct font_folder_info {
|
|||||||
char *name;
|
char *name;
|
||||||
uint32 flags;
|
uint32 flags;
|
||||||
} font_folder_info;
|
} font_folder_info;
|
||||||
|
|
||||||
typedef struct font_file_info {
|
typedef struct font_file_info {
|
||||||
char *name;
|
char *name;
|
||||||
uint32 flags;
|
uint32 flags;
|
||||||
@@ -34,7 +35,8 @@ extern long _count_font_files_(long);
|
|||||||
extern status_t _get_nth_font_file_(long, font_file_info **);
|
extern status_t _get_nth_font_file_(long, font_file_info **);
|
||||||
extern status_t _get_nth_font_folder_(long, font_folder_info **);
|
extern status_t _get_nth_font_folder_(long, font_folder_info **);
|
||||||
|
|
||||||
status_t find_font_file(entry_ref *to, font_family family, font_style style, float size)
|
status_t
|
||||||
|
find_font_file(entry_ref *to, font_family family, font_style style, float size)
|
||||||
{
|
{
|
||||||
#ifdef B_BEOS_VERSION_DANO
|
#ifdef B_BEOS_VERSION_DANO
|
||||||
status_t err = ENOENT;
|
status_t err = ENOENT;
|
||||||
@@ -74,6 +76,7 @@ status_t find_font_file(entry_ref *to, font_family family, font_style style, flo
|
|||||||
return ENOENT;
|
return ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define _BORK(_t) \
|
#define _BORK(_t) \
|
||||||
err = find_directory(_t, &path); \
|
err = find_directory(_t, &path); \
|
||||||
if (!err && (s = dir->FindFirst(path.Path())) >= 0) { \
|
if (!err && (s = dir->FindFirst(path.Path())) >= 0) { \
|
||||||
@@ -86,7 +89,8 @@ status_t find_font_file(entry_ref *to, font_family family, font_style style, flo
|
|||||||
return B_OK; \
|
return B_OK; \
|
||||||
} \
|
} \
|
||||||
|
|
||||||
status_t escape_find_directory(BString *dir)
|
status_t
|
||||||
|
escape_find_directory(BString *dir)
|
||||||
{
|
{
|
||||||
status_t err;
|
status_t err;
|
||||||
BPath path;
|
BPath path;
|
||||||
@@ -157,6 +161,7 @@ status_t escape_find_directory(BString *dir)
|
|||||||
}
|
}
|
||||||
#undef _BORK
|
#undef _BORK
|
||||||
|
|
||||||
|
|
||||||
#define _BORK(_t) \
|
#define _BORK(_t) \
|
||||||
if (tok == #_t) { \
|
if (tok == #_t) { \
|
||||||
err = find_directory(_t, &path); \
|
err = find_directory(_t, &path); \
|
||||||
@@ -167,7 +172,8 @@ status_t escape_find_directory(BString *dir)
|
|||||||
} \
|
} \
|
||||||
|
|
||||||
|
|
||||||
status_t unescape_find_directory(BString *dir)
|
status_t
|
||||||
|
unescape_find_directory(BString *dir)
|
||||||
{
|
{
|
||||||
status_t err = B_ERROR;
|
status_t err = B_ERROR;
|
||||||
int32 s, e;
|
int32 s, e;
|
||||||
@@ -243,12 +249,13 @@ status_t unescape_find_directory(BString *dir)
|
|||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef _BORK
|
#undef _BORK
|
||||||
|
|
||||||
|
|
||||||
// copy a file including its attributes
|
// copy a file including its attributes
|
||||||
#define BUFF_SZ 1024*1024
|
#define BUFF_SZ 1024*1024
|
||||||
status_t copy_file(entry_ref *ref, const char *to)
|
status_t
|
||||||
|
copy_file(entry_ref *ref, const char *to)
|
||||||
{
|
{
|
||||||
char *buff;
|
char *buff;
|
||||||
status_t err = B_OK;
|
status_t err = B_OK;
|
||||||
@@ -265,7 +272,8 @@ status_t copy_file(entry_ref *ref, const char *to)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int testhook()
|
int
|
||||||
|
testhook()
|
||||||
{
|
{
|
||||||
status_t err;
|
status_t err;
|
||||||
BString str("/boot/home/config/fonts/ttfonts/toto.ttf");
|
BString str("/boot/home/config/fonts/ttfonts/toto.ttf");
|
||||||
@@ -274,7 +282,6 @@ int testhook()
|
|||||||
err = unescape_find_directory(&str);
|
err = unescape_find_directory(&str);
|
||||||
printf("error 0x%08lx %s\n", err, str.String());
|
printf("error 0x%08lx %s\n", err, str.String());
|
||||||
return 0;
|
return 0;
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
|
|||||||
Vendored
+10
-3
@@ -4,7 +4,9 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <Debug.h>
|
#include <Debug.h>
|
||||||
|
|
||||||
ViewItem::ViewItem(BRect bounds, const char *name, uint32 resizeMask, uint32 flags, uint32 level, bool expanded)
|
|
||||||
|
ViewItem::ViewItem(BRect bounds, const char *name,
|
||||||
|
uint32 resizeMask, uint32 flags, uint32 level, bool expanded)
|
||||||
: BView(bounds, name, resizeMask, flags), BListItem(level, expanded)
|
: BView(bounds, name, resizeMask, flags), BListItem(level, expanded)
|
||||||
{
|
{
|
||||||
fOwner = NULL;
|
fOwner = NULL;
|
||||||
@@ -12,13 +14,16 @@ ViewItem::ViewItem(BRect bounds, const char *name, uint32 resizeMask, uint32 fla
|
|||||||
SetHeight(bounds.Height());
|
SetHeight(bounds.Height());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ViewItem::~ViewItem()
|
ViewItem::~ViewItem()
|
||||||
{
|
{
|
||||||
if (fOwner)
|
if (fOwner)
|
||||||
fOwner->RemoveChild(this);
|
fOwner->RemoveChild(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewItem::DrawItem(BView *ownerview, BRect frame, bool complete)
|
|
||||||
|
void
|
||||||
|
ViewItem::DrawItem(BView *ownerview, BRect frame, bool complete)
|
||||||
{
|
{
|
||||||
(void)frame; (void)complete;
|
(void)frame; (void)complete;
|
||||||
if (!fOwner) {
|
if (!fOwner) {
|
||||||
@@ -40,7 +45,9 @@ void ViewItem::DrawItem(BView *ownerview, BRect frame, bool complete)
|
|||||||
//BListItem::DrawItem(ownerview, frame, complete);
|
//BListItem::DrawItem(ownerview, frame, complete);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewItem::Update(BView *ownerview, const BFont *font)
|
|
||||||
|
void
|
||||||
|
ViewItem::Update(BView *ownerview, const BFont *font)
|
||||||
{
|
{
|
||||||
PRINT(("ViewItem::Update()\n"));
|
PRINT(("ViewItem::Update()\n"));
|
||||||
(void)font;
|
(void)font;
|
||||||
|
|||||||
Vendored
+7
-7
@@ -7,13 +7,13 @@
|
|||||||
|
|
||||||
class ViewItem : public BView, public BListItem
|
class ViewItem : public BView, public BListItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ViewItem(BRect bounds, const char *name, uint32 resizeMask, uint32 flags, uint32 level = 0, bool expanded = true);
|
ViewItem(BRect bounds, const char *name, uint32 resizeMask, uint32 flags, uint32 level = 0, bool expanded = true);
|
||||||
virtual ~ViewItem();
|
virtual ~ViewItem();
|
||||||
virtual void DrawItem(BView *ownerview, BRect frame, bool complete = false);
|
virtual void DrawItem(BView *ownerview, BRect frame, bool complete = false);
|
||||||
virtual void Update(BView *ownerview, const BFont *font);
|
virtual void Update(BView *ownerview, const BFont *font);
|
||||||
private:
|
private:
|
||||||
BListView *fOwner;
|
BListView* fOwner;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _VIEW_ITEM_H_
|
#endif // _VIEW_ITEM_H_
|
||||||
|
|||||||
Reference in New Issue
Block a user