"add support for panning with cursor keys and PgUp/PgDn "
Brought to you by:
johnston
From: <ivt...@li...> - 2002-04-19 16:58:31
|
Patch: ivtools-020419-johnston-047 For: ivtools-1.0.3 Author: joh...@us... Subject: add support for panning with cursor keys and PgUp/PgDn Requires: This is an intermediate patch to ivtools-1.0.3. To apply, cd to the top-level directory of the ivtools source tree (the directory with src and config subdirs), and apply like this: patch -p0 <ThisFile Summary of Changes: - add support for panning with cursor keys (left/right/up/down) as well as Page Up and Page Down (PgUp/PgDn) for larger vertical moves. Index: src_x11/xevent.c diff -c src_x11/xevent.c:1.1 src_x11/xevent.c:1.2 *** src_x11/xevent.c:1.1 Fri Nov 2 13:05:07 2001 --- src/IV-X11/xevent.c Fri Apr 19 09:49:05 2002 *************** *** 41,46 **** --- 41,47 ---- #include <IV-X11/xwindow.h> #include <X11/keysymdef.h> #include <string.h> + #include <stdio.h> event_tracker_ptr Event::_event_tracker = nil; *************** *** 358,363 **** --- 359,376 ---- buf[i] |= 0200; } } + + + #if 0 /* determined this would be better done in Editor::keystroke */ + if (!n) { + KeySym ks = XKeycodeToKeysym(rep()->display_->rep()->display_, xe.xkey.keycode, 0); + if (ks) { + strncpy(buf, (const char*)&ks, 2); + n = 2; + } + } + #endif + } return n; } Index: Unidraw/editor.c diff -c Unidraw/editor.c:1.1 Unidraw/editor.c:1.2 *** Unidraw/editor.c:1.1 Fri Nov 2 13:06:49 2001 --- src/Unidraw/editor.c Fri Apr 19 09:49:17 2002 *************** *** 39,46 **** #include <InterViews/style.h> #include <InterViews/target.h> #include <InterViews/window.h> ! #include <OS/list.h> declarePtrList(EditorImpl,TransientWindow) implementPtrList(EditorImpl,TransientWindow) --- 39,48 ---- #include <InterViews/style.h> #include <InterViews/target.h> #include <InterViews/window.h> ! #include <IV-X11/xdisplay.h> ! #include <IV-X11/xevent.h> #include <OS/list.h> + #include <string.h> declarePtrList(EditorImpl,TransientWindow) implementPtrList(EditorImpl,TransientWindow) *************** *** 117,122 **** --- 119,134 ---- if (n > 0) { buf[n] = '\0'; GetKeyMap()->Execute(buf); + } else if (e.rep()->xevent_.type == KeyPress) { + KeySym ks = XKeycodeToKeysym(e.rep()->display_->rep()->display_, + e.rep()->xevent_.xkey.keycode, 0); + if (ks) { + strncpy(buf, (const char*)&ks, 2); + n = 2; + buf[n] = '\0'; + GetKeyMap()->Execute(buf); + } + } } Index: OverlayUnidraw/ovkit.c diff -c OverlayUnidraw/ovkit.c:1.2 OverlayUnidraw/ovkit.c:1.3 *** OverlayUnidraw/ovkit.c:1.2 Thu Nov 29 07:39:20 2001 --- src/OverlayUnidraw/ovkit.c Fri Apr 19 09:49:19 2002 *************** *** 1,4 **** --- 1,5 ---- /* + * Copyright (c) 2002 Scott E. Johnston * Copyright (c) 2000 IET Inc. * Copyright (c) 1998-2000 Vectaport Inc. * Copyright (c) 1994-1995 Vectaport Inc., Cartoactive Systems *************** *** 150,155 **** --- 151,158 ---- #include <Attribute/attrlist.h> #include <Attribute/attrvalue.h> + #include <X11/keysym.h> + #include <stdlib.h> #include <string.h> *************** *** 1306,1311 **** --- 1309,1318 ---- } MenuItem* OverlayKit::MakeViewMenu() { + /* for handling special keys */ + char keystr[3]; + keystr[2] = '\0'; + LayoutKit& lk = *LayoutKit::instance(); WidgetKit& kit = *WidgetKit::instance(); *************** *** 1381,1402 **** MenuItem* spani = kit.menu_item(kit.label("Small Pan ")); Menu* span = kit.pullright(); spani->menu(span); ! MakeMenu(spani, new FixedPanCmd(new ControlInfo("Small Pan Up"), NO_PAN, PLUS_SMALL_PAN), "Small Pan Up "); ! MakeMenu(spani, new FixedPanCmd(new ControlInfo("Small Pan Down"), NO_PAN, MINUS_SMALL_PAN), "Small Pan Down "); ! MakeMenu(spani, new FixedPanCmd(new ControlInfo("Small Pan Left"), MINUS_SMALL_PAN, NO_PAN), "Small Pan Left "); ! MakeMenu(spani, new FixedPanCmd(new ControlInfo("Small Pan Right"), PLUS_SMALL_PAN, NO_PAN), "Small Pan Right "); mbi->menu()->append_item(spani); MenuItem* lpani = kit.menu_item(kit.label("Large Pan ")); Menu* lpan = kit.pullright(); lpani->menu(lpan); ! MakeMenu(lpani, new FixedPanCmd(new ControlInfo("Large Pan Up"), NO_PAN, PLUS_LARGE_PAN), "Large Pan Up "); ! MakeMenu(lpani, new FixedPanCmd(new ControlInfo("Large Pan Down"), NO_PAN, MINUS_LARGE_PAN), "Large Pan Down "); MakeMenu(lpani, new FixedPanCmd(new ControlInfo("Large Pan Left"), MINUS_LARGE_PAN, NO_PAN), "Large Pan Left "); --- 1388,1415 ---- MenuItem* spani = kit.menu_item(kit.label("Small Pan ")); Menu* span = kit.pullright(); spani->menu(span); ! *(unsigned short*)keystr = XK_Up; ! MakeMenu(spani, new FixedPanCmd(new ControlInfo("Small Pan Up", "", keystr), NO_PAN, PLUS_SMALL_PAN), "Small Pan Up "); ! *(unsigned short*)keystr = XK_Down; ! MakeMenu(spani, new FixedPanCmd(new ControlInfo("Small Pan Down", "", keystr), NO_PAN, MINUS_SMALL_PAN), "Small Pan Down "); ! *(unsigned short*)keystr = XK_Left; ! MakeMenu(spani, new FixedPanCmd(new ControlInfo("Small Pan Left", "", keystr), MINUS_SMALL_PAN, NO_PAN), "Small Pan Left "); ! *(unsigned short*)keystr = XK_Right; ! MakeMenu(spani, new FixedPanCmd(new ControlInfo("Small Pan Right", "", keystr), PLUS_SMALL_PAN, NO_PAN), "Small Pan Right "); mbi->menu()->append_item(spani); MenuItem* lpani = kit.menu_item(kit.label("Large Pan ")); Menu* lpan = kit.pullright(); lpani->menu(lpan); ! *(unsigned short*)keystr = XK_Page_Up; ! MakeMenu(lpani, new FixedPanCmd(new ControlInfo("Large Pan Up", "PgUp", keystr), NO_PAN, PLUS_LARGE_PAN), "Large Pan Up "); ! *(unsigned short*)keystr = XK_Page_Down; ! MakeMenu(lpani, new FixedPanCmd(new ControlInfo("Large Pan Down", "PgDn", keystr), NO_PAN, MINUS_LARGE_PAN), "Large Pan Down "); MakeMenu(lpani, new FixedPanCmd(new ControlInfo("Large Pan Left"), MINUS_LARGE_PAN, NO_PAN), "Large Pan Left "); *** /dev/null Fri Apr 19 09:49:31 PDT 2002 --- patches/ivtools-020419-johnston-047 *************** patches/ivtools-020419-johnston-047 *** 0 **** --- 1 ---- + ivtools-020419-johnston-047 |