* some fixes to the GUI on BeOS, avoid an app_server bug when resizing the window

after creating the views, but before Show()
* make the MenuFields in the Style section follow left/right


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22204 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2007-09-08 18:21:20 +00:00
parent 62454aae66
commit 5725361ffe
5 changed files with 28 additions and 19 deletions

View File

@ -227,10 +227,10 @@ IconEditorApp::ReadyToRun()
new BMessage(MSG_SAVE_AS));
// create main window
fMainWindow = new MainWindow(this, fDocument);
_RestoreSettings();
BMessage settings('stns');
_RestoreSettings(settings);
fMainWindow = new MainWindow(this, fDocument, &settings);
fMainWindow->Show();
_InstallDocumentMimeType();
@ -566,16 +566,13 @@ IconEditorApp::_StoreSettings()
// _RestoreSettings
void
IconEditorApp::_RestoreSettings()
IconEditorApp::_RestoreSettings(BMessage& settings)
{
BMessage settings('stns');
load_settings(&settings, "Icon-O-Matic");
int32 mode;
if (settings.FindInt32("export mode", &mode) >= B_OK)
fSavePanel->SetExportMode(mode);
fMainWindow->RestoreSettings(&settings);
}
// _InstallDocumentMimeType

View File

@ -77,7 +77,7 @@ class IconEditorApp : public BApplication {
const char* _LastFilePath(path_kind which);
void _StoreSettings();
void _RestoreSettings();
void _RestoreSettings(BMessage& settings);
void _InstallDocumentMimeType();
MainWindow* fMainWindow;

View File

@ -18,7 +18,7 @@
#include <Screen.h>
#include <ScrollView.h>
#if __HAIKU__
#ifdef __HAIKU__
# include <GridLayout.h>
# include <GroupLayout.h>
# include <GroupView.h>
@ -80,14 +80,16 @@ enum {
};
// constructor
MainWindow::MainWindow(IconEditorApp* app, Document* document)
MainWindow::MainWindow(IconEditorApp* app, Document* document,
const BMessage* settings)
: BWindow(BRect(50, 50, 900, 750), "Icon-O-Matic",
B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
B_ASYNCHRONOUS_CONTROLS),
B_DOCUMENT_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS),
fApp(app),
fDocument(document),
fIcon(NULL)
{
RestoreSettings(settings);
_Init();
}
@ -425,7 +427,7 @@ MainWindow::StoreSettings(BMessage* archive)
// RestoreSettings
void
MainWindow::RestoreSettings(BMessage* archive)
MainWindow::RestoreSettings(const BMessage* archive)
{
BRect frame;
if (archive->FindRect("main window frame", &frame) == B_OK) {
@ -489,7 +491,7 @@ MainWindow::_Init()
void
MainWindow::_CreateGUI(BRect bounds)
{
const float splitWidth = 160;
const float splitWidth = 13 * be_plain_font->Size();
#ifdef __HAIKU__
@ -676,7 +678,7 @@ MainWindow::_CreateGUI(BRect bounds)
topSideView->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED,
swatchGroupView->MinSize().height));
#else // __HAIKU__
#else // !__HAIKU__
BView* bg = new BView(bounds, "bg", B_FOLLOW_ALL, 0);
bg->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

View File

@ -46,7 +46,8 @@ class MainWindow : public BWindow,
public Observer {
public:
MainWindow(IconEditorApp* app,
Document* document);
Document* document,
const BMessage* settings);
virtual ~MainWindow();
// BWindow interface
@ -65,7 +66,7 @@ class MainWindow : public BWindow,
void SetIcon(Icon* icon);
void StoreSettings(BMessage* archive);
void RestoreSettings(BMessage* archive);
void RestoreSettings(const BMessage* archive);
private:
void _Init();

View File

@ -88,6 +88,7 @@ StyleView::StyleView(BRect frame)
fStyleType->MenuBar()->ResizeTo(width, height);
fStyleType->ResizeTo(frame.Width(), height + 6);
fStyleType->SetResizingMode(B_FOLLOW_TOP | B_FOLLOW_LEFT_RIGHT);
fStyleType->MenuBar()->SetResizingMode(B_FOLLOW_TOP | B_FOLLOW_LEFT_RIGHT);
#endif // __HAIKU__
// gradient type
@ -125,7 +126,7 @@ StyleView::StyleView(BRect frame)
layout->AddItem(BSpaceLayoutItem::CreateHorizontalStrut(3), 3, 1, 1, 3);
layout->AddItem(BSpaceLayoutItem::CreateVerticalStrut(3), 0, 4, 4);
#else // __HAIKU__
#else // !__HAIKU__
frame.OffsetBy(0, fStyleType->Frame().Height() + 6);
fGradientType = new BMenuField(frame, "gradient type", "Gradient Type",
menu, true);
@ -135,6 +136,7 @@ StyleView::StyleView(BRect frame)
fGradientType->MenuBar()->ResizeTo(width, height);
fGradientType->ResizeTo(frame.Width(), height + 6);
fGradientType->SetResizingMode(B_FOLLOW_TOP | B_FOLLOW_LEFT_RIGHT);
fGradientType->MenuBar()->SetResizingMode(B_FOLLOW_TOP | B_FOLLOW_LEFT_RIGHT);
// create gradient control
frame.top = fGradientType->Frame().bottom + 8;
@ -142,7 +144,7 @@ StyleView::StyleView(BRect frame)
fGradientControl = new GradientControl(new BMessage(MSG_SET_COLOR),
this);
width = max_c(fGradientControl->Frame().Width(), frame.Width());
width = frame.Width();
height = max_c(fGradientControl->Frame().Height(), 30);
fGradientControl->ResizeTo(width, height);
@ -151,6 +153,13 @@ StyleView::StyleView(BRect frame)
fGradientControl->SetResizingMode(B_FOLLOW_TOP | B_FOLLOW_LEFT_RIGHT);
AddChild(fGradientControl);
// align label divider
float divider = fGradientType->StringWidth(fGradientType->Label());
divider = max_c(divider, fStyleType->StringWidth(fStyleType->Label()));
fGradientType->SetDivider(divider + 8);
fStyleType->SetDivider(divider + 8);
#endif // __HAIKU__
fStyleType->SetEnabled(false);