1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-31 13:05:52 +01:00

added notification in colorpanel

colorwell updating with colorpanel change
This commit is contained in:
kojima
1999-05-16 07:00:01 +00:00
parent 59e1504fe7
commit bedc22384f
8 changed files with 2965 additions and 2922 deletions

View File

@@ -20,6 +20,12 @@ changes since wmaker 0.53.0:
in the delegate variable. in the delegate variable.
Take a look in wfilepanel.c to see how it is used there. 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 - added WMTabView
changes since wmaker 0.52.0: changes since wmaker 0.52.0:

View File

@@ -194,7 +194,6 @@ enum {
WMDeleteTextEvent WMDeleteTextEvent
}; };
typedef enum { typedef enum {
WMGrayModeColorPanel, WMGrayModeColorPanel,
WMRGBModeColorPanel, WMRGBModeColorPanel,
@@ -383,6 +382,8 @@ typedef void WMEventHook(XEvent *event);
* clientData to the data set to with WMSetClientData() */ * clientData to the data set to with WMSetClientData() */
typedef void WMAction(WMWidget *self, void *clientData); 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); typedef void WMCallback(void *data);
@@ -1024,13 +1025,11 @@ void WMCloseColorPanel(WMColorPanel *panel);
void WMSetColorPanelColor(WMColorPanel *panel, WMColor *color); void WMSetColorPanelColor(WMColorPanel *panel, WMColor *color);
RColor WMGetColorPanelColor(WMColorPanel *panel);
void WMSetColorPanelPickerMode(WMColorPanel *panel, WMColorPanelMode mode); 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;
/* ....................................................................... */ /* ....................................................................... */

View File

@@ -6,7 +6,6 @@
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include "WUtil.h"
#include "WINGs.h" #include "WINGs.h"
#if WINGS_H_VERSION < 990222 #if WINGS_H_VERSION < 990222

File diff suppressed because it is too large Load Diff

View File

@@ -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 static void
activatedObserver(void *data, WMNotification *notification) activatedObserver(void *data, WMNotification *notification)
{ {
/*
WMColorWell *cPtr = (WMColorWell*)data; WMColorWell *cPtr = (WMColorWell*)data;
if (!cPtr->flags.active || WMGetNotificationObject(notification) == cPtr) if (!cPtr->flags.active || WMGetNotificationObject(notification) == cPtr)
@@ -78,9 +111,11 @@ activatedObserver(void *data, WMNotification *notification)
paintColorWell(cPtr); paintColorWell(cPtr);
cPtr->flags.active = 0; cPtr->flags.active = 0;
*/
} }
WMColorWell* WMColorWell*
WMCreateColorWell(WMWidget *parent) WMCreateColorWell(WMWidget *parent)
{ {
@@ -128,6 +163,9 @@ WMCreateColorWell(WMWidget *parent)
cPtr->color = WMBlackColor(WMWidgetScreen(cPtr)); cPtr->color = WMBlackColor(WMWidgetScreen(cPtr));
WMAddNotificationObserver(colorChangedObserver, cPtr,
WMColorPanelColorChangedNotification, NULL);
return cPtr; return cPtr;
} }
@@ -287,7 +325,7 @@ dragColor(ColorWell *cPtr, XEvent *event, WMPixmap *image)
WMScreen *scr = cPtr->view->screen; WMScreen *scr = cPtr->view->screen;
Display *dpy = scr->display; Display *dpy = scr->display;
XColor black = {0, 0,0,0, DoRed|DoGreen|DoBlue}; 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}; XColor back = {0, 0xffff,0xffff,0xffff, DoRed|DoGreen|DoBlue};
Bool done = False; Bool done = False;
WMColorWell *activeWell = NULL; WMColorWell *activeWell = NULL;
@@ -405,7 +443,6 @@ handleDragEvents(XEvent *event, void *data)
} }
static void static void
handleActionEvents(XEvent *event, void *data) handleActionEvents(XEvent *event, void *data)
{ {
@@ -425,31 +462,12 @@ handleActionEvents(XEvent *event, void *data)
WMPostNotificationName(_ColorWellActivatedNotification, cPtr, NULL); WMPostNotificationName(_ColorWellActivatedNotification, cPtr, NULL);
} }
cpanel = WMGetColorPanel(scr); cpanel = WMGetColorPanel(scr);
WMSetColorPanelAction(cpanel, updateColorCallback, cPtr);
if (cPtr->color) if (cPtr->color)
WMSetColorPanelColor(cpanel, cPtr->color); WMSetColorPanelColor(cpanel, cPtr->color);
WMShowColorPanel(cpanel); 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);
}
}
*/
} }

View File

@@ -437,27 +437,6 @@ paintTabView(TabView *tPtr)
int i; int i;
WMRect rect; 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) { if (tPtr->flags.type == WTTopTabsBevelBorder) {
buffer = XCreatePixmap(dpy, W_VIEW(tPtr)->window, buffer = XCreatePixmap(dpy, W_VIEW(tPtr)->window,
W_VIEW(tPtr)->size.width, tPtr->tabHeight, W_VIEW(tPtr)->size.width, tPtr->tabHeight,
@@ -485,7 +464,7 @@ paintTabView(TabView *tPtr)
XDrawLine(dpy, buffer, white, XDrawLine(dpy, buffer, white,
8 + 10 + (rect.size.width-10) * tPtr->itemCount, 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); tPtr->tabHeight - 1);
@@ -500,6 +479,26 @@ paintTabView(TabView *tPtr)
XFreePixmap(dpy, buffer); 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;
}
} }

View File

@@ -403,20 +403,34 @@ testTabView(WMScreen *scr)
WMAddItemInTabView(tabv, tab); WMAddItemInTabView(tabv, tab);
WMSetTabViewItemLabel(tab, "Instances"); WMSetTabViewItemLabel(tab, "Instances");
frame = WMCreateFrame(win); frame = WMCreateFrame(win);
WMSetFrameRelief(frame, WRFlat); WMSetFrameRelief(frame, WRFlat);
label = WMCreateLabel(frame); label = WMCreateLabel(frame);
WMResizeWidget(label, 100, 100); WMResizeWidget(label, 40, 50);
WMMoveWidget(label, 40, 40);
WMSetLabelText(label, "Label 2"); WMSetLabelText(label, "Label 2");
WMMapWidget(label); WMMapWidget(label);
tab = WMCreateTabViewItemWithIdentifier(0); tab = WMCreateTabViewItemWithIdentifier(0);
WMSetTabViewItemView(tab, WMWidgetView(frame)); WMSetTabViewItemView(tab, WMWidgetView(frame));
WMAddItemInTabView(tabv, tab); WMAddItemInTabView(tabv, tab);
WMSetTabViewItemLabel(tab, "Classes"); 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); WMRealizeWidget(win);
WMMapSubwidgets(win); WMMapSubwidgets(win);
WMMapWidget(win); WMMapWidget(win);

View File

@@ -177,7 +177,8 @@ decrToFit(TextField *tPtr)
static Bool static Bool
requestHandler(WMWidget *w, Atom selection, Atom target, Atom *type, requestHandler(WMWidget *w, Atom selection, Atom target, Atom *type,
void **value, unsigned *length, int *format) { void **value, unsigned *length, int *format)
{
TextField *tPtr = w; TextField *tPtr = w;
int count,count2; int count,count2;
Display *dpy = tPtr->view->screen->display; Display *dpy = tPtr->view->screen->display;