Esempio n. 1
0
static void sgrabClicked(WMWidget * w, void *data)
{
	_Panel *panel = (_Panel *) data;
	Display *dpy = WMScreenDisplay(WMWidgetScreen(panel->parent));
	char *shortcut;

	if (w == panel->sclearB) {
		WMSetTextFieldText(panel->shortT, "");
		updateMenuItem(panel, panel->currentItem, panel->shortT);
		return;
	}

	if (!panel->capturing) {
		panel->capturing = 1;
		WMSetButtonText(w, _("Cancel"));
		XGrabKeyboard(dpy, WMWidgetXID(panel->parent), True, GrabModeAsync, GrabModeAsync, CurrentTime);
		shortcut = capture_shortcut(dpy, &panel->capturing, 0);
		if (shortcut) {
			WMSetTextFieldText(panel->shortT, shortcut);
			updateMenuItem(panel, panel->currentItem, panel->shortT);
			wfree(shortcut);
		}
	}
	panel->capturing = 0;
	WMSetButtonText(w, _("Capture"));
	XUngrabKeyboard(dpy, CurrentTime);
}
Esempio n. 2
0
void testTextField(WMScreen * scr)
{
	WMWindow *win;
	WMTextField *field, *field2;

	windowCount++;

	win = WMCreateWindow(scr, "testTextField");
	WMResizeWidget(win, 400, 300);

	WMSetWindowCloseAction(win, closeAction, NULL);

	field = WMCreateTextField(win);
	WMResizeWidget(field, 200, 20);
	WMMoveWidget(field, 20, 20);
	WMSetTextFieldText(field, "the little \xc2\xa9 sign");

	field2 = WMCreateTextField(win);
	WMResizeWidget(field2, 200, 20);
	WMMoveWidget(field2, 20, 50);
	WMSetTextFieldAlignment(field2, WARight);

	WMRealizeWidget(win);
	WMMapSubwidgets(win);
	WMMapWidget(win);

}
Esempio n. 3
0
static void browseForFile(WMWidget * self, void *clientData)
{
	_Panel *panel = (_Panel *) clientData;
	WMFilePanel *filePanel;
	char *text, *oldprog, *newprog;

	filePanel = WMGetOpenPanel(WMWidgetScreen(self));
	text = WMGetTextFieldText(panel->commandT);

	oldprog = wtrimspace(text);
	wfree(text);

	if (oldprog[0] == 0 || oldprog[0] != '/') {
		wfree(oldprog);
		oldprog = wstrdup("/");
	} else {
		char *ptr = oldprog;
		while (*ptr && !isspace(*ptr))
			ptr++;
		*ptr = 0;
	}

	WMSetFilePanelCanChooseDirectories(filePanel, False);

	if (WMRunModalFilePanelForDirectory(filePanel, panel->parent, oldprog, _("Select Program"), NULL) == True) {
		newprog = WMGetFilePanelFileName(filePanel);
		WMSetTextFieldText(panel->commandT, newprog);
		updateMenuItem(panel, panel->currentItem, panel->commandT);
		wfree(newprog);
	}

	wfree(oldprog);
}
Esempio n. 4
0
static void chooseIconCallback(WMWidget * self, void *clientData)
{
	char *file;
	AppSettingsPanel *panel = (AppSettingsPanel *) clientData;
	int result;

	panel->choosingIcon = 1;

	WMSetButtonEnabled(panel->browseBtn, False);

	result = wIconChooserDialog(panel->wwin->screen_ptr, &file,
				    panel->editedIcon->wm_instance, panel->editedIcon->wm_class);

	panel->choosingIcon = 0;
	if (!panel->destroyed) {
		if (result) {
			WMSetTextFieldText(panel->iconField, file);
			wfree(file);
			updateSettingsPanelIcon(panel);
		}

		WMSetButtonEnabled(panel->browseBtn, True);
	} else {
		/* kluge for the case, the user asked to close the panel before
		 * the icon chooser */
		DestroyDockAppSettingsPanel(panel);
	}
}
Esempio n. 5
0
static void chooseIconCallback(WMWidget *self, void *clientData)
{
	char *file;
	InspectorPanel *panel = (InspectorPanel *) clientData;
	int result;

	panel->choosingIcon = 1;

	WMSetButtonEnabled(panel->browseIconBtn, False);

	result = wIconChooserDialog(panel->frame->screen_ptr, &file,
				    panel->inspected->wm_instance,
				    panel->inspected->wm_class);

	panel->choosingIcon = 0;

	if (!panel->destroyed) {	/* kluge */
		if (result) {
			WMSetTextFieldText(panel->fileText, file);
			showIconFor(WMWidgetScreen(self), panel, NULL, NULL, USE_TEXT_FIELD);
		}
		WMSetButtonEnabled(panel->browseIconBtn, True);
	} else {
		freeInspector(panel);
	}
	if (result)
		wfree(file);
}
Esempio n. 6
0
File: Focus.c Progetto: jafd/wmaker
static void pushDelayButton(WMWidget * w, void *data)
{
	_Panel *panel = (_Panel *) data;

	panel->raiseDelaySelected = 1;
	if (w == panel->raisB[0]) {
		WMSetTextFieldText(panel->raisT, "OFF");
	} else if (w == panel->raisB[1]) {
		WMSetTextFieldText(panel->raisT, "10");
	} else if (w == panel->raisB[2]) {
		WMSetTextFieldText(panel->raisT, "100");
	} else if (w == panel->raisB[3]) {
		WMSetTextFieldText(panel->raisT, "350");
	} else if (w == panel->raisB[4]) {
		WMSetTextFieldText(panel->raisT, "800");
	}
}
Esempio n. 7
0
File: Focus.c Progetto: jafd/wmaker
static void showData(_Panel * panel)
{
	char *str;
	int i;
	char buffer[32];

	str = GetStringForKey("FocusMode");
	if (!str)
		str = "manual";
	if (strcasecmp(str, "manual") == 0 || strcasecmp(str, "clicktofocus") == 0)
		WMSetButtonSelected(panel->kfocB[0], 1);
	else if (strcasecmp(str, "auto") == 0 || strcasecmp(str, "semiauto") == 0
		 || strcasecmp(str, "sloppy") == 0)
		WMSetButtonSelected(panel->kfocB[1], 1);
	else {
		wwarning(_("bad option value %s for option FocusMode. Using default Manual"), str);
		WMSetButtonSelected(panel->kfocB[0], 1);
	}

	 /**/ str = GetStringForKey("ColormapMode");
	if (!str)
		str = "auto";
	if (strcasecmp(str, "manual") == 0 || strcasecmp(str, "clicktofocus") == 0) {
		WMPerformButtonClick(panel->manB);
	} else if (strcasecmp(str, "auto") == 0 || strcasecmp(str, "focusfollowsmouse") == 0) {
		WMPerformButtonClick(panel->autB);
	} else {
		wwarning(_("bad option value %s for option ColormapMode. Using default Auto"), str);
		WMPerformButtonClick(panel->manB);
	}

	 /**/ i = GetIntegerForKey("RaiseDelay");
	sprintf(buffer, "%i", i);
	WMSetTextFieldText(panel->raisT, buffer);

	switch (i) {
	case 0:
		WMPerformButtonClick(panel->raisB[0]);
		break;
	case 10:
		WMPerformButtonClick(panel->raisB[1]);
		break;
	case 100:
		WMPerformButtonClick(panel->raisB[2]);
		break;
	case 350:
		WMPerformButtonClick(panel->raisB[3]);
		break;
	case 800:
		WMPerformButtonClick(panel->raisB[4]);
		break;
	}

	 /**/ WMSetButtonSelected(panel->ignB, GetBoolForKey("IgnoreFocusClick"));

	WMSetButtonSelected(panel->newB, GetBoolForKey("AutoFocus"));
	WMSetButtonSelected(panel->craisB, GetBoolForKey("CirculateRaise"));
}
Esempio n. 8
0
File: Docks.c Progetto: jafd/wmaker
static void showData(_Panel *panel)
{
	char *value;
	int i;
	for (i = 0; i < 4; i++)
	{
		value = GetStringForKey(auto_delay[i].key);
		WMSetTextFieldText(panel->autoDelayT[i], value);
		adjustButtonSelectionBasedOnValue(panel, i, value);
	}
	for (i = 0; i < 3; i++)
	{
		WMSetButtonSelected(panel->docksB[i], !GetBoolForKey(dock_config[i].disable_key));
	}
}
Esempio n. 9
0
static void doubleClick(WMWidget * w, void *data)
{
	_Panel *panel = (_Panel *) data;
	int i;
	char buffer[32];

	for (i = 0; i < wlengthof(panel->ddelaB); i++) {
		if (panel->ddelaB[i] == w)
			break;
	}
	WINGsConfiguration.doubleClickDelay = DELAY(i);

	sprintf(buffer, "%i", DELAY(i));
	WMSetTextFieldText(panel->ddelaT, buffer);
}
Esempio n. 10
0
File: Docks.c Progetto: jafd/wmaker
static void pushAutoDelayButton(WMWidget *w, void *data)
{
	_Panel *panel = (_Panel *) data;
	int i, j;
	for (i = 0; i < 4; i++)
	{
		for (j = 0; j < 5; j++)
		{
			if (w == panel->autoDelayB[i][j])
			{
				WMSetTextFieldText(panel->autoDelayT[i], autoDelayPresetValues[j]);
				return;
			}
		}
	}
}
Esempio n. 11
0
static void speedChange(WMWidget * w, void *data)
{
	_Panel *panel = (_Panel *) data;
	int i;
	char buffer[64];
	int threshold;
	char *tmp;

	if (w == NULL) {
		float accel;

		tmp = WMGetTextFieldText(panel->acceT);
		if (sscanf(tmp, "%f", &accel) != 1 || accel < 0) {
			WMRunAlertPanel(WMWidgetScreen(panel->acceT), GetWindow(),
					_("Error"),
					_("Invalid mouse acceleration value. Must be a positive real value."),
					_("OK"), NULL, NULL);
			wfree(tmp);
			return;
		}
		panel->acceleration = accel;
		wfree(tmp);
	} else {
		i = (int)WMGetSliderValue(panel->speedS);

		panel->acceleration = 0.25 + (i * 0.25);

		sprintf(buffer, "%.2f", 0.25 + (i * 0.25));
		WMSetTextFieldText(panel->acceT, buffer);
	}

	tmp = WMGetTextFieldText(panel->threT);
	if (sscanf(tmp, "%i", &threshold) != 1 || threshold < 0 || threshold > panel->maxThreshold) {
		WMRunAlertPanel(WMWidgetScreen(panel->parent), GetWindow(), _("Error"),
				_
				("Invalid mouse acceleration threshold value. Must be the number of pixels to travel before accelerating."),
				_("OK"), NULL, NULL);
	} else {
		setMouseAccel(WMWidgetScreen(panel->parent), panel->acceleration, threshold);
	}
	wfree(tmp);
}
Esempio n. 12
0
static void menuItemSelected(WEditMenuDelegate * delegate, WEditMenu * menu, WEditMenuItem * item)
{
	ItemData *data = WGetEditMenuItemData(item);
	_Panel *panel = (_Panel *) delegate->data;

	/* Parameter not used, but tell the compiler that it is ok */
	(void) menu;

	panel->currentItem = item;

	if (data) {
		changeInfoType(panel, WGetEditMenuItemTitle(item), data->type);

		switch (data->type) {
		case NoInfo:
			break;

		case ExecInfo:
			WMSetTextFieldText(panel->commandT, data->param.exec.command);
			WMSetTextFieldText(panel->shortT, data->param.exec.shortcut);
			break;

		case CommandInfo:
			WMSelectListItem(panel->icommandL, data->param.command.command);
			WMSetListPosition(panel->icommandL, data->param.command.command - 2);
			WMSetTextFieldText(panel->shortT, data->param.command.shortcut);

			switch (data->param.command.command) {
			case 3:
			case 4:
				WMSetButtonSelected(panel->quickB, data->param.command.parameter != NULL);
				break;
			case 6:
				WMSetTextFieldText(panel->paramT, data->param.command.parameter);
				break;
			}

			icommandLClicked(panel->icommandL, panel);
			break;

		case PipeInfo:
			WMSetTextFieldText(panel->pipeT, data->param.pipe.command);
			WMSetButtonSelected(panel->pipeCacheB, data->param.pipe.cached);
			break;

		case PLPipeInfo:
			WMSetTextFieldText(panel->plpipeT, data->param.pipe.command);
			WMSetButtonSelected(panel->plpipeCacheB, data->param.pipe.cached);
			break;

		case ExternalInfo:
			WMSetTextFieldText(panel->pathT, data->param.external.path);
			break;

		case DirectoryInfo:
			WMSetTextFieldText(panel->dpathT, data->param.directory.directory);
			WMSetTextFieldText(panel->dcommandT, data->param.directory.command);
			WMSetButtonSelected(panel->dstripB, data->param.directory.stripExt);
			break;

		case WSMenuInfo:
			break;

		default:
			break;
		}
	}
}
Esempio n. 13
0
static void showData(_Panel * panel)
{
	char *str;
	int i;
	int a = -1, b = -1;
	float accel;
	char buffer[32];
	Display *dpy = WMScreenDisplay(WMWidgetScreen(panel->parent));

	for (i = 0; i < wlengthof(button_list); i++) {
		int action;

		str = GetStringForKey(button_list[i].db_key);
		if (button_list[i].type == T_BUTTON)
			action = getButtonAction(str);
		else
			action = getWheelAction(str);

		if (action < 0) {
			if (action == -1)
				wwarning(_("bad value %s for option %s"), str, button_list[i].db_key);
			action = button_list[i].default_action;
		}
		WMSetPopUpButtonSelectedItem(panel->mouse_action[i].popup, action);
	}

	WMSetButtonSelected(panel->disaB, GetBoolForKey("DisableWSMouseActions"));
	toggle_disabling_of_mouse_actions(panel->disaB, panel);

	 /**/ getMouseParameters(dpy, &accel, &a);
	panel->maxThreshold = WidthOfScreen(DefaultScreenOfDisplay(dpy));
	if (a > panel->maxThreshold) {
		panel->maxThreshold = a;
	}
	sprintf(buffer, "%i", a);
	WMSetTextFieldText(panel->threT, buffer);

	WMSetSliderValue(panel->speedS, (accel - 0.25F) / 0.25F);

	panel->acceleration = accel;
	sprintf(buffer, "%.2f", (double)accel);
	WMSetTextFieldText(panel->acceT, buffer);

	 /**/ b = GetIntegerForKey("DoubleClickTime");
	/* find best match */
	a = -1;
	for (i = 0; i < wlengthof(panel->ddelaB); i++) {
		if (DELAY(i) == b)
			a = i;
	}
	if (a >= 0)
		WMPerformButtonClick(panel->ddelaB[a]);
	sprintf(buffer, "%i", b);
	WMSetTextFieldText(panel->ddelaT, buffer);

	 /**/ str = GetStringForKey("ModifierKey");
	if (!str)
		str = "mod1";
	a = ModifierFromKey(dpy, str);

	if (a != -1) {
		str = modifierNames[a];

		a = 0;
		for (i = 0; i < WMGetPopUpButtonNumberOfItems(panel->grabP); i++) {
			if (strstr(WMGetPopUpButtonItem(panel->grabP, i), str)) {
				WMSetPopUpButtonSelectedItem(panel->grabP, i);
				a = 1;
				break;
			}
		}
	}

	if (a < 1) {
		char *previous;

		previous = WMGetPopUpButtonItem(panel->grabP, 0);
		if (previous != NULL)
			WMSetPopUpButtonSelectedItem(panel->grabP, 0);
		wwarning(_("modifier key %s for option ModifierKey was not recognized. Using %s as default"),
					str, previous?previous:"(empty)");
	}
}
Esempio n. 14
0
void ShowDockAppSettingsPanel(WAppIcon * aicon)
{
	AppSettingsPanel *panel;
	WScreen *scr = aicon->icon->core->screen_ptr;
	Window parent;
	WMFont *font;
	int x, y;
	WMBox *vbox;

	panel = wmalloc(sizeof(AppSettingsPanel));

	panel->editedIcon = aicon;

	aicon->panel = panel;
	aicon->editing = 1;

	panel->win = WMCreateWindow(scr->wmscreen, "applicationSettings");
	WMResizeWidget(panel->win, PWIDTH, PHEIGHT);

	panel->iconLabel = WMCreateLabel(panel->win);
	WMResizeWidget(panel->iconLabel, 64, 64);
	WMMoveWidget(panel->iconLabel, 10, 10);
	WMSetLabelImagePosition(panel->iconLabel, WIPImageOnly);

	panel->nameLabel = WMCreateLabel(panel->win);
	WMResizeWidget(panel->nameLabel, 190, 18);
	WMMoveWidget(panel->nameLabel, 80, 35);
	WMSetLabelTextAlignment(panel->nameLabel, WALeft);
	font = WMBoldSystemFontOfSize(scr->wmscreen, 14);
	WMSetLabelFont(panel->nameLabel, font);
	WMReleaseFont(font);
	if (aicon->wm_class && strcmp(aicon->wm_class, "DockApp") == 0)
		WMSetLabelText(panel->nameLabel, aicon->wm_instance);
	else
		WMSetLabelText(panel->nameLabel, aicon->wm_class);

	vbox = WMCreateBox(panel->win);
	WMResizeWidget(vbox, PWIDTH - 20, PHEIGHT - 84 - 10);
	WMMoveWidget(vbox, 10, 84);

	panel->autoLaunchBtn = WMCreateSwitchButton(vbox);
	WMAddBoxSubview(vbox, WMWidgetView(panel->autoLaunchBtn), False, True, 20, 20, 2);
	WMSetButtonText(panel->autoLaunchBtn, _("Start when Window Maker is started"));
	WMSetButtonSelected(panel->autoLaunchBtn, aicon->auto_launch);

	panel->lockBtn = WMCreateSwitchButton(vbox);
	WMAddBoxSubview(vbox, WMWidgetView(panel->lockBtn), False, True, 20, 20, 5);
	WMSetButtonText(panel->lockBtn, _("Lock (prevent accidental removal)"));
	WMSetButtonSelected(panel->lockBtn, aicon->lock);

	panel->commandFrame = WMCreateFrame(vbox);
	WMSetFrameTitle(panel->commandFrame, _("Application path and arguments"));
	WMAddBoxSubview(vbox, WMWidgetView(panel->commandFrame), False, True, 50, 50, 5);

	panel->commandField = WMCreateTextField(panel->commandFrame);
	WMResizeWidget(panel->commandField, 256, 20);
	WMMoveWidget(panel->commandField, 10, 20);
	WMSetTextFieldText(panel->commandField, aicon->command);

	WMMapSubwidgets(panel->commandFrame);

	panel->pasteCommandFrame = WMCreateFrame(vbox);
	WMSetFrameTitle(panel->pasteCommandFrame, _("Command for middle-click launch"));
	WMAddBoxSubview(vbox, WMWidgetView(panel->pasteCommandFrame), False, True, 70, 70, 5);

	panel->pasteCommandField = WMCreateTextField(panel->pasteCommandFrame);
	WMResizeWidget(panel->pasteCommandField, 256, 20);
	WMMoveWidget(panel->pasteCommandField, 10, 20);

	panel->pasteCommandLabel = WMCreateLabel(panel->pasteCommandFrame);
	WMResizeWidget(panel->pasteCommandLabel, 256, 18);
	WMMoveWidget(panel->pasteCommandLabel, 10, 45);

	WMSetTextFieldText(panel->pasteCommandField, aicon->paste_command);
	WMSetLabelText(panel->pasteCommandLabel, _("%s will be replaced with current selection"));
	WMMapSubwidgets(panel->pasteCommandFrame);

	panel->dndCommandFrame = WMCreateFrame(vbox);
	WMSetFrameTitle(panel->dndCommandFrame, _("Command for files dropped with DND"));
	WMAddBoxSubview(vbox, WMWidgetView(panel->dndCommandFrame), False, True, 70, 70, 5);

	panel->dndCommandField = WMCreateTextField(panel->dndCommandFrame);
	WMResizeWidget(panel->dndCommandField, 256, 20);
	WMMoveWidget(panel->dndCommandField, 10, 20);

	panel->dndCommandLabel = WMCreateLabel(panel->dndCommandFrame);
	WMResizeWidget(panel->dndCommandLabel, 256, 18);
	WMMoveWidget(panel->dndCommandLabel, 10, 45);
#ifdef XDND
	WMSetTextFieldText(panel->dndCommandField, aicon->dnd_command);
	WMSetLabelText(panel->dndCommandLabel, _("%d will be replaced with the file name"));
#else
	WMSetTextFieldEditable(panel->dndCommandField, False);
	WMSetLabelText(panel->dndCommandLabel, _("DND support was not compiled in"));
#endif
	WMMapSubwidgets(panel->dndCommandFrame);

	panel->iconFrame = WMCreateFrame(vbox);
	WMSetFrameTitle(panel->iconFrame, _("Icon Image"));
	WMAddBoxSubview(vbox, WMWidgetView(panel->iconFrame), False, True, 50, 50, 10);

	panel->iconField = WMCreateTextField(panel->iconFrame);
	WMResizeWidget(panel->iconField, 176, 20);
	WMMoveWidget(panel->iconField, 10, 20);
	WMSetTextFieldText(panel->iconField, wDefaultGetIconFile(aicon->wm_instance, aicon->wm_class, False));

	panel->browseBtn = WMCreateCommandButton(panel->iconFrame);
	WMResizeWidget(panel->browseBtn, 70, 24);
	WMMoveWidget(panel->browseBtn, 195, 18);
	WMSetButtonText(panel->browseBtn, _("Browse..."));
	WMSetButtonAction(panel->browseBtn, chooseIconCallback, panel);

	{
		WMBox *hbox;

		hbox = WMCreateBox(vbox);
		WMSetBoxHorizontal(hbox, True);
		WMAddBoxSubview(vbox, WMWidgetView(hbox), False, True, 24, 24, 0);

		panel->okBtn = WMCreateCommandButton(hbox);
		WMSetButtonText(panel->okBtn, _("OK"));
		WMSetButtonAction(panel->okBtn, panelBtnCallback, panel);
		WMAddBoxSubviewAtEnd(hbox, WMWidgetView(panel->okBtn), False, True, 80, 80, 0);

		panel->cancelBtn = WMCreateCommandButton(hbox);
		WMSetButtonText(panel->cancelBtn, _("Cancel"));
		WMSetButtonAction(panel->cancelBtn, panelBtnCallback, panel);
		WMAddBoxSubviewAtEnd(hbox, WMWidgetView(panel->cancelBtn), False, True, 80, 80, 5);

		WMMapSubwidgets(hbox);
	}

	WMRealizeWidget(panel->win);
	WMMapSubwidgets(panel->win);
	WMMapSubwidgets(vbox);
	WMMapSubwidgets(panel->iconFrame);

	updateSettingsPanelIcon(panel);

	parent = XCreateSimpleWindow(dpy, scr->root_win, 0, 0, PWIDTH, PHEIGHT, 0, 0, 0);
	XSelectInput(dpy, parent, KeyPressMask | KeyReleaseMask);

	XReparentWindow(dpy, WMWidgetXID(panel->win), parent, 0, 0);

	/*
	 * make things relative to head
	 */
	{
		WMRect rect = wGetRectForHead(scr, wGetHeadForPointerLocation(scr));

		y = aicon->y_pos;
		if (y < 0)
			y = 0;
		else if (y + PHEIGHT > rect.pos.y + rect.size.height)
			y = rect.pos.y + rect.size.height - PHEIGHT - 30;

		if (aicon->dock && aicon->dock->type == WM_DOCK) {
			if (aicon->dock->on_right_side)
				x = rect.pos.x + rect.size.width / 2;
			else
				x = rect.pos.x + rect.size.width / 2 - PWIDTH - 2;
		} else {
			x = rect.pos.x + (rect.size.width - PWIDTH) / 2;
		}
	}

	panel->wwin = wManageInternalWindow(scr, parent, None,
					    _("Docked Application Settings"), x, y, PWIDTH, PHEIGHT);

	panel->wwin->client_leader = WMWidgetXID(panel->win);

	panel->parent = parent;

	WMMapWidget(panel->win);

	wWindowMap(panel->wwin);
}
Esempio n. 15
0
static void createPanel(Panel * p)
{
	_Panel *panel = (_Panel *) p;
	WMScreen *scr = WMWidgetScreen(panel->parent);
	int i;
	WMColor *color;
	WMFont *font;

	color = WMDarkGrayColor(scr);
	font = WMSystemFontOfSize(scr, 10);

	panel->box = WMCreateBox(panel->parent);
	WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);

    /**************** Initial Key Repeat ***************/
	panel->delaF = WMCreateFrame(panel->box);
	WMResizeWidget(panel->delaF, 495, 60);
	WMMoveWidget(panel->delaF, 15, 10);
	WMSetFrameTitle(panel->delaF, _("Initial Key Repeat"));

	for (i = 0; i < 4; i++) {
		panel->delaB[i] = WMCreateButton(panel->delaF, WBTOnOff);
		WMResizeWidget(panel->delaB[i], 60, 20);
		WMMoveWidget(panel->delaB[i], 70 + i * 60, 25);
		if (i > 0)
			WMGroupButtons(panel->delaB[0], panel->delaB[i]);
		switch (i) {
		case 0:
			WMSetButtonText(panel->delaB[i], "....a");
			break;
		case 1:
			WMSetButtonText(panel->delaB[i], "...a");
			break;
		case 2:
			WMSetButtonText(panel->delaB[i], "..a");
			break;
		case 3:
			WMSetButtonText(panel->delaB[i], ".a");
			break;
		}
	}
	panel->dmsT = WMCreateTextField(panel->delaF);
	WMResizeWidget(panel->dmsT, 50, 20);
	WMMoveWidget(panel->dmsT, 345, 25);
	/*    WMSetTextFieldAlignment(panel->dmsT, WARight); */

	panel->dmsL = WMCreateLabel(panel->delaF);
	WMResizeWidget(panel->dmsL, 30, 16);
	WMMoveWidget(panel->dmsL, 400, 30);
	WMSetLabelTextColor(panel->dmsL, color);
	WMSetLabelFont(panel->dmsL, font);
	WMSetLabelText(panel->dmsL, "msec");

	WMMapSubwidgets(panel->delaF);

    /**************** Key Repeat Rate ***************/
	panel->rateF = WMCreateFrame(panel->box);
	WMResizeWidget(panel->rateF, 495, 60);
	WMMoveWidget(panel->rateF, 15, 95);
	WMSetFrameTitle(panel->rateF, _("Key Repeat Rate"));

	for (i = 0; i < 4; i++) {
		panel->rateB[i] = WMCreateButton(panel->rateF, WBTOnOff);
		WMResizeWidget(panel->rateB[i], 60, 20);
		WMMoveWidget(panel->rateB[i], 70 + i * 60, 25);
		if (i > 0)
			WMGroupButtons(panel->rateB[0], panel->rateB[i]);
		switch (i) {
		case 0:
			WMSetButtonText(panel->rateB[i], "a....a");
			break;
		case 1:
			WMSetButtonText(panel->rateB[i], "a...a");
			break;
		case 2:
			WMSetButtonText(panel->rateB[i], "a..a");
			break;
		case 3:
			WMSetButtonText(panel->rateB[i], "a.a");
			break;
		}
	}
	panel->rmsT = WMCreateTextField(panel->rateF);
	WMResizeWidget(panel->rmsT, 50, 20);
	WMMoveWidget(panel->rmsT, 345, 25);
	/*    WMSetTextFieldAlignment(panel->rmsT, WARight); */

	panel->rmsL = WMCreateLabel(panel->rateF);
	WMResizeWidget(panel->rmsL, 30, 16);
	WMMoveWidget(panel->rmsL, 400, 30);
	WMSetLabelTextColor(panel->rmsL, color);
	WMSetLabelFont(panel->rmsL, font);
	WMSetLabelText(panel->rmsL, "msec");

	WMMapSubwidgets(panel->rateF);

	panel->testT = WMCreateTextField(panel->box);
	WMResizeWidget(panel->testT, 480, 20);
	WMMoveWidget(panel->testT, 20, 180);
	WMSetTextFieldText(panel->testT, _("Type here to test"));

	WMReleaseColor(color);
	WMReleaseFont(font);

	WMRealizeWidget(panel->box);
	WMMapSubwidgets(panel->box);
}
Esempio n. 16
0
static int showIconFor(WMScreen *scrPtr, InspectorPanel *panel, const char *wm_instance, const char *wm_class, int flags)
{
	WMPixmap *pixmap = (WMPixmap *) NULL;
	char *file = NULL, *path = NULL;

	if ((flags & USE_TEXT_FIELD) != 0) {
		file = WMGetTextFieldText(panel->fileText);
		if (file && file[0] == 0) {
			wfree(file);
			file = NULL;
		}
	} else if (flags & REVERT_TO_DEFAULT) {
		const char *db_icon;

		/* Get the application icon, default NOT included */
		db_icon = wDefaultGetIconFile(wm_instance, wm_class, False);
		if (db_icon != NULL) {
			file = wstrdup(db_icon);
			flags |= UPDATE_TEXT_FIELD;
		}
	}

	if ((flags & UPDATE_TEXT_FIELD) != 0)
		WMSetTextFieldText(panel->fileText, file);

	if (file) {
		path = FindImage(wPreferences.icon_path, file);

		if (!path) {
			char *buf;
			int len = strlen(file) + 80;

			buf = wmalloc(len);
			snprintf(buf, len, _("Could not find icon \"%s\" specified for this window"), file);
			wMessageDialog(panel->frame->screen_ptr, _("Error"), buf, _("OK"), NULL, NULL);
			wfree(buf);
			wfree(file);
			return -1;
		}

		pixmap = WMCreatePixmapFromFile(scrPtr, path);
		wfree(path);

		if (!pixmap) {
			char *buf;
			int len = strlen(file) + 80;

			buf = wmalloc(len);
			snprintf(buf, len, _("Could not open specified icon \"%s\":%s"),
				 file, RMessageForError(RErrorCode));
			wMessageDialog(panel->frame->screen_ptr, _("Error"), buf, _("OK"), NULL, NULL);
			wfree(buf);
			wfree(file);
			return -1;
		}
		wfree(file);
	}

	WMSetLabelImage(panel->iconLbl, pixmap);
	if (pixmap)
		WMReleasePixmap(pixmap);

	return 0;
}
Esempio n. 17
0
static void create_tab_icon_workspace(WWindow *wwin, InspectorPanel *panel)
{
	int i = 0;

	/* miniwindow/workspace */
	panel->iconFrm = WMCreateFrame(panel->win);
	WMMoveWidget(panel->iconFrm, 15, 50);
	WMResizeWidget(panel->iconFrm, PWIDTH - (2 * 15), 170);
	WMSetFrameTitle(panel->iconFrm, _("Miniwindow Image"));

	panel->iconLbl = WMCreateLabel(panel->iconFrm);
	WMMoveWidget(panel->iconLbl, PWIDTH - (2 * 15) - 22 - 64, 20);
	WMResizeWidget(panel->iconLbl, 64, 64);
	WMSetLabelRelief(panel->iconLbl, WRGroove);
	WMSetLabelImagePosition(panel->iconLbl, WIPImageOnly);

	panel->browseIconBtn = WMCreateCommandButton(panel->iconFrm);
	WMSetButtonAction(panel->browseIconBtn, chooseIconCallback, panel);
	WMMoveWidget(panel->browseIconBtn, 22, 32);
	WMResizeWidget(panel->browseIconBtn, 120, 26);
	WMSetButtonText(panel->browseIconBtn, _("Browse..."));

	panel->fileLbl = WMCreateLabel(panel->iconFrm);
	WMMoveWidget(panel->fileLbl, 20, 85);
	WMResizeWidget(panel->fileLbl, PWIDTH - (2 * 15) - (2 * 20), 14);
	WMSetLabelText(panel->fileLbl, _("Icon filename:"));

	panel->fileText = WMCreateTextField(panel->iconFrm);
	WMMoveWidget(panel->fileText, 20, 105);
	WMResizeWidget(panel->fileText, PWIDTH - (2 * 20) - (2 * 15), 20);
	WMSetTextFieldText(panel->fileText, NULL);
	WMAddNotificationObserver(textEditedObserver, panel, WMTextDidEndEditingNotification, panel->fileText);

	panel->alwChk = WMCreateSwitchButton(panel->iconFrm);
	WMMoveWidget(panel->alwChk, 20, 130);
	WMResizeWidget(panel->alwChk, PWIDTH - (2 * 15) - (2 * 15), 30);
	WMSetButtonText(panel->alwChk, _("Ignore client supplied icon"));
	WMSetButtonSelected(panel->alwChk, WFLAGP(wwin, always_user_icon));

	panel->wsFrm = WMCreateFrame(panel->win);
	WMMoveWidget(panel->wsFrm, 15, 225);
	WMResizeWidget(panel->wsFrm, PWIDTH - (2 * 15), 70);
	WMSetFrameTitle(panel->wsFrm, _("Initial Workspace"));

	WMSetBalloonTextForView(_("The workspace to place the window when it's"
				  "first shown."), WMWidgetView(panel->wsFrm));

	panel->wsP = WMCreatePopUpButton(panel->wsFrm);
	WMMoveWidget(panel->wsP, 20, 30);
	WMResizeWidget(panel->wsP, PWIDTH - (2 * 15) - (2 * 20), 20);
	WMAddPopUpButtonItem(panel->wsP, _("Nowhere in particular"));

	for (i = 0; i < w_global.workspace.count; i++)
		WMAddPopUpButtonItem(panel->wsP, w_global.workspace.array[i]->name);

	i = wDefaultGetStartWorkspace(wwin->wm_instance, wwin->wm_class);
	if (i >= 0 && i <= w_global.workspace.count)
		WMSetPopUpButtonSelectedItem(panel->wsP, i + 1);
	else
		WMSetPopUpButtonSelectedItem(panel->wsP, 0);
}