Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
base repository: HaikuArchives/Hare
base: ab3a4449eeae
head repository: HaikuArchives/Hare
compare: 05500f33d667
  • 1 commit
  • 11 files changed
  • 0 commit comments
  • 1 contributor
Commits on Mar 05, 2018
* Added Split View, fixed some window sizing, fixes to columnlistview

* BColumnListView has equivelant functionality with Santa ColumnListView
@@ -74,11 +74,14 @@ AppView::InitView()
PRINT(("AppView::InitView()\n"));

SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
int32 space = 6;

fileNamePatternView = new FileNamePatternView();
fileNamePatternView->SetExplicitMinSize(BSize(240, 400));
fileNamePatternView->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));

editorView = new EditorView();
editorView->SetExplicitMinSize(BSize(295, 400));
editorView->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));

encodeButton = new BButton("encodeButton", ENCODE_BTN,
new BMessage(ENCODE_MSG));
@@ -87,7 +90,8 @@ AppView::InitView()
new BMessage(CANCEL_MSG));

listView = new EncoderListView();
listView->SetSelectionMessage(new BMessage(LIST_SELECTION_MSG));
listView->SetExplicitMinSize(BSize(0, 50));
listView->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));

BString remaining(STATUS_TRAILING_LABEL);
remaining << 0;
@@ -122,7 +126,6 @@ AppView::AttachedToWindow()

InitView();

listView->SetTarget(editorView);
encodeButton->SetTarget(this);
cancelButton->SetTarget(this);
}
@@ -176,6 +179,10 @@ AppView::MessageReceived(BMessage* message)
}
}
break;
case LIST_SELECTION_MSG: {
editorView->ListSelectionChanged(message);
break;
}
case APPLY_ATTRIBUTE_CHANGES:
ApplyAttributeChanges(message);
break;
@@ -324,7 +331,7 @@ void
AppView::InitializeColumn(BRefRow* row)
{
PRINT(("AppView::InitializeColumn(BRefRow*)\n"));

entry_ref* ref = row->EntryRef();

row->SetField(new BStringField(ref->name), FILE_COLUMN_INDEX);
@@ -30,14 +30,15 @@
#include "GUIStrings.h"
#include "Settings.h"

AppWindow::AppWindow(BRect windowFrame)
AppWindow::AppWindow()
:
BWindow(windowFrame, APPLICATION, B_DOCUMENT_WINDOW,
B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS)
BWindow(BRect(0,0,0,0) , APPLICATION, B_DOCUMENT_WINDOW,
B_ASYNCHRONOUS_CONTROLS| B_AUTO_UPDATE_SIZE_LIMITS)
{
PRINT(("AppWindow::AppWindow()\n"));

InitWindow();
CenterOnScreen();
}

AppWindow::~AppWindow()
@@ -47,7 +48,7 @@ AppWindow::~AppWindow()
stop_watching(this);
delete volumes;

settings->SetWindowFrame(Frame());
// settings->SetWindowFrame(Frame());
}

void
@@ -84,6 +85,7 @@ AppWindow::InitWindow()
volumes->StartWatching(*windowMessenger);

InitMenus();
SetKeyMenuBar(menuBar);

appView = new AppView();

@@ -572,15 +574,13 @@ AppWindow*
AppWindow::GetInstance()
{
PRINT(("AppWindow::GetInstance()\n"));

BRect windowFrame;

AppWindow* win = 0;

Settings::OpenSettings();
PRINT_OBJECT(*settings);

windowFrame = settings->WindowFrame();
win = new AppWindow(windowFrame);
win = new AppWindow();

return(win);
}
@@ -12,7 +12,7 @@ class BVolumeRoster;

class AppWindow : public BWindow {
public:
AppWindow(BRect windowFrame);
AppWindow();
~AppWindow();
static AppWindow* GetInstance();
BMenuBar* MenuBar();
@@ -52,83 +52,9 @@ EditorView::InitView()

SetLabel(EDITOR_LABEL);

int space = 6;

numSelected = 0;
selectedIndexes = 0;

font_height fh;
GetFontHeight(&fh);
float height = fh.ascent + fh.descent + fh.leading;

char* left[] = {
ARTIST_COLUMN,
ALBUM_COLUMN,
TITLE_COLUMN,
TRACK_COLUMN,
YEAR_COLUMN,
0
};
char* right[] = {
COMMENT_COLUMN,
GENRE_COLUMN,
0
};
//float leftWidth = 0;
//float rightWidth = 400;

int i = 0;

/*
while(left[i])
{
if(StringWidth(left[i]) > leftWidth)
{
leftWidth = StringWidth(left[i]);
}
i++;
}
i=0;
while(right[i])
{
if(StringWidth(right[i]) > rightWidth)
{
rightWidth = StringWidth(right[i]);
}
i++;
}
*/

//use cb to determine spacing of box at different fonts
BCheckBox cb(BRect(0, 0, 0, 0), 0, 0, 0);
cb.ResizeToPreferred();

/*BRect leftCB = Bounds();
leftCB.InsetBy(space, 2 * space);
leftCB.right = 200; //leftCB.left + leftWidth + cb.Frame().Width();
leftCB.bottom = 100; //leftCB.top + height;
BRect leftTC = leftCB;
leftTC.left = leftCB.right + space / 2;
leftTC.right = leftTC.left + 110;
BRect rightCB = leftCB;
.Add(reverbMenu->CreateLabelLayoutItem(), 0, 1)
.Add(reverbMenu->CreateMenuBarLayoutItem(), 1, 1)
.Add(inputMenu->CreateLabelLayoutItem(), 0, 2)
.Add(inputMenu->CreateMenuBarLayoutItem(), 1, 2)
.Add(volumeLabel, 0, 3)
.Add(volumeSlider, 1, 3)
rightCB.left = leftTC.right + space;
rightCB.right = rightCB.left + rightWidth + cb.Frame().Width();
BRect rightTC = rightCB;
rightTC.left = rightCB.right + space / 2;
rightTC.right = rightTC.left + 110;*/

artistCheckBox = new BCheckBox("artistCB", ARTIST_COLUMN, new BMessage(MSG_ARTIST_CB));

artistTextControl = new BTextControl("artistTC", 0, "", 0);
@@ -155,7 +81,6 @@ EditorView::InitView()

genreCheckBox = new BCheckBox("genreCB", GENRE_COLUMN, new BMessage(MSG_GENRE_CB));


genreBox = new BBox(B_FANCY_BORDER);

// INSIDE THE BOX
@@ -218,33 +143,6 @@ EditorView::InitView()
.Add(genreBox, 1, 6)
.Add(applyButton, 10, 10)
.End();

/*AddChild(artistCheckBox);
AddChild(artistTextControl);
AddChild(albumCheckBox);
AddChild(albumTextControl);
AddChild(titleCheckBox);
AddChild(titleTextControl);
AddChild(trackCheckBox);
AddChild(trackTextControl);
AddChild(yearCheckBox);
AddChild(yearTextControl);
AddChild(commentCheckBox);
AddChild(commentTextControl);
AddChild(genreCheckBox);
AddChild(genreBox);
genreBox->AddChild(genreMenuField);
genreBox->AddChild(genreTextControl);
AddChild(applyButton);
ResizeToPreferred();*/
}

void
@@ -286,22 +184,6 @@ EditorView::AttachedToWindow()
SetEnabled(genreCheckBox, genreTextControl);
}

void
EditorView::GetPreferredSize(float* width, float* height)
{
PRINT(("EditorView::GetPreferredSize(float* float*)\n"));

int space = 6;

*width = commentTextControl->Frame().right + space;
*height = yearTextControl->Frame().bottom + space;
float ht = 100; //genreBox->Frame().bottom + 3*space +
// applyButton->Frame().Height();
if (ht > *height) {
*height = ht;
}
}

void
EditorView::Apply()
{
@@ -559,9 +441,6 @@ EditorView::MessageReceived(BMessage* message)
//PRINT(("EditorView::MessageReceived(BMessage*)\n"));

switch (message->what) {
case LIST_SELECTION_MSG:
ListSelectionChanged(message);
break;
case APPLY_MSG:
Apply();
break;
@@ -20,17 +20,16 @@ class EditorView : public BBox {
EditorView();
~EditorView();
virtual void AttachedToWindow();
virtual void GetPreferredSize(float* width, float* height);
virtual void MessageReceived(BMessage* message);
virtual void MakeFocus(bool focused = true);
void ListSelectionChanged(BMessage* message);
void SetEnabled(bool value);
private:
void InitView();
void Apply();
void GenreSelectionAction();
void SetEnabled(BCheckBox* checkbox, BControl* control);
void SetEnabled(BCheckBox* checkbox, BMenuField* menufield);
void ListSelectionChanged(BMessage* message);
void EnableCheckBoxes(bool value);
void SetControlValues(BRefRow* item);
BCheckBox* artistCheckBox;
@@ -57,34 +57,34 @@ EncoderListView::InitView()
float maxWidth = 1000;
int32 truncate = 3;

AddColumn(new BBitmapColumn("", 16, 16, 16, B_ALIGN_CENTER), 0);
AddColumn(new BBitmapColumn("", 16, 16, 16, B_ALIGN_CENTER), COMPLETE_COLUMN_INDEX);

minWidth = StringWidth(FILE_COLUMN) + 20;
AddColumn(new BStringColumn(FILE_COLUMN, minWidth, minWidth, maxWidth, truncate, B_ALIGN_LEFT), 1);
AddColumn(new BStringColumn(FILE_COLUMN, minWidth, minWidth, maxWidth, truncate, B_ALIGN_LEFT), FILE_COLUMN_INDEX);

minWidth = StringWidth(SAVE_AS_COLUMN) + 20;
AddColumn(new BStringColumn(SAVE_AS_COLUMN, minWidth, minWidth, maxWidth, truncate, B_ALIGN_LEFT), 2);
AddColumn(new BStringColumn(SAVE_AS_COLUMN, minWidth, minWidth, maxWidth, truncate, B_ALIGN_LEFT), SAVE_AS_COLUMN_INDEX);

minWidth = StringWidth(ARTIST_COLUMN) + 20;
AddColumn(new BStringColumn(ARTIST_COLUMN, minWidth, minWidth, maxWidth, truncate, B_ALIGN_LEFT), 3);
AddColumn(new BStringColumn(ARTIST_COLUMN, minWidth, minWidth, maxWidth, truncate, B_ALIGN_LEFT), ARTIST_COLUMN_INDEX);

minWidth = StringWidth(ALBUM_COLUMN) + 20;
AddColumn(new BStringColumn(ALBUM_COLUMN, minWidth, minWidth, maxWidth, truncate, B_ALIGN_LEFT), 4);
AddColumn(new BStringColumn(ALBUM_COLUMN, minWidth, minWidth, maxWidth, truncate, B_ALIGN_LEFT), ALBUM_COLUMN_INDEX);

minWidth = StringWidth(TITLE_COLUMN) + 20;
AddColumn(new BStringColumn(TITLE_COLUMN, minWidth, minWidth, maxWidth, truncate, B_ALIGN_LEFT), 5);
AddColumn(new BStringColumn(TITLE_COLUMN, minWidth, minWidth, maxWidth, truncate, B_ALIGN_LEFT), TITLE_COLUMN_INDEX);

minWidth = StringWidth(YEAR_COLUMN) + 20;
AddColumn(new BStringColumn(YEAR_COLUMN, minWidth, minWidth, maxWidth, truncate, B_ALIGN_LEFT), 6);
AddColumn(new BStringColumn(YEAR_COLUMN, minWidth, minWidth, maxWidth, truncate, B_ALIGN_LEFT), YEAR_COLUMN_INDEX);

minWidth = StringWidth(COMMENT_COLUMN) + 20;
AddColumn(new BStringColumn(COMMENT_COLUMN, minWidth, minWidth, maxWidth, truncate, B_ALIGN_LEFT), 7);
AddColumn(new BStringColumn(COMMENT_COLUMN, minWidth, minWidth, maxWidth, truncate, B_ALIGN_LEFT), COMMENT_COLUMN_INDEX);

minWidth = StringWidth(TRACK_COLUMN) + 20;
AddColumn(new BStringColumn(TRACK_COLUMN, minWidth, minWidth, maxWidth, truncate, B_ALIGN_LEFT), 8);
AddColumn(new BStringColumn(TRACK_COLUMN, minWidth, minWidth, maxWidth, truncate, B_ALIGN_LEFT), TRACK_COLUMN_INDEX);

minWidth = StringWidth(GENRE_COLUMN) + 20;
AddColumn(new BStringColumn(GENRE_COLUMN, minWidth, minWidth, maxWidth, truncate, B_ALIGN_LEFT), 9);
AddColumn(new BStringColumn(GENRE_COLUMN, minWidth, minWidth, maxWidth, truncate, B_ALIGN_LEFT), GENRE_COLUMN_INDEX);

bool* columnsShown = settings->ColumnsShown();
float* columnWidths = settings->ColumnWidths();
@@ -103,6 +103,13 @@ EncoderListView::AttachedToWindow()
PRINT(("EncoderListView::AttachedToWindow()\n"));
}

void
EncoderListView::MessageDropped(BMessage* message, BPoint point)
{
BMessenger messenger(Parent());
messenger.SendMessage(message);
}

void
EncoderListView::MessageReceived(BMessage* message)
{
@@ -114,6 +121,23 @@ EncoderListView::MessageReceived(BMessage* message)
}
}

void
EncoderListView::SelectionChanged()
{
BMessage* listSelectMsg = new BMessage(LIST_SELECTION_MSG);
listSelectMsg->AddPointer("source", this);

for (int32 i = 0; i < CountRows(); i++) {
if (RowAt(i)->IsSelected()) {
listSelectMsg->AddInt32("index", i);
}
}

BMessenger messenger(Parent());
messenger.SendMessage(listSelectMsg);
delete listSelectMsg;
}

BBitmap*
EncoderListView::GetCheckMark()
{
@@ -6,14 +6,15 @@
class BBitmap;
class BMessage;
class BRect;
class BetterScrollView;

class EncoderListView : public BColumnListView {
public:
EncoderListView();
~EncoderListView();
virtual void AttachedToWindow();
virtual void MessageDropped(BMessage* message, BPoint point);
virtual void MessageReceived(BMessage* message);
virtual void SelectionChanged();
BBitmap* GetCheckMark();
private:
void InitView();

No commit comments for this range

You can’t perform that action at this time.