1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 20:38:08 +01:00

fixed font bug in WINGs

font panel problems
po file problems
misc bugs
This commit is contained in:
kojima
1999-09-22 02:09:42 +00:00
parent 54e241d2fc
commit d5fbe62ddd
15 changed files with 177 additions and 85 deletions

View File

@@ -1,3 +1,9 @@
changes since wmaker 0.61.0:
............................
- added WMGetTextFieldFont()
changes since wmaker 0.60.0:
............................

View File

@@ -45,7 +45,7 @@ testcolorpanel_LDADD = libWINGs.a $(LIBLIST)
testnot_SOURCES = testnot.c
testnot_LDADD = libWUtil.a @LIBRARY_SEARCH_PATH@ @LIBPL@
testnot_LDADD = libWUtil.a $(LIBLIST)
wmquery_SOURCES = wmquery.c

View File

@@ -131,7 +131,7 @@ testcolorpanel_LDADD = libWINGs.a $(LIBLIST)
testnot_SOURCES = testnot.c
testnot_LDADD = libWUtil.a @LIBRARY_SEARCH_PATH@ @LIBPL@
testnot_LDADD = libWUtil.a $(LIBLIST)
wmquery_SOURCES = wmquery.c
@@ -197,7 +197,7 @@ testcolorpanel_DEPENDENCIES = libWINGs.a \
$(top_builddir)/wrlib/libwraster.la
testcolorpanel_LDFLAGS =
testnot_OBJECTS = testnot.o
testnot_DEPENDENCIES = libWUtil.a
testnot_DEPENDENCIES = libWUtil.a $(top_builddir)/wrlib/libwraster.la
testnot_LDFLAGS =
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)

View File

@@ -64,6 +64,7 @@ Widgets provided by WINGs:
- file panel
- color panel
- alert panel
- font panel
Planned:
--------
@@ -74,8 +75,6 @@ Planned:
If you think you can code the following, please do. They are needed by
WPrefs.app, but the number of other things I have to do is huge.
- font panel (the UI part is done. Might require a rewrite of the font list
retrievel code. Might also require a WMFontManager)
- input method support (XIM). I have no idea of how to code it. People who use
different characters than ASCII will have trouble editing menus without it...

View File

@@ -474,6 +474,16 @@ typedef struct WMTabViewDelegate {
/* ...................................................................... */
WMRange wmkrange(int start, int count);
WMPoint wmkpoint(int x, int y);
WMSize wmksize(unsigned int width, unsigned int height);
/* ....................................................................... */
@@ -884,6 +894,8 @@ void WMSetTextFieldAlignment(WMTextField *tPtr, WMAlignment alignment);
void WMSetTextFieldFont(WMTextField *tPtr, WMFont *font);
WMFont *WMGetTextFieldFont(WMTextField *tPtr);
void WMSetTextFieldBordered(WMTextField *tPtr, Bool bordered);
void WMSetTextFieldBeveled(WMTextField *tPtr, Bool flag);

View File

@@ -346,7 +346,12 @@ makeFontSetOfSize(char *fontset, int size)
end = 0;
tmp = wmalloc(end + strlen(f) + 8);
sprintf(tmp + end, f, size);
if (end != 0) {
sprintf(tmp, "%s,", newfs);
sprintf(tmp + end + 1, f, size);
} else {
sprintf(tmp + end, f, size);
}
if (newfs)
free(newfs);

View File

@@ -27,7 +27,6 @@ typedef struct W_FontPanel {
WMList *sizLs;
WMButton *revertB;
WMButton *previewB;
WMButton *setB;
proplist_t fdb;
@@ -71,6 +70,7 @@ static int scalableFontSizes[] = {
static void getSelectedFont(FontPanel *panel, char buffer[]);
static void arrangeLowerFrame(FontPanel *panel);
@@ -80,9 +80,6 @@ static void typefaceClick(WMWidget *, void *);
static void sizeClick(WMWidget *, void *);
static void previewClick(WMWidget *w, void *data);
static void listFamilies(WMScreen *scr, WMFontPanel *panel);
static void
@@ -107,7 +104,7 @@ notificationObserver(void *self, WMNotification *notif)
WMResizeWidget(panel->split, w, h-BUTTON_SPACE_HEIGHT);
WMMoveWidget(panel->setB, w-80, h-(BUTTON_SPACE_HEIGHT-5));
WMMoveWidget(panel->previewB, w-160, h-(BUTTON_SPACE_HEIGHT-5));
WMMoveWidget(panel->revertB, w-240, h-(BUTTON_SPACE_HEIGHT-5));
} else if (object == WMWidgetView(panel->upperF)) {
@@ -156,7 +153,7 @@ WMGetFontPanel(WMScreen *scr)
memset(panel, 0, sizeof(FontPanel));
panel->win = WMCreateWindow(scr, "fontPanel");
// WMSetWidgetBackgroundColor(panel->win, WMWhiteColor(scr));
/* WMSetWidgetBackgroundColor(panel->win, WMWhiteColor(scr));*/
WMResizeWidget(panel->win, DEF_WIDTH, DEF_HEIGHT);
WMSetWindowMinSize(panel->win, MIN_WIDTH, MIN_HEIGHT);
WMSetViewNotifySizeChanges(WMWidgetView(panel->win), True);
@@ -171,7 +168,7 @@ WMGetFontPanel(WMScreen *scr)
WMSetFrameRelief(panel->upperF, WRFlat);
WMSetViewNotifySizeChanges(WMWidgetView(panel->upperF), True);
panel->lowerF = WMCreateFrame(panel->win);
// WMSetWidgetBackgroundColor(panel->lowerF, WMBlackColor(scr));
/* WMSetWidgetBackgroundColor(panel->lowerF, WMBlackColor(scr));*/
WMSetFrameRelief(panel->lowerF, WRFlat);
WMSetViewNotifySizeChanges(WMWidgetView(panel->lowerF), True);
@@ -239,12 +236,6 @@ WMGetFontPanel(WMScreen *scr)
WMMoveWidget(panel->setB, 240, DEF_HEIGHT - (BUTTON_SPACE_HEIGHT-5));
WMSetButtonText(panel->setB, "Set");
panel->previewB = WMCreateCommandButton(panel->win);
WMResizeWidget(panel->previewB, 70, 24);
WMMoveWidget(panel->previewB, 160, DEF_HEIGHT - (BUTTON_SPACE_HEIGHT-5));
WMSetButtonText(panel->previewB, "Preview");
WMSetButtonAction(panel->previewB, previewClick, panel);
panel->revertB = WMCreateCommandButton(panel->win);
WMResizeWidget(panel->revertB, 70, 24);
WMMoveWidget(panel->revertB, 80, DEF_HEIGHT - (BUTTON_SPACE_HEIGHT-5));
@@ -313,22 +304,34 @@ WMHideFontPanel(WMFontPanel *panel)
void
WMSetFontPanelFont(WMFontPanel *panel, WMFont *font)
{
}
Bool
WMSetFontPanelFontName(WMFontPanel *panel, char *fontName)
{
return True;
}
WMFont*
WMGetFontPanelFont(WMFontPanel *panel)
{
return NULL;
return WMGetTextFieldFont(panel->sampleT);
}
char*
WMGetFontPanelFontName(WMFontPanel *panel)
{
return NULL;
}
char name[256];
getSelectedFont(panel, name);
return wstrdup(name);
}
@@ -571,6 +574,7 @@ addFontToFamily(WMHashTable *families, char fontFields[NUM_FIELDS][256])
Family *fam;
WMBag *family;
family = WMHashGet(families, fontFields[FAMILY]);
if (family) {
@@ -600,7 +604,7 @@ addFontToFamily(WMHashTable *families, char fontFields[NUM_FIELDS][256])
if (enc && reg) {
/* has the same encoding, but the foundry is different */
fam->showRegistry = 1;
fam->showFoundry = 1;
fam = wmalloc(sizeof(Family));
memset(fam, 0, sizeof(Family));
@@ -609,12 +613,11 @@ addFontToFamily(WMHashTable *families, char fontFields[NUM_FIELDS][256])
fam->foundry = wstrdup(fontFields[FOUNDRY]);
fam->registry = wstrdup(fontFields[REGISTRY]);
fam->encoding = wstrdup(fontFields[ENCODING]);
fam->showRegistry = 1;
fam->showFoundry = 1;
addTypefaceToFamily(fam, fontFields);
WMPutInBag(family, fam);
return;
}
}
@@ -628,7 +631,7 @@ addFontToFamily(WMHashTable *families, char fontFields[NUM_FIELDS][256])
if (found) {
/* has the same foundry, but encoding is different */
fam->showFoundry = 1;
fam->showRegistry = 1;
fam = wmalloc(sizeof(Family));
memset(fam, 0, sizeof(Family));
@@ -637,12 +640,11 @@ addFontToFamily(WMHashTable *families, char fontFields[NUM_FIELDS][256])
fam->foundry = wstrdup(fontFields[FOUNDRY]);
fam->registry = wstrdup(fontFields[REGISTRY]);
fam->encoding = wstrdup(fontFields[ENCODING]);
fam->showFoundry = 1;
fam->showRegistry = 1;
addTypefaceToFamily(fam, fontFields);
WMPutInBag(family, fam);
return;
}
}
@@ -660,7 +662,6 @@ addFontToFamily(WMHashTable *families, char fontFields[NUM_FIELDS][256])
addTypefaceToFamily(fam, fontFields);
WMPutInBag(family, fam);
return;
}
@@ -758,6 +759,56 @@ listFamilies(WMScreen *scr, WMFontPanel *panel)
}
static void
getSelectedFont(FontPanel *panel, char buffer[])
{
WMListItem *item;
Family *family;
Typeface *face;
char *size;
item = WMGetListSelectedItem(panel->famLs);
if (!item)
return;
family = (Family*)item->clientData;
item = WMGetListSelectedItem(panel->typLs);
if (!item)
return;
face = (Typeface*)item->clientData;
size = WMGetTextFieldText(panel->sizT);
sprintf(buffer, "-%s-%s-%s-%s-%s-%s-%s-*-*-*-*-*-%s-%s",
family->foundry,
family->name,
face->weight,
face->slant,
face->setWidth,
face->addStyle,
size,
family->registry,
family->encoding);
}
static void
preview(FontPanel *panel)
{
char buffer[256];
WMFont *font;
getSelectedFont(panel, buffer);
font = WMCreateFont(WMWidgetScreen(panel->win), buffer);
if (font) {
WMSetTextFieldFont(panel->sampleT, font);
WMReleaseFont(font);
}
}
static void
@@ -775,7 +826,7 @@ familyClick(WMWidget *w, void *data)
int facei = -1;
int sizei = -1;
/* must try to keep the same type face and size for the new family */
/* must try to keep the same typeface and size for the new family */
item = WMGetListSelectedItem(panel->typLs);
if (item)
oface = wstrdup(item->text);
@@ -853,6 +904,9 @@ familyClick(WMWidget *w, void *data)
if (osize)
free(osize);
preview(panel);
}
@@ -903,6 +957,8 @@ typefaceClick(WMWidget *w, void *data)
if (osize)
free(osize);
preview(panel);
}
@@ -915,49 +971,9 @@ sizeClick(WMWidget *w, void *data)
item = WMGetListSelectedItem(panel->sizLs);
WMSetTextFieldText(panel->sizT, item->text);
WMSelectTextFieldRange(panel->sizT, wmkrange(0, strlen(item->text));
preview(panel);
}
static void
previewClick(WMWidget *w, void *data)
{
FontPanel *panel = (FontPanel*)data;
char buffer[256];
WMListItem *item;
Family *family;
Typeface *face;
char *size;
WMFont *font;
item = WMGetListSelectedItem(panel->famLs);
if (!item)
return;
family = (Family*)item->clientData;
item = WMGetListSelectedItem(panel->typLs);
if (!item)
return;
face = (Typeface*)item->clientData;
size = WMGetTextFieldText(panel->sizT);
sprintf(buffer, "-%s-%s-%s-%s-%s-%s-%s-*-*-*-*-*-%s-%s",
family->foundry,
family->name,
face->weight,
face->slant,
face->setWidth,
face->addStyle,
size,
family->registry,
family->encoding);
font = WMCreateFont(WMWidgetScreen(w), buffer);
if (font) {
WMSetTextFieldFont(panel->sampleT, font);
WMReleaseFont(font);
}
}

View File

@@ -297,3 +297,43 @@ W_PaintTextAndImage(W_View *view, int wrap, GC textGC, W_Font *font,
}
WMRange
wmkrange(int start, int count)
{
WMRange range;
range.position = start;
range.count = count;
return range;
}
WMPoint
wmkpoint(int x, int y)
{
WMPoint point;
point.x = x;
point.y = y;
return point;
}
WMSize
wmksize(unsigned int width, unsigned int height)
{
WMSize size;
size.width = width;
size.height = height;
return size;
}

View File

@@ -604,6 +604,13 @@ WMSetTextFieldFont(WMTextField *tPtr, WMFont *font)
}
WMFont*
WMGetTextFieldFont(WMTextField *tPtr)
{
return tPtr->font;
}
static void
didResizeTextField(W_ViewDelegate *self, WMView *view)

View File

@@ -1,6 +1,6 @@
{
MultiByteText = NO;
SmoothWorkspaceBack = YES;
SmoothWorkspaceBack = NO;
WindozeCycling = NO;
PopupSwitchMenu = NO;
MenuStyle = normal;

View File

@@ -958,7 +958,7 @@ msgstr "Signal %i (%s) erhalten - breche ab...\n"
#: ../src/startup.c:277
msgid "got signal %i - exiting...\n"
msgstr "Signal %i erhalten - breche ab"
msgstr "Signal %i erhalten - breche ab\n"
#: ../src/startup.c:290
msgid "got signal %i (%s)\n"
@@ -1180,7 +1180,7 @@ msgid ""
"To access the window commands menu of a window\n"
"without it's titlebar, press Control+Esc (or the\n"
"equivalent shortcut, if you changed the default\n"
"settings)."
"settings).\n"
msgstr ""
"Die Titelzeile dieses Fensters entfernen.\n"
"Drücken Sie Strg+Esc (oder das entsprechende\n"
@@ -1218,7 +1218,7 @@ msgstr "Immer Oben"
#: ../src/winspector.c:1188
msgid ""
"Keep the window over other windows, not allowing\n"
"them to covert it."
"them to covert it.\n"
msgstr ""
"Halte dieses Fenster über allen anderen. Erlaube keinem\n"
"anderen Fenster, dieses zu überdecken.\n"

View File

@@ -153,11 +153,13 @@ MakeCPPArgs(char *path)
/* put the dir where the menu is being read from to the
* search path */
tmp = wstrdup(path);
buf = strrchr(tmp, '/');
if (buf) *buf = 0; /* trunc filename */
putdef(line, " -I", tmp);
free(tmp);
if (path) {
tmp = wstrdup(path);
buf = strrchr(tmp, '/');
if (buf) *buf = 0; /* trunc filename */
putdef(line, " -I", tmp);
free(tmp);
}
/* this should be done just once, but it works this way */

View File

@@ -2010,6 +2010,7 @@ int req_x, req_y; /* new position of the frame */
#endif
}
void
wWindowUpdateButtonImages(WWindow *wwin)
{

View File

@@ -215,6 +215,10 @@ makeShortcutCommand(WMenu *menu, WMenuEntry *entry)
WMPutInBag(scr->shortcutWindows[index], tmp);
}
} else {
scr->shortcutWindows[index] = WMCreateBag(4);
WMPutInBag(scr->shortcutWindows[index], wwin);
}
wSelectWindow(wwin, !wwin->flags.selected);