mirror of
https://github.com/edeproject/ede.git
synced 2023-08-10 21:13:03 +03:00
Unused code
This commit is contained in:
parent
b230d3608b
commit
b96b32af8f
@ -1,16 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# Part of Equinox Desktop Environment (EDE).
|
||||
# Copyright (c) 2000-2007 EDE Authors.
|
||||
#
|
||||
# This program is licenced under terms of the
|
||||
# GNU General Public Licence version 2 or newer.
|
||||
# See COPYING for details.
|
||||
|
||||
SubDir TOP ekeyconf ;
|
||||
|
||||
SOURCE = ekeys.cpp ekeyconf.cpp Shortcut_Button.cpp ;
|
||||
|
||||
MakeProgram ekeyconf : $(SOURCE) ;
|
||||
ExtractStrings locale : $(SOURCE) ;
|
@ -1,54 +0,0 @@
|
||||
// -- copyied over from fluid (Fl_Menu_Type.cpp)
|
||||
// This program is licenced under terms of the
|
||||
// GNU General Public Licence version 2 or newer.
|
||||
// See COPYING for details.
|
||||
|
||||
#include "Shortcut_Button.h"
|
||||
|
||||
#include <fltk/Button.h> //#include <efltk/Fl_Button.h>
|
||||
#include <fltk/draw.h> //#include <efltk/fl_draw.h>
|
||||
//#include <efltk/Fl.h>
|
||||
#include <fltk/events.h>
|
||||
|
||||
|
||||
void Shortcut_Button::draw() {
|
||||
label(fltk::key_name(svalue));
|
||||
color(value() ? default_style->selection_color() : default_style->color());
|
||||
textcolor(value() ? default_style->selection_textcolor() : default_style->textcolor());
|
||||
#ifdef _WIN32
|
||||
Button::draw();
|
||||
#else
|
||||
fltk::Button::draw();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
int Shortcut_Button::handle(int e) {
|
||||
when(0); type(TOGGLE);
|
||||
if (e == fltk::KEY) {
|
||||
if (!value()) return 0;
|
||||
int v = fltk::event_text()[0];
|
||||
if (v > 32 && v < 0x7f || v > 0xa0 && v <= 0xff) {
|
||||
v = v | fltk::event_state()&(fltk::META|fltk::ALT|fltk::CTRL);
|
||||
} else {
|
||||
v = fltk::event_state()&(fltk::META|fltk::ALT|fltk::CTRL|fltk::SHIFT) | fltk::event_key();
|
||||
if (v == fltk::BackSpaceKey && svalue) v = 0;
|
||||
}
|
||||
if (v != svalue) {svalue = v; do_callback(); redraw();}
|
||||
return 1;
|
||||
} else if (e == fltk::UNFOCUS) {
|
||||
int c = changed(); value(0); if (c) set_changed();
|
||||
return 1;
|
||||
} else if (e == fltk::FOCUS) {
|
||||
return value();
|
||||
} else {
|
||||
#ifdef _WIN32
|
||||
int r = Button::handle(e);
|
||||
#else
|
||||
int r = fltk::Button::handle(e);
|
||||
#endif
|
||||
if (e == fltk::RELEASE && value() && fltk::focus() != this) take_focus();
|
||||
return r;
|
||||
}
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
//
|
||||
// "$Id: Shortcut_Button.h 4886 2006-03-30 09:55:32Z fabien $"
|
||||
//
|
||||
// Shortcut header file for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
// Copyright 1998-2006 by Bill Spitzak and others.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Library General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Library General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Library General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
// USA.
|
||||
//
|
||||
// Please report all bugs and problems to "fltk-bugs@fltk.org".
|
||||
//
|
||||
|
||||
#ifndef Shortcut_Button_H
|
||||
#define Shortcut_Button_H
|
||||
|
||||
#include <fltk/Button.h>
|
||||
|
||||
class Shortcut_Button : public fltk::Button {
|
||||
public:
|
||||
int svalue;
|
||||
int handle(int);
|
||||
void draw();
|
||||
Shortcut_Button(int x, int y, int w, int h, const char* l = 0) :
|
||||
fltk::Button(x,y,w,h,l) {svalue = 0;}
|
||||
};
|
||||
|
||||
//
|
||||
// End of "$Id: Shortcut_Button.h 4886 2006-03-30 09:55:32Z fabien $".
|
||||
//
|
||||
#endif
|
@ -1,154 +0,0 @@
|
||||
// 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();
|
||||
}
|
@ -1,135 +0,0 @@
|
||||
# data file for the FLTK User Interface Designer (FLUID)
|
||||
version 2.0100
|
||||
images_dir ./
|
||||
header_name {.h}
|
||||
code_name {.cpp}
|
||||
gridx 5
|
||||
gridy 5
|
||||
snap 3
|
||||
decl {/*
|
||||
* $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.
|
||||
*/} {}
|
||||
|
||||
decl {\#include "../edelib2/NLS.h"} {}
|
||||
|
||||
decl {\#include "../edeconf.h"} {}
|
||||
|
||||
decl {\#include "Shortcut_Button.h"} {public
|
||||
}
|
||||
|
||||
decl {\#include "ekeys.h"} {}
|
||||
|
||||
Function {} {open
|
||||
} {
|
||||
code {//fl_init_locale_support("ekeyconf", PREFIX"/share/locale");
|
||||
readKeysConfiguration();} {}
|
||||
{fltk::Window} iconsConfWindow {
|
||||
label {Keyboard settings} open
|
||||
xywh {471 199 275 265} resizable visible
|
||||
} {
|
||||
{fltk::Button} {} {
|
||||
label {&OK}
|
||||
callback {writeKeysConfiguration();
|
||||
sendUpdateInfo();
|
||||
exit(0);}
|
||||
xywh {20 237 80 25}
|
||||
}
|
||||
{fltk::Button} {} {
|
||||
label {&Cancel}
|
||||
callback {exit(0);}
|
||||
xywh {190 237 80 24}
|
||||
}
|
||||
{fltk::Button} {} {
|
||||
label {&Apply}
|
||||
callback {writeKeysConfiguration();
|
||||
sendUpdateInfo();}
|
||||
xywh {105 237 80 24}
|
||||
}
|
||||
{fltk::TabGroup} {} {open
|
||||
xywh {1 5 267 226} color 0xfffffffe
|
||||
} {
|
||||
{fltk::Group} {} {
|
||||
label Shortcuts open
|
||||
xywh {0 23 263 200} align 5
|
||||
} {
|
||||
{fltk::InvisibleBox} {} {
|
||||
label {Keyboard shortcut:}
|
||||
xywh {20 52 140 20} align 36
|
||||
}
|
||||
{fltk::Button} shortcut {
|
||||
label {Keyboard shortcut:}
|
||||
callback {setshortcutfor(action->text(),shortcut->svalue);} selected
|
||||
tooltip {To set a shortcut:
|
||||
Click here, then type the key combination you want.
|
||||
To delete the shortcut:
|
||||
Click here, then type backspace.
|
||||
To get out of shortcut-setting mode:
|
||||
Click the mouse on this again, or on some other field.}
|
||||
xywh {20 72 140 20} align 36 color 7
|
||||
class Shortcut_Button
|
||||
}
|
||||
{fltk::InputBrowser} action {
|
||||
label {Action:}
|
||||
callback {shortcut->svalue = getshortcutfor(action->text());
|
||||
shortcut->redraw();}
|
||||
xywh {20 26 165 21} align 5
|
||||
extra_code {action->text("Next window");}
|
||||
} {}
|
||||
{fltk::Button} {} {
|
||||
label {&New shortcut...}
|
||||
callback {newShortcutWindow->show();}
|
||||
xywh {20 127 110 25}
|
||||
}
|
||||
{fltk::Button} {} {
|
||||
label {&Remove shortcut}
|
||||
callback {removeShortcut(action->text());
|
||||
populatelist(action);
|
||||
action->text(action->child(0)->label());
|
||||
action->do_callback();}
|
||||
xywh {140 127 110 25}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
{fltk::Window} newShortcutWindow {
|
||||
label {Define new shortcut} open
|
||||
xywh {601 395 285 114} hide resizable modal
|
||||
} {
|
||||
{fltk::Input} shortcutName {
|
||||
label {&Shortcut name:}
|
||||
xywh {104 15 170 24}
|
||||
}
|
||||
{fltk::Input} shortcutCommand {
|
||||
label {C&ommand}
|
||||
xywh {104 49 170 24}
|
||||
}
|
||||
{fltk::Button} {} {
|
||||
label {&Ok}
|
||||
callback {addShortcut(shortcutName->value(),shortcutCommand->value());
|
||||
populatelist(action);
|
||||
action->text(shortcutName->value());
|
||||
action->do_callback();
|
||||
newShortcutWindow->hide();}
|
||||
xywh {49 83 88 24}
|
||||
}
|
||||
{fltk::Button} {} {
|
||||
label {&Cancel}
|
||||
callback {newShortcutWindow->hide();}
|
||||
xywh {158 83 88 24}
|
||||
}
|
||||
}
|
||||
code {populatelist(action);
|
||||
shortcut->svalue = getshortcutfor("Next window");
|
||||
shortcut->redraw();
|
||||
|
||||
// Grab all keyboard events from window manager
|
||||
XGrabKey(fltk::xdisplay, AnyKey, AnyModifier, fltk::xid(w), true, GrabModeAsync, GrabModeAsync);} {}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
// generated by Fast Light User Interface Designer (fluid) version 2.0100
|
||||
|
||||
#ifndef ekeyconf_h
|
||||
#define ekeyconf_h
|
||||
#include "Shortcut_Button.h"
|
||||
#include <fltk/Window.h>
|
||||
extern fltk::Window* iconsConfWindow;
|
||||
#include <fltk/Button.h>
|
||||
#include <fltk/TabGroup.h>
|
||||
#include <fltk/Group.h>
|
||||
#include <fltk/InvisibleBox.h>
|
||||
extern Shortcut_Button* shortcut;
|
||||
#include <fltk/InputBrowser.h>
|
||||
extern fltk::InputBrowser* action;
|
||||
extern fltk::Window* newShortcutWindow;
|
||||
#include <fltk/Input.h>
|
||||
extern fltk::Input* shortcutName;
|
||||
extern fltk::Input* shortcutCommand;
|
||||
#endif
|
@ -1,285 +0,0 @@
|
||||
/*
|
||||
* $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 "ekeys.h"
|
||||
|
||||
|
||||
using namespace fltk;
|
||||
using namespace edelib;
|
||||
|
||||
|
||||
#define NR_HOTKEYS 30
|
||||
|
||||
|
||||
static struct {
|
||||
char systemname[20];
|
||||
char uiname[50];
|
||||
char command[50];
|
||||
} hotkeys[] = {
|
||||
{"NextWindow", "Next window", ""},
|
||||
{"PreviousWindow", "Previous window", ""},
|
||||
{"NextDesktop", "Next workspace", ""},
|
||||
{"PreviousDesktop", "Previous workspace", ""},
|
||||
{"FastRun", "Run program", ""},
|
||||
{"FindUtil", "Find file", ""},
|
||||
{"CloseWindow", "Close window", ""},
|
||||
{"MinimizeWindow", "Minimize window", ""},
|
||||
{"MaximizeWindow", "Maximize window", ""},
|
||||
{"Desktop1", "Workspace 1", ""},
|
||||
{"Desktop2", "Workspace 2", ""},
|
||||
{"Desktop3", "Workspace 3", ""},
|
||||
{"Desktop4", "Workspace 4", ""},
|
||||
{"Desktop5", "Workspace 5", ""},
|
||||
{"Desktop6", "Workspace 6", ""},
|
||||
{"Desktop7", "Workspace 7", ""},
|
||||
{"Desktop8", "Workspace 8", ""},
|
||||
{"App1", "", ""},
|
||||
{"App2", "", ""},
|
||||
{"App3", "", ""},
|
||||
{"App4", "", ""},
|
||||
{"App5", "", ""},
|
||||
{"App6", "", ""},
|
||||
{"App7", "", ""},
|
||||
{"App8", "", ""},
|
||||
{"App9", "", ""},
|
||||
{"App10", "", ""},
|
||||
{"App11", "", ""},
|
||||
{"App12", "", ""},
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
int keycodes[NR_HOTKEYS];
|
||||
|
||||
|
||||
|
||||
|
||||
static void sendClientMessage(XWindow w, Atom a, long x)
|
||||
{
|
||||
XEvent ev;
|
||||
long mask;
|
||||
|
||||
memset(&ev, 0, sizeof(ev));
|
||||
ev.xclient.type = ClientMessage;
|
||||
ev.xclient.window = w;
|
||||
ev.xclient.message_type = a;
|
||||
ev.xclient.format = 32;
|
||||
ev.xclient.data.l[0] = x;
|
||||
ev.xclient.data.l[1] = CurrentTime;
|
||||
mask = 0L;
|
||||
if (w == RootWindow(xdisplay, xscreen))
|
||||
mask = SubstructureRedirectMask;
|
||||
XSendEvent(xdisplay, w, False, mask, &ev);
|
||||
}
|
||||
|
||||
void sendUpdateInfo()
|
||||
{
|
||||
// No worky
|
||||
/* unsigned int i, nrootwins;
|
||||
XWindow dw1, dw2, *rootwins = 0;
|
||||
int screen_count = ScreenCount(fltk::xdisplay);
|
||||
extern Atom FLTKChangeSettings;
|
||||
for (int s = 0; s < screen_count; s++) {
|
||||
XWindow root = RootWindow(fltk::xdisplay, s);
|
||||
XQueryTree(fltk::xdisplay, root, &dw1, &dw2, &rootwins, &nrootwins);
|
||||
for (i = 0; i < nrootwins; i++) {
|
||||
if (rootwins[i]!=RootWindow(fltk::xdisplay, fltk::xscreen)) {
|
||||
sendClientMessage(rootwins[i], FLTKChangeSettings, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
XFlush(fltk::xdisplay);*/
|
||||
}
|
||||
|
||||
int getshortcutfor(const char* action)
|
||||
{
|
||||
for (int i=0; i<NR_HOTKEYS; i++)
|
||||
if (strcmp(action,hotkeys[i].uiname) == 0) return keycodes[i];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void setshortcutfor(const char* action, int svalue)
|
||||
{
|
||||
for (int i=0; i<NR_HOTKEYS; i++)
|
||||
if (strcmp(action,hotkeys[i].uiname) == 0) keycodes[i] = svalue;
|
||||
}
|
||||
|
||||
int name_to_svalue(char *hotkey)
|
||||
{
|
||||
static struct {
|
||||
char *name;
|
||||
int value;
|
||||
} keys[] = {
|
||||
{"alt", ALT},
|
||||
{"ctrl", CTRL},
|
||||
{"shift", SHIFT},
|
||||
{"win", META},
|
||||
{"space", SpaceKey},
|
||||
{"backspace", BackSpaceKey},
|
||||
{"tab", TabKey},
|
||||
{"enter", ReturnKey},
|
||||
{"escape", EscapeKey},
|
||||
{"home", HomeKey},
|
||||
{"left", LeftKey},
|
||||
{"up", UpKey},
|
||||
{"right", RightKey},
|
||||
{"down", DownKey},
|
||||
{"pageup", PageUpKey},
|
||||
{"pagedown", PageDownKey},
|
||||
{"end", EndKey},
|
||||
{"insert", InsertKey},
|
||||
{"delete", DeleteKey},
|
||||
{"f1", F1Key},
|
||||
{"f2", F2Key},
|
||||
{"f3", F3Key},
|
||||
{"f4", F4Key},
|
||||
{"f5", F5Key},
|
||||
{"f6", F6Key},
|
||||
{"f7", F7Key},
|
||||
{"f8", F8Key},
|
||||
{"f9", F9Key},
|
||||
{"f10", F10Key},
|
||||
{"f11", F11Key},
|
||||
{"f12", F12Key},
|
||||
{0, 0}
|
||||
};
|
||||
int parsed = 0;
|
||||
char f[20];
|
||||
|
||||
// The parser - case insensitive and hopefully robust
|
||||
int plus=0;
|
||||
for (int i=0; i<=strlen(hotkey); i++) {
|
||||
if (i<strlen(hotkey) && hotkey[i] != '+') continue;
|
||||
if (i==plus) { plus=i+1; continue; } // two +s in row
|
||||
char key[20];
|
||||
strncpy (key, hotkey+plus, i-plus);
|
||||
key[i-plus]='\0';
|
||||
plus=i+1;
|
||||
|
||||
bool found = false;
|
||||
for (int j=0; keys[j].value; j++) {
|
||||
if (strcasecmp(key,keys[j].name) == 0) {
|
||||
parsed += keys[j].value;
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
// use first letter as shortcut key
|
||||
if ((key[0] >= 'a') && (key[0] <= 'z')) {
|
||||
parsed += key[0];
|
||||
} else if ((key[0] >= 'A') && (key[0] <= 'Z')) {
|
||||
parsed += (key[0] - 'A' + 'a');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return parsed;
|
||||
}
|
||||
|
||||
void readKeysConfiguration()
|
||||
{
|
||||
Config globalConfig(Config::find_file("wmanager.conf", 0), true, false);
|
||||
globalConfig.set_section("Hotkeys");
|
||||
|
||||
for (int i=0; i<NR_HOTKEYS; i++) {
|
||||
char tmp[128];
|
||||
globalConfig.read(hotkeys[i].systemname, tmp, "", 128);
|
||||
keycodes[i] = name_to_svalue(tmp);
|
||||
}
|
||||
|
||||
globalConfig.set_section("Applications");
|
||||
for (int i=0; i<NR_HOTKEYS; i++) {
|
||||
char tmp[128];
|
||||
if ((strncmp(hotkeys[i].systemname,"App",3) == 0) && (keycodes[i] != 0)) {
|
||||
globalConfig.read(hotkeys[i].systemname, tmp, "", 128);
|
||||
if (tmp != "") strncpy(hotkeys[i].command, tmp, 50);
|
||||
if (keycodes[i]>0 && tmp != "") strncpy(hotkeys[i].uiname, hotkeys[i].systemname, 20);
|
||||
}
|
||||
}
|
||||
|
||||
globalConfig.set_section("ApplicationNames");
|
||||
for (int i=0; i<NR_HOTKEYS; i++) {
|
||||
char tmp[128];
|
||||
if ((strncmp(hotkeys[i].systemname,"App",3) == 0) && (keycodes[i] != 0)) {
|
||||
globalConfig.read(hotkeys[i].systemname, tmp, "", 128);
|
||||
if (tmp != "") strncpy(hotkeys[i].uiname, tmp, 50);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void writeKeysConfiguration()
|
||||
{
|
||||
Config globalConfig(Config::find_file("wmanager.conf", true));
|
||||
globalConfig.set_section("Hotkeys");
|
||||
|
||||
for (int i=0; i<NR_HOTKEYS; i++)
|
||||
globalConfig.write(hotkeys[i].systemname, key_name(keycodes[i]));
|
||||
|
||||
globalConfig.set_section("Applications");
|
||||
for (int i=0; i<NR_HOTKEYS; i++)
|
||||
if ((strncmp(hotkeys[i].systemname,"App",3) == 0)
|
||||
&& (strcmp(hotkeys[i].uiname,"") != 0)
|
||||
&& (strcmp(hotkeys[i].command,"") != 0))
|
||||
globalConfig.write(hotkeys[i].systemname, hotkeys[i].command);
|
||||
|
||||
globalConfig.set_section("ApplicationNames");
|
||||
for (int i=0; i<NR_HOTKEYS; i++)
|
||||
if ((strncmp(hotkeys[i].systemname,"App",3) == 0)
|
||||
&& (strcmp(hotkeys[i].uiname,"") != 0)
|
||||
&& (strcmp(hotkeys[i].command,"") != 0))
|
||||
globalConfig.write(hotkeys[i].systemname, hotkeys[i].uiname);
|
||||
}
|
||||
|
||||
void populatelist(InputBrowser *action)
|
||||
{
|
||||
action->clear(); // Rewrite?
|
||||
for (int i=0; i<NR_HOTKEYS; i++)
|
||||
if (strcmp(hotkeys[i].uiname,"") != 0) action->add ( hotkeys[i].uiname);
|
||||
}
|
||||
|
||||
void addShortcut(const char *name, const char *cmd)
|
||||
{
|
||||
if ((strcmp(name,"") !=0) && (strcmp(cmd,"") != 0)) {
|
||||
for (int i=0; i<NR_HOTKEYS; i++) {
|
||||
if ((strncmp(hotkeys[i].systemname,"App",3) == 0) && (strcmp(hotkeys[i].uiname,name) == 0)) {
|
||||
alert(_("Shortcut already defined! Please use a different name"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (int i=0; i<NR_HOTKEYS; i++) {
|
||||
if ((strncmp(hotkeys[i].systemname,"App",3) == 0) && (strcmp(hotkeys[i].uiname,"") == 0)) {
|
||||
strncpy(hotkeys[i].uiname, name, 50);
|
||||
strncpy(hotkeys[i].command, cmd, 50);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
alert(_("Maximum number of user shortcuts exceeded"));
|
||||
}
|
||||
|
||||
|
||||
void removeShortcut(const char* action)
|
||||
{
|
||||
for (int i=0; i<NR_HOTKEYS; i++)
|
||||
if (strcmp(action,hotkeys[i].uiname)==0) {
|
||||
keycodes[i]=0;
|
||||
if (strncmp(hotkeys[i].systemname,"App",3) == 0)
|
||||
strcpy(hotkeys[i].uiname,"");
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
/*
|
||||
* $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.
|
||||
*/
|
||||
|
||||
#ifndef EICON_H
|
||||
#define EICON_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <fltk/events.h> //#include <efltk/Fl.h>
|
||||
#include <fltk/ask.h> //#include <efltk/fl_ask.h>
|
||||
//#include <efltk/Fl_Color_Chooser.h>
|
||||
#include <fltk/x.h> //#include <efltk/x.h>
|
||||
#include "../edelib2/Config.h" //#include <efltk/Fl_Config.h>
|
||||
#include "../edelib2/NLS.h" //#include <efltk/Fl_Locale.h>
|
||||
#include <fltk/InputBrowser.h> //#include <efltk/Fl_Input_Browser.h>
|
||||
|
||||
|
||||
int getshortcutfor(const char*);
|
||||
void setshortcutfor(const char*, int);
|
||||
void readKeysConfiguration();
|
||||
void writeKeysConfiguration();
|
||||
void sendUpdateInfo();
|
||||
void populatelist(fltk::InputBrowser *);
|
||||
void addShortcut(const char*,const char*);
|
||||
void removeShortcut(const char*);
|
||||
|
||||
#endif
|
||||
|
@ -1,55 +0,0 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2005-04-03 13:14+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=CHARSET\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: ekeyconf.cpp:47
|
||||
msgid "Keyboard settings"
|
||||
msgstr ""
|
||||
|
||||
#: ekeyconf.cpp:50
|
||||
msgid "&OK"
|
||||
msgstr ""
|
||||
|
||||
#: ekeyconf.cpp:53
|
||||
msgid "&Cancel"
|
||||
msgstr ""
|
||||
|
||||
#: ekeyconf.cpp:56
|
||||
msgid "&Apply"
|
||||
msgstr ""
|
||||
|
||||
#: ekeyconf.cpp:61
|
||||
msgid "Shortcuts"
|
||||
msgstr ""
|
||||
|
||||
#: ekeyconf.cpp:63
|
||||
msgid "Keyboard shortcut:"
|
||||
msgstr ""
|
||||
|
||||
#: ekeyconf.cpp:68
|
||||
msgid ""
|
||||
"To set a shortcut:\n"
|
||||
" Click here, then type the key combination you want.\n"
|
||||
"To delete the shortcut:\n"
|
||||
" Click here, then type backspace.\n"
|
||||
"To get out of shortcut-setting mode:\n"
|
||||
" Click the mouse on this again, or on some other field."
|
||||
msgstr ""
|
||||
|
||||
#: ekeyconf.cpp:72
|
||||
msgid "Action:"
|
||||
msgstr ""
|
Loading…
Reference in New Issue
Block a user