#include "m17n-gui.h"
#include "m17n-misc.h"
#include "internal.h"
+#include "plist.h"
#include "internal-gui.h"
#include "font.h"
#include "fontset.h"
@brief Create a new frame.
The mframe () function creates a new frame with parameters listed
- in $PLIST.
+ in $PLIST which may be NULL.
The recognized keys in $PLIST are window system dependent.
@brief ¿·¤·¤¤¥Õ¥ì¡¼¥à¤òºî¤ë.
´Ø¿ô mframe () ¤Ï $PLIST Ãæ¤Î¥Ñ¥é¥á¡¼¥¿¤ò»ý¤Ä¿·¤·¤¤¥Õ¥ì¡¼¥à¤òºî¤ë¡£
+ $PLIST ¤ÏNULL ¤Ç¤âÎɤ¤¡£
$PLIST ¤Ë¸½¤ï¤ì¤ë¥¡¼¤Î¤¦¤Á¤É¤ì¤¬Ç§¼±¤µ¤ì¤ë¤«¤Ï¥¦¥£¥ó¥É¥¦¥·¥¹¥Æ¥à
¤Ë°Í¸¤¹¤ë¡£¤·¤«¤·°Ê²¼¤Î¥¡¼¤Ï¾ï¤Ëǧ¼±¤µ¤ì¤ë¡£
mframe (MPlist *plist)
{
MFrame *frame;
- MSymbol key;
+ int plist_created = 0;
+ MPlist *pl;
M17N_OBJECT (frame, free_frame, MERROR_FRAME);
+ if (! plist)
+ {
+ plist = mplist ();
+ plist_created = 1;
+ }
frame->device = mwin__open_device (frame, plist);
if (! frame->device)
{
MERROR (MERROR_WIN, NULL);
}
- frame->face = mface_from_font (frame->font);
- frame->face->property[MFACE_FONTSET] = mfontset (NULL);
- M17N_OBJECT_REF (mface__default->property[MFACE_FONTSET]);
- if (plist)
- for (; (key = mplist_key (plist)) != Mnil; plist = mplist_next (plist))
- if (key == Mface)
- mface_merge (frame->face, (MFace *) mplist_value (plist));
-
- frame->rface = mface__realize (frame, NULL, 0, Mnil, Mnil, 0);
+ frame->face = mface ();
+ MPLIST_DO (pl, plist)
+ if (MPLIST_KEY (pl) == Mface)
+ mface_merge (frame->face, (MFace *) MPLIST_VAL (pl));
+ mface__update_frame_face (frame);
if (! frame->rface->rfont)
MERROR (MERROR_WIN, NULL);
- frame->space_width = frame->rface->space_width;
- frame->ascent = frame->rface->ascent;
- frame->descent = frame->rface->descent;
if (! mframe_default)
mframe_default = frame;
+ if (plist_created)
+ M17N_OBJECT_UNREF (plist);
return frame;
}