Fixed a whole lot of font sensitivity (and some other minor, like the "Show Contents"

menu label update) issues of the main window (didn't touch the rest yet) - shame on
you, Korli ;-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16971 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2006-04-02 18:31:30 +00:00
parent 3647d70ded
commit 0e6b056fdc
3 changed files with 249 additions and 176 deletions
+20 -14
View File
@@ -2,36 +2,32 @@
* Copyright 2004-2006, Jérôme DUVAL. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#include <Alert.h>
#include "ExpanderApp.h"
#include "ExpanderWindow.h"
const char *APP_SIG = "application/x-vnd.haiku-Expander";
#include <Alert.h>
#include <TextView.h>
int main(int, char **)
{
ExpanderApp theApp;
theApp.Run();
return 0;
}
ExpanderApp::ExpanderApp()
: BApplication(APP_SIG)
: BApplication("application/x-vnd.haiku-Expander")
{
BPoint windowPosition = fSettings.Message().FindPoint("window_position");
BRect windowFrame(0,0,450,120);
BRect windowFrame(0, 0, 450, 120);
windowFrame.OffsetBy(windowPosition);
BMessage settings(fSettings.Message());
fWindow = new ExpanderWindow(windowFrame, NULL, &settings);
}
void
ExpanderApp::AboutRequested()
{
BAlert *alert = new BAlert("about", "Expand-O-Matic\n"
"\twritten by Jérôme Duval\n"
"\tCopyright 2004, OpenBeOS.\n\n"
"\tCopyright 2004-2006, Haiku Inc.\n\n"
"original Be version by \n"
"Dominic, Hiroshi, Peter, Pavel and Robert\n", "Ok");
BTextView *view = alert->TextView();
@@ -45,14 +41,12 @@ ExpanderApp::AboutRequested()
view->SetFontAndColor(0, 14, &font);
alert->Go();
}
void
ExpanderApp::ReadyToRun()
{
}
@@ -90,3 +84,15 @@ ExpanderApp::UpdateSettingsFrom(BMessage *message)
{
fSettings.UpdateFrom(message);
}
// #pragma mark -
int
main(int, char **)
{
ExpanderApp theApp;
theApp.Run();
return 0;
}
+219 -156
View File
@@ -2,38 +2,41 @@
* Copyright 2004-2006, Jérôme DUVAL. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#include <Application.h>
#include <Box.h>
#include <Button.h>
#include <Entry.h>
#include <File.h>
#include <Menu.h>
#include <MenuBar.h>
#include <MenuItem.h>
#include <Path.h>
#include <Screen.h>
#include <Alert.h>
#include <SupportDefs.h>
#include "ExpanderApp.h"
#include "ExpanderWindow.h"
#include "ExpanderThread.h"
#include "ExpanderPreferences.h"
#include <Alert.h>
#include <Application.h>
#include <Box.h>
#include <Button.h>
#include <CheckBox.h>
#include <Entry.h>
#include <File.h>
#include <Menu.h>
#include <MenuBar.h>
#include <MenuItem.h>
#include <Path.h>
#include <ScrollView.h>
#include <StringView.h>
#include <TextView.h>
const uint32 MSG_SOURCE = 'mSOU';
const uint32 MSG_DEST = 'mDES';
const uint32 MSG_EXPAND = 'mEXP';
const uint32 MSG_SHOW = 'mSHO';
const uint32 MSG_STOP = 'mSTO';
const uint32 MSG_CLOSE = 'mCLO';
const uint32 MSG_PREFERENCES = 'mPRE';
const uint32 MSG_SOURCETEXT = 'mSTX';
const uint32 MSG_DESTTEXT = 'mDTX';
const uint32 MSG_SHOWCONTENTS = 'mSCT';
ExpanderWindow::ExpanderWindow(BRect frame_rect, const entry_ref *ref, BMessage *settings)
: BWindow(frame_rect, "Expand-O-Matic", B_TITLED_WINDOW, B_NOT_ZOOMABLE),
ExpanderWindow::ExpanderWindow(BRect frame, const entry_ref *ref, BMessage *settings)
: BWindow(frame, "Expand-O-Matic", B_TITLED_WINDOW, B_NOT_ZOOMABLE),
fSourceChanged(true),
fListingThread(NULL),
fListingStarted(false),
@@ -44,7 +47,7 @@ ExpanderWindow::ExpanderWindow(BRect frame_rect, const entry_ref *ref, BMessage
{
fSourcePanel = NULL;
fDestPanel = NULL;
// create menu bar
fBar = new BMenuBar(BRect(0, 0, Bounds().right, 20), "menu_bar");
BMenu *menu = new BMenu("File");
@@ -63,94 +66,112 @@ ExpanderWindow::ExpanderWindow(BRect frame_rect, const entry_ref *ref, BMessage
menu->AddItem(fStopItem = new BMenuItem("Stop", new BMessage(MSG_STOP), 'K'));
fStopItem->SetEnabled(false);
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem("Close", new BMessage(MSG_CLOSE), 'W'));
menu->AddItem(new BMenuItem("Close", new BMessage(B_QUIT_REQUESTED), 'W'));
fBar->AddItem(menu);
menu = new BMenu("Edit");
menu->AddItem(fPreferencesItem = new BMenuItem("Preferences...", new BMessage(MSG_PREFERENCES), 'P'));
menu->AddItem(fPreferencesItem = new BMenuItem("Preferences...",
new BMessage(MSG_PREFERENCES), 'P'));
fBar->AddItem(menu);
AddChild(fBar);
BRect rect = Bounds();
rect.top += fBar->Bounds().Height() + 1;
BBox *box = new BBox(rect, "background", B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS, B_PLAIN_BORDER);
AddChild(box);
BView *topView = new BView(rect, "background", B_FOLLOW_ALL, B_WILL_DRAW);
topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(topView);
float size = 8 + be_plain_font->StringWidth("Destination")/2;
rect = BRect(42 - size, 10, 42 + size, 25);
fSourceButton = new BButton(rect, "sourceButton", "Source",
new BMessage(MSG_SOURCE), B_FOLLOW_LEFT | B_FOLLOW_TOP);
box->AddChild(fSourceButton);
rect.OffsetBy(0, 28);
// Buttons
rect = topView->Bounds().InsetByCopy(8, 8);
fDestButton = new BButton(rect, "destButton", "Destination",
new BMessage(MSG_DEST), B_FOLLOW_LEFT | B_FOLLOW_TOP);
box->AddChild(fDestButton);
rect.OffsetBy(0, 28);
fDestButton->ResizeToPreferred();
topView->AddChild(fDestButton);
rect = fDestButton->Frame();
fDestButton->MoveBy(0, rect.Height() + 4);
fSourceButton = new BButton(rect, "sourceButton", "Source",
new BMessage(MSG_SOURCE), B_FOLLOW_LEFT | B_FOLLOW_TOP);
topView->AddChild(fSourceButton);
rect = fDestButton->Frame();
rect.OffsetBy(0, rect.Height() + 4);
fExpandButton = new BButton(rect, "expandButton", "Expand",
new BMessage(MSG_EXPAND), B_FOLLOW_LEFT | B_FOLLOW_TOP);
box->AddChild(fExpandButton);
topView->AddChild(fExpandButton);
fExpandButton->SetEnabled(false);
rect = BRect(rect.right+5, 12, Bounds().right - 10, 25);
// TextControls
rect = fSourceButton->Frame();
rect.left = rect.right + 5;
rect.right = frame.Width() - 8;
fSourceText = new BTextControl(rect, "sourceText", "", NULL,
new BMessage(MSG_SOURCETEXT), B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
fSourceText->SetDivider(0);
box->AddChild(fSourceText);
rect.OffsetBy(0, 28);
float width, height;
fSourceText->GetPreferredSize(&width, &height);
fSourceText->ResizeTo(rect.Width(), height);
float offset = (rect.Height() - fSourceText->Bounds().Height()) / 2;
fSourceText->MoveBy(0, offset);
topView->AddChild(fSourceText);
rect = fSourceText->Frame();
rect.OffsetBy(0, fSourceButton->Bounds().Height() + 4);
fDestText = new BTextControl(rect, "destText", "", NULL,
new BMessage(MSG_DESTTEXT), B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
fDestText->SetDivider(0);
box->AddChild(fDestText);
BRect frameRect = rect.OffsetByCopy(0, 27);
frameRect.left += 4;
frameRect.right = frameRect.left + 250;
BRect textRect(frameRect);
textRect.OffsetTo(B_ORIGIN);
textRect.InsetBy(1,1);
fExpandedText = new BTextView(frameRect, "expandedText", textRect,
be_plain_font, NULL, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
fExpandedText->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fExpandedText->MakeEditable(false);
fExpandedText->MakeSelectable(false);
box->AddChild(fExpandedText);
fExpandedText->SetText("");
rect = BRect(Bounds().right - 38 - be_plain_font->StringWidth("Show Contents"), rect.bottom + 13, Bounds().right - 10, rect.bottom + 28);
topView->AddChild(fDestText);
rect.OffsetBy(0, fSourceButton->Bounds().Height() + 4 + offset);
fShowContents = new BCheckBox(rect, "showContents", "Show Contents",
new BMessage(MSG_SHOWCONTENTS), B_FOLLOW_RIGHT | B_FOLLOW_TOP);
box->AddChild(fShowContents);
fShowContents->ResizeToPreferred();
fShowContents->MoveTo(Bounds().right - 8 - fShowContents->Bounds().Width(),
rect.top);
topView->AddChild(fShowContents);
fShowContents->SetEnabled(false);
frameRect = Bounds();
frameRect.InsetBy(10, 0);
frameRect.top += frameRect.Height() - 21;
frameRect.bottom = frameRect.top + 100;
frameRect.right -= B_V_SCROLL_BAR_WIDTH;
textRect = frameRect;
rect.left = fExpandButton->Frame().right + 5;
rect.right = fShowContents->Frame().left - 4;
fStatusView = new BStringView(rect, "statusView", "",
B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_FRAME_EVENTS);
topView->AddChild(fStatusView);
ResizeTo(frame.Width(), topView->Frame().top + fExpandButton->Frame().bottom + 8);
SetSizeLimits(fExpandButton->Bounds().Width() * 3 + fShowContents->Bounds().Width() + 24,
32767.0f, Frame().Height(), Frame().Height());
rect = topView->Bounds();
rect.InsetBy(10, 0);
rect.top = rect.bottom + 2;
rect.bottom -= 10;
rect.right -= B_V_SCROLL_BAR_WIDTH;
BRect textRect = rect;
textRect.OffsetTo(B_ORIGIN);
textRect.InsetBy(1,1);
fListingText = new BTextView(frameRect, "listingText", textRect,
be_fixed_font, NULL, B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FRAME_EVENTS);
textRect.InsetBy(1, 1);
fListingText = new BTextView(rect, "listingText", textRect,
be_fixed_font, NULL, B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS);
fListingText->SetText("");
fListingText->MakeEditable(false);
fListingScroll = new BScrollView("listingScroll", fListingText,
B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS, false, true);
box->AddChild(fListingScroll);
topView->AddChild(fListingScroll);
fListingScroll->Hide();
SetSizeLimits(450, BScreen(this).Frame().Width(), 120, 120);
// finish creating window
Show();
}
ExpanderWindow::~ExpanderWindow()
{
}
void
ExpanderWindow::FrameResized(float width, float height)
{
@@ -158,52 +179,55 @@ ExpanderWindow::FrameResized(float width, float height)
BRect textRect;
textRect = fListingText->Bounds();
textRect.OffsetTo(B_ORIGIN);
textRect.InsetBy(1,1);
textRect.InsetBy(1, 1);
fListingText->SetTextRect(textRect);
}
}
void
ExpanderWindow::MessageReceived(BMessage *msg)
{
switch (msg->what) {
case MSG_SOURCE:
if (!fSourcePanel)
if (!fSourcePanel) {
fSourcePanel = new BFilePanel(B_OPEN_PANEL, new BMessenger(this), NULL,
B_FILE_NODE, false, NULL, new RuleRefFilter(fRules), true);
}
fSourcePanel->Show();
break;
case MSG_DEST:
if (!fDestPanel)
if (!fDestPanel) {
fDestPanel = new DirectoryFilePanel(B_OPEN_PANEL, new BMessenger(this), NULL,
B_DIRECTORY_NODE, false, NULL, new DirectoryRefFilter(), true);
}
fDestPanel->Show();
break;
case MSG_DIRECTORY:
{
entry_ref ref;
fDestPanel->GetPanelDirectory(&ref);
fDestRef = ref;
BEntry entry(&ref);
BPath path(&entry);
fDestText->SetText(path.Path());
fDestPanel->Hide();
}
break;
case B_SIMPLE_DATA:
case B_REFS_RECEIVED:
{
RefsReceived(msg);
entry_ref ref;
fDestPanel->GetPanelDirectory(&ref);
fDestRef = ref;
BEntry entry(&ref);
BPath path(&entry);
fDestText->SetText(path.Path());
fDestPanel->Hide();
break;
}
case MSG_CLOSE:
PostMessage(B_QUIT_REQUESTED);
case B_SIMPLE_DATA:
case B_REFS_RECEIVED:
RefsReceived(msg);
break;
case MSG_EXPAND:
if (!fExpandingStarted) {
StartExpanding();
break;
}
// supposed to fall through
case MSG_STOP:
if (fExpandingStarted) {
fExpandingThread->SuspendExternalExpander();
@@ -217,19 +241,25 @@ ExpanderWindow::MessageReceived(BMessage *msg)
fExpandingThread->ResumeExternalExpander();
}
break;
case MSG_SHOW:
fShowContents->SetValue(fShowContents->Value() == B_CONTROL_OFF ? B_CONTROL_ON : B_CONTROL_OFF);
fShowItem->SetLabel(fShowContents->Value() == B_CONTROL_OFF ? "Show Contents" : "Hide Contents");
fShowContents->SetValue(fShowContents->Value() == B_CONTROL_OFF
? B_CONTROL_ON : B_CONTROL_OFF);
// supposed to fall through
case MSG_SHOWCONTENTS:
// change menu item label
fShowItem->SetLabel(fShowContents->Value() == B_CONTROL_OFF
? "Show Contents" : "Hide Contents");
if (fShowContents->Value() == B_CONTROL_OFF) {
if (fListingStarted)
StopListing();
SetSizeLimits(450, BScreen().Frame().Width(), 120, 120);
ResizeTo(Frame().Width(), 120);
fShowItem->SetLabel("Show Contents");
_UpdateWindowSize(false);
} else
StartListing();
break;
case MSG_SOURCETEXT:
{
BEntry entry(fSourceText->Text(), true);
@@ -299,7 +329,7 @@ ExpanderWindow::MessageReceived(BMessage *msg)
case 'exit': // thread has finished (finished, quit, killed, we don't know)
// reset window state
if (fExpandingStarted) {
fExpandedText->SetText("File expanded");
fStatusView->SetText("File expanded");
StopExpanding();
OpenDestFolder();
CloseWindowOrKeepOpen();
@@ -307,12 +337,12 @@ ExpanderWindow::MessageReceived(BMessage *msg)
fSourceChanged = false;
StopListing();
} else
fExpandedText->SetText("");
fStatusView->SetText("");
break;
case 'exrr': // thread has finished
// reset window state
fExpandedText->SetText("Error when expanding archive");
fStatusView->SetText("Error when expanding archive");
CloseWindowOrKeepOpen();
break;
default:
@@ -321,13 +351,14 @@ ExpanderWindow::MessageReceived(BMessage *msg)
}
}
bool
ExpanderWindow::CanQuit()
{
if ((fSourcePanel && fSourcePanel->IsShowing())
|| (fDestPanel && fDestPanel->IsShowing()))
return false;
if (fExpandingStarted) {
fExpandingThread->SuspendExternalExpander();
BAlert *alert = new BAlert("stopAlert", "Are you sure you want to stop expanding this\n"
@@ -344,36 +375,36 @@ ExpanderWindow::CanQuit()
return true;
}
bool
ExpanderWindow::QuitRequested()
{
if (!CanQuit())
return false;
if (fListingStarted) {
if (fListingStarted)
StopListing();
}
be_app->PostMessage(B_QUIT_REQUESTED);
fSettings.ReplacePoint("window_position", Frame().LeftTop());
((ExpanderApp*)(be_app))->UpdateSettingsFrom(&fSettings);
return true;
}
void
void
ExpanderWindow::RefsReceived(BMessage *msg)
{
entry_ref ref;
int32 i = 0;
int8 destination_folder = 0x63;
fSettings.FindInt8("destination_folder", &destination_folder);
while (msg->FindRef("refs", i++, &ref) == B_OK) {
BEntry entry(&ref, true);
BPath path(&entry);
BNode node(&entry);
if (node.IsFile()) {
fSourceChanged = true;
fSourceRef = ref;
@@ -389,13 +420,13 @@ ExpanderWindow::RefsReceived(BMessage *msg)
BPath dPath(&dEntry);
fDestText->SetText(dPath.Path());
}
BEntry dEntry(&fDestRef, true);
if (dEntry.Exists()) {
fExpandButton->SetEnabled(true);
fExpandItem->SetEnabled(true);
}
if (fShowContents->Value() == B_CONTROL_ON) {
StopListing();
StartListing();
@@ -405,7 +436,7 @@ ExpanderWindow::RefsReceived(BMessage *msg)
}
bool fromApp;
if (msg->FindBool("fromApp", &fromApp)==B_OK) {
if (msg->FindBool("fromApp", &fromApp) == B_OK) {
AutoExpand();
} else
AutoListing();
@@ -416,16 +447,14 @@ ExpanderWindow::RefsReceived(BMessage *msg)
}
}
void
ExpanderWindow::StartExpanding()
{
BMessage message;
ExpanderRule *rule = fRules.MatchingRule(&fSourceRef);
if (!rule) {
if (!rule)
return;
}
BEntry destEntry(fDestText->Text(), true);
if (!destEntry.Exists()) {
BAlert *alert = new BAlert("destAlert", "The directory was either moved, renamed or not\n"
@@ -435,11 +464,12 @@ ExpanderWindow::StartExpanding()
alert->Go();
return;
}
BMessage message;
message.AddString("cmd", rule->ExpandCmd());
message.AddRef("srcRef", &fSourceRef);
message.AddRef("destRef", &fDestRef);
fExpandButton->SetLabel("Stop");
fSourceButton->SetEnabled(false);
fDestButton->SetEnabled(false);
@@ -450,19 +480,20 @@ ExpanderWindow::StartExpanding()
fShowItem->SetEnabled(false);
fStopItem->SetEnabled(true);
fPreferencesItem->SetEnabled(false);
BEntry entry(&fSourceRef);
BPath path(&entry);
BString text("Expanding file ");
text.Append(path.Leaf());
fExpandedText->SetText(text.String());
fStatusView->SetText(text.String());
fExpandingThread = new ExpanderThread(&message, new BMessenger(this));
fExpandingThread->Start();
fExpandingStarted = true;
}
void
ExpanderWindow::StopExpanding(void)
{
@@ -472,7 +503,7 @@ ExpanderWindow::StopExpanding(void)
}
fExpandingStarted = false;
fExpandButton->SetLabel("Expand");
fSourceButton->SetEnabled(true);
fDestButton->SetEnabled(true);
@@ -485,27 +516,52 @@ ExpanderWindow::StopExpanding(void)
fPreferencesItem->SetEnabled(true);
}
void
ExpanderWindow::_UpdateWindowSize(bool showContents)
{
float minWidth, maxWidth, minHeight, maxHeight;
GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight);
float bottom = fExpandButton->Parent()->Frame().top + fExpandButton->Frame().bottom + 8;
if (showContents) {
font_height fontHeight;
be_plain_font->GetHeight(&fontHeight);
float lineHeight = ceilf(fontHeight.ascent + fontHeight.descent + fontHeight.leading);
minHeight = bottom + 14 + 4 * lineHeight;
maxHeight = 32767.0;
bottom = minHeight + 10 * lineHeight;
} else {
minHeight = bottom;
maxHeight = bottom;
}
SetSizeLimits(minWidth, maxWidth, minHeight, maxHeight);
ResizeTo(Frame().Width(), bottom);
}
void
ExpanderWindow::StartListing()
{
SetSizeLimits(450, BScreen().Frame().Width(), 335, BScreen().Frame().Height());
ResizeTo(Frame().Width(), 335);
fListingScroll->ResizeTo(fListingScroll->Bounds().Width(), 210);
_UpdateWindowSize(true);
if (fListingScroll->IsHidden())
fListingScroll->Show();
if (!fSourceChanged)
return;
BMessage message;
ExpanderRule *rule = fRules.MatchingRule(&fSourceRef);
if (!rule) {
if (!rule)
return;
}
BMessage message;
message.AddString("cmd", rule->ListingCmd());
message.AddRef("srcRef", &fSourceRef);
fShowContents->SetEnabled(true);
fSourceItem->SetEnabled(false);
fDestItem->SetEnabled(false);
@@ -514,24 +570,25 @@ ExpanderWindow::StartListing()
fShowItem->SetLabel("Hide Contents");
fStopItem->SetEnabled(false);
fPreferencesItem->SetEnabled(false);
fSourceButton->SetEnabled(false);
fDestButton->SetEnabled(false);
fExpandButton->SetEnabled(false);
BEntry entry(&fSourceRef);
BPath path(&entry);
BString text("Creating listing for ");
text.Append(path.Leaf());
fExpandedText->SetText(text.String());
fStatusView->SetText(text.String());
fListingText->SetText("");
fListingThread = new ExpanderThread(&message, new BMessenger(this));
fListingThread->Start();
fListingStarted = true;
}
void
ExpanderWindow::StopListing(void)
{
@@ -541,7 +598,7 @@ ExpanderWindow::StopListing(void)
}
fListingStarted = false;
fShowContents->SetEnabled(true);
fSourceItem->SetEnabled(true);
fDestItem->SetEnabled(true);
@@ -553,59 +610,65 @@ ExpanderWindow::StopListing(void)
fSourceButton->SetEnabled(true);
fDestButton->SetEnabled(true);
fExpandButton->SetEnabled(true);
fExpandedText->SetText("");
fStatusView->SetText("");
}
void
ExpanderWindow::CloseWindowOrKeepOpen()
{
bool automatically_expand_files = false;
fSettings.FindBool("automatically_expand_files", &automatically_expand_files);
bool close_when_done = false;
fSettings.FindBool("close_when_done", &close_when_done);
if (automatically_expand_files || close_when_done)
bool expandFiles = false;
fSettings.FindBool("automatically_expand_files", &expandFiles);
bool closeWhenDone = false;
fSettings.FindBool("close_when_done", &closeWhenDone);
if (expandFiles || closeWhenDone)
PostMessage(B_QUIT_REQUESTED);
}
void
ExpanderWindow::OpenDestFolder()
{
bool open_destination_folder = true;
fSettings.FindBool("open_destination_folder", &open_destination_folder);
bool openFolder = true;
fSettings.FindBool("open_destination_folder", &openFolder);
if (!open_destination_folder)
if (!openFolder)
return;
BMessage * message = new BMessage(B_REFS_RECEIVED);
message->AddRef("refs", &fDestRef);
BPath path(&fDestRef);
BMessenger tracker( "application/x-vnd.Be-TRAK" );
tracker.SendMessage( message );
BMessenger tracker("application/x-vnd.Be-TRAK");
tracker.SendMessage(message);
}
void
ExpanderWindow::AutoListing()
{
bool show_contents_listing = false;
fSettings.FindBool("show_contents_listing", &show_contents_listing);
if (!show_contents_listing)
bool showContents = false;
fSettings.FindBool("show_contents_listing", &showContents);
if (!showContents)
return;
fShowContents->SetValue(B_CONTROL_ON);
fShowContents->Invoke();
}
void
ExpanderWindow::AutoExpand()
{
bool automatically_expand_files = false;
fSettings.FindBool("automatically_expand_files", &automatically_expand_files);
bool expandFiles = false;
fSettings.FindBool("automatically_expand_files", &expandFiles);
if (!automatically_expand_files) {
if (!expandFiles) {
AutoListing();
return;
}
fExpandButton->Invoke();
}
+10 -6
View File
@@ -9,15 +9,17 @@
#define EXPANDER_WINDOW_H
#include <CheckBox.h>
#include <Window.h>
#include <FilePanel.h>
#include <TextControl.h>
#include <ScrollView.h>
#include "DirectoryFilePanel.h"
#include "ExpanderRules.h"
#include <Window.h>
class BCheckBox;
class BMenu;
class BScrollView;
class BStringView;
class BTextControl;
class BTextView;
class ExpanderThread;
class ExpanderPreferences;
@@ -44,6 +46,7 @@ class ExpanderWindow : public BWindow {
void AutoExpand();
void StartExpanding();
void StopExpanding();
void _UpdateWindowSize(bool showContents);
void StartListing();
void StopListing();
@@ -60,7 +63,8 @@ class ExpanderWindow : public BWindow {
*fSourceItem, *fDestItem, *fPreferencesItem;
BCheckBox *fShowContents;
BTextControl *fSourceText, *fDestText;
BTextView *fExpandedText, *fListingText;
BStringView* fStatusView;
BTextView *fListingText;
BScrollView *fListingScroll;
ExpanderThread *fListingThread;