mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-29 19:48:19 +00:00
Improve display of Haiku font dialog
* src/haiku_support.cc (EmacsFontSelectionDialog) (class EmacsFontSelectionDialog, FrameResized): Set minimum size based on individual view dimensions and add label to size control. (BWindow_set_min_size): Delete function. * src/haiku_support.h: Update prototypes. * src/haikuterm.c (haiku_update_size_hints): Stop setting min size, since that doesn't work correctly on Haiku.
This commit is contained in:
parent
159d8f7a0a
commit
7c50fb248d
@ -2565,7 +2565,7 @@ class EmacsFontSelectionDialog : public BWindow
|
||||
: BWindow (BRect (0, 0, 500, 500),
|
||||
"Select font from list",
|
||||
B_TITLED_WINDOW_LOOK,
|
||||
B_NORMAL_WINDOW_FEEL, 0),
|
||||
B_MODAL_APP_WINDOW_FEEL, 0),
|
||||
basic_view (NULL, 0),
|
||||
font_family_pane (BRect (0, 0, 10, 10), NULL,
|
||||
B_SINGLE_SELECTION_LIST,
|
||||
@ -2584,14 +2584,15 @@ class EmacsFontSelectionDialog : public BWindow
|
||||
cancel_button ("Cancel", "Cancel",
|
||||
new BMessage (B_CANCEL)),
|
||||
ok_button ("OK", "OK", new BMessage (B_OK)),
|
||||
size_entry (NULL, NULL, NULL, NULL),
|
||||
size_entry (NULL, "Size:", NULL, NULL),
|
||||
allow_monospace_only (monospace_only)
|
||||
{
|
||||
BStringItem *family_item;
|
||||
int i, n_families;
|
||||
font_family name;
|
||||
uint32 flags;
|
||||
uint32 flags, c;
|
||||
BMessage *selection;
|
||||
BTextView *size_text;
|
||||
|
||||
AddChild (&basic_view);
|
||||
|
||||
@ -2638,12 +2639,20 @@ class EmacsFontSelectionDialog : public BWindow
|
||||
font_family_pane.AddItem (family_item);
|
||||
}
|
||||
}
|
||||
|
||||
size_text = size_entry.TextView ();
|
||||
|
||||
for (c = 0; c <= 47; ++c)
|
||||
size_text->DisallowChar (c);
|
||||
|
||||
for (c = 58; c <= 127; ++c)
|
||||
size_text->DisallowChar (c);
|
||||
}
|
||||
|
||||
void
|
||||
FrameResized (float new_width, float new_height)
|
||||
{
|
||||
BRect frame = Frame ();
|
||||
BRect frame;
|
||||
float ok_height, ok_width;
|
||||
float cancel_height, cancel_width;
|
||||
float size_width, size_height;
|
||||
@ -2658,6 +2667,10 @@ class EmacsFontSelectionDialog : public BWindow
|
||||
max_height = std::max (std::max (ok_height, cancel_height),
|
||||
size_height);
|
||||
|
||||
SetSizeLimits (cancel_width + ok_width + size_width + 6,
|
||||
65535, max_height + 64, 65535);
|
||||
frame = Frame ();
|
||||
|
||||
basic_view.ResizeTo (BE_RECT_WIDTH (frame), BE_RECT_HEIGHT (frame));
|
||||
split_view.ResizeTo (BE_RECT_WIDTH (frame),
|
||||
BE_RECT_HEIGHT (frame) - 4 - max_height);
|
||||
@ -2673,7 +2686,8 @@ class EmacsFontSelectionDialog : public BWindow
|
||||
|
||||
ok_button.ResizeTo (ok_width, ok_height);
|
||||
cancel_button.ResizeTo (cancel_width, cancel_height);
|
||||
size_entry.ResizeTo (BE_RECT_WIDTH (frame) / 6,
|
||||
size_entry.ResizeTo (std::max (size_width,
|
||||
BE_RECT_WIDTH (frame) / 4),
|
||||
size_height);
|
||||
}
|
||||
|
||||
@ -4405,17 +4419,6 @@ be_get_display_screens (void)
|
||||
}
|
||||
|
||||
/* Set the minimum width the user can resize WINDOW to. */
|
||||
void
|
||||
BWindow_set_min_size (void *window, int width, int height)
|
||||
{
|
||||
BWindow *w = (BWindow *) window;
|
||||
|
||||
if (!w->LockLooper ())
|
||||
gui_abort ("Failed to lock window looper setting min size");
|
||||
w->SetSizeLimits (width, -1, height, -1);
|
||||
w->UnlockLooper ();
|
||||
}
|
||||
|
||||
/* Synchronize WINDOW's connection to the App Server. */
|
||||
void
|
||||
BWindow_sync (void *window)
|
||||
|
@ -468,7 +468,6 @@ extern void BWindow_change_decoration (void *, int);
|
||||
extern void BWindow_set_tooltip_decoration (void *);
|
||||
extern void BWindow_set_avoid_focus (void *, int);
|
||||
extern void BWindow_zoom (void *);
|
||||
extern void BWindow_set_min_size (void *, int, int);
|
||||
extern void BWindow_set_size_alignment (void *, int, int);
|
||||
extern void BWindow_sync (void *);
|
||||
extern void BWindow_send_behind (void *, void *);
|
||||
|
@ -144,23 +144,15 @@ get_string_resource (void *ignored, const char *name, const char *class)
|
||||
static void
|
||||
haiku_update_size_hints (struct frame *f)
|
||||
{
|
||||
int base_width, base_height;
|
||||
eassert (FRAME_HAIKU_P (f) && FRAME_HAIKU_WINDOW (f));
|
||||
|
||||
if (f->tooltip)
|
||||
return;
|
||||
|
||||
base_width = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, 0);
|
||||
base_height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, 0);
|
||||
|
||||
block_input ();
|
||||
BWindow_set_size_alignment (FRAME_HAIKU_WINDOW (f),
|
||||
frame_resize_pixelwise ? 1 : FRAME_COLUMN_WIDTH (f),
|
||||
frame_resize_pixelwise ? 1 : FRAME_LINE_HEIGHT (f));
|
||||
BWindow_set_min_size (FRAME_HAIKU_WINDOW (f), base_width,
|
||||
base_height
|
||||
+ FRAME_TOOL_BAR_HEIGHT (f)
|
||||
+ FRAME_MENU_BAR_HEIGHT (f));
|
||||
(frame_resize_pixelwise
|
||||
? 1 : FRAME_COLUMN_WIDTH (f)),
|
||||
(frame_resize_pixelwise
|
||||
? 1 : FRAME_LINE_HEIGHT (f)));
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user