summaryrefslogtreecommitdiff
path: root/src/haiku_support.cc
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-05-04 05:46:24 +0000
committerPo Lu <luangruo@yahoo.com>2022-05-04 05:46:24 +0000
commit268713e227e8b665b1874c96ea96d1e7fccaab11 (patch)
tree2007fbd5a73369525fa5cba0e141e2b52f8a1329 /src/haiku_support.cc
parent10284ca3d3a01505c3f19668f7e00586cac414b5 (diff)
downloademacs-268713e227e8b665b1874c96ea96d1e7fccaab11.tar.gz
Set initial size in the Haiku font dialog
* src/haiku_support.cc (class EmacsFontSelectionDialog) (EmacsFontSelectionDialog): New argument `initial_size'. (be_select_font): Likewise. * src/haiku_support.h: Update prototypes. * src/haikufont.c (Fx_select_font): Set font dialog size to the pixel size of the current font.
Diffstat (limited to 'src/haiku_support.cc')
-rw-r--r--src/haiku_support.cc16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/haiku_support.cc b/src/haiku_support.cc
index 1280a77b22a..311df2e06b1 100644
--- a/src/haiku_support.cc
+++ b/src/haiku_support.cc
@@ -2577,7 +2577,8 @@ public:
EmacsFontSelectionDialog (bool monospace_only,
int initial_family_idx,
- int initial_style_idx)
+ int initial_style_idx,
+ int initial_size)
: BWindow (BRect (0, 0, 500, 500),
"Select font from list",
B_TITLED_WINDOW_LOOK,
@@ -2610,6 +2611,7 @@ public:
uint32 flags, c;
BMessage *selection;
BTextView *size_text;
+ char format_buffer[4];
AddChild (&basic_view);
@@ -2670,6 +2672,12 @@ public:
for (c = 58; c <= 127; ++c)
size_text->DisallowChar (c);
+
+ if (initial_size > 0 && initial_size < 1000)
+ {
+ sprintf (format_buffer, "%d", initial_size);
+ size_entry.SetText (format_buffer);
+ }
}
void
@@ -4719,7 +4727,8 @@ be_select_font (void (*process_pending_signals_function) (void),
haiku_font_family_or_style *family,
haiku_font_family_or_style *style,
int *size, bool allow_monospace_only,
- int initial_family, int initial_style)
+ int initial_family, int initial_style,
+ int initial_size)
{
EmacsFontSelectionDialog *dialog;
struct font_selection_dialog_message msg;
@@ -4728,7 +4737,8 @@ be_select_font (void (*process_pending_signals_function) (void),
font_style style_buffer;
dialog = new EmacsFontSelectionDialog (allow_monospace_only,
- initial_family, initial_style);
+ initial_family, initial_style,
+ initial_size);
dialog->CenterOnScreen ();
if (dialog->InitCheck () < B_OK)