Merge branch 'master' into sam460ex
This commit is contained in:
+17
-17
@@ -135,7 +135,7 @@
|
|||||||
|
|
||||||
\returns A status code.
|
\returns A status code.
|
||||||
\retval B_OK Initialization was successful.
|
\retval B_OK Initialization was successful.
|
||||||
\retval B_BAD_VALUE \c NULL \a ref.
|
\retval B_BAD_VALUE \a ref was \c NULL.
|
||||||
\retval B_NAME_TOO_LONG The pathname was longer than \c B_PATH_NAME_LENGTH.
|
\retval B_NAME_TOO_LONG The pathname was longer than \c B_PATH_NAME_LENGTH.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -148,7 +148,7 @@
|
|||||||
|
|
||||||
\returns A status code.
|
\returns A status code.
|
||||||
\retval B_OK Initialization was successful.
|
\retval B_OK Initialization was successful.
|
||||||
\retval B_BAD_VALUE \c NULL \a ref.
|
\retval B_BAD_VALUE \a ref was \c NULL.
|
||||||
\retval B_NAME_TOO_LONG The pathname was longer than \c B_PATH_NAME_LENGTH.
|
\retval B_NAME_TOO_LONG The pathname was longer than \c B_PATH_NAME_LENGTH.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -173,7 +173,7 @@
|
|||||||
|
|
||||||
\returns A status code.
|
\returns A status code.
|
||||||
\retval B_OK Initialization was successful.
|
\retval B_OK Initialization was successful.
|
||||||
\retval B_BAD_VALUE \c NULL \a ref.
|
\retval B_BAD_VALUE \a ref was \c NULL.
|
||||||
\retval B_NAME_TOO_LONG The pathname was longer than \c B_PATH_NAME_LENGTH.
|
\retval B_NAME_TOO_LONG The pathname was longer than \c B_PATH_NAME_LENGTH.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -196,7 +196,7 @@
|
|||||||
|
|
||||||
\returns A status code.
|
\returns A status code.
|
||||||
\retval B_OK Initialization was successful.
|
\retval B_OK Initialization was successful.
|
||||||
\retval B_BAD_VALUE \c NULL \a ref.
|
\retval B_BAD_VALUE \a ref was \c NULL.
|
||||||
\retval B_NAME_TOO_LONG The pathname was longer than \c B_PATH_NAME_LENGTH.
|
\retval B_NAME_TOO_LONG The pathname was longer than \c B_PATH_NAME_LENGTH.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -238,7 +238,7 @@
|
|||||||
|
|
||||||
\returns A status code.
|
\returns A status code.
|
||||||
\retval B_OK Initialization was successful.
|
\retval B_OK Initialization was successful.
|
||||||
\retval B_BAD_VALUE \c NULL \a ref.
|
\retval B_BAD_VALUE \a ref was \c NULL.
|
||||||
\retval B_NAME_TOO_LONG The pathname was longer than \c B_PATH_NAME_LENGTH.
|
\retval B_NAME_TOO_LONG The pathname was longer than \c B_PATH_NAME_LENGTH.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -285,7 +285,7 @@
|
|||||||
|
|
||||||
\returns A status code.
|
\returns A status code.
|
||||||
\retval B_OK Everything went fine.
|
\retval B_OK Everything went fine.
|
||||||
\retval B_BAD_VALUE \c NULL \a path.
|
\retval B_BAD_VALUE \a path was \c NULL.
|
||||||
\retval B_ENTRY_NOT_FOUND The BPath object represents the root path and
|
\retval B_ENTRY_NOT_FOUND The BPath object represents the root path and
|
||||||
thus has no parent.
|
thus has no parent.
|
||||||
*/
|
*/
|
||||||
@@ -389,7 +389,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\name BFlattenable override methods
|
\name BFlattenable method implementations
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -398,7 +398,7 @@
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn bool BPath::IsFixedSize() const
|
\fn bool BPath::IsFixedSize() const
|
||||||
\brief Overrides BFlattenable::IsFixedSize(). Always returns \c false.
|
\brief Implements BFlattenable::IsFixedSize(). Always returns \c false.
|
||||||
|
|
||||||
\return \c false
|
\return \c false
|
||||||
*/
|
*/
|
||||||
@@ -406,7 +406,7 @@
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn type_code BPath::TypeCode() const
|
\fn type_code BPath::TypeCode() const
|
||||||
\brief Overrides BFlattenable::TypeCode() Always returns \c B_REF_TYPE.
|
\brief Implements BFlattenable::TypeCode(). Always returns \c B_REF_TYPE.
|
||||||
|
|
||||||
\return \c B_REF_TYPE
|
\return \c B_REF_TYPE
|
||||||
*/
|
*/
|
||||||
@@ -414,7 +414,7 @@
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn ssize_t BPath::FlattenedSize() const
|
\fn ssize_t BPath::FlattenedSize() const
|
||||||
\brief Overrides BFlattenable::FlattenedSize() Gets the size of the
|
\brief Implements BFlattenable::FlattenedSize(). Gets the size of the
|
||||||
flattened entry_ref struct that represents the path in bytes.
|
flattened entry_ref struct that represents the path in bytes.
|
||||||
|
|
||||||
\return The size of the flattened entry_ref struct that represents the
|
\return The size of the flattened entry_ref struct that represents the
|
||||||
@@ -424,7 +424,7 @@
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn status_t BPath::Flatten(void* buffer, ssize_t size) const
|
\fn status_t BPath::Flatten(void* buffer, ssize_t size) const
|
||||||
\brief Overrides BFlattenable::Flatten(). Converts the path of the object
|
\brief Implements BFlattenable::Flatten(). Converts the path of the object
|
||||||
to an entry_ref and writes it into <em>buffer</em>.
|
to an entry_ref and writes it into <em>buffer</em>.
|
||||||
|
|
||||||
\param buffer The buffer that the data is to be stored in.
|
\param buffer The buffer that the data is to be stored in.
|
||||||
@@ -432,13 +432,13 @@
|
|||||||
|
|
||||||
\returns A status code.
|
\returns A status code.
|
||||||
\retval B_OK Everything went fine.
|
\retval B_OK Everything went fine.
|
||||||
\retval B_BAD_VALUE \c NULL buffer or the buffer is of insufficient size.
|
\retval B_BAD_VALUE \a buffer was \c NULL or of insufficient size.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn bool BPath::AllowsTypeCode(type_code code) const
|
\fn bool BPath::AllowsTypeCode(type_code code) const
|
||||||
\brief Overrides BFlattenable::AllowsTypeCode(). Checks if type code is
|
\brief Implements BFlattenable::AllowsTypeCode(). Checks if type code is
|
||||||
equal to \c B_REF_TYPE.
|
equal to \c B_REF_TYPE.
|
||||||
|
|
||||||
\param code The type code to test.
|
\param code The type code to test.
|
||||||
@@ -450,7 +450,7 @@
|
|||||||
/*!
|
/*!
|
||||||
\fn status_t BPath::Unflatten(type_code code, const void* buffer,
|
\fn status_t BPath::Unflatten(type_code code, const void* buffer,
|
||||||
ssize_t size)
|
ssize_t size)
|
||||||
\brief Overrides BFlattenable::Unflatten(). Initializes the object with
|
\brief Implements BFlattenable::Unflatten(). Initializes the object with
|
||||||
the flattened entry_ref data from the passed in buffer.
|
the flattened entry_ref data from the passed in buffer.
|
||||||
|
|
||||||
The type code must be set to \c B_REF_TYPE.
|
The type code must be set to \c B_REF_TYPE.
|
||||||
@@ -461,7 +461,7 @@
|
|||||||
|
|
||||||
\returns A status code.
|
\returns A status code.
|
||||||
\retval B_OK Everything went fine.
|
\retval B_OK Everything went fine.
|
||||||
\retval B_BAD_VALUE \a buffer is \c NULL or doesn't contain an entry_ref.
|
\retval B_BAD_VALUE \a buffer was \c NULL or didn't contain an entry_ref.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -475,8 +475,8 @@
|
|||||||
status_t BPath::_SetPath(const char* path)
|
status_t BPath::_SetPath(const char* path)
|
||||||
\brief Sets the supplied path.
|
\brief Sets the supplied path.
|
||||||
|
|
||||||
The path is copied. If \a path is \c NULL path of the object is set to
|
The path is copied, if \a path is \c NULL the path of the object is set to
|
||||||
\c NULL as well. The object's old path is deleted.
|
\c NULL as well. The old path is deleted.
|
||||||
|
|
||||||
\param path the path to be set
|
\param path the path to be set
|
||||||
|
|
||||||
|
|||||||
@@ -58,8 +58,6 @@ public:
|
|||||||
BUrlContext* Context() const;
|
BUrlContext* Context() const;
|
||||||
BUrlProtocolListener* Listener() const;
|
BUrlProtocolListener* Listener() const;
|
||||||
const BString& Protocol() const;
|
const BString& Protocol() const;
|
||||||
// TODO: Does not belong here.
|
|
||||||
BHttpHeaders& Headers() { return fRequestHeaders; }
|
|
||||||
|
|
||||||
// URL protocol informations
|
// URL protocol informations
|
||||||
bool IsRunning() const;
|
bool IsRunning() const;
|
||||||
@@ -82,8 +80,6 @@ protected:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
BUrl fUrl;
|
BUrl fUrl;
|
||||||
BHttpHeaders fRequestHeaders;
|
|
||||||
// TODO: Does not belong here.
|
|
||||||
BUrlResult* fResult;
|
BUrlResult* fResult;
|
||||||
BUrlContext* fContext;
|
BUrlContext* fContext;
|
||||||
BUrlProtocolListener* fListener;
|
BUrlProtocolListener* fListener;
|
||||||
|
|||||||
@@ -22,10 +22,10 @@ enum {
|
|||||||
class BUrlRequest {
|
class BUrlRequest {
|
||||||
public:
|
public:
|
||||||
BUrlRequest(const BUrl& url,
|
BUrlRequest(const BUrl& url,
|
||||||
BUrlProtocolListener* listener);
|
BUrlProtocolListener* listener = NULL,
|
||||||
BUrlRequest(const BUrl& url);
|
BUrlContext* context = NULL);
|
||||||
BUrlRequest(const BUrlRequest& other);
|
BUrlRequest(const BUrlRequest& other);
|
||||||
virtual ~BUrlRequest() { };
|
virtual ~BUrlRequest();
|
||||||
|
|
||||||
// Request parameters modification
|
// Request parameters modification
|
||||||
status_t SetUrl(const BUrl& url);
|
status_t SetUrl(const BUrl& url);
|
||||||
@@ -40,15 +40,13 @@ public:
|
|||||||
const BUrl& Url();
|
const BUrl& Url();
|
||||||
|
|
||||||
// Request control
|
// Request control
|
||||||
status_t Identify();
|
virtual status_t Start();
|
||||||
virtual status_t Perform();
|
|
||||||
// TODO: Rename to Run() perhaps? "Perform" is used for FBC stuff.
|
|
||||||
virtual status_t Pause();
|
virtual status_t Pause();
|
||||||
virtual status_t Resume();
|
virtual status_t Resume();
|
||||||
virtual status_t Abort();
|
virtual status_t Abort();
|
||||||
|
|
||||||
// Request informations
|
// Request informations
|
||||||
virtual bool InitCheck() const;
|
virtual status_t InitCheck() const;
|
||||||
bool IsRunning() const;
|
bool IsRunning() const;
|
||||||
status_t Status() const;
|
status_t Status() const;
|
||||||
|
|
||||||
@@ -62,7 +60,10 @@ protected:
|
|||||||
BUrlResult fResult;
|
BUrlResult fResult;
|
||||||
BUrlContext* fContext;
|
BUrlContext* fContext;
|
||||||
BUrl fUrl;
|
BUrl fUrl;
|
||||||
bool fReady;
|
status_t fInitStatus;
|
||||||
|
|
||||||
|
private:
|
||||||
|
status_t _SetupProtocol();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _B_URL_REQUEST_H_
|
#endif // _B_URL_REQUEST_H_
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
|
|
||||||
class AboutView;
|
class AboutView;
|
||||||
|
class BBitmap;
|
||||||
class BPoint;
|
class BPoint;
|
||||||
class BHandler;
|
class BHandler;
|
||||||
|
|
||||||
@@ -26,6 +27,7 @@ class BAboutWindow : public BWindow {
|
|||||||
virtual ~BAboutWindow();
|
virtual ~BAboutWindow();
|
||||||
|
|
||||||
virtual bool QuitRequested();
|
virtual bool QuitRequested();
|
||||||
|
virtual void Show();
|
||||||
|
|
||||||
BPoint AboutPosition(float width, float height);
|
BPoint AboutPosition(float width, float height);
|
||||||
void AddDescription(const char* description);
|
void AddDescription(const char* description);
|
||||||
@@ -37,6 +39,15 @@ class BAboutWindow : public BWindow {
|
|||||||
void AddVersionHistory(const char** history);
|
void AddVersionHistory(const char** history);
|
||||||
void AddExtraInfo(const char* extraInfo);
|
void AddExtraInfo(const char* extraInfo);
|
||||||
|
|
||||||
|
BBitmap* Icon();
|
||||||
|
void SetIcon(BBitmap* icon);
|
||||||
|
|
||||||
|
const char* Name();
|
||||||
|
void SetName(const char* name);
|
||||||
|
|
||||||
|
const char* Version();
|
||||||
|
void SetVersion(const char* version);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AboutView* fAboutView;
|
AboutView* fAboutView;
|
||||||
BHandler* fCaller;
|
BHandler* fCaller;
|
||||||
|
|||||||
@@ -133,7 +133,6 @@ TBarMenuTitle::DrawContent()
|
|||||||
rgb_color menuColor = menu->LowColor();
|
rgb_color menuColor = menu->LowColor();
|
||||||
rgb_color dark = tint_color(menuColor, B_DARKEN_1_TINT);
|
rgb_color dark = tint_color(menuColor, B_DARKEN_1_TINT);
|
||||||
rgb_color light = tint_color(menuColor, B_LIGHTEN_2_TINT);
|
rgb_color light = tint_color(menuColor, B_LIGHTEN_2_TINT);
|
||||||
rgb_color black = {0, 0, 0, 255};
|
|
||||||
|
|
||||||
bool inExpandoMode = dynamic_cast<TExpandoMenuBar*>(menu) != NULL;
|
bool inExpandoMode = dynamic_cast<TExpandoMenuBar*>(menu) != NULL;
|
||||||
|
|
||||||
@@ -161,7 +160,10 @@ TBarMenuTitle::DrawContent()
|
|||||||
frame.InsetBy(1, 1);
|
frame.InsetBy(1, 1);
|
||||||
menu->SetHighColor(menuColor);
|
menu->SetHighColor(menuColor);
|
||||||
menu->FillRect(frame);
|
menu->FillRect(frame);
|
||||||
menu->SetHighColor(black);
|
if (IsSelected())
|
||||||
|
menu->SetHighColor(ui_color(B_MENU_SELECTED_ITEM_TEXT_COLOR));
|
||||||
|
else
|
||||||
|
menu->SetHighColor(ui_color(B_MENU_ITEM_TEXT_COLOR));
|
||||||
frame.InsetBy(-1, -1);
|
frame.InsetBy(-1, -1);
|
||||||
if (inExpandoMode)
|
if (inExpandoMode)
|
||||||
frame.top -= 1;
|
frame.top -= 1;
|
||||||
@@ -177,7 +179,10 @@ TBarMenuTitle::DrawContent()
|
|||||||
menu->StrokeLine(frame.LeftTop(), frame.LeftBottom());
|
menu->StrokeLine(frame.LeftTop(), frame.LeftBottom());
|
||||||
}
|
}
|
||||||
|
|
||||||
menu->SetHighColor(black);
|
if (IsSelected())
|
||||||
|
menu->SetHighColor(ui_color(B_MENU_SELECTED_ITEM_TEXT_COLOR));
|
||||||
|
else
|
||||||
|
menu->SetHighColor(ui_color(B_MENU_ITEM_TEXT_COLOR));
|
||||||
}
|
}
|
||||||
|
|
||||||
menu->SetDrawingMode(B_OP_ALPHA);
|
menu->SetDrawingMode(B_OP_ALPHA);
|
||||||
|
|||||||
@@ -283,6 +283,18 @@ PreferencesWindow::QuitRequested()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
PreferencesWindow::Show()
|
||||||
|
{
|
||||||
|
if (IsHidden()) {
|
||||||
|
// move to current workspace
|
||||||
|
SetWorkspaces(B_CURRENT_WORKSPACE);
|
||||||
|
}
|
||||||
|
|
||||||
|
BWindow::Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PreferencesWindow::WindowActivated(bool active)
|
PreferencesWindow::WindowActivated(bool active)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ public:
|
|||||||
|
|
||||||
virtual void MessageReceived(BMessage* message);
|
virtual void MessageReceived(BMessage* message);
|
||||||
virtual bool QuitRequested();
|
virtual bool QuitRequested();
|
||||||
|
virtual void Show();
|
||||||
virtual void WindowActivated(bool active);
|
virtual void WindowActivated(bool active);
|
||||||
|
|
||||||
void UpdateRecentCounts();
|
void UpdateRecentCounts();
|
||||||
|
|||||||
@@ -395,9 +395,6 @@ TTeamMenuItem::DrawContent()
|
|||||||
menu->MovePenTo(drawLoc);
|
menu->MovePenTo(drawLoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the pen to black so that either method will draw in the same color
|
|
||||||
// low color is set in inherited::DrawContent, override makes sure its
|
|
||||||
// what we want
|
|
||||||
if (fDrawLabel) {
|
if (fDrawLabel) {
|
||||||
menu->SetDrawingMode(B_OP_OVER);
|
menu->SetDrawingMode(B_OP_OVER);
|
||||||
menu->SetHighColor(ui_color(B_MENU_ITEM_TEXT_COLOR));
|
menu->SetHighColor(ui_color(B_MENU_ITEM_TEXT_COLOR));
|
||||||
@@ -513,6 +510,11 @@ TTeamMenuItem::DrawContentLabel()
|
|||||||
else
|
else
|
||||||
menu->SetLowColor(menu->LowColor());
|
menu->SetLowColor(menu->LowColor());
|
||||||
|
|
||||||
|
if (IsSelected())
|
||||||
|
menu->SetHighColor(ui_color(B_MENU_SELECTED_ITEM_TEXT_COLOR));
|
||||||
|
else
|
||||||
|
menu->SetHighColor(ui_color(B_MENU_ITEM_TEXT_COLOR));
|
||||||
|
|
||||||
menu->DrawString(label);
|
menu->DrawString(label);
|
||||||
|
|
||||||
free(truncLabel);
|
free(truncLabel);
|
||||||
|
|||||||
@@ -272,7 +272,10 @@ TWindowMenuItem::DrawContent()
|
|||||||
+ ((frame.Height() - fTitleAscent - fTitleDescent) / 2) + 1.0f;
|
+ ((frame.Height() - fTitleAscent - fTitleDescent) / 2) + 1.0f;
|
||||||
|
|
||||||
menu->MovePenTo(contLoc);
|
menu->MovePenTo(contLoc);
|
||||||
// Set the pen color so that the label is always visible.
|
|
||||||
|
if (IsSelected())
|
||||||
|
menu->SetHighColor(ui_color(B_MENU_SELECTED_ITEM_TEXT_COLOR));
|
||||||
|
else
|
||||||
menu->SetHighColor(ui_color(B_MENU_ITEM_TEXT_COLOR));
|
menu->SetHighColor(ui_color(B_MENU_ITEM_TEXT_COLOR));
|
||||||
|
|
||||||
BMenuItem::DrawContent();
|
BMenuItem::DrawContent();
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ PowerStatusView::PowerStatusView(BMessage* archive)
|
|||||||
|
|
||||||
PowerStatusView::~PowerStatusView()
|
PowerStatusView::~PowerStatusView()
|
||||||
{
|
{
|
||||||
if (fAboutWindow != NULL)
|
if (fAboutWindow != NULL && fAboutWindow->Lock())
|
||||||
fAboutWindow->Quit();
|
fAboutWindow->Quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
#include <Catalog.h>
|
#include <Catalog.h>
|
||||||
#include <CheckBox.h>
|
#include <CheckBox.h>
|
||||||
#include <Clipboard.h>
|
#include <Clipboard.h>
|
||||||
|
#include <ControlLook.h>
|
||||||
#include <Directory.h>
|
#include <Directory.h>
|
||||||
#include <Entry.h>
|
#include <Entry.h>
|
||||||
#include <File.h>
|
#include <File.h>
|
||||||
@@ -56,6 +57,7 @@
|
|||||||
#include <Roster.h>
|
#include <Roster.h>
|
||||||
#include <Screen.h>
|
#include <Screen.h>
|
||||||
#include <SeparatorView.h>
|
#include <SeparatorView.h>
|
||||||
|
#include <Size.h>
|
||||||
#include <SpaceLayoutItem.h>
|
#include <SpaceLayoutItem.h>
|
||||||
#include <StatusBar.h>
|
#include <StatusBar.h>
|
||||||
#include <StringView.h>
|
#include <StringView.h>
|
||||||
@@ -424,6 +426,12 @@ BrowserWindow::BrowserWindow(BRect frame, SettingsMessage* appSettings,
|
|||||||
const float kElementSpacing = 5;
|
const float kElementSpacing = 5;
|
||||||
|
|
||||||
// Find group
|
// Find group
|
||||||
|
fFindCloseButton = new BButton("\xc3\x97", // multiplication sign
|
||||||
|
new BMessage(EDIT_HIDE_FIND_GROUP));
|
||||||
|
fFindCloseButton->SetExplicitMinSize(
|
||||||
|
BSize(be_control_look->DefaultItemSpacing() * 3, B_SIZE_UNSET));
|
||||||
|
fFindCloseButton->SetExplicitMaxSize(
|
||||||
|
BSize(be_control_look->DefaultItemSpacing() * 3, B_SIZE_UNSET));
|
||||||
fFindTextControl = new BTextControl("find", B_TRANSLATE("Find:"), "",
|
fFindTextControl = new BTextControl("find", B_TRANSLATE("Find:"), "",
|
||||||
new BMessage(EDIT_FIND_NEXT));
|
new BMessage(EDIT_FIND_NEXT));
|
||||||
fFindTextControl->SetModificationMessage(new BMessage(FIND_TEXT_CHANGED));
|
fFindTextControl->SetModificationMessage(new BMessage(FIND_TEXT_CHANGED));
|
||||||
@@ -431,18 +439,15 @@ BrowserWindow::BrowserWindow(BRect frame, SettingsMessage* appSettings,
|
|||||||
new BMessage(EDIT_FIND_PREVIOUS));
|
new BMessage(EDIT_FIND_PREVIOUS));
|
||||||
fFindNextButton = new BButton(B_TRANSLATE("Next"),
|
fFindNextButton = new BButton(B_TRANSLATE("Next"),
|
||||||
new BMessage(EDIT_FIND_NEXT));
|
new BMessage(EDIT_FIND_NEXT));
|
||||||
fFindCloseButton = new BButton(B_TRANSLATE("Close"),
|
|
||||||
new BMessage(EDIT_HIDE_FIND_GROUP));
|
|
||||||
fFindCaseSensitiveCheckBox = new BCheckBox(B_TRANSLATE("Match case"));
|
fFindCaseSensitiveCheckBox = new BCheckBox(B_TRANSLATE("Match case"));
|
||||||
BGroupLayout* findGroup = BLayoutBuilder::Group<>(B_VERTICAL, 0.0)
|
BGroupLayout* findGroup = BLayoutBuilder::Group<>(B_VERTICAL, 0.0)
|
||||||
.Add(new BSeparatorView(B_HORIZONTAL, B_PLAIN_BORDER))
|
.Add(new BSeparatorView(B_HORIZONTAL, B_PLAIN_BORDER))
|
||||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL, kElementSpacing)
|
.Add(BGroupLayoutBuilder(B_HORIZONTAL, B_USE_DEFAULT_SPACING)
|
||||||
|
.Add(fFindCloseButton)
|
||||||
.Add(fFindTextControl)
|
.Add(fFindTextControl)
|
||||||
.Add(fFindPreviousButton)
|
.Add(fFindPreviousButton)
|
||||||
.Add(fFindNextButton)
|
.Add(fFindNextButton)
|
||||||
.Add(fFindCaseSensitiveCheckBox)
|
.Add(fFindCaseSensitiveCheckBox)
|
||||||
.Add(BSpaceLayoutItem::CreateGlue())
|
|
||||||
.Add(fFindCloseButton)
|
|
||||||
.SetInsets(kInsetSpacing, kInsetSpacing,
|
.SetInsets(kInsetSpacing, kInsetSpacing,
|
||||||
kInsetSpacing, kInsetSpacing)
|
kInsetSpacing, kInsetSpacing)
|
||||||
)
|
)
|
||||||
@@ -2332,5 +2337,3 @@ BrowserWindow::_HandlePageSourceResult(const BMessage* message)
|
|||||||
alert->Go(NULL);
|
alert->Go(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+35
-1
@@ -222,9 +222,12 @@ struct MimeAttribute
|
|||||||
|
|
||||||
MimeAttribute(BMessage& msg, int32 index);
|
MimeAttribute(BMessage& msg, int32 index);
|
||||||
MimeAttribute(TUserArgs& args);
|
MimeAttribute(TUserArgs& args);
|
||||||
|
MimeAttribute(const MimeAttribute& src);
|
||||||
|
|
||||||
status_t InitCheck() { return fStatus; }
|
status_t InitCheck() { return fStatus; }
|
||||||
|
|
||||||
|
MimeAttribute& operator=(const MimeAttribute& src);
|
||||||
|
|
||||||
void Dump();
|
void Dump();
|
||||||
void SyncWith(TUserArgs& args) throw(Error);
|
void SyncWith(TUserArgs& args) throw(Error);
|
||||||
void StoreInto(BMessage* target);
|
void StoreInto(BMessage* target);
|
||||||
@@ -288,12 +291,43 @@ MimeAttribute::MimeAttribute(BMessage& msg, int32 index)
|
|||||||
|
|
||||||
|
|
||||||
MimeAttribute::MimeAttribute(TUserArgs& args)
|
MimeAttribute::MimeAttribute(TUserArgs& args)
|
||||||
|
:
|
||||||
|
fStatus(B_NO_INIT),
|
||||||
|
fType('CSTR'),
|
||||||
|
fViewable(true),
|
||||||
|
fEditable(false),
|
||||||
|
fExtra(false),
|
||||||
|
fWidth(0),
|
||||||
|
fAlignment(0)
|
||||||
{
|
{
|
||||||
SyncWith(args);
|
SyncWith(args);
|
||||||
fStatus = B_OK;
|
fStatus = B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
MimeAttribute::MimeAttribute(const MimeAttribute& src)
|
||||||
|
{
|
||||||
|
*this = src;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
MimeAttribute&
|
||||||
|
MimeAttribute::operator=(const MimeAttribute& src)
|
||||||
|
{
|
||||||
|
fStatus = src.fStatus;
|
||||||
|
fName = src.fName;
|
||||||
|
fPublicName = src.fPublicName;
|
||||||
|
fType = src.fType;
|
||||||
|
fViewable = src.fViewable;
|
||||||
|
fEditable = src.fEditable;
|
||||||
|
fExtra = src.fExtra;
|
||||||
|
fWidth = src.fWidth;
|
||||||
|
fAlignment = src.fAlignment;
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MimeAttribute::SyncWith(TUserArgs& args) throw(Error)
|
MimeAttribute::SyncWith(TUserArgs& args) throw(Error)
|
||||||
{
|
{
|
||||||
@@ -609,7 +643,7 @@ MimeType::_Init(char** argv) throw (Error)
|
|||||||
throw Error("'%s' allowed only after the '%s' <name>",
|
throw Error("'%s' allowed only after the '%s' <name>",
|
||||||
name, kAttribute);
|
name, kAttribute);
|
||||||
|
|
||||||
if (!*++arg)
|
if (!*++arg || **arg == '-')
|
||||||
throw Error("'%s', argument should be specified", name);
|
throw Error("'%s', argument should be specified", name);
|
||||||
|
|
||||||
TUserArgsI A = fUserAttributes.back().find(key);
|
TUserArgsI A = fUserAttributes.back().find(key);
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ BUrlProtocolHttp::BUrlProtocolHttp(BUrl& url, bool ssl,
|
|||||||
fSocket = new BSecureSocket();
|
fSocket = new BSecureSocket();
|
||||||
else
|
else
|
||||||
fSocket = new BSocket();
|
fSocket = new BSocket();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -320,8 +319,7 @@ BUrlProtocolHttp::_ProtocolLoop()
|
|||||||
|
|
||||||
_EmitDebug(B_URL_PROTOCOL_DEBUG_TEXT,
|
_EmitDebug(B_URL_PROTOCOL_DEBUG_TEXT,
|
||||||
"%ld headers and %ld bytes of data remaining",
|
"%ld headers and %ld bytes of data remaining",
|
||||||
fHeaders.CountHeaders(),
|
fHeaders.CountHeaders(), fInputBuffer.Size());
|
||||||
fInputBuffer.Size());
|
|
||||||
|
|
||||||
if (fResult->StatusCode() == 404)
|
if (fResult->StatusCode() == 404)
|
||||||
return B_PROT_HTTP_NOT_FOUND;
|
return B_PROT_HTTP_NOT_FOUND;
|
||||||
@@ -339,10 +337,7 @@ BUrlProtocolHttp::_ResolveHostName()
|
|||||||
if (fUrl.HasPort())
|
if (fUrl.HasPort())
|
||||||
fRemoteAddr = BNetworkAddress(fUrl.Host(), fUrl.Port());
|
fRemoteAddr = BNetworkAddress(fUrl.Host(), fUrl.Port());
|
||||||
else {
|
else {
|
||||||
if (fSSL)
|
fRemoteAddr = BNetworkAddress(fUrl.Host(), fSSL ? 443 : 80);
|
||||||
fRemoteAddr = BNetworkAddress(fUrl.Host(), 443);
|
|
||||||
else
|
|
||||||
fRemoteAddr = BNetworkAddress(fUrl.Host(), 80);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fRemoteAddr.InitCheck() != B_OK)
|
if (fRemoteAddr.InitCheck() != B_OK)
|
||||||
@@ -350,8 +345,7 @@ BUrlProtocolHttp::_ResolveHostName()
|
|||||||
|
|
||||||
//! ProtocolHook:HostnameResolved
|
//! ProtocolHook:HostnameResolved
|
||||||
if (fListener != NULL)
|
if (fListener != NULL)
|
||||||
fListener->HostnameResolved(this,
|
fListener->HostnameResolved(this, fRemoteAddr.ToString().String());
|
||||||
const_cast<const char*>(fRemoteAddr.ToString().String()));
|
|
||||||
|
|
||||||
_EmitDebug(B_URL_PROTOCOL_DEBUG_TEXT, "Hostname resolved to: %s",
|
_EmitDebug(B_URL_PROTOCOL_DEBUG_TEXT, "Hostname resolved to: %s",
|
||||||
fRemoteAddr.ToString().String());
|
fRemoteAddr.ToString().String());
|
||||||
@@ -823,25 +817,9 @@ BUrlProtocolHttp::_AddHeaders()
|
|||||||
&& (fRequestMethod == B_HTTP_POST || fRequestMethod == B_HTTP_PUT))
|
&& (fRequestMethod == B_HTTP_POST || fRequestMethod == B_HTTP_PUT))
|
||||||
fOutputHeaders.AddHeader("Transfer-Encoding", "chunked");
|
fOutputHeaders.AddHeader("Transfer-Encoding", "chunked");
|
||||||
|
|
||||||
// Request headers
|
|
||||||
for (int32 headerIndex = 0;
|
|
||||||
headerIndex < fRequestHeaders.CountHeaders();
|
|
||||||
headerIndex++) {
|
|
||||||
BHttpHeader& optHeader = fRequestHeaders[headerIndex];
|
|
||||||
int32 replaceIndex = fOutputHeaders.HasHeader(optHeader.Name());
|
|
||||||
|
|
||||||
// Add or replace the current option header to the
|
|
||||||
// output header list
|
|
||||||
if (replaceIndex == -1)
|
|
||||||
fOutputHeaders.AddHeader(optHeader.Name(), optHeader.Value());
|
|
||||||
else
|
|
||||||
fOutputHeaders[replaceIndex].SetValue(optHeader.Value());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Optional headers specified by the user
|
// Optional headers specified by the user
|
||||||
if (fOptHeaders != NULL) {
|
if (fOptHeaders != NULL) {
|
||||||
for (int32 headerIndex = 0;
|
for (int32 headerIndex = 0; headerIndex < fOptHeaders->CountHeaders();
|
||||||
headerIndex < fOptHeaders->CountHeaders();
|
|
||||||
headerIndex++) {
|
headerIndex++) {
|
||||||
BHttpHeader& optHeader = (*fOptHeaders)[headerIndex];
|
BHttpHeader& optHeader = (*fOptHeaders)[headerIndex];
|
||||||
int32 replaceIndex = fOutputHeaders.HasHeader(optHeader.Name());
|
int32 replaceIndex = fOutputHeaders.HasHeader(optHeader.Name());
|
||||||
@@ -859,16 +837,14 @@ BUrlProtocolHttp::_AddHeaders()
|
|||||||
if (fOptSetCookies && (fContext != NULL)) {
|
if (fOptSetCookies && (fContext != NULL)) {
|
||||||
BNetworkCookie* cookie;
|
BNetworkCookie* cookie;
|
||||||
|
|
||||||
for (BNetworkCookieJar::UrlIterator
|
for (BNetworkCookieJar::UrlIterator it
|
||||||
it(fContext->GetCookieJar().GetUrlIterator(fUrl));
|
= fContext->GetCookieJar().GetUrlIterator(fUrl);
|
||||||
(cookie = it.Next()) != NULL;
|
(cookie = it.Next()) != NULL;)
|
||||||
)
|
|
||||||
fOutputHeaders.AddHeader("Cookie", cookie->RawCookie(false));
|
fOutputHeaders.AddHeader("Cookie", cookie->RawCookie(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write output headers to output stream
|
// Write output headers to output stream
|
||||||
for (int32 headerIndex = 0;
|
for (int32 headerIndex = 0; headerIndex < fOutputHeaders.CountHeaders();
|
||||||
headerIndex < fOutputHeaders.CountHeaders();
|
|
||||||
headerIndex++)
|
headerIndex++)
|
||||||
_AddOutputBufferLine(fOutputHeaders.HeaderAt(headerIndex).Header());
|
_AddOutputBufferLine(fOutputHeaders.HeaderAt(headerIndex).Header());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,27 +13,15 @@
|
|||||||
#include <Debug.h>
|
#include <Debug.h>
|
||||||
|
|
||||||
|
|
||||||
BUrlRequest::BUrlRequest(const BUrl& url, BUrlProtocolListener* listener)
|
BUrlRequest::BUrlRequest(const BUrl& url, BUrlProtocolListener* listener,
|
||||||
|
BUrlContext* context)
|
||||||
:
|
:
|
||||||
fListener(listener),
|
fListener(listener),
|
||||||
fUrlProtocol(NULL),
|
fUrlProtocol(NULL),
|
||||||
fResult(url),
|
fResult(url),
|
||||||
fContext(),
|
fContext(context),
|
||||||
fUrl(),
|
fUrl(),
|
||||||
fReady(false)
|
fInitStatus(B_ERROR)
|
||||||
{
|
|
||||||
SetUrl(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BUrlRequest::BUrlRequest(const BUrl& url)
|
|
||||||
:
|
|
||||||
fListener(NULL),
|
|
||||||
fUrlProtocol(NULL),
|
|
||||||
fResult(url),
|
|
||||||
fContext(),
|
|
||||||
fUrl(),
|
|
||||||
fReady(false)
|
|
||||||
{
|
{
|
||||||
SetUrl(url);
|
SetUrl(url);
|
||||||
}
|
}
|
||||||
@@ -46,12 +34,18 @@ BUrlRequest::BUrlRequest(const BUrlRequest& other)
|
|||||||
fResult(other.fUrl),
|
fResult(other.fUrl),
|
||||||
fContext(),
|
fContext(),
|
||||||
fUrl(),
|
fUrl(),
|
||||||
fReady(false)
|
fInitStatus(B_ERROR)
|
||||||
{
|
{
|
||||||
*this = other;
|
*this = other;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BUrlRequest::~BUrlRequest()
|
||||||
|
{
|
||||||
|
if (fUrlProtocol != NULL)
|
||||||
|
delete fUrlProtocol;
|
||||||
|
}
|
||||||
|
|
||||||
// #pragma mark Request parameters modification
|
// #pragma mark Request parameters modification
|
||||||
|
|
||||||
|
|
||||||
@@ -61,15 +55,13 @@ BUrlRequest::SetUrl(const BUrl& url)
|
|||||||
fUrl = url;
|
fUrl = url;
|
||||||
fResult.SetUrl(url);
|
fResult.SetUrl(url);
|
||||||
|
|
||||||
if (fUrlProtocol != NULL && url.Protocol() == fUrl.Protocol())
|
if (fUrlProtocol != NULL && url.Protocol() == fUrl.Protocol()) {
|
||||||
fUrlProtocol->SetUrl(url);
|
fUrlProtocol->SetUrl(url);
|
||||||
else {
|
return B_OK;
|
||||||
status_t err = Identify();
|
|
||||||
if (err != B_OK)
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return B_OK;
|
fInitStatus = _SetupProtocol();
|
||||||
|
return fInitStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -129,33 +121,7 @@ BUrlRequest::Url()
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BUrlRequest::Identify()
|
BUrlRequest::Start()
|
||||||
{
|
|
||||||
// TODO: instanciate the correct BUrlProtocol w/ the services roster
|
|
||||||
delete fUrlProtocol;
|
|
||||||
fUrlProtocol = NULL;
|
|
||||||
|
|
||||||
if (fUrl.Protocol() == "http") {
|
|
||||||
fUrlProtocol = new(std::nothrow) BUrlProtocolHttp(fUrl, false, "HTTP",
|
|
||||||
fListener, fContext,
|
|
||||||
&fResult);
|
|
||||||
fReady = true;
|
|
||||||
return B_OK;
|
|
||||||
} else if (fUrl.Protocol() == "https") {
|
|
||||||
fUrlProtocol = new(std::nothrow) BUrlProtocolHttp(fUrl, true, "HTTPS",
|
|
||||||
fListener, fContext,
|
|
||||||
&fResult);
|
|
||||||
fReady = true;
|
|
||||||
return B_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
fReady = false;
|
|
||||||
return B_NO_HANDLER_FOR_PROTOCOL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
BUrlRequest::Perform()
|
|
||||||
{
|
{
|
||||||
if (fUrlProtocol == NULL) {
|
if (fUrlProtocol == NULL) {
|
||||||
PRINT(("BUrlRequest::Perform() : Oops, no BUrlProtocol defined!\n"));
|
PRINT(("BUrlRequest::Perform() : Oops, no BUrlProtocol defined!\n"));
|
||||||
@@ -208,10 +174,10 @@ BUrlRequest::Abort()
|
|||||||
// #pragma mark Request informations
|
// #pragma mark Request informations
|
||||||
|
|
||||||
|
|
||||||
bool
|
status_t
|
||||||
BUrlRequest::InitCheck() const
|
BUrlRequest::InitCheck() const
|
||||||
{
|
{
|
||||||
return fReady;
|
return fInitStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -251,3 +217,26 @@ BUrlRequest::operator=(const BUrlRequest& other)
|
|||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BUrlRequest::_SetupProtocol()
|
||||||
|
{
|
||||||
|
// TODO: instanciate the correct BUrlProtocol w/ the services roster
|
||||||
|
delete fUrlProtocol;
|
||||||
|
fUrlProtocol = NULL;
|
||||||
|
|
||||||
|
if (fUrl.Protocol() == "http")
|
||||||
|
fUrlProtocol = new(std::nothrow) BUrlProtocolHttp(fUrl, false, "HTTP",
|
||||||
|
fListener, fContext, &fResult);
|
||||||
|
else if (fUrl.Protocol() == "https")
|
||||||
|
fUrlProtocol = new(std::nothrow) BUrlProtocolHttp(fUrl, true, "HTTPS",
|
||||||
|
fListener, fContext, &fResult);
|
||||||
|
else
|
||||||
|
return B_NO_HANDLER_FOR_PROTOCOL;
|
||||||
|
|
||||||
|
if (fUrlProtocol == NULL)
|
||||||
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ BUrlSynchronousRequest::Perform()
|
|||||||
SetProtocolListener(this);
|
SetProtocolListener(this);
|
||||||
fRequestComplete = false;
|
fRequestComplete = false;
|
||||||
|
|
||||||
return BUrlRequest::Perform();
|
return Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+206
-10
@@ -20,7 +20,10 @@
|
|||||||
#include <Font.h>
|
#include <Font.h>
|
||||||
#include <GroupLayoutBuilder.h>
|
#include <GroupLayoutBuilder.h>
|
||||||
#include <GroupView.h>
|
#include <GroupView.h>
|
||||||
|
#include <InterfaceDefs.h>
|
||||||
#include <LayoutBuilder.h>
|
#include <LayoutBuilder.h>
|
||||||
|
#include <Message.h>
|
||||||
|
#include <MessageFilter.h>
|
||||||
#include <Point.h>
|
#include <Point.h>
|
||||||
#include <Roster.h>
|
#include <Roster.h>
|
||||||
#include <Screen.h>
|
#include <Screen.h>
|
||||||
@@ -42,6 +45,46 @@ using BPrivate::gSystemCatalog;
|
|||||||
#define B_TRANSLATION_CONTEXT "AboutWindow"
|
#define B_TRANSLATION_CONTEXT "AboutWindow"
|
||||||
|
|
||||||
|
|
||||||
|
class EscapeFilter : public BMessageFilter {
|
||||||
|
public:
|
||||||
|
EscapeFilter(BWindow* target)
|
||||||
|
:
|
||||||
|
BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE),
|
||||||
|
fTarget(target)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
virtual ~EscapeFilter()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
virtual filter_result
|
||||||
|
Filter(BMessage* message, BHandler** target)
|
||||||
|
{
|
||||||
|
filter_result result = B_DISPATCH_MESSAGE;
|
||||||
|
switch (message->what) {
|
||||||
|
case B_KEY_DOWN:
|
||||||
|
case B_UNMAPPED_KEY_DOWN: {
|
||||||
|
uint32 key;
|
||||||
|
if (message->FindInt32("raw_char",
|
||||||
|
(int32*)&key) >= B_OK) {
|
||||||
|
if (key == B_ESCAPE) {
|
||||||
|
result = B_SKIP_MESSAGE;
|
||||||
|
fTarget->PostMessage(
|
||||||
|
B_QUIT_REQUESTED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
BWindow* fTarget;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class StripeView : public BView {
|
class StripeView : public BView {
|
||||||
public:
|
public:
|
||||||
StripeView(BBitmap* icon);
|
StripeView(BBitmap* icon);
|
||||||
@@ -49,6 +92,9 @@ class StripeView : public BView {
|
|||||||
|
|
||||||
virtual void Draw(BRect updateRect);
|
virtual void Draw(BRect updateRect);
|
||||||
|
|
||||||
|
BBitmap* Icon() const { return fIcon; };
|
||||||
|
void SetIcon(BBitmap* icon);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BBitmap* fIcon;
|
BBitmap* fIcon;
|
||||||
};
|
};
|
||||||
@@ -62,14 +108,24 @@ class AboutView : public BGroupView {
|
|||||||
|
|
||||||
BTextView* InfoView() const { return fInfoView; };
|
BTextView* InfoView() const { return fInfoView; };
|
||||||
|
|
||||||
|
BBitmap* Icon();
|
||||||
|
status_t SetIcon(BBitmap* icon);
|
||||||
|
|
||||||
|
const char* Name();
|
||||||
|
status_t SetName(const char* name);
|
||||||
|
|
||||||
|
const char* Version();
|
||||||
|
status_t SetVersion(const char* version);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const char* AppVersion(const char* signature);
|
const char* _GetVersionFromSignature(const char* signature);
|
||||||
BBitmap* AppIcon(const char* signature);
|
BBitmap* _GetIconFromSignature(const char* signature);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BStringView* fNameView;
|
BStringView* fNameView;
|
||||||
BStringView* fVersionView;
|
BStringView* fVersionView;
|
||||||
BTextView* fInfoView;
|
BTextView* fInfoView;
|
||||||
|
StripeView* fStripeView;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -81,13 +137,14 @@ StripeView::StripeView(BBitmap* icon)
|
|||||||
BView("StripeView", B_WILL_DRAW),
|
BView("StripeView", B_WILL_DRAW),
|
||||||
fIcon(icon)
|
fIcon(icon)
|
||||||
{
|
{
|
||||||
|
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
|
|
||||||
float width = 0.0f;
|
float width = 0.0f;
|
||||||
if (icon != NULL)
|
if (icon != NULL)
|
||||||
width += icon->Bounds().Width() + 32.0f;
|
width += icon->Bounds().Width() + 32.0f;
|
||||||
|
|
||||||
SetExplicitMinSize(BSize(width, B_SIZE_UNSET));
|
SetExplicitMinSize(BSize(width, B_SIZE_UNSET));
|
||||||
SetExplicitPreferredSize(BSize(width, B_SIZE_UNLIMITED));
|
SetExplicitPreferredSize(BSize(width, B_SIZE_UNLIMITED));
|
||||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -116,7 +173,24 @@ StripeView::Draw(BRect updateRect)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
void
|
||||||
|
StripeView::SetIcon(BBitmap* icon)
|
||||||
|
{
|
||||||
|
if (fIcon != NULL)
|
||||||
|
delete fIcon;
|
||||||
|
|
||||||
|
fIcon = icon;
|
||||||
|
|
||||||
|
float width = 0.0f;
|
||||||
|
if (icon != NULL)
|
||||||
|
width += icon->Bounds().Width() + 32.0f;
|
||||||
|
|
||||||
|
SetExplicitMinSize(BSize(width, B_SIZE_UNSET));
|
||||||
|
SetExplicitPreferredSize(BSize(width, B_SIZE_UNLIMITED));
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark - AboutView
|
||||||
|
|
||||||
|
|
||||||
AboutView::AboutView(const char* appName, const char* signature)
|
AboutView::AboutView(const char* appName, const char* signature)
|
||||||
@@ -131,7 +205,8 @@ AboutView::AboutView(const char* appName, const char* signature)
|
|||||||
fNameView->SetFont(&font, B_FONT_FAMILY_AND_STYLE | B_FONT_SIZE
|
fNameView->SetFont(&font, B_FONT_FAMILY_AND_STYLE | B_FONT_SIZE
|
||||||
| B_FONT_FLAGS);
|
| B_FONT_FLAGS);
|
||||||
|
|
||||||
fVersionView = new BStringView("version", AppVersion(signature));
|
fVersionView = new BStringView("version",
|
||||||
|
_GetVersionFromSignature(signature));
|
||||||
|
|
||||||
fInfoView = new BTextView("info", B_WILL_DRAW);
|
fInfoView = new BTextView("info", B_WILL_DRAW);
|
||||||
fInfoView->SetExplicitMinSize(BSize(210.0, 160.0));
|
fInfoView->SetExplicitMinSize(BSize(210.0, 160.0));
|
||||||
@@ -145,10 +220,12 @@ AboutView::AboutView(const char* appName, const char* signature)
|
|||||||
"infoViewScroller", fInfoView, B_WILL_DRAW | B_FRAME_EVENTS,
|
"infoViewScroller", fInfoView, B_WILL_DRAW | B_FRAME_EVENTS,
|
||||||
false, true, B_PLAIN_BORDER);
|
false, true, B_PLAIN_BORDER);
|
||||||
|
|
||||||
|
fStripeView = new StripeView(_GetIconFromSignature(signature));
|
||||||
|
|
||||||
GroupLayout()->SetSpacing(0);
|
GroupLayout()->SetSpacing(0);
|
||||||
BLayoutBuilder::Group<>(this)
|
BLayoutBuilder::Group<>(this)
|
||||||
.AddGroup(B_HORIZONTAL, 0)
|
.AddGroup(B_HORIZONTAL, 0)
|
||||||
.Add(new StripeView(AppIcon(signature)))
|
.Add(fStripeView)
|
||||||
.AddGroup(B_VERTICAL, B_USE_SMALL_SPACING)
|
.AddGroup(B_VERTICAL, B_USE_SMALL_SPACING)
|
||||||
.SetInsets(0, B_USE_DEFAULT_SPACING,
|
.SetInsets(0, B_USE_DEFAULT_SPACING,
|
||||||
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
|
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
|
||||||
@@ -166,8 +243,11 @@ AboutView::~AboutView()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark - AboutView protected methods
|
||||||
|
|
||||||
|
|
||||||
const char*
|
const char*
|
||||||
AboutView::AppVersion(const char* signature)
|
AboutView::_GetVersionFromSignature(const char* signature)
|
||||||
{
|
{
|
||||||
if (signature == NULL)
|
if (signature == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -228,7 +308,7 @@ AboutView::AppVersion(const char* signature)
|
|||||||
|
|
||||||
|
|
||||||
BBitmap*
|
BBitmap*
|
||||||
AboutView::AppIcon(const char* signature)
|
AboutView::_GetIconFromSignature(const char* signature)
|
||||||
{
|
{
|
||||||
if (signature == NULL)
|
if (signature == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -251,7 +331,64 @@ AboutView::AppIcon(const char* signature)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark - AboutView public methods
|
||||||
|
|
||||||
|
|
||||||
|
const char*
|
||||||
|
AboutView::Name()
|
||||||
|
{
|
||||||
|
return fNameView->Text();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
AboutView::SetName(const char* name)
|
||||||
|
{
|
||||||
|
fNameView->SetText(name);
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char*
|
||||||
|
AboutView::Version()
|
||||||
|
{
|
||||||
|
return fVersionView->Text();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
AboutView::SetVersion(const char* version)
|
||||||
|
{
|
||||||
|
fVersionView->SetText(version);
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BBitmap*
|
||||||
|
AboutView::Icon()
|
||||||
|
{
|
||||||
|
if (fStripeView == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return fStripeView->Icon();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
AboutView::SetIcon(BBitmap* icon)
|
||||||
|
{
|
||||||
|
if (fStripeView == NULL)
|
||||||
|
return B_NO_INIT;
|
||||||
|
|
||||||
|
fStripeView->SetIcon(icon);
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark - BAboutWindow
|
||||||
|
|
||||||
|
|
||||||
BAboutWindow::BAboutWindow(const char* appName, const char* signature)
|
BAboutWindow::BAboutWindow(const char* appName, const char* signature)
|
||||||
@@ -272,6 +409,8 @@ BAboutWindow::BAboutWindow(const char* appName, const char* signature)
|
|||||||
AddChild(fAboutView);
|
AddChild(fAboutView);
|
||||||
|
|
||||||
MoveTo(AboutPosition(Frame().Width(), Frame().Height()));
|
MoveTo(AboutPosition(Frame().Width(), Frame().Height()));
|
||||||
|
|
||||||
|
AddCommonFilter(new EscapeFilter(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -283,6 +422,9 @@ BAboutWindow::~BAboutWindow()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark - BAboutWindow virtual methods
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
BAboutWindow::QuitRequested()
|
BAboutWindow::QuitRequested()
|
||||||
{
|
{
|
||||||
@@ -292,7 +434,19 @@ BAboutWindow::QuitRequested()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
void
|
||||||
|
BAboutWindow::Show()
|
||||||
|
{
|
||||||
|
if (IsHidden()) {
|
||||||
|
// move to current workspace
|
||||||
|
SetWorkspaces(B_CURRENT_WORKSPACE);
|
||||||
|
}
|
||||||
|
|
||||||
|
BWindow::Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark - BAboutWindow public methods
|
||||||
|
|
||||||
|
|
||||||
BPoint
|
BPoint
|
||||||
@@ -463,3 +617,45 @@ BAboutWindow::AddExtraInfo(const char* extraInfo)
|
|||||||
|
|
||||||
fAboutView->InfoView()->Insert(extra.String());
|
fAboutView->InfoView()->Insert(extra.String());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char*
|
||||||
|
BAboutWindow::Name()
|
||||||
|
{
|
||||||
|
return fAboutView->Name();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BAboutWindow::SetName(const char* name)
|
||||||
|
{
|
||||||
|
fAboutView->SetName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char*
|
||||||
|
BAboutWindow::Version()
|
||||||
|
{
|
||||||
|
return fAboutView->Version();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BAboutWindow::SetVersion(const char* version)
|
||||||
|
{
|
||||||
|
fAboutView->SetVersion(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BBitmap*
|
||||||
|
BAboutWindow::Icon()
|
||||||
|
{
|
||||||
|
return fAboutView->Icon();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BAboutWindow::SetIcon(BBitmap* icon)
|
||||||
|
{
|
||||||
|
fAboutView->SetIcon(icon);
|
||||||
|
}
|
||||||
|
|||||||
@@ -70,11 +70,11 @@ const uint32 kRevertButtonPressed = 'Rebp';
|
|||||||
#undef B_TRANSLATION_CONTEXT
|
#undef B_TRANSLATION_CONTEXT
|
||||||
#define B_TRANSLATION_CONTEXT "TrackerSettingsWindow"
|
#define B_TRANSLATION_CONTEXT "TrackerSettingsWindow"
|
||||||
|
|
||||||
|
|
||||||
TrackerSettingsWindow::TrackerSettingsWindow()
|
TrackerSettingsWindow::TrackerSettingsWindow()
|
||||||
:
|
:
|
||||||
BWindow(BRect(80, 80, 450, 350), B_TRANSLATE("Tracker preferences"),
|
BWindow(BRect(80, 80, 450, 350), B_TRANSLATE("Tracker preferences"),
|
||||||
B_TITLED_WINDOW, B_NOT_MINIMIZABLE | B_NOT_RESIZABLE
|
B_TITLED_WINDOW, B_NOT_MINIMIZABLE | B_NOT_RESIZABLE
|
||||||
| B_NO_WORKSPACE_ACTIVATION | B_NOT_ANCHORED_ON_ACTIVATE
|
|
||||||
| B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE
|
| B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE
|
||||||
| B_AUTO_UPDATE_SIZE_LIMITS)
|
| B_AUTO_UPDATE_SIZE_LIMITS)
|
||||||
{
|
{
|
||||||
@@ -184,6 +184,12 @@ TrackerSettingsWindow::Show()
|
|||||||
|
|
||||||
Unlock();
|
Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsHidden()) {
|
||||||
|
// move to current workspace
|
||||||
|
SetWorkspaces(B_CURRENT_WORKSPACE);
|
||||||
|
}
|
||||||
|
|
||||||
_inherited::Show();
|
_inherited::Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user