mirror of
https://github.com/edeproject/ede.git
synced 2023-08-10 21:13:03 +03:00
155 lines
4.8 KiB
C++
155 lines
4.8 KiB
C++
// generated by Fast Light User Interface Designer (fluid) version 2.0100
|
|
|
|
#include "ekeyconf.h"
|
|
/*
|
|
* $Id$
|
|
*
|
|
* Keyboard shortcuts applet
|
|
* Part of Equinox Desktop Environment (EDE).
|
|
* Copyright (c) 2005-2006 EDE Authors.
|
|
*
|
|
* This program is licenced under terms of the
|
|
* GNU General Public Licence version 2 or newer.
|
|
* See COPYING for details.
|
|
*/
|
|
#include "../edelib2/NLS.h"
|
|
#include "../edeconf.h"
|
|
#include "ekeys.h"
|
|
|
|
fltk::Window *iconsConfWindow=(fltk::Window *)0;
|
|
|
|
static void cb_OK(fltk::Button*, void*) {
|
|
writeKeysConfiguration();
|
|
sendUpdateInfo();
|
|
exit(0);
|
|
}
|
|
|
|
static void cb_Cancel(fltk::Button*, void*) {
|
|
exit(0);
|
|
}
|
|
|
|
static void cb_Apply(fltk::Button*, void*) {
|
|
writeKeysConfiguration();
|
|
sendUpdateInfo();
|
|
}
|
|
|
|
Shortcut_Button *shortcut=(Shortcut_Button *)0;
|
|
|
|
static void cb_shortcut(Shortcut_Button*, void*) {
|
|
setshortcutfor(action->text(),shortcut->svalue);
|
|
}
|
|
|
|
fltk::InputBrowser *action=(fltk::InputBrowser *)0;
|
|
|
|
static void cb_action(fltk::InputBrowser*, void*) {
|
|
shortcut->svalue = getshortcutfor(action->text());
|
|
shortcut->redraw();
|
|
}
|
|
|
|
static void cb_New(fltk::Button*, void*) {
|
|
newShortcutWindow->show();
|
|
}
|
|
|
|
static void cb_Remove(fltk::Button*, void*) {
|
|
removeShortcut(action->text());
|
|
populatelist(action);
|
|
action->text(action->child(0)->label());
|
|
action->do_callback();
|
|
}
|
|
|
|
fltk::Window *newShortcutWindow=(fltk::Window *)0;
|
|
|
|
fltk::Input *shortcutName=(fltk::Input *)0;
|
|
|
|
fltk::Input *shortcutCommand=(fltk::Input *)0;
|
|
|
|
static void cb_Ok(fltk::Button*, void*) {
|
|
addShortcut(shortcutName->value(),shortcutCommand->value());
|
|
populatelist(action);
|
|
action->text(shortcutName->value());
|
|
action->do_callback();
|
|
newShortcutWindow->hide();
|
|
}
|
|
|
|
static void cb_Cancel1(fltk::Button*, void*) {
|
|
newShortcutWindow->hide();
|
|
}
|
|
|
|
#include <fltk/run.h>
|
|
|
|
int main (int argc, char **argv) {
|
|
|
|
fltk::Window* w;
|
|
//fl_init_locale_support("ekeyconf", PREFIX"/share/locale");
|
|
readKeysConfiguration();
|
|
{fltk::Window* o = iconsConfWindow = new fltk::Window(275, 265, "Keyboard settings");
|
|
o->begin();
|
|
{fltk::Button* o = new fltk::Button(20, 237, 80, 25, "&OK");
|
|
o->callback((fltk::Callback*)cb_OK);
|
|
}
|
|
{fltk::Button* o = new fltk::Button(190, 237, 80, 24, "&Cancel");
|
|
o->callback((fltk::Callback*)cb_Cancel);
|
|
}
|
|
{fltk::Button* o = new fltk::Button(105, 237, 80, 24, "&Apply");
|
|
o->callback((fltk::Callback*)cb_Apply);
|
|
}
|
|
{fltk::TabGroup* o = new fltk::TabGroup(1, 5, 267, 226);
|
|
o->color((fltk::Color)0xfffffffe);
|
|
o->begin();
|
|
{fltk::Group* o = new fltk::Group(0, 23, 263, 200, "Shortcuts");
|
|
o->align(fltk::ALIGN_TOP|fltk::ALIGN_LEFT);
|
|
o->begin();
|
|
{fltk::InvisibleBox* o = new fltk::InvisibleBox(20, 52, 140, 20, "Keyboard shortcut:");
|
|
o->align(fltk::ALIGN_LEFT|fltk::ALIGN_INSIDE);
|
|
}
|
|
{Shortcut_Button* o = shortcut = new Shortcut_Button(20, 72, 140, 20, "Keyboard shortcut:");
|
|
o->color((fltk::Color)7);
|
|
o->callback((fltk::Callback*)cb_shortcut);
|
|
o->align(fltk::ALIGN_LEFT|fltk::ALIGN_INSIDE);
|
|
o->tooltip("To set a shortcut:\n Click here, then type the key combination you want.\nT\
|
|
o delete the shortcut:\n Click here, then type backspace.\nTo get out of sho\
|
|
rtcut-setting mode:\n Click the mouse on this again, or on some other field.");
|
|
}
|
|
{fltk::InputBrowser* o = action = new fltk::InputBrowser(20, 26, 165, 21, "Action:");
|
|
o->callback((fltk::Callback*)cb_action);
|
|
o->align(fltk::ALIGN_TOP|fltk::ALIGN_LEFT);
|
|
action->text("Next window");
|
|
}
|
|
{fltk::Button* o = new fltk::Button(20, 127, 110, 25, "&New shortcut...");
|
|
o->callback((fltk::Callback*)cb_New);
|
|
}
|
|
{fltk::Button* o = new fltk::Button(140, 127, 110, 25, "&Remove shortcut");
|
|
o->callback((fltk::Callback*)cb_Remove);
|
|
}
|
|
o->end();
|
|
}
|
|
o->end();
|
|
}
|
|
o->end();
|
|
o->resizable(o);
|
|
}
|
|
{fltk::Window* o = newShortcutWindow = new fltk::Window(285, 114, "Define new shortcut");
|
|
w = o;
|
|
o->begin();
|
|
shortcutName = new fltk::Input(104, 15, 170, 24, "&Shortcut name:");
|
|
shortcutCommand = new fltk::Input(104, 49, 170, 24, "C&ommand");
|
|
{fltk::Button* o = new fltk::Button(49, 83, 88, 24, "&Ok");
|
|
o->callback((fltk::Callback*)cb_Ok);
|
|
}
|
|
{fltk::Button* o = new fltk::Button(158, 83, 88, 24, "&Cancel");
|
|
o->callback((fltk::Callback*)cb_Cancel1);
|
|
}
|
|
o->end();
|
|
o->set_modal();
|
|
o->resizable(o);
|
|
}
|
|
populatelist(action);
|
|
shortcut->svalue = getshortcutfor("Next window");
|
|
shortcut->redraw();
|
|
|
|
// Grab all keyboard events from window manager
|
|
iconsConfWindow->show(argc, argv);
|
|
XGrabKey(fltk::xdisplay, AnyKey, AnyModifier, fltk::xid(iconsConfWindow), true, GrabModeAsync, GrabModeAsync);
|
|
return fltk::run();
|
|
}
|