* 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:
parent
62454aae66
commit
5725361ffe
@ -227,10 +227,10 @@ IconEditorApp::ReadyToRun()
|
|||||||
new BMessage(MSG_SAVE_AS));
|
new BMessage(MSG_SAVE_AS));
|
||||||
|
|
||||||
// create main window
|
// create main window
|
||||||
fMainWindow = new MainWindow(this, fDocument);
|
BMessage settings('stns');
|
||||||
|
_RestoreSettings(settings);
|
||||||
_RestoreSettings();
|
|
||||||
|
|
||||||
|
fMainWindow = new MainWindow(this, fDocument, &settings);
|
||||||
fMainWindow->Show();
|
fMainWindow->Show();
|
||||||
|
|
||||||
_InstallDocumentMimeType();
|
_InstallDocumentMimeType();
|
||||||
@ -566,16 +566,13 @@ IconEditorApp::_StoreSettings()
|
|||||||
|
|
||||||
// _RestoreSettings
|
// _RestoreSettings
|
||||||
void
|
void
|
||||||
IconEditorApp::_RestoreSettings()
|
IconEditorApp::_RestoreSettings(BMessage& settings)
|
||||||
{
|
{
|
||||||
BMessage settings('stns');
|
|
||||||
load_settings(&settings, "Icon-O-Matic");
|
load_settings(&settings, "Icon-O-Matic");
|
||||||
|
|
||||||
int32 mode;
|
int32 mode;
|
||||||
if (settings.FindInt32("export mode", &mode) >= B_OK)
|
if (settings.FindInt32("export mode", &mode) >= B_OK)
|
||||||
fSavePanel->SetExportMode(mode);
|
fSavePanel->SetExportMode(mode);
|
||||||
|
|
||||||
fMainWindow->RestoreSettings(&settings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// _InstallDocumentMimeType
|
// _InstallDocumentMimeType
|
||||||
|
@ -77,7 +77,7 @@ class IconEditorApp : public BApplication {
|
|||||||
const char* _LastFilePath(path_kind which);
|
const char* _LastFilePath(path_kind which);
|
||||||
|
|
||||||
void _StoreSettings();
|
void _StoreSettings();
|
||||||
void _RestoreSettings();
|
void _RestoreSettings(BMessage& settings);
|
||||||
void _InstallDocumentMimeType();
|
void _InstallDocumentMimeType();
|
||||||
|
|
||||||
MainWindow* fMainWindow;
|
MainWindow* fMainWindow;
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include <Screen.h>
|
#include <Screen.h>
|
||||||
#include <ScrollView.h>
|
#include <ScrollView.h>
|
||||||
|
|
||||||
#if __HAIKU__
|
#ifdef __HAIKU__
|
||||||
# include <GridLayout.h>
|
# include <GridLayout.h>
|
||||||
# include <GroupLayout.h>
|
# include <GroupLayout.h>
|
||||||
# include <GroupView.h>
|
# include <GroupView.h>
|
||||||
@ -80,14 +80,16 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// constructor
|
// 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",
|
: BWindow(BRect(50, 50, 900, 750), "Icon-O-Matic",
|
||||||
B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
|
B_DOCUMENT_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS),
|
||||||
B_ASYNCHRONOUS_CONTROLS),
|
|
||||||
fApp(app),
|
fApp(app),
|
||||||
fDocument(document),
|
fDocument(document),
|
||||||
fIcon(NULL)
|
fIcon(NULL)
|
||||||
{
|
{
|
||||||
|
RestoreSettings(settings);
|
||||||
|
|
||||||
_Init();
|
_Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -425,7 +427,7 @@ MainWindow::StoreSettings(BMessage* archive)
|
|||||||
|
|
||||||
// RestoreSettings
|
// RestoreSettings
|
||||||
void
|
void
|
||||||
MainWindow::RestoreSettings(BMessage* archive)
|
MainWindow::RestoreSettings(const BMessage* archive)
|
||||||
{
|
{
|
||||||
BRect frame;
|
BRect frame;
|
||||||
if (archive->FindRect("main window frame", &frame) == B_OK) {
|
if (archive->FindRect("main window frame", &frame) == B_OK) {
|
||||||
@ -489,7 +491,7 @@ MainWindow::_Init()
|
|||||||
void
|
void
|
||||||
MainWindow::_CreateGUI(BRect bounds)
|
MainWindow::_CreateGUI(BRect bounds)
|
||||||
{
|
{
|
||||||
const float splitWidth = 160;
|
const float splitWidth = 13 * be_plain_font->Size();
|
||||||
|
|
||||||
#ifdef __HAIKU__
|
#ifdef __HAIKU__
|
||||||
|
|
||||||
@ -676,7 +678,7 @@ MainWindow::_CreateGUI(BRect bounds)
|
|||||||
topSideView->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED,
|
topSideView->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED,
|
||||||
swatchGroupView->MinSize().height));
|
swatchGroupView->MinSize().height));
|
||||||
|
|
||||||
#else // __HAIKU__
|
#else // !__HAIKU__
|
||||||
|
|
||||||
BView* bg = new BView(bounds, "bg", B_FOLLOW_ALL, 0);
|
BView* bg = new BView(bounds, "bg", B_FOLLOW_ALL, 0);
|
||||||
bg->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
bg->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
|
@ -46,7 +46,8 @@ class MainWindow : public BWindow,
|
|||||||
public Observer {
|
public Observer {
|
||||||
public:
|
public:
|
||||||
MainWindow(IconEditorApp* app,
|
MainWindow(IconEditorApp* app,
|
||||||
Document* document);
|
Document* document,
|
||||||
|
const BMessage* settings);
|
||||||
virtual ~MainWindow();
|
virtual ~MainWindow();
|
||||||
|
|
||||||
// BWindow interface
|
// BWindow interface
|
||||||
@ -65,7 +66,7 @@ class MainWindow : public BWindow,
|
|||||||
void SetIcon(Icon* icon);
|
void SetIcon(Icon* icon);
|
||||||
|
|
||||||
void StoreSettings(BMessage* archive);
|
void StoreSettings(BMessage* archive);
|
||||||
void RestoreSettings(BMessage* archive);
|
void RestoreSettings(const BMessage* archive);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _Init();
|
void _Init();
|
||||||
|
@ -88,6 +88,7 @@ StyleView::StyleView(BRect frame)
|
|||||||
fStyleType->MenuBar()->ResizeTo(width, height);
|
fStyleType->MenuBar()->ResizeTo(width, height);
|
||||||
fStyleType->ResizeTo(frame.Width(), height + 6);
|
fStyleType->ResizeTo(frame.Width(), height + 6);
|
||||||
fStyleType->SetResizingMode(B_FOLLOW_TOP | B_FOLLOW_LEFT_RIGHT);
|
fStyleType->SetResizingMode(B_FOLLOW_TOP | B_FOLLOW_LEFT_RIGHT);
|
||||||
|
fStyleType->MenuBar()->SetResizingMode(B_FOLLOW_TOP | B_FOLLOW_LEFT_RIGHT);
|
||||||
#endif // __HAIKU__
|
#endif // __HAIKU__
|
||||||
|
|
||||||
// gradient type
|
// gradient type
|
||||||
@ -125,7 +126,7 @@ StyleView::StyleView(BRect frame)
|
|||||||
layout->AddItem(BSpaceLayoutItem::CreateHorizontalStrut(3), 3, 1, 1, 3);
|
layout->AddItem(BSpaceLayoutItem::CreateHorizontalStrut(3), 3, 1, 1, 3);
|
||||||
layout->AddItem(BSpaceLayoutItem::CreateVerticalStrut(3), 0, 4, 4);
|
layout->AddItem(BSpaceLayoutItem::CreateVerticalStrut(3), 0, 4, 4);
|
||||||
|
|
||||||
#else // __HAIKU__
|
#else // !__HAIKU__
|
||||||
frame.OffsetBy(0, fStyleType->Frame().Height() + 6);
|
frame.OffsetBy(0, fStyleType->Frame().Height() + 6);
|
||||||
fGradientType = new BMenuField(frame, "gradient type", "Gradient Type",
|
fGradientType = new BMenuField(frame, "gradient type", "Gradient Type",
|
||||||
menu, true);
|
menu, true);
|
||||||
@ -135,6 +136,7 @@ StyleView::StyleView(BRect frame)
|
|||||||
fGradientType->MenuBar()->ResizeTo(width, height);
|
fGradientType->MenuBar()->ResizeTo(width, height);
|
||||||
fGradientType->ResizeTo(frame.Width(), height + 6);
|
fGradientType->ResizeTo(frame.Width(), height + 6);
|
||||||
fGradientType->SetResizingMode(B_FOLLOW_TOP | B_FOLLOW_LEFT_RIGHT);
|
fGradientType->SetResizingMode(B_FOLLOW_TOP | B_FOLLOW_LEFT_RIGHT);
|
||||||
|
fGradientType->MenuBar()->SetResizingMode(B_FOLLOW_TOP | B_FOLLOW_LEFT_RIGHT);
|
||||||
|
|
||||||
// create gradient control
|
// create gradient control
|
||||||
frame.top = fGradientType->Frame().bottom + 8;
|
frame.top = fGradientType->Frame().bottom + 8;
|
||||||
@ -142,7 +144,7 @@ StyleView::StyleView(BRect frame)
|
|||||||
fGradientControl = new GradientControl(new BMessage(MSG_SET_COLOR),
|
fGradientControl = new GradientControl(new BMessage(MSG_SET_COLOR),
|
||||||
this);
|
this);
|
||||||
|
|
||||||
width = max_c(fGradientControl->Frame().Width(), frame.Width());
|
width = frame.Width();
|
||||||
height = max_c(fGradientControl->Frame().Height(), 30);
|
height = max_c(fGradientControl->Frame().Height(), 30);
|
||||||
|
|
||||||
fGradientControl->ResizeTo(width, height);
|
fGradientControl->ResizeTo(width, height);
|
||||||
@ -151,6 +153,13 @@ StyleView::StyleView(BRect frame)
|
|||||||
fGradientControl->SetResizingMode(B_FOLLOW_TOP | B_FOLLOW_LEFT_RIGHT);
|
fGradientControl->SetResizingMode(B_FOLLOW_TOP | B_FOLLOW_LEFT_RIGHT);
|
||||||
|
|
||||||
AddChild(fGradientControl);
|
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__
|
#endif // __HAIKU__
|
||||||
|
|
||||||
fStyleType->SetEnabled(false);
|
fStyleType->SetEnabled(false);
|
||||||
|
Loading…
Reference in New Issue
Block a user