mirror of
https://github.com/gryf/wmaker.git
synced 2026-02-02 14:15:46 +01:00
added notification in colorpanel
colorwell updating with colorpanel change
This commit is contained in:
@@ -20,6 +20,12 @@ changes since wmaker 0.53.0:
|
||||
in the delegate variable.
|
||||
Take a look in wfilepanel.c to see how it is used there.
|
||||
|
||||
- WMTextField
|
||||
Removed all the didChange notifications that were sent when the text
|
||||
was changed programmatically. Only changes made by user interaction
|
||||
will be notified now. If you need the old behaviour, send notifications
|
||||
manually when you change the text.
|
||||
|
||||
- added WMTabView
|
||||
|
||||
changes since wmaker 0.52.0:
|
||||
|
||||
@@ -194,7 +194,6 @@ enum {
|
||||
WMDeleteTextEvent
|
||||
};
|
||||
|
||||
|
||||
typedef enum {
|
||||
WMGrayModeColorPanel,
|
||||
WMRGBModeColorPanel,
|
||||
@@ -383,6 +382,8 @@ typedef void WMEventHook(XEvent *event);
|
||||
* clientData to the data set to with WMSetClientData() */
|
||||
typedef void WMAction(WMWidget *self, void *clientData);
|
||||
|
||||
/* same as WMAction, but for stuff that arent widgets */
|
||||
typedef void WMAction2(void *self, void *clientData);
|
||||
|
||||
typedef void WMCallback(void *data);
|
||||
|
||||
@@ -1024,13 +1025,11 @@ void WMCloseColorPanel(WMColorPanel *panel);
|
||||
|
||||
void WMSetColorPanelColor(WMColorPanel *panel, WMColor *color);
|
||||
|
||||
RColor WMGetColorPanelColor(WMColorPanel *panel);
|
||||
|
||||
void WMSetColorPanelPickerMode(WMColorPanel *panel, WMColorPanelMode mode);
|
||||
|
||||
void WMSetColorPanelAction(WMColorPanel *panel, WMAction *action, void *data);
|
||||
|
||||
void WMSetColorPanelAction(WMColorPanel *panel, WMAction2 *action, void *data);
|
||||
|
||||
extern char *WMColorPanelColorChangedNotification;
|
||||
|
||||
/* ....................................................................... */
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
|
||||
#include "WUtil.h"
|
||||
#include "WINGs.h"
|
||||
|
||||
#if WINGS_H_VERSION < 990222
|
||||
|
||||
5739
WINGs/wcolorpanel.c
5739
WINGs/wcolorpanel.c
File diff suppressed because it is too large
Load Diff
@@ -66,9 +66,42 @@ static WMDragSourceProcs dragProcs = {
|
||||
|
||||
|
||||
|
||||
static void
|
||||
colorChangedObserver(void *data, WMNotification *notification)
|
||||
{
|
||||
/*
|
||||
WMColorPanel *panel = (WMColorPanel*)WMGetNotificationObject(notification);
|
||||
WMColorWell *cPtr = (WMColorWell*)data;
|
||||
WMColor *color;
|
||||
|
||||
if (!cPtr->flags.active)
|
||||
return;
|
||||
|
||||
color = WMGetColorPanelColor(panel);
|
||||
|
||||
WMSetColorWellColor(cPtr, color);*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
updateColorCallback(void *self, void *data)
|
||||
{
|
||||
/*
|
||||
WMColorPanel *panel = (WMColorPanel*)self;
|
||||
WMColorWell *cPtr = (ColorWell*)data;
|
||||
WMColor *color;
|
||||
|
||||
color = WMGetColorPanelColor(panel);
|
||||
WMSetColorWellColor(cPtr, color);*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
activatedObserver(void *data, WMNotification *notification)
|
||||
{
|
||||
/*
|
||||
WMColorWell *cPtr = (WMColorWell*)data;
|
||||
|
||||
if (!cPtr->flags.active || WMGetNotificationObject(notification) == cPtr)
|
||||
@@ -78,9 +111,11 @@ activatedObserver(void *data, WMNotification *notification)
|
||||
paintColorWell(cPtr);
|
||||
|
||||
cPtr->flags.active = 0;
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
WMColorWell*
|
||||
WMCreateColorWell(WMWidget *parent)
|
||||
{
|
||||
@@ -128,6 +163,9 @@ WMCreateColorWell(WMWidget *parent)
|
||||
|
||||
cPtr->color = WMBlackColor(WMWidgetScreen(cPtr));
|
||||
|
||||
WMAddNotificationObserver(colorChangedObserver, cPtr,
|
||||
WMColorPanelColorChangedNotification, NULL);
|
||||
|
||||
return cPtr;
|
||||
}
|
||||
|
||||
@@ -287,7 +325,7 @@ dragColor(ColorWell *cPtr, XEvent *event, WMPixmap *image)
|
||||
WMScreen *scr = cPtr->view->screen;
|
||||
Display *dpy = scr->display;
|
||||
XColor black = {0, 0,0,0, DoRed|DoGreen|DoBlue};
|
||||
XColor green = {0, 0x4500,0xb000,0x4500, DoRed|DoGreen|DoBlue};
|
||||
XColor green = {0x0045b045, 0x4500,0xb000,0x4500, DoRed|DoGreen|DoBlue};
|
||||
XColor back = {0, 0xffff,0xffff,0xffff, DoRed|DoGreen|DoBlue};
|
||||
Bool done = False;
|
||||
WMColorWell *activeWell = NULL;
|
||||
@@ -405,7 +443,6 @@ handleDragEvents(XEvent *event, void *data)
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
handleActionEvents(XEvent *event, void *data)
|
||||
{
|
||||
@@ -425,31 +462,12 @@ handleActionEvents(XEvent *event, void *data)
|
||||
WMPostNotificationName(_ColorWellActivatedNotification, cPtr, NULL);
|
||||
}
|
||||
cpanel = WMGetColorPanel(scr);
|
||||
|
||||
WMSetColorPanelAction(cpanel, updateColorCallback, cPtr);
|
||||
|
||||
if (cPtr->color)
|
||||
WMSetColorPanelColor(cpanel, cPtr->color);
|
||||
WMShowColorPanel(cpanel);
|
||||
/*
|
||||
{
|
||||
char *t;
|
||||
WMColor *color;
|
||||
|
||||
t = WMRunInputPanel(scr, NULL, "Advanced Color Picker",
|
||||
"Type a Color (this is temporary!!! I'm not THAT dumb :P)",
|
||||
NULL, "OK", "Cancel");
|
||||
|
||||
if (t) {
|
||||
color = WMCreateNamedColor(scr, t, False);
|
||||
if (color) {
|
||||
WMSetColorWellColor(cPtr, color);
|
||||
WMPostNotificationName(WMColorWellDidChangeNotification,
|
||||
cPtr, NULL);
|
||||
WMReleaseColor(color);
|
||||
}
|
||||
free(t);
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -437,27 +437,6 @@ paintTabView(TabView *tPtr)
|
||||
int i;
|
||||
WMRect rect;
|
||||
|
||||
switch (tPtr->flags.type) {
|
||||
case WTTopTabsBevelBorder:
|
||||
drawRelief(scr, W_VIEW(tPtr)->window, 0, tPtr->tabHeight - 1,
|
||||
W_VIEW(tPtr)->size.width,
|
||||
W_VIEW(tPtr)->size.height - tPtr->tabHeight + 1);
|
||||
break;
|
||||
|
||||
case WTNoTabsBevelBorder:
|
||||
W_DrawRelief(scr, W_VIEW(tPtr)->window, 0, 0, W_VIEW(tPtr)->size.width,
|
||||
W_VIEW(tPtr)->size.height, WRRaised);
|
||||
break;
|
||||
|
||||
case WTNoTabsLineBorder:
|
||||
W_DrawRelief(scr, W_VIEW(tPtr)->window, 0, 0, W_VIEW(tPtr)->size.width,
|
||||
W_VIEW(tPtr)->size.height, WRSimple);
|
||||
break;
|
||||
|
||||
case WTNoTabsNoBorder:
|
||||
break;
|
||||
}
|
||||
|
||||
if (tPtr->flags.type == WTTopTabsBevelBorder) {
|
||||
buffer = XCreatePixmap(dpy, W_VIEW(tPtr)->window,
|
||||
W_VIEW(tPtr)->size.width, tPtr->tabHeight,
|
||||
@@ -485,7 +464,7 @@ paintTabView(TabView *tPtr)
|
||||
|
||||
XDrawLine(dpy, buffer, white,
|
||||
8 + 10 + (rect.size.width-10) * tPtr->itemCount,
|
||||
tPtr->tabHeight - 1, W_VIEW(tPtr)->size.width,
|
||||
tPtr->tabHeight - 1, W_VIEW(tPtr)->size.width - 1,
|
||||
tPtr->tabHeight - 1);
|
||||
|
||||
|
||||
@@ -500,6 +479,26 @@ paintTabView(TabView *tPtr)
|
||||
|
||||
XFreePixmap(dpy, buffer);
|
||||
}
|
||||
switch (tPtr->flags.type) {
|
||||
case WTTopTabsBevelBorder:
|
||||
drawRelief(scr, W_VIEW(tPtr)->window, 0, tPtr->tabHeight - 1,
|
||||
W_VIEW(tPtr)->size.width,
|
||||
W_VIEW(tPtr)->size.height - tPtr->tabHeight + 1);
|
||||
break;
|
||||
|
||||
case WTNoTabsBevelBorder:
|
||||
W_DrawRelief(scr, W_VIEW(tPtr)->window, 0, 0, W_VIEW(tPtr)->size.width,
|
||||
W_VIEW(tPtr)->size.height, WRRaised);
|
||||
break;
|
||||
|
||||
case WTNoTabsLineBorder:
|
||||
W_DrawRelief(scr, W_VIEW(tPtr)->window, 0, 0, W_VIEW(tPtr)->size.width,
|
||||
W_VIEW(tPtr)->size.height, WRSimple);
|
||||
break;
|
||||
|
||||
case WTNoTabsNoBorder:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -403,20 +403,34 @@ testTabView(WMScreen *scr)
|
||||
WMAddItemInTabView(tabv, tab);
|
||||
WMSetTabViewItemLabel(tab, "Instances");
|
||||
|
||||
|
||||
frame = WMCreateFrame(win);
|
||||
WMSetFrameRelief(frame, WRFlat);
|
||||
label = WMCreateLabel(frame);
|
||||
WMResizeWidget(label, 100, 100);
|
||||
WMMoveWidget(label, 40, 40);
|
||||
WMResizeWidget(label, 40, 50);
|
||||
WMSetLabelText(label, "Label 2");
|
||||
WMMapWidget(label);
|
||||
|
||||
|
||||
tab = WMCreateTabViewItemWithIdentifier(0);
|
||||
WMSetTabViewItemView(tab, WMWidgetView(frame));
|
||||
WMAddItemInTabView(tabv, tab);
|
||||
WMSetTabViewItemLabel(tab, "Classes");
|
||||
|
||||
|
||||
frame = WMCreateFrame(win);
|
||||
WMSetFrameRelief(frame, WRFlat);
|
||||
label = WMCreateLabel(frame);
|
||||
WMResizeWidget(label, 100, 100);
|
||||
WMMoveWidget(label, 60, 40);
|
||||
WMSetLabelText(label, "Label 3");
|
||||
WMMapWidget(label);
|
||||
|
||||
tab = WMCreateTabViewItemWithIdentifier(0);
|
||||
WMSetTabViewItemView(tab, WMWidgetView(frame));
|
||||
WMAddItemInTabView(tabv, tab);
|
||||
WMSetTabViewItemLabel(tab, "Something");
|
||||
|
||||
|
||||
WMRealizeWidget(win);
|
||||
WMMapSubwidgets(win);
|
||||
WMMapWidget(win);
|
||||
|
||||
@@ -177,7 +177,8 @@ decrToFit(TextField *tPtr)
|
||||
|
||||
static Bool
|
||||
requestHandler(WMWidget *w, Atom selection, Atom target, Atom *type,
|
||||
void **value, unsigned *length, int *format) {
|
||||
void **value, unsigned *length, int *format)
|
||||
{
|
||||
TextField *tPtr = w;
|
||||
int count,count2;
|
||||
Display *dpy = tPtr->view->screen->display;
|
||||
|
||||
Reference in New Issue
Block a user