parent
0498390726
commit
90bd960b93
204
src/E.h
204
src/E.h
|
@ -323,6 +323,11 @@ int Esnprintf(va_alist);
|
|||
* Types
|
||||
*/
|
||||
|
||||
struct _imageclass;
|
||||
struct _imagestate;
|
||||
struct _textclass;
|
||||
struct _textstate;
|
||||
|
||||
typedef struct _ewin EWin;
|
||||
typedef struct _dialog Dialog;
|
||||
typedef struct _ditem DItem;
|
||||
|
@ -330,19 +335,9 @@ typedef struct _group Group;
|
|||
typedef struct _background Background;
|
||||
typedef struct _ecursor ECursor;
|
||||
typedef struct _efont Efont;
|
||||
typedef struct _textclass TextClass;
|
||||
typedef struct _action Action;
|
||||
typedef struct _actionclass ActionClass;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char type;
|
||||
Pixmap pmap;
|
||||
Pixmap mask;
|
||||
int w, h;
|
||||
}
|
||||
PmapMask;
|
||||
|
||||
typedef struct _client Client;
|
||||
|
||||
typedef struct
|
||||
|
@ -377,106 +372,6 @@ typedef struct
|
|||
}
|
||||
VirtRoot;
|
||||
|
||||
#if ENABLE_COLOR_MODIFIERS
|
||||
typedef struct _modcurve
|
||||
{
|
||||
int num;
|
||||
unsigned char *px;
|
||||
unsigned char *py;
|
||||
unsigned char map[256];
|
||||
}
|
||||
ModCurve;
|
||||
|
||||
typedef struct _colormodifierclass
|
||||
{
|
||||
char *name;
|
||||
ModCurve red, green, blue;
|
||||
unsigned int ref_count;
|
||||
}
|
||||
ColorModifierClass;
|
||||
#endif
|
||||
|
||||
typedef struct _imagestate
|
||||
{
|
||||
char *im_file;
|
||||
char *real_file;
|
||||
char unloadable;
|
||||
char transparent;
|
||||
Imlib_Image *im;
|
||||
Imlib_Border *border;
|
||||
int pixmapfillstyle;
|
||||
XColor bg, hi, lo, hihi, lolo;
|
||||
int bevelstyle;
|
||||
#if ENABLE_COLOR_MODIFIERS
|
||||
ColorModifierClass *colmod;
|
||||
#endif
|
||||
}
|
||||
ImageState;
|
||||
|
||||
typedef struct _ImageStateArray
|
||||
{
|
||||
ImageState *normal;
|
||||
ImageState *hilited;
|
||||
ImageState *clicked;
|
||||
ImageState *disabled;
|
||||
}
|
||||
ImageStateArray;
|
||||
|
||||
typedef struct _imageclass
|
||||
{
|
||||
char *name;
|
||||
ImageStateArray norm, active, sticky, sticky_active;
|
||||
Imlib_Border padding;
|
||||
#if ENABLE_COLOR_MODIFIERS
|
||||
ColorModifierClass *colmod;
|
||||
#endif
|
||||
unsigned int ref_count;
|
||||
}
|
||||
ImageClass;
|
||||
|
||||
#define MODE_VERBATIM 0
|
||||
#define MODE_WRAP_CHAR 1
|
||||
#define MODE_WRAP_WORD 2
|
||||
|
||||
#define FONT_TO_RIGHT 0
|
||||
#define FONT_TO_DOWN 1
|
||||
#define FONT_TO_UP 2
|
||||
#define FONT_TO_LEFT 3
|
||||
|
||||
typedef struct _textstate
|
||||
{
|
||||
char *fontname;
|
||||
struct
|
||||
{
|
||||
char mode;
|
||||
char orientation;
|
||||
} style;
|
||||
XColor fg_col;
|
||||
XColor bg_col;
|
||||
int effect;
|
||||
Efont *efont;
|
||||
XFontStruct *xfont;
|
||||
XFontSet xfontset;
|
||||
int xfontset_ascent;
|
||||
char need_utf8;
|
||||
}
|
||||
TextState;
|
||||
|
||||
struct _textclass
|
||||
{
|
||||
char *name;
|
||||
struct
|
||||
{
|
||||
TextState *normal;
|
||||
TextState *hilited;
|
||||
TextState *clicked;
|
||||
TextState *disabled;
|
||||
}
|
||||
norm , active, sticky, sticky_active;
|
||||
int justification;
|
||||
unsigned int ref_count;
|
||||
};
|
||||
|
||||
typedef struct _constraints
|
||||
{
|
||||
int min, max;
|
||||
|
@ -505,9 +400,9 @@ Geometry;
|
|||
typedef struct _winpart
|
||||
{
|
||||
Geometry geom;
|
||||
ImageClass *iclass;
|
||||
struct _imageclass *iclass;
|
||||
ActionClass *aclass;
|
||||
TextClass *tclass;
|
||||
struct _textclass *tclass;
|
||||
ECursor *ec;
|
||||
signed char ontop;
|
||||
int flags;
|
||||
|
@ -540,8 +435,8 @@ typedef struct _ewinbit
|
|||
char expose;
|
||||
char no_expose;
|
||||
char left;
|
||||
ImageState *is;
|
||||
TextState *ts;
|
||||
struct _imagestate *is;
|
||||
struct _textstate *ts;
|
||||
}
|
||||
EWinBit;
|
||||
|
||||
|
@ -727,11 +622,6 @@ typedef struct
|
|||
#ifdef HAS_XINERAMA
|
||||
char extra_head; /* Not used */
|
||||
#endif
|
||||
#if 0 /* Not used */
|
||||
char primaryicondir;
|
||||
TextClass *icon_textclass;
|
||||
int icon_mode;
|
||||
#endif
|
||||
}
|
||||
EConf;
|
||||
|
||||
|
@ -988,14 +878,14 @@ void BorderIncRefcount(const Border * b);
|
|||
void BorderDecRefcount(const Border * b);
|
||||
const char *BorderGetName(const Border * b);
|
||||
int BorderConfigLoad(FILE * fs);
|
||||
void BorderWinpartAdd(Border * b, ImageClass * ic,
|
||||
ActionClass * aclass, TextClass * tclass,
|
||||
ECursor * ec, char ontop, int flags,
|
||||
char isregion, int wmin, int wmax,
|
||||
int hmin, int hmax, int torigin, int txp,
|
||||
int txa, int typ, int tya, int borigin,
|
||||
int bxp, int bxa, int byp, int bya,
|
||||
char keep_for_shade);
|
||||
void BorderWinpartAdd(Border * b, struct _imageclass *ic,
|
||||
ActionClass * aclass,
|
||||
struct _textclass *tclass, ECursor * ec,
|
||||
char ontop, int flags, char isregion,
|
||||
int wmin, int wmax, int hmin, int hmax,
|
||||
int torigin, int txp, int txa, int typ,
|
||||
int tya, int borigin, int bxp, int bxa,
|
||||
int byp, int bya, char keep_for_shade);
|
||||
void EwinBorderSelect(EWin * ewin);
|
||||
void EwinBorderDetach(EWin * ewin);
|
||||
void EwinBorderSetTo(EWin * ewin, const Border * b);
|
||||
|
@ -1099,8 +989,8 @@ DItem *DialogAddItem(DItem * dii, int type);
|
|||
DItem *DialogItem(Dialog * d);
|
||||
void DialogItemSetCallback(DItem * di, DialogCallbackFunc * func,
|
||||
int val, void *data);
|
||||
void DialogItemSetClass(DItem * di, ImageClass * ic,
|
||||
TextClass * tclass);
|
||||
void DialogItemSetClass(DItem * di, struct _imageclass *ic,
|
||||
struct _textclass *tclass);
|
||||
void DialogItemSetPadding(DItem * di, int left, int right,
|
||||
int top, int bottom);
|
||||
void DialogItemSetFill(DItem * di, char fill_h, char fill_v);
|
||||
|
@ -1432,41 +1322,6 @@ void ICCCM_GetHints(EWin * ewin, Atom atom_change);
|
|||
void ICCCM_SetIconSizes(void);
|
||||
void ICCCM_ProcessPropertyChange(EWin * ewin, Atom atom_change);
|
||||
|
||||
/* iclass.c */
|
||||
int ImageclassConfigLoad(FILE * fs);
|
||||
|
||||
#ifdef ENABLE_THEME_TRANSPARENCY
|
||||
void TransparencySet(int transparency);
|
||||
int TransparencyEnabled(void);
|
||||
int TransparencyUpdateNeeded(void);
|
||||
int ImageclassIsTransparent(ImageClass * ic);
|
||||
#else
|
||||
#define TransparencyEnabled() 0
|
||||
#define TransparencyUpdateNeeded() 0
|
||||
#define ImageclassIsTransparent(ic) 0
|
||||
#endif
|
||||
ImageState *ImageclassGetImageState(ImageClass * ic, int state,
|
||||
int active, int sticky);
|
||||
ImageClass *ImageclassCreateSimple(const char *name, const char *image);
|
||||
ImageClass *ImageclassFind(const char *name, int fallback);
|
||||
Imlib_Image *ImageclassGetImage(ImageClass * ic, int active, int sticky,
|
||||
int state);
|
||||
Pixmap ImageclassApplySimple(ImageClass * ic, Window win,
|
||||
Drawable draw, int state, int x,
|
||||
int y, int w, int h);
|
||||
void ImageclassApply(ImageClass * ic, Window win, int w, int h,
|
||||
int active, int sticky, int state,
|
||||
char expose, int image_type);
|
||||
void ImageclassApplyCopy(ImageClass * ic, Window win, int w,
|
||||
int h, int active, int sticky,
|
||||
int state, PmapMask * pmm,
|
||||
int make_mask, int image_type);
|
||||
void FreePmapMask(PmapMask * pmm);
|
||||
void ITApply(Window win, ImageClass * ic, ImageState * is, int w,
|
||||
int h, int state, int active, int sticky,
|
||||
char expose, int image_type, TextClass * tc,
|
||||
TextState * ts, const char *text);
|
||||
|
||||
/* ipc.c */
|
||||
void __PRINTF__ IpcPrintf(const char *fmt, ...);
|
||||
int HandleIPC(const char *params, Client * c);
|
||||
|
@ -1633,27 +1488,6 @@ void SoundPlay(const char *name);
|
|||
void StartupWindowsCreate(void);
|
||||
void StartupWindowsOpen(void);
|
||||
|
||||
/* tclass.c */
|
||||
int TextclassConfigLoad(FILE * fs);
|
||||
TextClass *TextclassFind(const char *name, int fallback);
|
||||
void TextclassApply(ImageClass * ic, Window win, int w,
|
||||
int h, int active, int sticky, int state,
|
||||
char expose, TextClass * tclass,
|
||||
const char *text);
|
||||
|
||||
/* text.c */
|
||||
TextState *TextclassGetTextState(TextClass * tclass, int state,
|
||||
int active, int sticky);
|
||||
void TextstateDrawText(TextState * ts, Window win,
|
||||
const char *text, int x, int y, int w,
|
||||
int h, int fsize, int justification);
|
||||
void TextSize(TextClass * tclass, int active, int sticky,
|
||||
int state, const char *text, int *width,
|
||||
int *height, int fsize);
|
||||
void TextDraw(TextClass * tclass, Window win, int active,
|
||||
int sticky, int state, const char *text, int x,
|
||||
int y, int w, int h, int fsize, int justification);
|
||||
|
||||
/* theme.c */
|
||||
void ThemePathFind(void);
|
||||
char **ThemesList(int *num);
|
||||
|
|
|
@ -66,6 +66,7 @@ e16_SOURCES = \
|
|||
hiwin.h \
|
||||
icccm.c \
|
||||
iclass.c \
|
||||
iclass.h \
|
||||
iconify.c \
|
||||
icons.c \
|
||||
icons.h \
|
||||
|
@ -97,6 +98,7 @@ e16_SOURCES = \
|
|||
stacking.c \
|
||||
startup.c \
|
||||
tclass.c \
|
||||
tclass.h \
|
||||
text.c \
|
||||
theme.c \
|
||||
timers.c \
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#include "E.h"
|
||||
#include "desktops.h"
|
||||
#include "emodule.h"
|
||||
#include "iclass.h"
|
||||
#include "tclass.h"
|
||||
#include "xwin.h"
|
||||
|
||||
typedef struct
|
||||
|
|
|
@ -23,7 +23,9 @@
|
|||
*/
|
||||
#include "E.h"
|
||||
#include "ewins.h"
|
||||
#include "iclass.h"
|
||||
#include "snaps.h"
|
||||
#include "tclass.h"
|
||||
#include "tooltips.h"
|
||||
#include "xwin.h"
|
||||
#include <sys/time.h>
|
||||
|
@ -254,6 +256,7 @@ BorderWinpartCalc(EWin * ewin, int i, int ww, int hh)
|
|||
int dummywidth, wmax, wmin;
|
||||
ImageClass *iclass;
|
||||
TextClass *tclass;
|
||||
Imlib_Border *pad;
|
||||
|
||||
/*
|
||||
* calculate width before height, because we need it in order to
|
||||
|
@ -274,13 +277,14 @@ BorderWinpartCalc(EWin * ewin, int i, int ww, int hh)
|
|||
}
|
||||
iclass = ewin->border->part[i].iclass;
|
||||
tclass = ewin->border->part[i].tclass;
|
||||
pad = ImageclassGetPadding(iclass);
|
||||
TextSize(tclass, ewin->state.active, EoIsSticky(ewin),
|
||||
ewin->bits[i].state, EwinGetName(ewin), &max, &dummywidth,
|
||||
w - (iclass->padding.top + iclass->padding.bottom));
|
||||
max += iclass->padding.left + iclass->padding.right;
|
||||
w - (pad->top + pad->bottom));
|
||||
max += pad->left + pad->right;
|
||||
if (h > max)
|
||||
{
|
||||
y = y + (((h - max) * tclass->justification) >> 10);
|
||||
y = y + (((h - max) * TextclassGetJustification(tclass)) >> 10);
|
||||
h = max;
|
||||
}
|
||||
if (h < min)
|
||||
|
@ -315,21 +319,22 @@ BorderWinpartCalc(EWin * ewin, int i, int ww, int hh)
|
|||
if (max == 0 && ewin->border->part[i].flags == FLAG_TITLE)
|
||||
{
|
||||
int dummyheight;
|
||||
|
||||
ImageClass *iclass;
|
||||
TextClass *tclass;
|
||||
Imlib_Border *pad;
|
||||
|
||||
iclass = ewin->border->part[i].iclass;
|
||||
tclass = ewin->border->part[i].tclass;
|
||||
pad = ImageclassGetPadding(iclass);
|
||||
TextSize(tclass, ewin->state.active, EoIsSticky(ewin),
|
||||
ewin->bits[i].state, EwinGetName(ewin), &max,
|
||||
&dummyheight,
|
||||
h - (iclass->padding.top + iclass->padding.bottom));
|
||||
max += iclass->padding.left + iclass->padding.right;
|
||||
&dummyheight, h - (pad->top + pad->bottom));
|
||||
max += pad->left + pad->right;
|
||||
|
||||
if (w > max)
|
||||
{
|
||||
x = x + (((w - max) * tclass->justification) >> 10);
|
||||
x = x +
|
||||
(((w - max) * TextclassGetJustification(tclass)) >> 10);
|
||||
w = max;
|
||||
}
|
||||
}
|
||||
|
@ -644,9 +649,9 @@ BorderDestroy(Border * b)
|
|||
for (i = 0; i < b->num_winparts; i++)
|
||||
{
|
||||
if (b->part[i].iclass)
|
||||
b->part[i].iclass->ref_count--;
|
||||
ImageclassDecRefcount(b->part[i].iclass);
|
||||
if (b->part[i].tclass)
|
||||
b->part[i].tclass->ref_count--;
|
||||
TextclassDecRefcount(b->part[i].tclass);
|
||||
if (b->part[i].aclass)
|
||||
ActionclassDecRefcount(b->part[i].aclass);
|
||||
if (b->part[i].ec)
|
||||
|
@ -685,15 +690,15 @@ BorderWinpartAdd(Border * b, ImageClass * iclass, ActionClass * aclass,
|
|||
|
||||
b->part[n - 1].iclass = iclass;
|
||||
if (iclass)
|
||||
iclass->ref_count++;
|
||||
ImageclassIncRefcount(iclass);
|
||||
|
||||
b->part[n - 1].aclass = aclass;
|
||||
if (aclass)
|
||||
ActionclassDecRefcount(aclass);
|
||||
ActionclassIncRefcount(aclass);
|
||||
|
||||
b->part[n - 1].tclass = tclass;
|
||||
if (tclass)
|
||||
tclass->ref_count++;
|
||||
TextclassIncRefcount(tclass);
|
||||
|
||||
b->part[n - 1].ec = ec;
|
||||
if (ec)
|
||||
|
|
|
@ -124,7 +124,7 @@ ButtonCreate(const char *name, int id, ImageClass * iclass,
|
|||
if (!b->iclass)
|
||||
b->iclass = ImageclassFind(NULL, 0);
|
||||
if (b->iclass)
|
||||
b->iclass->ref_count++;
|
||||
ImageclassIncRefcount(b->iclass);
|
||||
|
||||
b->aclass = aclass;
|
||||
if (b->aclass)
|
||||
|
@ -134,7 +134,7 @@ ButtonCreate(const char *name, int id, ImageClass * iclass,
|
|||
if (!b->tclass && b->label)
|
||||
b->tclass = TextclassFind(NULL, 0);
|
||||
if (b->tclass)
|
||||
b->tclass->ref_count++;
|
||||
TextclassIncRefcount(b->tclass);
|
||||
|
||||
b->flags = flags;
|
||||
b->geom.width.min = minw;
|
||||
|
@ -186,13 +186,13 @@ ButtonDestroy(Button * b)
|
|||
EDestroyWindow(EoGetWin(b));
|
||||
|
||||
if (b->iclass)
|
||||
b->iclass->ref_count--;
|
||||
ImageclassDecRefcount(b->iclass);
|
||||
|
||||
if (b->aclass)
|
||||
ActionclassDecRefcount(b->aclass);
|
||||
|
||||
if (b->tclass)
|
||||
b->tclass->ref_count--;
|
||||
TextclassDecRefcount(b->tclass);
|
||||
|
||||
if (b->label)
|
||||
Efree(b->label);
|
||||
|
@ -212,21 +212,13 @@ ButtonCalc(Button * b)
|
|||
h = 32;
|
||||
if (b->geom.size_from_image)
|
||||
{
|
||||
if ((b->iclass) && (b->iclass->norm.normal->im_file))
|
||||
im = ImageclassGetImage(b->iclass, 0, 0, 0);
|
||||
if (im)
|
||||
{
|
||||
im = ELoadImage(b->iclass->norm.normal->im_file);
|
||||
if (im)
|
||||
{
|
||||
imlib_context_set_image(im);
|
||||
w = imlib_image_get_width();
|
||||
h = imlib_image_get_height();
|
||||
imlib_free_image();
|
||||
}
|
||||
else
|
||||
{
|
||||
w = 32;
|
||||
h = 32;
|
||||
}
|
||||
imlib_context_set_image(im);
|
||||
w = imlib_image_get_width();
|
||||
h = imlib_image_get_height();
|
||||
imlib_free_image();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -935,7 +927,7 @@ ButtonsConfigSave(void)
|
|||
fprintf(fs, "4 999\n");
|
||||
fprintf(fs, "100 %s\n", EoGetName(blst[i]));
|
||||
if (blst[i]->iclass)
|
||||
fprintf(fs, "12 %s\n", blst[i]->iclass->name);
|
||||
fprintf(fs, "12 %s\n", ImageclassGetName(blst[i]->iclass));
|
||||
if (blst[i]->aclass)
|
||||
fprintf(fs, "11 %s\n", ActionclassGetName(blst[i]->aclass));
|
||||
if (EoGetLayer(blst[i]) >= 0)
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
#define _BUTTONS_H_
|
||||
|
||||
#include "eobj.h"
|
||||
#include "iclass.h"
|
||||
#include "tclass.h"
|
||||
|
||||
typedef struct _button Button;
|
||||
struct _desk;
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include "desktops.h"
|
||||
#include "eobj.h"
|
||||
#include "ewins.h"
|
||||
#include "iclass.h"
|
||||
#include "tclass.h"
|
||||
#include "xwin.h"
|
||||
|
||||
static EObj *coord_eo = NULL;
|
||||
|
@ -38,6 +40,7 @@ CoordsShow(EWin * ewin)
|
|||
int x, y, w, h;
|
||||
int cx, cy, cw, ch;
|
||||
EObj *eo = coord_eo;
|
||||
Imlib_Border *pad;
|
||||
|
||||
if (!Conf.movres.mode_info)
|
||||
return;
|
||||
|
@ -58,8 +61,9 @@ CoordsShow(EWin * ewin)
|
|||
|
||||
Esnprintf(s, sizeof(s), "%i x %i (%i, %i)", w, h, x, y);
|
||||
TextSize(tc, 0, 0, 0, s, &cw, &ch, 17);
|
||||
cw += ic->padding.left + ic->padding.right;
|
||||
ch += ic->padding.top + ic->padding.bottom;
|
||||
pad = ImageclassGetPadding(ic);
|
||||
cw += pad->left + pad->right;
|
||||
ch += pad->top + pad->bottom;
|
||||
|
||||
if (Mode.mode == MODE_MOVE)
|
||||
md = Conf.movres.mode_move;
|
||||
|
|
310
src/dialog.c
310
src/dialog.c
|
@ -23,6 +23,8 @@
|
|||
*/
|
||||
#include "E.h"
|
||||
#include "ewins.h"
|
||||
#include "iclass.h"
|
||||
#include "tclass.h"
|
||||
#include "xwin.h"
|
||||
|
||||
#define DEBUG_DIALOGS 0
|
||||
|
@ -230,11 +232,11 @@ DialogCreate(const char *name)
|
|||
|
||||
d->tclass = TextclassFind("DIALOG", 1);
|
||||
if (d->tclass)
|
||||
d->tclass->ref_count++;
|
||||
TextclassIncRefcount(d->tclass);
|
||||
|
||||
d->iclass = ImageclassFind("DIALOG", 1);
|
||||
if (d->iclass)
|
||||
d->iclass->ref_count++;
|
||||
ImageclassIncRefcount(d->iclass);
|
||||
|
||||
d->xu1 = d->yu1 = 99999;
|
||||
d->xu2 = d->yu2 = 0;
|
||||
|
@ -248,9 +250,9 @@ FreeDButton(DButton * db)
|
|||
if (db->text)
|
||||
Efree(db->text);
|
||||
if (db->iclass)
|
||||
db->iclass->ref_count--;
|
||||
ImageclassDecRefcount(db->iclass);
|
||||
if (db->tclass)
|
||||
db->tclass->ref_count--;
|
||||
TextclassDecRefcount(db->tclass);
|
||||
Efree(db);
|
||||
}
|
||||
|
||||
|
@ -274,9 +276,9 @@ DialogDestroy(Dialog * d)
|
|||
if (d->item)
|
||||
DialogFreeItem(d->item);
|
||||
if (d->iclass)
|
||||
d->iclass->ref_count--;
|
||||
ImageclassDecRefcount(d->iclass);
|
||||
if (d->tclass)
|
||||
d->tclass->ref_count--;
|
||||
TextclassDecRefcount(d->tclass);
|
||||
if (d->keybindings)
|
||||
Efree(d->keybindings);
|
||||
|
||||
|
@ -289,6 +291,7 @@ void
|
|||
DialogSetText(Dialog * d, const char *text)
|
||||
{
|
||||
int w, h;
|
||||
Imlib_Border *pad;
|
||||
|
||||
if (d->text)
|
||||
Efree(d->text);
|
||||
|
@ -298,8 +301,9 @@ DialogSetText(Dialog * d, const char *text)
|
|||
return;
|
||||
|
||||
TextSize(d->tclass, 0, 0, STATE_NORMAL, text, &w, &h, 17);
|
||||
d->w = w + d->iclass->padding.left + d->iclass->padding.right;
|
||||
d->h = h + d->iclass->padding.top + d->iclass->padding.bottom;
|
||||
pad = ImageclassGetPadding(d->iclass);
|
||||
d->w = w + pad->left + pad->right;
|
||||
d->h = h + pad->top + pad->bottom;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -335,6 +339,7 @@ DialogAddButton(Dialog * d, const char *text, DialogCallbackFunc * func,
|
|||
{
|
||||
DButton *db;
|
||||
int w, h;
|
||||
Imlib_Border *pad;
|
||||
|
||||
db = Emalloc(sizeof(DButton));
|
||||
|
||||
|
@ -359,15 +364,16 @@ DialogAddButton(Dialog * d, const char *text, DialogCallbackFunc * func,
|
|||
|
||||
db->tclass = TextclassFind("DIALOG_BUTTON", 1);
|
||||
if (db->tclass)
|
||||
db->tclass->ref_count++;
|
||||
TextclassIncRefcount(db->tclass);
|
||||
|
||||
db->iclass = ImageclassFind("DIALOG_BUTTON", 1);
|
||||
if (db->iclass)
|
||||
db->iclass->ref_count++;
|
||||
ImageclassIncRefcount(db->iclass);
|
||||
|
||||
TextSize(db->tclass, 0, 0, STATE_NORMAL, text, &w, &h, 17);
|
||||
db->h = h + db->iclass->padding.top + db->iclass->padding.bottom;
|
||||
db->w = w + db->iclass->padding.left + db->iclass->padding.right;
|
||||
pad = ImageclassGetPadding(db->iclass);
|
||||
db->h = h + pad->top + pad->bottom;
|
||||
db->w = w + pad->left + pad->right;
|
||||
if (Conf.dialogs.button_image && db->image)
|
||||
db->w += h + 2;
|
||||
|
||||
|
@ -424,20 +430,20 @@ DialogDrawButton(Dialog * d __UNUSED__, DButton * db)
|
|||
if (im)
|
||||
{
|
||||
ImageClass *ic = db->iclass;
|
||||
Imlib_Border *pad;
|
||||
int h;
|
||||
|
||||
h = db->h - (ic->padding.top + ic->padding.bottom);
|
||||
|
||||
pad = ImageclassGetPadding(ic);
|
||||
h = db->h - (pad->top + pad->bottom);
|
||||
TextDraw(db->tclass, db->win, 0, 0, state, db->text,
|
||||
h + 2 + ic->padding.left, ic->padding.top,
|
||||
db->w - (h + 2 + ic->padding.left + ic->padding.right),
|
||||
h, h, db->tclass->justification);
|
||||
h + 2 + pad->left, pad->top,
|
||||
db->w - (h + 2 + pad->left + pad->right),
|
||||
h, h, TextclassGetJustification(db->tclass));
|
||||
|
||||
imlib_context_set_image(im);
|
||||
imlib_context_set_drawable(db->win);
|
||||
imlib_context_set_blend(1);
|
||||
imlib_render_image_on_drawable_at_size(ic->padding.left,
|
||||
ic->padding.top, h, h);
|
||||
imlib_render_image_on_drawable_at_size(pad->left, pad->top, h, h);
|
||||
imlib_context_set_blend(0);
|
||||
imlib_free_image();
|
||||
}
|
||||
|
@ -541,6 +547,7 @@ ShowDialog(Dialog * d)
|
|||
{
|
||||
int i, w, h, mw, mh;
|
||||
EWin *ewin;
|
||||
Imlib_Border *pad;
|
||||
|
||||
if (d->title)
|
||||
{
|
||||
|
@ -564,6 +571,7 @@ ShowDialog(Dialog * d)
|
|||
if (d->item)
|
||||
DialogItemsRealize(d);
|
||||
|
||||
pad = ImageclassGetPadding(d->iclass);
|
||||
w = d->w;
|
||||
h = d->h;
|
||||
mw = 0;
|
||||
|
@ -575,27 +583,21 @@ ShowDialog(Dialog * d)
|
|||
if (d->button[i]->h > mh)
|
||||
mh = d->button[i]->h;
|
||||
}
|
||||
h += d->iclass->padding.top + d->iclass->padding.bottom + mh;
|
||||
h += pad->top + pad->bottom + mh;
|
||||
|
||||
if ((d->iclass->padding.left + d->iclass->padding.right +
|
||||
(d->num_buttons *
|
||||
(mw + d->iclass->padding.left + d->iclass->padding.right))) > w)
|
||||
w = d->iclass->padding.left + d->iclass->padding.right +
|
||||
(d->num_buttons *
|
||||
(mw + d->iclass->padding.left + d->iclass->padding.right));
|
||||
if ((pad->left + pad->right +
|
||||
(d->num_buttons * (mw + pad->left + pad->right))) > w)
|
||||
w = pad->left + pad->right +
|
||||
(d->num_buttons * (mw + pad->left + pad->right));
|
||||
|
||||
for (i = 0; i < d->num_buttons; i++)
|
||||
{
|
||||
d->button[i]->x =
|
||||
(((w
|
||||
- (d->iclass->padding.left + d->iclass->padding.right)) -
|
||||
(d->num_buttons *
|
||||
(mw + d->iclass->padding.left +
|
||||
d->iclass->padding.right))) / 2) + d->iclass->padding.left +
|
||||
(i * (mw + d->iclass->padding.left + d->iclass->padding.right)) +
|
||||
d->iclass->padding.left;
|
||||
d->button[i]->y =
|
||||
d->h - d->iclass->padding.bottom + d->iclass->padding.top;
|
||||
(((w - (pad->left + pad->right)) -
|
||||
(d->num_buttons * (mw + pad->left +
|
||||
pad->right))) / 2) + pad->left +
|
||||
(i * (mw + pad->left + pad->right)) + pad->left;
|
||||
d->button[i]->y = d->h - pad->bottom + pad->top;
|
||||
|
||||
d->button[i]->w = mw;
|
||||
d->button[i]->h = mh;
|
||||
|
@ -797,21 +799,23 @@ DialogItemSetCallback(DItem * di, DialogCallbackFunc * func, int val,
|
|||
di->data = data;
|
||||
}
|
||||
|
||||
#if 0 /* Unused */
|
||||
void
|
||||
DialogItemSetClass(DItem * di, ImageClass * iclass, TextClass * tclass)
|
||||
{
|
||||
if (di->iclass)
|
||||
di->iclass->ref_count--;
|
||||
ImageclassDecRefcount(di->iclass);
|
||||
di->iclass = iclass;
|
||||
if (di->iclass)
|
||||
di->iclass->ref_count++;
|
||||
ImageclassIncRefcount(di->iclass);
|
||||
|
||||
if (di->tclass)
|
||||
di->tclass->ref_count--;
|
||||
TextclassDecRefcount(di->tclass);
|
||||
di->tclass = tclass;
|
||||
if (di->tclass)
|
||||
di->tclass->ref_count++;
|
||||
TextclassIncRefcount(di->tclass);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
DialogItemSetPadding(DItem * di, int left, int right, int top, int bottom)
|
||||
|
@ -861,6 +865,8 @@ DialogRealizeItem(Dialog * d, DItem * di)
|
|||
const char *def = NULL;
|
||||
int iw = 0, ih = 0;
|
||||
int register_win_callback;
|
||||
Imlib_Image *im;
|
||||
Imlib_Border *pad;
|
||||
|
||||
if (di->type == DITEM_BUTTON)
|
||||
{
|
||||
|
@ -903,9 +909,9 @@ DialogRealizeItem(Dialog * d, DItem * di)
|
|||
di->iclass = ImageclassFind(def, 1);
|
||||
}
|
||||
if (di->tclass)
|
||||
di->tclass->ref_count++;
|
||||
TextclassIncRefcount(di->tclass);
|
||||
if (di->iclass)
|
||||
di->iclass->ref_count++;
|
||||
ImageclassIncRefcount(di->iclass);
|
||||
|
||||
if (di->type == DITEM_TABLE)
|
||||
{
|
||||
|
@ -954,21 +960,16 @@ DialogRealizeItem(Dialog * d, DItem * di)
|
|||
}
|
||||
}
|
||||
|
||||
if (di->item.slider.ic_base->norm.normal->im_file)
|
||||
im = ImageclassGetImage(di->item.slider.ic_base, 0, 0, 0);
|
||||
if (im)
|
||||
{
|
||||
Imlib_Image *im;
|
||||
|
||||
im = ELoadImage(di->item.slider.ic_base->norm.normal->im_file);
|
||||
if (im)
|
||||
{
|
||||
imlib_context_set_image(im);
|
||||
di->item.slider.base_orig_w = imlib_image_get_width();
|
||||
di->item.slider.base_orig_h = imlib_image_get_height();
|
||||
imlib_free_image();
|
||||
}
|
||||
imlib_context_set_image(im);
|
||||
di->item.slider.base_orig_w = imlib_image_get_width();
|
||||
di->item.slider.base_orig_h = imlib_image_get_height();
|
||||
imlib_free_image();
|
||||
}
|
||||
if (di->item.slider.ic_base)
|
||||
di->item.slider.ic_base->ref_count++;
|
||||
ImageclassIncRefcount(di->item.slider.ic_base);
|
||||
|
||||
if (!di->item.slider.ic_knob)
|
||||
{
|
||||
|
@ -984,20 +985,15 @@ DialogRealizeItem(Dialog * d, DItem * di)
|
|||
}
|
||||
}
|
||||
if (di->item.slider.ic_knob)
|
||||
di->item.slider.ic_knob->ref_count++;
|
||||
ImageclassIncRefcount(di->item.slider.ic_knob);
|
||||
|
||||
if (di->item.slider.ic_knob->norm.normal->im_file)
|
||||
im = ImageclassGetImage(di->item.slider.ic_knob, 0, 0, 0);
|
||||
if (im)
|
||||
{
|
||||
Imlib_Image *im;
|
||||
|
||||
im = ELoadImage(di->item.slider.ic_knob->norm.normal->im_file);
|
||||
if (im)
|
||||
{
|
||||
imlib_context_set_image(im);
|
||||
di->item.slider.knob_orig_w = imlib_image_get_width();
|
||||
di->item.slider.knob_orig_h = imlib_image_get_height();
|
||||
imlib_free_image();
|
||||
}
|
||||
imlib_context_set_image(im);
|
||||
di->item.slider.knob_orig_w = imlib_image_get_width();
|
||||
di->item.slider.knob_orig_h = imlib_image_get_height();
|
||||
imlib_free_image();
|
||||
}
|
||||
if (!di->item.slider.ic_border)
|
||||
{
|
||||
|
@ -1015,46 +1011,38 @@ DialogRealizeItem(Dialog * d, DItem * di)
|
|||
}
|
||||
if (di->item.slider.ic_border)
|
||||
{
|
||||
if (di->item.slider.ic_border->norm.normal->im_file)
|
||||
im = ImageclassGetImage(di->item.slider.ic_border, 0, 0, 0);
|
||||
if (im)
|
||||
{
|
||||
Imlib_Image *im;
|
||||
|
||||
im = ELoadImage(di->item.slider.ic_border->norm.
|
||||
normal->im_file);
|
||||
if (im)
|
||||
{
|
||||
imlib_context_set_image(im);
|
||||
di->item.slider.border_orig_w = imlib_image_get_width();
|
||||
di->item.slider.border_orig_h = imlib_image_get_height();
|
||||
imlib_free_image();
|
||||
di->item.slider.border_win =
|
||||
ECreateWindow(d->win, -20, -20, 2, 2, 0);
|
||||
EMapWindow(di->item.slider.border_win);
|
||||
}
|
||||
imlib_context_set_image(im);
|
||||
di->item.slider.border_orig_w = imlib_image_get_width();
|
||||
di->item.slider.border_orig_h = imlib_image_get_height();
|
||||
imlib_free_image();
|
||||
di->item.slider.border_win =
|
||||
ECreateWindow(d->win, -20, -20, 2, 2, 0);
|
||||
EMapWindow(di->item.slider.border_win);
|
||||
}
|
||||
di->item.slider.ic_border->ref_count++;
|
||||
ImageclassIncRefcount(di->item.slider.ic_border);
|
||||
}
|
||||
pad = ImageclassGetPadding(di->item.slider.ic_base);
|
||||
if (di->item.slider.horizontal)
|
||||
{
|
||||
iw = di->item.slider.min_length +
|
||||
di->item.slider.ic_base->padding.left +
|
||||
di->item.slider.ic_base->padding.right;
|
||||
iw = di->item.slider.min_length + pad->left + pad->right;
|
||||
ih = di->item.slider.base_orig_h;
|
||||
}
|
||||
else
|
||||
{
|
||||
iw = di->item.slider.base_orig_w;
|
||||
ih = di->item.slider.min_length +
|
||||
di->item.slider.ic_base->padding.top +
|
||||
di->item.slider.ic_base->padding.bottom;
|
||||
ih = di->item.slider.min_length + pad->top + pad->bottom;
|
||||
}
|
||||
di->w = iw;
|
||||
di->h = ih;
|
||||
break;
|
||||
case DITEM_BUTTON:
|
||||
pad = ImageclassGetPadding(di->iclass);
|
||||
TextSize(di->tclass, 0, 0, STATE_NORMAL, di->text, &iw, &ih, 17);
|
||||
iw += di->iclass->padding.left + di->iclass->padding.right;
|
||||
ih += di->iclass->padding.top + di->iclass->padding.bottom;
|
||||
iw += pad->left + pad->right;
|
||||
ih += pad->top + pad->bottom;
|
||||
di->win = ECreateWindow(d->win, -20, -20, 2, 2, 0);
|
||||
EMapWindow(di->win);
|
||||
ESelectInput(di->win,
|
||||
|
@ -1064,10 +1052,11 @@ DialogRealizeItem(Dialog * d, DItem * di)
|
|||
di->h = ih;
|
||||
break;
|
||||
case DITEM_AREA:
|
||||
pad = ImageclassGetPadding(di->iclass);
|
||||
iw = di->item.area.w;
|
||||
ih = di->item.area.h;
|
||||
iw += di->iclass->padding.left + di->iclass->padding.right;
|
||||
ih += di->iclass->padding.top + di->iclass->padding.bottom;
|
||||
iw += pad->left + pad->right;
|
||||
ih += pad->top + pad->bottom;
|
||||
di->win = ECreateWindow(d->win, -20, -20, 2, 2, 0);
|
||||
EMapWindow(di->win);
|
||||
ESelectInput(di->win, ExposureMask);
|
||||
|
@ -1081,23 +1070,19 @@ DialogRealizeItem(Dialog * d, DItem * di)
|
|||
di->h = ih;
|
||||
break;
|
||||
case DITEM_CHECKBUTTON:
|
||||
if (di->iclass->norm.normal->im_file)
|
||||
pad = ImageclassGetPadding(di->iclass);
|
||||
im = ImageclassGetImage(di->iclass, 0, 0, 0);
|
||||
if (im)
|
||||
{
|
||||
Imlib_Image *im;
|
||||
|
||||
im = ELoadImage(di->iclass->norm.normal->im_file);
|
||||
if (im)
|
||||
{
|
||||
imlib_context_set_image(im);
|
||||
di->item.check_button.check_orig_w = imlib_image_get_width();
|
||||
di->item.check_button.check_orig_h = imlib_image_get_height();
|
||||
imlib_free_image();
|
||||
}
|
||||
imlib_context_set_image(im);
|
||||
di->item.check_button.check_orig_w = imlib_image_get_width();
|
||||
di->item.check_button.check_orig_h = imlib_image_get_height();
|
||||
imlib_free_image();
|
||||
}
|
||||
TextSize(di->tclass, 0, 0, STATE_NORMAL, di->text, &iw, &ih, 17);
|
||||
if (ih < di->item.check_button.check_orig_h)
|
||||
ih = di->item.check_button.check_orig_h;
|
||||
iw += di->item.check_button.check_orig_w + di->iclass->padding.left;
|
||||
iw += di->item.check_button.check_orig_w + pad->left;
|
||||
di->item.check_button.check_win =
|
||||
ECreateWindow(d->win, -20, -20, 2, 2, 0);
|
||||
di->win = ECreateEventWindow(d->win, -20, -20, 2, 2);
|
||||
|
@ -1115,34 +1100,31 @@ DialogRealizeItem(Dialog * d, DItem * di)
|
|||
di->h = ih;
|
||||
break;
|
||||
case DITEM_IMAGE:
|
||||
{
|
||||
Imlib_Image *im;
|
||||
im = ELoadImage(di->item.image.image);
|
||||
if (im)
|
||||
{
|
||||
Pixmap pmap = 0, mask = 0;
|
||||
|
||||
im = ELoadImage(di->item.image.image);
|
||||
if (im)
|
||||
{
|
||||
Pixmap pmap = 0, mask = 0;
|
||||
|
||||
imlib_context_set_image(im);
|
||||
iw = imlib_image_get_width();
|
||||
ih = imlib_image_get_height();
|
||||
di->win = ECreateWindow(d->win, 0, 0, iw, ih, 0);
|
||||
EMapWindow(di->win);
|
||||
imlib_context_set_drawable(di->win);
|
||||
imlib_render_pixmaps_for_whole_image(&pmap, &mask);
|
||||
ESetWindowBackgroundPixmap(di->win, pmap);
|
||||
EShapeCombineMask(di->win, ShapeBounding, 0, 0, mask, ShapeSet);
|
||||
imlib_free_pixmap_and_mask(pmap);
|
||||
imlib_free_image();
|
||||
}
|
||||
}
|
||||
imlib_context_set_image(im);
|
||||
iw = imlib_image_get_width();
|
||||
ih = imlib_image_get_height();
|
||||
di->win = ECreateWindow(d->win, 0, 0, iw, ih, 0);
|
||||
EMapWindow(di->win);
|
||||
imlib_context_set_drawable(di->win);
|
||||
imlib_render_pixmaps_for_whole_image(&pmap, &mask);
|
||||
ESetWindowBackgroundPixmap(di->win, pmap);
|
||||
EShapeCombineMask(di->win, ShapeBounding, 0, 0, mask, ShapeSet);
|
||||
imlib_free_pixmap_and_mask(pmap);
|
||||
imlib_free_image();
|
||||
}
|
||||
di->w = iw;
|
||||
di->h = ih;
|
||||
register_win_callback = 0;
|
||||
break;
|
||||
case DITEM_SEPARATOR:
|
||||
iw = di->iclass->padding.left + di->iclass->padding.right;
|
||||
ih = di->iclass->padding.top + di->iclass->padding.bottom;
|
||||
pad = ImageclassGetPadding(di->iclass);
|
||||
iw = pad->left + pad->right;
|
||||
ih = pad->top + pad->bottom;
|
||||
di->win = ECreateWindow(d->win, -20, -20, 2, 2, 0);
|
||||
EMapWindow(di->win);
|
||||
di->w = iw;
|
||||
|
@ -1150,23 +1132,19 @@ DialogRealizeItem(Dialog * d, DItem * di)
|
|||
register_win_callback = 0;
|
||||
break;
|
||||
case DITEM_RADIOBUTTON:
|
||||
if (di->iclass->norm.normal->im_file)
|
||||
pad = ImageclassGetPadding(di->iclass);
|
||||
im = ImageclassGetImage(di->iclass, 0, 0, 0);
|
||||
if (im)
|
||||
{
|
||||
Imlib_Image *im;
|
||||
|
||||
im = ELoadImage(di->iclass->norm.normal->im_file);
|
||||
if (im)
|
||||
{
|
||||
imlib_context_set_image(im);
|
||||
di->item.radio_button.radio_orig_w = imlib_image_get_width();
|
||||
di->item.radio_button.radio_orig_h = imlib_image_get_height();
|
||||
imlib_free_image();
|
||||
}
|
||||
imlib_context_set_image(im);
|
||||
di->item.radio_button.radio_orig_w = imlib_image_get_width();
|
||||
di->item.radio_button.radio_orig_h = imlib_image_get_height();
|
||||
imlib_free_image();
|
||||
}
|
||||
TextSize(di->tclass, 0, 0, STATE_NORMAL, di->text, &iw, &ih, 17);
|
||||
if (ih < di->item.radio_button.radio_orig_h)
|
||||
ih = di->item.radio_button.radio_orig_h;
|
||||
iw += di->item.radio_button.radio_orig_w + di->iclass->padding.left;
|
||||
iw += di->item.radio_button.radio_orig_w + pad->left;
|
||||
di->item.radio_button.radio_win =
|
||||
ECreateWindow(d->win, -20, -20, 2, 2, 0);
|
||||
di->win = ECreateEventWindow(d->win, -20, -20, 2, 2);
|
||||
|
@ -1182,6 +1160,8 @@ DialogRealizeItem(Dialog * d, DItem * di)
|
|||
{
|
||||
int cols, rows;
|
||||
|
||||
pad = ImageclassGetPadding(d->iclass);
|
||||
|
||||
cols = di->item.table.num_columns;
|
||||
rows = 1;
|
||||
if ((cols > 0) && (rows > 0))
|
||||
|
@ -1274,31 +1254,31 @@ DialogRealizeItem(Dialog * d, DItem * di)
|
|||
int dx, dy, newx, newy;
|
||||
|
||||
newx =
|
||||
di->x + x + d->iclass->padding.left +
|
||||
di->x + x + pad->left +
|
||||
dii->padding.left +
|
||||
(((sw
|
||||
- (dii->padding.left + dii->padding.right) -
|
||||
dii->w) * dii->align_h) >> 10);
|
||||
newy =
|
||||
di->y + y + d->iclass->padding.top +
|
||||
di->y + y + pad->top +
|
||||
dii->padding.top +
|
||||
(((sh
|
||||
- (dii->padding.top + dii->padding.bottom) -
|
||||
dii->h) * dii->align_v) >> 10);
|
||||
dx = newx - dii->x - d->iclass->padding.left;
|
||||
dy = newy - dii->y - d->iclass->padding.top;
|
||||
dx = newx - dii->x - pad->left;
|
||||
dy = newy - dii->y - pad->top;
|
||||
MoveTableBy(d, dii, dx, dy);
|
||||
}
|
||||
else
|
||||
{
|
||||
dii->x =
|
||||
di->x + x + d->iclass->padding.left +
|
||||
di->x + x + pad->left +
|
||||
dii->padding.left +
|
||||
(((sw
|
||||
- (dii->padding.left + dii->padding.right) -
|
||||
dii->w) * dii->align_h) >> 10);
|
||||
dii->y =
|
||||
di->y + y + d->iclass->padding.top +
|
||||
di->y + y + pad->top +
|
||||
dii->padding.top +
|
||||
(((sh
|
||||
- (dii->padding.top + dii->padding.bottom) -
|
||||
|
@ -1330,15 +1310,13 @@ DialogRealizeItem(Dialog * d, DItem * di)
|
|||
radio_orig_h);
|
||||
if (dii->type == DITEM_AREA)
|
||||
{
|
||||
pad = ImageclassGetPadding(dii->iclass);
|
||||
dii->item.area.w =
|
||||
dii->w - (dii->iclass->padding.left +
|
||||
dii->iclass->padding.right);
|
||||
dii->w - (pad->left + pad->right);
|
||||
dii->item.area.h =
|
||||
dii->h - (dii->iclass->padding.top +
|
||||
dii->iclass->padding.bottom);
|
||||
dii->h - (pad->top + pad->bottom);
|
||||
EMoveResizeWindow(dii->item.area.area_win,
|
||||
dii->iclass->padding.left,
|
||||
dii->iclass->padding.top,
|
||||
pad->left, pad->top,
|
||||
dii->item.area.w,
|
||||
dii->item.area.h);
|
||||
}
|
||||
|
@ -1499,6 +1477,7 @@ static void
|
|||
DialogDrawItem(Dialog * d, DItem * di)
|
||||
{
|
||||
int state;
|
||||
Imlib_Border *pad;
|
||||
|
||||
if (!di->update && di->type != DITEM_TABLE)
|
||||
return;
|
||||
|
@ -1620,17 +1599,18 @@ DialogDrawItem(Dialog * d, DItem * di)
|
|||
di->item.check_button.check_orig_h, 0, 0, state,
|
||||
0, ST_WIDGET);
|
||||
EClearArea(d->win, di->x, di->y, di->w, di->h, False);
|
||||
pad = ImageclassGetPadding(di->iclass);
|
||||
TextDraw(di->tclass, d->win, 0, 0, STATE_NORMAL, di->text,
|
||||
di->x + di->item.check_button.check_orig_w +
|
||||
di->iclass->padding.left, di->y,
|
||||
pad->left, di->y,
|
||||
di->w - di->item.check_button.check_orig_w -
|
||||
di->iclass->padding.left, 99999, 17,
|
||||
di->tclass->justification);
|
||||
pad->left, 99999, 17, TextclassGetJustification(di->tclass));
|
||||
break;
|
||||
case DITEM_TEXT:
|
||||
EClearArea(d->win, di->x, di->y, di->w, di->h, False);
|
||||
TextDraw(di->tclass, d->win, 0, 0, STATE_NORMAL, di->text,
|
||||
di->x, di->y, di->w, 99999, 17, di->tclass->justification);
|
||||
di->x, di->y, di->w, 99999, 17,
|
||||
TextclassGetJustification(di->tclass));
|
||||
break;
|
||||
case DITEM_IMAGE:
|
||||
break;
|
||||
|
@ -1661,12 +1641,12 @@ DialogDrawItem(Dialog * d, DItem * di)
|
|||
di->item.radio_button.radio_orig_w, 0, 0, state,
|
||||
0, ST_WIDGET);
|
||||
EClearArea(d->win, di->x, di->y, di->w, di->h, False);
|
||||
pad = ImageclassGetPadding(di->iclass);
|
||||
TextDraw(di->tclass, d->win, 0, 0, STATE_NORMAL, di->text,
|
||||
di->x + di->item.radio_button.radio_orig_w +
|
||||
di->iclass->padding.left, di->y,
|
||||
pad->left, di->y,
|
||||
di->w - di->item.radio_button.radio_orig_w -
|
||||
di->iclass->padding.left, 99999, 17,
|
||||
di->tclass->justification);
|
||||
pad->left, 99999, 17, TextclassGetJustification(di->tclass));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -1711,12 +1691,16 @@ DialogsCheckUpdate(void)
|
|||
static void
|
||||
DialogItemsRealize(Dialog * d)
|
||||
{
|
||||
Imlib_Border *pad;
|
||||
|
||||
if (!d->item)
|
||||
return;
|
||||
|
||||
DialogRealizeItem(d, d->item);
|
||||
DialogDrawItems(d, d->item, 0, 0, 99999, 99999);
|
||||
d->w = d->item->w + d->iclass->padding.left + d->iclass->padding.right;
|
||||
d->h = d->item->h + d->iclass->padding.top + d->iclass->padding.bottom;
|
||||
pad = ImageclassGetPadding(d->iclass);
|
||||
d->w = d->item->w + pad->left + pad->right;
|
||||
d->h = d->item->h + pad->top + pad->bottom;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1925,11 +1909,11 @@ DialogFreeItem(DItem * di)
|
|||
break;
|
||||
case DITEM_SLIDER:
|
||||
if (di->item.slider.ic_base)
|
||||
di->item.slider.ic_base->ref_count--;
|
||||
ImageclassDecRefcount(di->item.slider.ic_base);
|
||||
if (di->item.slider.ic_knob)
|
||||
di->item.slider.ic_knob->ref_count--;
|
||||
ImageclassDecRefcount(di->item.slider.ic_knob);
|
||||
if (di->item.slider.ic_border)
|
||||
di->item.slider.ic_border->ref_count--;
|
||||
ImageclassDecRefcount(di->item.slider.ic_border);
|
||||
break;
|
||||
case DITEM_TABLE:
|
||||
if (di->item.table.items)
|
||||
|
@ -1938,9 +1922,9 @@ DialogFreeItem(DItem * di)
|
|||
}
|
||||
|
||||
if (di->iclass)
|
||||
di->iclass->ref_count--;
|
||||
ImageclassDecRefcount(di->iclass);
|
||||
if (di->tclass)
|
||||
di->tclass->ref_count--;
|
||||
TextclassDecRefcount(di->tclass);
|
||||
|
||||
Efree(di);
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
#include "E.h"
|
||||
#include "ewins.h"
|
||||
#include "iclass.h"
|
||||
|
||||
static void
|
||||
DockappFindEmptySpotFor(EWin * eapp)
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "eobj.h"
|
||||
#include "ewins.h"
|
||||
#include "ewin-ops.h"
|
||||
#include "iclass.h" /* FIXME - Should not be here */
|
||||
#include "snaps.h"
|
||||
#include "xwin.h"
|
||||
#include <math.h>
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#define _EWIN_H_
|
||||
|
||||
#include "eobj.h"
|
||||
#include "xwin.h"
|
||||
|
||||
struct _desk;
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "eobj.h"
|
||||
#include "ewins.h"
|
||||
#include "hiwin.h"
|
||||
#include "iclass.h"
|
||||
#include "xwin.h"
|
||||
|
||||
#define DEBUG_HIWIN 0
|
||||
|
|
118
src/iclass.c
118
src/iclass.c
|
@ -25,8 +25,65 @@
|
|||
#include "conf.h"
|
||||
#include "desktops.h"
|
||||
#include "emodule.h"
|
||||
#include "iclass.h"
|
||||
#include "tclass.h"
|
||||
#include "xwin.h"
|
||||
|
||||
#if ENABLE_COLOR_MODIFIERS
|
||||
typedef struct _modcurve
|
||||
{
|
||||
int num;
|
||||
unsigned char *px;
|
||||
unsigned char *py;
|
||||
unsigned char map[256];
|
||||
}
|
||||
ModCurve;
|
||||
|
||||
typedef struct _colormodifierclass
|
||||
{
|
||||
char *name;
|
||||
ModCurve red, green, blue;
|
||||
unsigned int ref_count;
|
||||
}
|
||||
ColorModifierClass;
|
||||
#endif
|
||||
|
||||
struct _imagestate
|
||||
{
|
||||
char *im_file;
|
||||
char *real_file;
|
||||
char unloadable;
|
||||
char transparent;
|
||||
Imlib_Image *im;
|
||||
Imlib_Border *border;
|
||||
int pixmapfillstyle;
|
||||
XColor bg, hi, lo, hihi, lolo;
|
||||
int bevelstyle;
|
||||
#if ENABLE_COLOR_MODIFIERS
|
||||
ColorModifierClass *colmod;
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef struct _ImageStateArray
|
||||
{
|
||||
ImageState *normal;
|
||||
ImageState *hilited;
|
||||
ImageState *clicked;
|
||||
ImageState *disabled;
|
||||
}
|
||||
ImageStateArray;
|
||||
|
||||
struct _imageclass
|
||||
{
|
||||
char *name;
|
||||
ImageStateArray norm, active, sticky, sticky_active;
|
||||
Imlib_Border padding;
|
||||
#if ENABLE_COLOR_MODIFIERS
|
||||
ColorModifierClass *colmod;
|
||||
#endif
|
||||
unsigned int ref_count;
|
||||
};
|
||||
|
||||
#ifdef ENABLE_THEME_TRANSPARENCY
|
||||
|
||||
static Imlib_Color_Modifier *icm = NULL;
|
||||
|
@ -214,11 +271,15 @@ ImagestateRealize(ImageState * is)
|
|||
is->real_file = ThemeFileFind(is->im_file, 0);
|
||||
|
||||
is->im = ELoadImage(is->real_file);
|
||||
if (!is->im)
|
||||
{
|
||||
Eprintf
|
||||
("ImagestateRealize: Hmmm... is->im is NULL (im_file=%s real_file=%s)\n",
|
||||
is->im_file, is->real_file);
|
||||
return;
|
||||
}
|
||||
|
||||
imlib_context_set_image(is->im);
|
||||
if (is->im == NULL)
|
||||
Eprintf
|
||||
("ImagestateRealize: Hmmm... is->im is NULL (im_file=%s real_file=%s\n",
|
||||
is->im_file, is->real_file);
|
||||
|
||||
if (is->border)
|
||||
imlib_image_set_border(is->border);
|
||||
|
@ -293,6 +354,30 @@ ImageclassDestroy(ImageClass * ic)
|
|||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
ImageclassIncRefcount(ImageClass * ic)
|
||||
{
|
||||
ic->ref_count++;
|
||||
}
|
||||
|
||||
void
|
||||
ImageclassDecRefcount(ImageClass * ic)
|
||||
{
|
||||
ic->ref_count--;
|
||||
}
|
||||
|
||||
const char *
|
||||
ImageclassGetName(ImageClass * ic)
|
||||
{
|
||||
return (ic) ? ic->name : NULL;
|
||||
}
|
||||
|
||||
Imlib_Border *
|
||||
ImageclassGetPadding(ImageClass * ic)
|
||||
{
|
||||
return (ic) ? &(ic->padding) : NULL;
|
||||
}
|
||||
|
||||
ImageClass *
|
||||
ImageclassFind(const char *name, int fallback)
|
||||
{
|
||||
|
@ -1107,7 +1192,7 @@ ITApply(Window win, ImageClass * ic, ImageState * is, int w, int h, int state,
|
|||
ic->padding.right),
|
||||
h - (ic->padding.top +
|
||||
ic->padding.bottom),
|
||||
0, tc->justification);
|
||||
0, TextclassGetJustification(tc));
|
||||
decache = 1;
|
||||
}
|
||||
|
||||
|
@ -1265,29 +1350,6 @@ ImageclassApplyCopy(ImageClass * ic, Window win, int w, int h, int active,
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*/
|
||||
void
|
||||
FreePmapMask(PmapMask * pmm)
|
||||
{
|
||||
/* type !=0: Created by imlib_render_pixmaps_for_whole_image... */
|
||||
if (pmm->pmap)
|
||||
{
|
||||
if (pmm->type == 0)
|
||||
EFreePixmap(pmm->pmap);
|
||||
else
|
||||
imlib_free_pixmap_and_mask(pmm->pmap);
|
||||
pmm->pmap = 0;
|
||||
}
|
||||
|
||||
if (pmm->mask)
|
||||
{
|
||||
if (pmm->type == 0)
|
||||
EFreePixmap(pmm->mask);
|
||||
pmm->mask = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ImageclassSetupFallback(void)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* Copyright (C) 2000-2005 Carsten Haitzler, Geoff Harrison
|
||||
* and various contributors
|
||||
* Copyright (C) 2004-2005 Kim Woelders
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies of the Software, its documentation and marketing & publicity
|
||||
* materials, and acknowledgment shall be given in the documentation, materials
|
||||
* and software packages that this Software was used.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef _ICLASS_H
|
||||
#define _ICLASS_H
|
||||
|
||||
#include "xwin.h"
|
||||
|
||||
struct _textclass;
|
||||
struct _textstate;
|
||||
|
||||
typedef struct _imageclass ImageClass;
|
||||
typedef struct _imagestate ImageState;
|
||||
|
||||
/* iclass.c */
|
||||
int ImageclassConfigLoad(FILE * fs);
|
||||
|
||||
#ifdef ENABLE_THEME_TRANSPARENCY
|
||||
void TransparencySet(int transparency);
|
||||
int TransparencyEnabled(void);
|
||||
int TransparencyUpdateNeeded(void);
|
||||
int ImageclassIsTransparent(ImageClass * ic);
|
||||
#else
|
||||
#define TransparencyEnabled() 0
|
||||
#define TransparencyUpdateNeeded() 0
|
||||
#define ImageclassIsTransparent(ic) 0
|
||||
#endif
|
||||
void ImageclassIncRefcount(ImageClass * ic);
|
||||
void ImageclassDecRefcount(ImageClass * ic);
|
||||
const char *ImageclassGetName(ImageClass * ic);
|
||||
Imlib_Border *ImageclassGetPadding(ImageClass * ic);
|
||||
ImageState *ImageclassGetImageState(ImageClass * ic, int state,
|
||||
int active, int sticky);
|
||||
ImageClass *ImageclassCreateSimple(const char *name, const char *image);
|
||||
ImageClass *ImageclassFind(const char *name, int fallback);
|
||||
Imlib_Image *ImageclassGetImage(ImageClass * ic, int active, int sticky,
|
||||
int state);
|
||||
Pixmap ImageclassApplySimple(ImageClass * ic, Window win,
|
||||
Drawable draw, int state, int x,
|
||||
int y, int w, int h);
|
||||
void ImageclassApply(ImageClass * ic, Window win, int w, int h,
|
||||
int active, int sticky, int state,
|
||||
char expose, int image_type);
|
||||
void ImageclassApplyCopy(ImageClass * ic, Window win, int w,
|
||||
int h, int active, int sticky,
|
||||
int state, PmapMask * pmm,
|
||||
int make_mask, int image_type);
|
||||
void ITApply(Window win, ImageClass * ic, ImageState * is, int w,
|
||||
int h, int state, int active, int sticky,
|
||||
char expose, int image_type, struct _textclass *tc,
|
||||
struct _textstate *ts, const char *text);
|
||||
|
||||
#endif /* _ICLASS_H */
|
|
@ -27,6 +27,7 @@
|
|||
#include "emodule.h"
|
||||
#include "eobj.h"
|
||||
#include "ewins.h"
|
||||
#include "iclass.h"
|
||||
#include "icons.h"
|
||||
#include "menus.h"
|
||||
#include "tooltips.h"
|
||||
|
@ -455,6 +456,7 @@ static void
|
|||
IconboxReconfigure(Iconbox * ib)
|
||||
{
|
||||
ImageClass *ic, *ic2;
|
||||
Imlib_Border *pad;
|
||||
EWin *ewin;
|
||||
int extra;
|
||||
|
||||
|
@ -471,13 +473,15 @@ IconboxReconfigure(Iconbox * ib)
|
|||
if (ib->orientation)
|
||||
{
|
||||
ic = ImageclassFind("ICONBOX_VERTICAL", 0);
|
||||
pad = ImageclassGetPadding(ic);
|
||||
if (ic)
|
||||
extra = ic->padding.left + ic->padding.right;
|
||||
extra = pad->left + pad->right;
|
||||
if (ib->draw_icon_base)
|
||||
{
|
||||
ic2 = ImageclassFind("DEFAULT_ICON_BUTTON", 0);
|
||||
pad = ImageclassGetPadding(ic2);
|
||||
if (ic2)
|
||||
extra += ic2->padding.left + ic2->padding.right;
|
||||
extra += pad->left + pad->right;
|
||||
}
|
||||
ewin->client.width.max = ewin->client.width.min =
|
||||
ib->iconsize + ib->scroll_thickness + extra;
|
||||
|
@ -487,13 +491,15 @@ IconboxReconfigure(Iconbox * ib)
|
|||
else
|
||||
{
|
||||
ic = ImageclassFind("ICONBOX_HORIZONTAL", 0);
|
||||
pad = ImageclassGetPadding(ic);
|
||||
if (ic)
|
||||
extra = ic->padding.top + ic->padding.bottom;
|
||||
extra = pad->top + pad->bottom;
|
||||
if (ib->draw_icon_base)
|
||||
{
|
||||
ic2 = ImageclassFind("DEFAULT_ICON_BUTTON", 0);
|
||||
pad = ImageclassGetPadding(ic2);
|
||||
if (ic2)
|
||||
extra += ic2->padding.top + ic2->padding.bottom;
|
||||
extra += pad->top + pad->bottom;
|
||||
}
|
||||
ewin->client.height.max = ewin->client.height.min =
|
||||
ib->iconsize + ib->scroll_thickness + extra;
|
||||
|
@ -877,6 +883,7 @@ IconboxLayoutImageWin(Iconbox * ib)
|
|||
int i, xo, yo, wo, ho, wi, hi;
|
||||
int item_pad, padl, padr, padt, padb;
|
||||
IboxOject *ibo;
|
||||
Imlib_Border *pad;
|
||||
|
||||
if (ib->orientation)
|
||||
ib->ic_box = ImageclassFind("ICONBOX_VERTICAL", 0);
|
||||
|
@ -898,10 +905,11 @@ IconboxLayoutImageWin(Iconbox * ib)
|
|||
|
||||
if (ib->draw_icon_base)
|
||||
{
|
||||
padl = ib->ic_item_base->padding.left;
|
||||
padr = ib->ic_item_base->padding.right;
|
||||
padt = ib->ic_item_base->padding.top;
|
||||
padb = ib->ic_item_base->padding.bottom;
|
||||
pad = ImageclassGetPadding(ib->ic_item_base);
|
||||
padl = pad->left;
|
||||
padr = pad->right;
|
||||
padt = pad->top;
|
||||
padb = pad->bottom;
|
||||
|
||||
item_pad = 0;
|
||||
}
|
||||
|
@ -916,8 +924,9 @@ IconboxLayoutImageWin(Iconbox * ib)
|
|||
yo = 0;
|
||||
if (ib->ic_box)
|
||||
{
|
||||
xo += ib->ic_box->padding.left;
|
||||
yo += ib->ic_box->padding.top;
|
||||
pad = ImageclassGetPadding(ib->ic_box);
|
||||
xo += pad->left;
|
||||
yo += pad->top;
|
||||
}
|
||||
|
||||
for (i = 0; i < ib->num_objs; i++)
|
||||
|
@ -991,8 +1000,9 @@ IconboxLayoutImageWin(Iconbox * ib)
|
|||
|
||||
if (ib->ic_box)
|
||||
{
|
||||
xo += ib->ic_box->padding.right;
|
||||
yo += ib->ic_box->padding.bottom;
|
||||
pad = ImageclassGetPadding(ib->ic_box);
|
||||
xo += pad->right;
|
||||
yo += pad->bottom;
|
||||
}
|
||||
|
||||
if (ib->orientation)
|
||||
|
@ -1028,6 +1038,7 @@ static void
|
|||
IB_DrawScroll(Iconbox * ib)
|
||||
{
|
||||
ImageClass *ic;
|
||||
Imlib_Border *pad;
|
||||
int arrow_mode = ib->arrow_side;
|
||||
int bs, bw, bx;
|
||||
int state;
|
||||
|
@ -1039,12 +1050,13 @@ IB_DrawScroll(Iconbox * ib)
|
|||
arrow_mode = 3; /* No arrows */
|
||||
|
||||
ic = ImageclassFind("ICONBOX_SCROLLBAR_BASE_VERTICAL", 0);
|
||||
pad = ImageclassGetPadding(ic);
|
||||
if (arrow_mode < 3)
|
||||
bs = ib->h - (ib->arrow_thickness * 2);
|
||||
else
|
||||
bs = ib->h;
|
||||
if (ic)
|
||||
bs -= (ic->padding.top + ic->padding.bottom);
|
||||
bs -= pad->top + pad->bottom;
|
||||
bw = (ib->h * bs) / ib->max;
|
||||
if (bs < 1)
|
||||
bs = 1;
|
||||
|
@ -1054,7 +1066,7 @@ IB_DrawScroll(Iconbox * ib)
|
|||
bw = 1;
|
||||
bx = ((ib->pos * bs) / ib->max);
|
||||
if (ic)
|
||||
bx += ic->padding.top;
|
||||
bx += pad->top;
|
||||
if ((ib->scrollbar_hide) && (bw == bs))
|
||||
goto do_hide_sb;
|
||||
|
||||
|
@ -1255,12 +1267,13 @@ IB_DrawScroll(Iconbox * ib)
|
|||
arrow_mode = 3; /* No arrows */
|
||||
|
||||
ic = ImageclassFind("ICONBOX_SCROLLBAR_BASE_HORIZONTAL", 0);
|
||||
pad = ImageclassGetPadding(ic);
|
||||
if (arrow_mode < 3)
|
||||
bs = ib->w - (ib->arrow_thickness * 2);
|
||||
else
|
||||
bs = ib->w;
|
||||
if (ic)
|
||||
bs -= (ic->padding.left + ic->padding.right);
|
||||
bs -= pad->left + pad->right;
|
||||
bw = (ib->w * bs) / ib->max;
|
||||
if (bs < 1)
|
||||
bs = 1;
|
||||
|
@ -1270,7 +1283,7 @@ IB_DrawScroll(Iconbox * ib)
|
|||
bw = 1;
|
||||
bx = ((ib->pos * bs) / ib->max);
|
||||
if (ic)
|
||||
bx += ic->padding.left;
|
||||
bx += pad->left;
|
||||
if ((ib->scrollbar_hide) && (bw == bs))
|
||||
goto do_hide_sb;
|
||||
|
||||
|
@ -1878,6 +1891,7 @@ IboxEventScrollbarWin(XEvent * ev, void *prm)
|
|||
static int px, py, pos0;
|
||||
int bs, dp;
|
||||
ImageClass *ic;
|
||||
Imlib_Border *pad;
|
||||
|
||||
switch (ev->type)
|
||||
{
|
||||
|
@ -1913,9 +1927,10 @@ IboxEventScrollbarWin(XEvent * ev, void *prm)
|
|||
if (ib->orientation)
|
||||
{
|
||||
ic = ImageclassFind("ICONBOX_SCROLLBAR_BASE_VERTICAL", 0);
|
||||
pad = ImageclassGetPadding(ic);
|
||||
bs = ib->h - (ib->arrow_thickness * 2);
|
||||
if (ic)
|
||||
bs -= (ic->padding.top + ic->padding.bottom);
|
||||
bs -= pad->top + pad->bottom;
|
||||
if (bs < 1)
|
||||
bs = 1;
|
||||
dp = ev->xmotion.y_root - py;
|
||||
|
@ -1923,9 +1938,10 @@ IboxEventScrollbarWin(XEvent * ev, void *prm)
|
|||
else
|
||||
{
|
||||
ic = ImageclassFind("ICONBOX_SCROLLBAR_BASE_HORIZONTAL", 0);
|
||||
pad = ImageclassGetPadding(ic);
|
||||
bs = ib->w - (ib->arrow_thickness * 2);
|
||||
if (ic)
|
||||
bs -= (ic->padding.left + ic->padding.right);
|
||||
bs -= pad->left + pad->right;
|
||||
if (bs < 1)
|
||||
bs = 1;
|
||||
dp = ev->xmotion.x_root - px;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "conf.h"
|
||||
#include "desktops.h"
|
||||
#include "ewins.h"
|
||||
#include "iclass.h"
|
||||
#include "menus.h"
|
||||
#include "xwin.h"
|
||||
#include <errno.h>
|
||||
|
|
85
src/menus.c
85
src/menus.c
|
@ -25,7 +25,9 @@
|
|||
#include "emodule.h"
|
||||
#include "eobj.h"
|
||||
#include "ewins.h"
|
||||
#include "iclass.h"
|
||||
#include "menus.h"
|
||||
#include "tclass.h"
|
||||
#include "tooltips.h"
|
||||
#include "xwin.h"
|
||||
#include <time.h>
|
||||
|
@ -402,7 +404,7 @@ MenuItemCreate(const char *text, ImageClass * iclass,
|
|||
|
||||
mi->icon_iclass = iclass;
|
||||
if (iclass)
|
||||
iclass->ref_count++;
|
||||
ImageclassIncRefcount(iclass);
|
||||
|
||||
mi->text = (text) ? Estrdup((text[0]) ? text : "?!?") : NULL;
|
||||
mi->params = Estrdup(action_params);
|
||||
|
@ -567,7 +569,7 @@ MenuEmpty(Menu * m, int destroying)
|
|||
if (!destroying && m->items[i]->win)
|
||||
EDestroyWindow(m->items[i]->win);
|
||||
if (m->items[i]->icon_iclass)
|
||||
m->items[i]->icon_iclass->ref_count--;
|
||||
ImageclassDecRefcount(m->items[i]->icon_iclass);
|
||||
if (m->items[i])
|
||||
Efree(m->items[i]);
|
||||
}
|
||||
|
@ -617,6 +619,7 @@ MenuRealize(Menu * m)
|
|||
int maxx1, maxx2, w, h, x, y, r, mmw, mmh;
|
||||
int iw, ih;
|
||||
Imlib_Image *im;
|
||||
Imlib_Border *pad, *pad_item, *pad_sub;
|
||||
char has_i, has_s;
|
||||
|
||||
if (!m->style)
|
||||
|
@ -664,7 +667,7 @@ MenuRealize(Menu * m)
|
|||
}
|
||||
if (m->items[i]->icon_iclass)
|
||||
{
|
||||
im = ELoadImage(m->items[i]->icon_iclass->norm.normal->im_file);
|
||||
im = ImageclassGetImage(m->items[i]->icon_iclass, 0, 0, 0);
|
||||
if (im)
|
||||
{
|
||||
imlib_context_set_image(im);
|
||||
|
@ -686,45 +689,44 @@ MenuRealize(Menu * m)
|
|||
}
|
||||
}
|
||||
|
||||
pad = ImageclassGetPadding(m->style->bg_iclass);
|
||||
pad_item = ImageclassGetPadding(m->style->item_iclass);
|
||||
pad_sub = ImageclassGetPadding(m->style->sub_iclass);
|
||||
if (((has_i) && (has_s)) || ((!has_i) && (!has_s)))
|
||||
{
|
||||
if (m->style->item_iclass->padding.top >
|
||||
m->style->sub_iclass->padding.top)
|
||||
maxh += m->style->item_iclass->padding.top;
|
||||
if (pad_item->top > pad_sub->top)
|
||||
maxh += pad_item->top;
|
||||
else
|
||||
maxh += m->style->sub_iclass->padding.top;
|
||||
if (m->style->item_iclass->padding.bottom >
|
||||
m->style->sub_iclass->padding.bottom)
|
||||
maxh += m->style->item_iclass->padding.bottom;
|
||||
maxh += pad_sub->top;
|
||||
if (pad_item->bottom > pad_sub->bottom)
|
||||
maxh += pad_item->bottom;
|
||||
else
|
||||
maxh += m->style->sub_iclass->padding.bottom;
|
||||
maxh += pad_sub->bottom;
|
||||
maxw = maxx1 + maxx2;
|
||||
if (m->style->item_iclass->padding.left >
|
||||
m->style->sub_iclass->padding.left)
|
||||
maxw += m->style->item_iclass->padding.left;
|
||||
if (pad_item->left > pad_sub->left)
|
||||
maxw += pad_item->left;
|
||||
else
|
||||
maxw += m->style->sub_iclass->padding.left;
|
||||
if (m->style->item_iclass->padding.right >
|
||||
m->style->sub_iclass->padding.right)
|
||||
maxw += m->style->item_iclass->padding.right;
|
||||
maxw += pad_sub->left;
|
||||
if (pad_item->right > pad_sub->right)
|
||||
maxw += pad_item->right;
|
||||
else
|
||||
maxw += m->style->sub_iclass->padding.right;
|
||||
maxw += pad_sub->right;
|
||||
}
|
||||
else if (has_i)
|
||||
{
|
||||
maxh += m->style->item_iclass->padding.top;
|
||||
maxh += m->style->item_iclass->padding.bottom;
|
||||
maxh += pad_item->top;
|
||||
maxh += pad_item->bottom;
|
||||
maxw = maxx1 + maxx2;
|
||||
maxw += m->style->item_iclass->padding.left;
|
||||
maxw += m->style->item_iclass->padding.right;
|
||||
maxw += pad_item->left;
|
||||
maxw += pad_item->right;
|
||||
}
|
||||
else if (has_s)
|
||||
{
|
||||
maxh += m->style->sub_iclass->padding.top;
|
||||
maxh += m->style->sub_iclass->padding.bottom;
|
||||
maxh += pad_sub->top;
|
||||
maxh += pad_sub->bottom;
|
||||
maxw = maxx1 + maxx2;
|
||||
maxw += m->style->sub_iclass->padding.left;
|
||||
maxw += m->style->sub_iclass->padding.right;
|
||||
maxw += pad_sub->left;
|
||||
maxw += pad_sub->right;
|
||||
}
|
||||
|
||||
mmw = 0;
|
||||
|
@ -741,29 +743,29 @@ MenuRealize(Menu * m)
|
|||
{
|
||||
if (r == 0 && (m->style->bg_iclass) && (!m->style->use_item_bg))
|
||||
{
|
||||
x += m->style->bg_iclass->padding.left;
|
||||
y += m->style->bg_iclass->padding.top;
|
||||
x += pad->left;
|
||||
y += pad->top;
|
||||
}
|
||||
EMoveResizeWindow(m->items[i]->win, x, y, maxw, maxh);
|
||||
if (m->style->iconpos == ICON_LEFT)
|
||||
{
|
||||
m->items[i]->text_x = m->style->item_iclass->padding.left + maxx2;
|
||||
m->items[i]->text_x = pad_item->left + maxx2;
|
||||
m->items[i]->text_w = maxx1;
|
||||
m->items[i]->text_y = (maxh - m->items[i]->text_h) / 2;
|
||||
if (m->items[i]->icon_win)
|
||||
EMoveWindow(m->items[i]->icon_win,
|
||||
m->style->item_iclass->padding.left +
|
||||
pad_item->left +
|
||||
((maxx2 - m->items[i]->icon_w) / 2),
|
||||
((maxh - m->items[i]->icon_h) / 2));
|
||||
}
|
||||
else
|
||||
{
|
||||
m->items[i]->text_x = m->style->item_iclass->padding.left;
|
||||
m->items[i]->text_x = pad_item->left;
|
||||
m->items[i]->text_w = maxx1;
|
||||
m->items[i]->text_y = (maxh - m->items[i]->text_h) / 2;
|
||||
if (m->items[i]->icon_win)
|
||||
EMoveWindow(m->items[i]->icon_win,
|
||||
maxw - m->style->item_iclass->padding.right -
|
||||
maxw - pad_item->right -
|
||||
maxx2 + ((maxx2 - w) / 2), ((maxh - h) / 2));
|
||||
}
|
||||
if (m->items[i]->icon_iclass)
|
||||
|
@ -810,8 +812,8 @@ MenuRealize(Menu * m)
|
|||
|
||||
if ((m->style->bg_iclass) && (!m->style->use_item_bg))
|
||||
{
|
||||
mmw += m->style->bg_iclass->padding.right;
|
||||
mmh += m->style->bg_iclass->padding.bottom;
|
||||
mmw += pad->right;
|
||||
mmh += pad->bottom;
|
||||
}
|
||||
|
||||
m->redraw = 1;
|
||||
|
@ -912,7 +914,8 @@ MenuDrawItem(Menu * m, MenuItem * mi, char shape, int state)
|
|||
{
|
||||
TextDraw(m->style->tclass, mi_pmm->pmap, 0, 0, mi->state,
|
||||
_(mi->text), mi->text_x, mi->text_y, mi->text_w,
|
||||
mi->text_h, 17, m->style->tclass->justification);
|
||||
mi->text_h, 17,
|
||||
TextclassGetJustification(m->style->tclass));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1690,22 +1693,22 @@ MenuStyleConfigLoad(FILE * ConfigFile)
|
|||
case CONFIG_TEXT:
|
||||
ms->tclass = TextclassFind(s2, 1);
|
||||
if (ms->tclass)
|
||||
ms->tclass->ref_count++;
|
||||
TextclassIncRefcount(ms->tclass);
|
||||
break;
|
||||
case MENU_BG_ICLASS:
|
||||
ms->bg_iclass = ImageclassFind(s2, 0);
|
||||
if (ms->bg_iclass)
|
||||
ms->bg_iclass->ref_count++;
|
||||
ImageclassIncRefcount(ms->bg_iclass);
|
||||
break;
|
||||
case MENU_ITEM_ICLASS:
|
||||
ms->item_iclass = ImageclassFind(s2, 0);
|
||||
if (ms->item_iclass)
|
||||
ms->item_iclass->ref_count++;
|
||||
ImageclassIncRefcount(ms->item_iclass);
|
||||
break;
|
||||
case MENU_SUBMENU_ICLASS:
|
||||
ms->sub_iclass = ImageclassFind(s2, 0);
|
||||
if (ms->sub_iclass)
|
||||
ms->sub_iclass->ref_count++;
|
||||
ImageclassIncRefcount(ms->sub_iclass);
|
||||
break;
|
||||
case MENU_USE_ITEM_BACKGROUND:
|
||||
ms->use_item_bg = atoi(s2);
|
||||
|
@ -1713,7 +1716,7 @@ MenuStyleConfigLoad(FILE * ConfigFile)
|
|||
{
|
||||
if (ms->bg_iclass)
|
||||
{
|
||||
ms->bg_iclass->ref_count--;
|
||||
ImageclassDecRefcount(ms->bg_iclass);
|
||||
ms->bg_iclass = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#ifndef _MENUS_H_
|
||||
#define _MENUS_H_
|
||||
|
||||
struct _imageclass;
|
||||
|
||||
typedef struct _menu Menu;
|
||||
typedef struct _menuitem MenuItem;
|
||||
typedef struct _menustyle MenuStyle;
|
||||
|
@ -40,7 +42,7 @@ void MenuDestroy(Menu * m);
|
|||
void MenuHide(Menu * m);
|
||||
void MenuEmpty(Menu * m, int destroying);
|
||||
void MenuRepack(Menu * m);
|
||||
MenuItem *MenuItemCreate(const char *text, ImageClass * ic,
|
||||
MenuItem *MenuItemCreate(const char *text, struct _imageclass *ic,
|
||||
const char *action_params, Menu * child);
|
||||
void MenuSetInternal(Menu * m);
|
||||
void MenuSetDynamic(Menu * m);
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
#include "E.h"
|
||||
#include "emodule.h"
|
||||
#include "iclass.h"
|
||||
|
||||
#ifdef ENABLE_THEME_TRANSPARENCY
|
||||
/*
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "emodule.h"
|
||||
#include "ewins.h"
|
||||
#include "hiwin.h"
|
||||
#include "iclass.h"
|
||||
#include "menus.h"
|
||||
#include "tooltips.h"
|
||||
#include "xwin.h"
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
*/
|
||||
#include "E.h"
|
||||
#include "eobj.h"
|
||||
#include "iclass.h"
|
||||
#include "tclass.h"
|
||||
#include "xwin.h"
|
||||
|
||||
struct _progressbar
|
||||
|
@ -68,23 +70,23 @@ ProgressbarCreate(char *name, int w, int h)
|
|||
|
||||
p->ic = ImageclassFind("PROGRESS_BAR", 1);
|
||||
if (p->ic)
|
||||
p->ic->ref_count++;
|
||||
ImageclassIncRefcount(p->ic);
|
||||
|
||||
p->inc = ImageclassFind("PROGRESS_BAR", 1);
|
||||
if (p->inc)
|
||||
p->inc->ref_count++;
|
||||
ImageclassIncRefcount(p->inc);
|
||||
|
||||
p->ipc = ImageclassFind("PROGRESS_BAR", 1);
|
||||
if (p->ipc)
|
||||
p->ipc->ref_count++;
|
||||
ImageclassIncRefcount(p->ipc);
|
||||
|
||||
p->tc = TextclassFind("PROGRESS_TEXT", 1);
|
||||
if (p->tc)
|
||||
p->tc->ref_count++;
|
||||
TextclassIncRefcount(p->tc);
|
||||
|
||||
p->tnc = TextclassFind("PROGRESS_TEXT_NUMBER", 1);
|
||||
if (p->tnc)
|
||||
p->tnc->ref_count++;
|
||||
TextclassIncRefcount(p->tnc);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
@ -119,16 +121,16 @@ ProgressbarDestroy(Progressbar * p)
|
|||
}
|
||||
|
||||
if (p->ic)
|
||||
p->ic->ref_count--;
|
||||
ImageclassDecRefcount(p->ic);
|
||||
if (p->inc)
|
||||
p->inc->ref_count--;
|
||||
ImageclassDecRefcount(p->inc);
|
||||
if (p->ipc)
|
||||
p->ipc->ref_count--;
|
||||
ImageclassDecRefcount(p->ipc);
|
||||
|
||||
if (p->tc)
|
||||
p->tc->ref_count--;
|
||||
TextclassDecRefcount(p->tc);
|
||||
if (p->tnc)
|
||||
p->tnc->ref_count--;
|
||||
TextclassDecRefcount(p->tnc);
|
||||
|
||||
if (p)
|
||||
Efree(p);
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
#include "E.h"
|
||||
#include "eobj.h"
|
||||
#include "iclass.h"
|
||||
#include "xwin.h"
|
||||
#include <time.h>
|
||||
|
||||
|
|
30
src/tclass.c
30
src/tclass.c
|
@ -24,6 +24,8 @@
|
|||
#include "E.h"
|
||||
#include "conf.h"
|
||||
#include "emodule.h"
|
||||
#include "iclass.h"
|
||||
#include "tclass.h"
|
||||
#include "xwin.h"
|
||||
|
||||
static char *
|
||||
|
@ -132,6 +134,24 @@ TextclassDestroy(TextClass * tc)
|
|||
Efree(tc);
|
||||
}
|
||||
|
||||
void
|
||||
TextclassIncRefcount(TextClass * tc)
|
||||
{
|
||||
tc->ref_count++;
|
||||
}
|
||||
|
||||
void
|
||||
TextclassDecRefcount(TextClass * tc)
|
||||
{
|
||||
tc->ref_count--;
|
||||
}
|
||||
|
||||
int
|
||||
TextclassGetJustification(TextClass * tc)
|
||||
{
|
||||
return tc->justification;
|
||||
}
|
||||
|
||||
static void
|
||||
TextclassPopulate(TextClass * tclass)
|
||||
{
|
||||
|
@ -437,17 +457,17 @@ TextclassApply(ImageClass * iclass, Window win, int w, int h, int active,
|
|||
int sticky, int state, char expose __UNUSED__,
|
||||
TextClass * tclass, const char *text)
|
||||
{
|
||||
Imlib_Border *pad;
|
||||
|
||||
if ((!iclass) || (!tclass) || (!text) || (!win) || (w < 1) || (h < 1))
|
||||
return;
|
||||
|
||||
XClearWindow(disp, win);
|
||||
|
||||
TextDraw(tclass, win, active, sticky, state, text, iclass->padding.left,
|
||||
iclass->padding.top,
|
||||
w - (iclass->padding.left + iclass->padding.right),
|
||||
h - (iclass->padding.top + iclass->padding.bottom),
|
||||
h - (iclass->padding.top + iclass->padding.bottom),
|
||||
pad = ImageclassGetPadding(iclass);
|
||||
TextDraw(tclass, win, active, sticky, state, text,
|
||||
pad->left, pad->top, w - (pad->left + pad->right),
|
||||
h - (pad->top + pad->bottom), h - (pad->top + pad->bottom),
|
||||
tclass->justification);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
* Copyright (C) 2000-2005 Carsten Haitzler, Geoff Harrison
|
||||
* and various contributors
|
||||
* Copyright (C) 2004-2005 Kim Woelders
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies of the Software, its documentation and marketing & publicity
|
||||
* materials, and acknowledgment shall be given in the documentation, materials
|
||||
* and software packages that this Software was used.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef _TCLASS_H
|
||||
#define _TCLASS_H
|
||||
|
||||
#include "xwin.h"
|
||||
|
||||
struct _imageclass;
|
||||
|
||||
typedef struct _textclass TextClass;
|
||||
typedef struct _textstate TextState;
|
||||
|
||||
#define MODE_VERBATIM 0
|
||||
#define MODE_WRAP_CHAR 1
|
||||
#define MODE_WRAP_WORD 2
|
||||
|
||||
#define FONT_TO_RIGHT 0
|
||||
#define FONT_TO_DOWN 1
|
||||
#define FONT_TO_UP 2
|
||||
#define FONT_TO_LEFT 3
|
||||
|
||||
struct _textstate
|
||||
{
|
||||
char *fontname;
|
||||
struct
|
||||
{
|
||||
char mode;
|
||||
char orientation;
|
||||
} style;
|
||||
XColor fg_col;
|
||||
XColor bg_col;
|
||||
int effect;
|
||||
Efont *efont;
|
||||
XFontStruct *xfont;
|
||||
XFontSet xfontset;
|
||||
int xfontset_ascent;
|
||||
char need_utf8;
|
||||
};
|
||||
|
||||
struct _textclass
|
||||
{
|
||||
char *name;
|
||||
struct
|
||||
{
|
||||
TextState *normal;
|
||||
TextState *hilited;
|
||||
TextState *clicked;
|
||||
TextState *disabled;
|
||||
}
|
||||
norm , active, sticky, sticky_active;
|
||||
int justification;
|
||||
unsigned int ref_count;
|
||||
};
|
||||
|
||||
/* tclass.c */
|
||||
int TextclassConfigLoad(FILE * fs);
|
||||
void TextclassIncRefcount(TextClass * tc);
|
||||
void TextclassDecRefcount(TextClass * tc);
|
||||
int TextclassGetJustification(TextClass * tc);
|
||||
TextClass *TextclassFind(const char *name, int fallback);
|
||||
void TextclassApply(struct _imageclass *ic, Window win, int w,
|
||||
int h, int active, int sticky, int state,
|
||||
char expose, TextClass * tclass,
|
||||
const char *text);
|
||||
|
||||
/* text.c */
|
||||
TextState *TextclassGetTextState(TextClass * tclass, int state,
|
||||
int active, int sticky);
|
||||
void TextstateDrawText(TextState * ts, Window win,
|
||||
const char *text, int x, int y, int w,
|
||||
int h, int fsize, int justification);
|
||||
void TextSize(TextClass * tclass, int active, int sticky,
|
||||
int state, const char *text, int *width,
|
||||
int *height, int fsize);
|
||||
void TextDraw(TextClass * tclass, Window win, int active,
|
||||
int sticky, int state, const char *text, int x,
|
||||
int y, int w, int h, int fsize, int justification);
|
||||
|
||||
#endif /* _TCLASS_H */
|
|
@ -22,6 +22,7 @@
|
|||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "E.h"
|
||||
#include "tclass.h"
|
||||
#include "xwin.h"
|
||||
|
||||
#define ExTextExtents XmbTextExtents
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#include "conf.h"
|
||||
#include "emodule.h"
|
||||
#include "eobj.h"
|
||||
#include "iclass.h"
|
||||
#include "tclass.h"
|
||||
#include "tooltips.h"
|
||||
#include "xwin.h"
|
||||
|
||||
|
@ -77,12 +79,12 @@ TooltipCreate(const char *name, ImageClass * ic0, ImageClass * ic1,
|
|||
tt->iclass[2] = ic3;
|
||||
tt->iclass[3] = ic4;
|
||||
tt->iclass[4] = ic0;
|
||||
ic0->ref_count++;
|
||||
ImageclassIncRefcount(ic0);
|
||||
tt->tclass = tclass;
|
||||
tclass->ref_count++;
|
||||
TextclassIncRefcount(tclass);
|
||||
tt->tooltippic = tooltippic;
|
||||
if (tooltippic)
|
||||
tooltippic->ref_count++;
|
||||
ImageclassIncRefcount(tooltippic);
|
||||
|
||||
tt->dist = dist;
|
||||
|
||||
|
@ -94,7 +96,7 @@ TooltipCreate(const char *name, ImageClass * ic0, ImageClass * ic1,
|
|||
wh = (i + 1) * 8;
|
||||
|
||||
eo = EobjWindowCreate(EOBJ_TYPE_MISC, -50, -100, wh, wh, 1, NULL);
|
||||
tt->iclass[i]->ref_count++;
|
||||
ImageclassIncRefcount(tt->iclass[i]);
|
||||
EobjChangeOpacity(eo, OpacityExt(Conf_tooltips.opacity));
|
||||
tt->win[i] = eo;
|
||||
}
|
||||
|
@ -219,14 +221,16 @@ static ImageClass *
|
|||
TooltipCreateIclass(const char *name, const char *file, int *pw, int *ph)
|
||||
{
|
||||
ImageClass *ic;
|
||||
Imlib_Image *im;
|
||||
|
||||
ic = ImageclassFind(name, 0);
|
||||
if (!ic)
|
||||
ic = ImageclassCreateSimple(name, file);
|
||||
im = ImageclassGetImage(ic, 0, 0, 0);
|
||||
|
||||
if (ic->norm.normal && ic->norm.normal->im)
|
||||
if (im)
|
||||
{
|
||||
imlib_context_set_image(ic->norm.normal->im);
|
||||
imlib_context_set_image(im);
|
||||
if (*pw < imlib_image_get_width())
|
||||
*pw = imlib_image_get_width();
|
||||
if (*ph < imlib_image_get_height())
|
||||
|
@ -240,12 +244,14 @@ static void
|
|||
TooltipIclassPaste(ToolTip * tt, const char *ic_name, int x, int y, int *px)
|
||||
{
|
||||
ImageClass *ic;
|
||||
Imlib_Image *im;
|
||||
|
||||
ic = ImageclassFind(ic_name, 0);
|
||||
if (!ic || !ic->norm.normal->im)
|
||||
im = ImageclassGetImage(ic, 0, 0, 0);
|
||||
if (!ic || !im)
|
||||
return;
|
||||
|
||||
imlib_context_set_image(ic->norm.normal->im);
|
||||
imlib_context_set_image(im);
|
||||
imlib_context_set_drawable(tt->TTWIN->win);
|
||||
imlib_context_set_blend(1);
|
||||
imlib_render_image_on_drawable(x, y);
|
||||
|
@ -264,6 +270,7 @@ TooltipShow(ToolTip * tt, const char *text, ActionClass * ac, int x, int y)
|
|||
Imlib_Image *im;
|
||||
int *heights = NULL;
|
||||
ImageClass *ic;
|
||||
Imlib_Border *pad;
|
||||
int cols[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
int num, modifiers;
|
||||
Action *aa;
|
||||
|
@ -403,11 +410,12 @@ TooltipShow(ToolTip * tt, const char *text, ActionClass * ac, int x, int y)
|
|||
h += headline_h;
|
||||
|
||||
ic = tt->TTICL;
|
||||
pad = ImageclassGetPadding(ic);
|
||||
iw = 0;
|
||||
ih = 0;
|
||||
if (tt->tooltippic)
|
||||
{
|
||||
im = ELoadImage(tt->tooltippic->norm.normal->im_file);
|
||||
im = ImageclassGetImage(tt->tooltippic, 0, 0, 0);
|
||||
ix = 0;
|
||||
iy = 0;
|
||||
if (im)
|
||||
|
@ -421,12 +429,12 @@ TooltipShow(ToolTip * tt, const char *text, ActionClass * ac, int x, int y)
|
|||
if (h < ih)
|
||||
h = ih;
|
||||
}
|
||||
w += ic->padding.left + ic->padding.right;
|
||||
h += ic->padding.top + ic->padding.bottom;
|
||||
w += pad->left + pad->right;
|
||||
h += pad->top + pad->bottom;
|
||||
|
||||
if ((tt->tooltippic) && (iw > 0) && (ih > 0))
|
||||
{
|
||||
ix = ic->padding.left;
|
||||
ix = pad->left;
|
||||
iy = (h - ih) / 2;
|
||||
EMoveResizeWindow(tt->iwin, ix, iy, iw, ih);
|
||||
EMapWindow(tt->iwin);
|
||||
|
@ -568,18 +576,18 @@ TooltipShow(ToolTip * tt, const char *text, ActionClass * ac, int x, int y)
|
|||
|
||||
ESync();
|
||||
|
||||
xx = ic->padding.left + iw;
|
||||
xx = pad->left + iw;
|
||||
|
||||
/* draw the ordinary tooltip text */
|
||||
TextDraw(tt->tclass, tt->TTWIN->win, 0, 0, STATE_NORMAL, text, xx,
|
||||
ic->padding.top, headline_w, headline_h, 17, 512);
|
||||
pad->top, headline_w, headline_h, 17, 512);
|
||||
|
||||
/* draw the icons and labels, if any */
|
||||
if (ac)
|
||||
{
|
||||
num = ActionclassGetActionCount(ac);
|
||||
y = ic->padding.top + headline_h;
|
||||
xx = ic->padding.left + double_w;
|
||||
y = pad->top + headline_h;
|
||||
xx = pad->left + double_w;
|
||||
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
|
@ -648,7 +656,7 @@ TooltipShow(ToolTip * tt, const char *text, ActionClass * ac, int x, int y)
|
|||
}
|
||||
|
||||
TextDraw(tt->tclass, tt->TTWIN->win, 0, 0, STATE_NORMAL, tts,
|
||||
ic->padding.left + icons_width + iw, y,
|
||||
pad->left + icons_width + iw, y,
|
||||
labels_width, heights[i], 17, 0);
|
||||
y += heights[i];
|
||||
|
||||
|
|
14
src/warp.c
14
src/warp.c
|
@ -34,7 +34,9 @@
|
|||
#include "E.h"
|
||||
#include "emodule.h"
|
||||
#include "ewins.h"
|
||||
#include "iclass.h"
|
||||
#include "icons.h"
|
||||
#include "tclass.h"
|
||||
#include "tooltips.h"
|
||||
#include "xwin.h"
|
||||
#include <X11/keysym.h>
|
||||
|
@ -63,6 +65,7 @@ WarpFocusShow(EWin * ewin)
|
|||
{
|
||||
TextClass *tc;
|
||||
ImageClass *ic;
|
||||
Imlib_Border *pad;
|
||||
int i, x, y, w, h, ww, hh;
|
||||
static int mw, mh, tw, th;
|
||||
char s[1024];
|
||||
|
@ -83,6 +86,8 @@ WarpFocusShow(EWin * ewin)
|
|||
if ((!ic) || (!tc))
|
||||
return;
|
||||
|
||||
pad = ImageclassGetPadding(ic);
|
||||
|
||||
if (!warpFocusWindow)
|
||||
{
|
||||
EObj *eo;
|
||||
|
@ -125,8 +130,8 @@ WarpFocusShow(EWin * ewin)
|
|||
|
||||
tw = w; /* Text size */
|
||||
th = h;
|
||||
w += (ic->padding.left + ic->padding.right);
|
||||
h += (ic->padding.top + ic->padding.bottom);
|
||||
w += pad->left + pad->right;
|
||||
h += pad->top + pad->bottom;
|
||||
if (Conf.warplist.icon_mode != 0)
|
||||
w += h;
|
||||
mw = w; /* Focus list item size */
|
||||
|
@ -174,8 +179,7 @@ WarpFocusShow(EWin * ewin)
|
|||
Imlib_Image *im;
|
||||
|
||||
TextDraw(tc, wl->win, 0, 0, state, wl->txt,
|
||||
ic->padding.left + mh, ic->padding.top,
|
||||
tw, th, 0, 0);
|
||||
pad->left + mh, pad->top, tw, th, 0, 0);
|
||||
|
||||
im = EwinIconImageGet(wl->ewin, icon_size,
|
||||
Conf.warplist.icon_mode);
|
||||
|
@ -185,7 +189,7 @@ WarpFocusShow(EWin * ewin)
|
|||
imlib_context_set_image(im);
|
||||
imlib_context_set_drawable(wl->win);
|
||||
imlib_context_set_blend(1);
|
||||
imlib_render_image_on_drawable_at_size(ic->padding.left +
|
||||
imlib_render_image_on_drawable_at_size(pad->left +
|
||||
ICON_PAD, ICON_PAD,
|
||||
icon_size, icon_size);
|
||||
imlib_free_image();
|
||||
|
|
21
src/x.c
21
src/x.c
|
@ -1513,3 +1513,24 @@ EDrawableDumpImage(Drawable draw, const char *txt)
|
|||
imlib_save_image(buf);
|
||||
imlib_free_image_and_decache();
|
||||
}
|
||||
|
||||
void
|
||||
FreePmapMask(PmapMask * pmm)
|
||||
{
|
||||
/* type !=0: Created by imlib_render_pixmaps_for_whole_image... */
|
||||
if (pmm->pmap)
|
||||
{
|
||||
if (pmm->type == 0)
|
||||
EFreePixmap(pmm->pmap);
|
||||
else
|
||||
imlib_free_pixmap_and_mask(pmm->pmap);
|
||||
pmm->pmap = 0;
|
||||
}
|
||||
|
||||
if (pmm->mask)
|
||||
{
|
||||
if (pmm->type == 0)
|
||||
EFreePixmap(pmm->mask);
|
||||
pmm->mask = 0;
|
||||
}
|
||||
}
|
||||
|
|
10
src/xwin.h
10
src/xwin.h
|
@ -118,4 +118,14 @@ void EGetColor(const XColor * pxc, int *pr, int *pg, int *pb);
|
|||
|
||||
void EDrawableDumpImage(Drawable draw, const char *txt);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char type;
|
||||
Pixmap pmap;
|
||||
Pixmap mask;
|
||||
int w, h;
|
||||
} PmapMask;
|
||||
|
||||
void FreePmapMask(PmapMask * pmm);
|
||||
|
||||
#endif /* _XWIN_H_ */
|
||||
|
|
Loading…
Reference in New Issue