Update Tracker's Find Panel to use the Layout API.
Signed-off-by: John Scipione <[email protected]>
This commit is contained in:
committed by
John Scipione
parent
a10aec9c5c
commit
21fd5809a7
+401
-478
File diff suppressed because it is too large
Load Diff
@@ -54,6 +54,7 @@ class BCheckBox;
|
|||||||
class BMenuField;
|
class BMenuField;
|
||||||
class BFile;
|
class BFile;
|
||||||
class BPopUpMenu;
|
class BPopUpMenu;
|
||||||
|
class BGridLayout;
|
||||||
|
|
||||||
namespace BPrivate {
|
namespace BPrivate {
|
||||||
|
|
||||||
@@ -173,11 +174,12 @@ class FindWindow : public BWindow {
|
|||||||
|
|
||||||
class FindPanel : public BView {
|
class FindPanel : public BView {
|
||||||
public:
|
public:
|
||||||
FindPanel(BRect, BFile*, FindWindow* parent, bool fromTemplate,
|
FindPanel(BFile*, FindWindow* parent, bool fromTemplate,
|
||||||
bool editTemplateOnly);
|
bool editTemplateOnly);
|
||||||
virtual ~FindPanel();
|
virtual ~FindPanel();
|
||||||
|
|
||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
|
virtual void Draw(BRect updateRect);
|
||||||
virtual void MessageReceived(BMessage*);
|
virtual void MessageReceived(BMessage*);
|
||||||
|
|
||||||
void BuildAttrQuery(BQuery*, bool &dynamicDate) const;
|
void BuildAttrQuery(BQuery*, bool &dynamicDate) const;
|
||||||
@@ -192,10 +194,6 @@ class FindPanel : public BView {
|
|||||||
uint32 Mode() const
|
uint32 Mode() const
|
||||||
{ return fMode; }
|
{ return fMode; }
|
||||||
|
|
||||||
static BRect InitialViewSize(const BNode*);
|
|
||||||
// used when showing window, does not account for more options,
|
|
||||||
// those if used will force a resize later
|
|
||||||
|
|
||||||
static uint32 InitialMode(const BNode* entry);
|
static uint32 InitialMode(const BNode* entry);
|
||||||
void SaveWindowState(BNode*, bool editTemplate);
|
void SaveWindowState(BNode*, bool editTemplate);
|
||||||
|
|
||||||
@@ -207,6 +205,7 @@ class FindPanel : public BView {
|
|||||||
// build up a simple query from the name we are searching for
|
// build up a simple query from the name we are searching for
|
||||||
|
|
||||||
void GetDefaultName(BString &) const;
|
void GetDefaultName(BString &) const;
|
||||||
|
void GetDefaultAttrName(BString &, int32) const;
|
||||||
const char* UserSpecifiedName() const;
|
const char* UserSpecifiedName() const;
|
||||||
// name filled out in the query name text field
|
// name filled out in the query name text field
|
||||||
|
|
||||||
@@ -216,11 +215,6 @@ class FindPanel : public BView {
|
|||||||
// queries
|
// queries
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static float ViewHeightForMode(uint32 mode, bool moreOptions);
|
|
||||||
// accouts for moreOptions
|
|
||||||
// if in attributeView, only returns valid result if one attr only
|
|
||||||
static float BoxHeightForMode(uint32 mode, bool moreOptions);
|
|
||||||
|
|
||||||
void AddMimeTypesToMenu();
|
void AddMimeTypesToMenu();
|
||||||
// populates the type menu
|
// populates the type menu
|
||||||
static bool AddOneMimeTypeToMenu(const ShortMimeInfo*, void* castToMenu);
|
static bool AddOneMimeTypeToMenu(const ShortMimeInfo*, void* castToMenu);
|
||||||
@@ -229,9 +223,9 @@ class FindPanel : public BView {
|
|||||||
// populates the volume menu
|
// populates the volume menu
|
||||||
void ShowVolumeMenuLabel();
|
void ShowVolumeMenuLabel();
|
||||||
|
|
||||||
void AddAttrView();
|
void AddAttrRow();
|
||||||
// add one more attribute item to the attr view
|
// add one more attribute item to the attr view
|
||||||
void RemoveAttrView();
|
void RemoveAttrRow();
|
||||||
// remove the last attribute item
|
// remove the last attribute item
|
||||||
void AddFirstAttr();
|
void AddFirstAttr();
|
||||||
|
|
||||||
@@ -239,20 +233,20 @@ class FindPanel : public BView {
|
|||||||
void RestoreWindowState(const BNode*);
|
void RestoreWindowState(const BNode*);
|
||||||
void RestoreMimeTypeMenuSelection(const BNode*);
|
void RestoreMimeTypeMenuSelection(const BNode*);
|
||||||
void AddByAttributeItems(const BNode*);
|
void AddByAttributeItems(const BNode*);
|
||||||
void ResizeAttributeBox(const BNode*);
|
|
||||||
void RemoveByAttributeItems();
|
void RemoveByAttributeItems();
|
||||||
void RemoveAttrViewItems();
|
void RemoveAttrViewItems(bool removeGrid = true);
|
||||||
void ShowOrHideMimeTypeMenu();
|
void ShowOrHideMimeTypeMenu();
|
||||||
// MimeTypeWindow is only shown in kByNameItem and
|
// MimeTypeWindow is only shown in kByNameItem and
|
||||||
// kByAttributeItem modes
|
// kByAttributeItem modes
|
||||||
|
|
||||||
|
void AddAttributeControls(int32);
|
||||||
|
|
||||||
void ShowOrHideMoreOptions(bool show);
|
void ShowOrHideMoreOptions(bool show);
|
||||||
// fMode gets set by this and the call relies on it being
|
// fMode gets set by this and the call relies on it being
|
||||||
// up-to-date
|
// up-to-date
|
||||||
static int32 InitialAttrCount(const BNode*);
|
static int32 InitialAttrCount(const BNode*);
|
||||||
void FillCurrentQueryName(BTextControl*, FindWindow*);
|
void FillCurrentQueryName(BTextControl*, FindWindow*);
|
||||||
void AddByNameOrFormulaItems();
|
void AddByNameOrFormulaItems();
|
||||||
void AddOneAttributeItem(BBox* box, BRect);
|
|
||||||
void SetUpAddRemoveButtons(BBox* box);
|
void SetUpAddRemoveButtons(BBox* box);
|
||||||
|
|
||||||
void SwitchMode(uint32);
|
void SwitchMode(uint32);
|
||||||
@@ -262,14 +256,25 @@ class FindPanel : public BView {
|
|||||||
|
|
||||||
void SaveAsQueryOrTemplate(const entry_ref*, const char*, bool queryTemplate);
|
void SaveAsQueryOrTemplate(const entry_ref*, const char*, bool queryTemplate);
|
||||||
|
|
||||||
|
BView* FindAttrView(const char*, int row) const;
|
||||||
|
|
||||||
|
void AddAttributes(BMenu* menu, const BMimeType &type);
|
||||||
|
void AddMimeTypeAttrs(BMenu* menu);
|
||||||
|
void RestoreAttrState(const BMessage &, int32);
|
||||||
|
void SaveAttrState(BMessage*, int32);
|
||||||
|
void AddLogicMenu(int32, bool selectAnd = true);
|
||||||
|
void RemoveLogicMenu(int32);
|
||||||
|
|
||||||
|
void ResizeMenuField(BMenuField*);
|
||||||
|
|
||||||
uint32 fMode;
|
uint32 fMode;
|
||||||
BObjectList<TAttrView> fAttrViewList;
|
BGridLayout* fAttrGrid;
|
||||||
BPopUpMenu* fMimeTypeMenu;
|
BPopUpMenu* fMimeTypeMenu;
|
||||||
BMenuField* fMimeTypeField;
|
BMenuField* fMimeTypeField;
|
||||||
BPopUpMenu* fVolMenu;
|
BPopUpMenu* fVolMenu;
|
||||||
BPopUpMenu* fSearchModeMenu;
|
BPopUpMenu* fSearchModeMenu;
|
||||||
BPopUpMenu* fRecentQueries;
|
BPopUpMenu* fRecentQueries;
|
||||||
DialogPane* fMoreOptionsPane;
|
BBox* fMoreOptions;
|
||||||
BTextControl* fQueryName;
|
BTextControl* fQueryName;
|
||||||
BString fInitialQueryName;
|
BString fInitialQueryName;
|
||||||
|
|
||||||
@@ -284,38 +289,6 @@ class FindPanel : public BView {
|
|||||||
friend class RecentQueriesPopUp;
|
friend class RecentQueriesPopUp;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TAttrView : public BView {
|
|
||||||
// a single attribute item - the search by attribute view
|
|
||||||
// can add several of these
|
|
||||||
public:
|
|
||||||
TAttrView(BRect frame, int32 index);
|
|
||||||
~TAttrView();
|
|
||||||
|
|
||||||
virtual void AttachedToWindow();
|
|
||||||
|
|
||||||
void RestoreState(const BMessage &settings, int32 index);
|
|
||||||
void SaveState(BMessage* settings, int32 index);
|
|
||||||
|
|
||||||
virtual void Draw(BRect updateRect);
|
|
||||||
virtual void MessageReceived(BMessage* message);
|
|
||||||
|
|
||||||
void AddLogicMenu(bool selectAnd = true);
|
|
||||||
void RemoveLogicMenu();
|
|
||||||
void AddMimeTypeAttrs();
|
|
||||||
void MakeTextViewFocus();
|
|
||||||
|
|
||||||
void GetDefaultName(BString &result) const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void AddAttributes(BMenu* menu, const BMimeType &type);
|
|
||||||
void AddMimeTypeAttrs(BMenu* menu);
|
|
||||||
|
|
||||||
BMenuField* fMenuField;
|
|
||||||
BTextControl* fTextControl;
|
|
||||||
|
|
||||||
typedef BView _inherited;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class DeleteTransientQueriesTask {
|
class DeleteTransientQueriesTask {
|
||||||
// transient queries get deleted if they didn't get used in a while;
|
// transient queries get deleted if they didn't get used in a while;
|
||||||
|
|||||||
Reference in New Issue
Block a user