Wrote:
Quote:>> So wouldn't it be nice with OpenKeyMap() equivalent to OpenFont()?
>You don't really need to load keymaps very often, do you?
I am writing a multilingual wordprocessor. Two keymaps should be available all
the time, while others should be accessable through a filerequester.
Quote:>> The LoadSeg() returns a pointer to a segList, but I couldn't find what is
>> seglist.
>A keymap file as stored in devs:keymaps/ consists of a
>struct KeyMapNode, as defined in <devices/keymap.h>.
The node is not a part of the kaymap struct, the keymap structure is pointed
from the KeyMapNode
Quote:>To load a keymap, do this:
I followd your instructions and wrote this test.
This is the first time I access exec's lists. Now I know why they didn't call
this part of the system "intuition".
Why the ->ln_Succ of the last node is not NULL?
/* ---------------------------------------------------- */
/* searching the keymap resource */
/* December 1995 */
/* ilan sharoni */
#include <stdio.h>
#include <stdlib.h>
#include <proto/exec.h>
#include <devices/keymap.h>
#include <proto/dos.h>
#include <proto/keymap.h>
#include <dos/dos.h>
main()
{
struct KeyMapResource *resource_p;
struct List *my_list_p;
struct Node *my_node_p;
BPTR KeyMapSeglist;
struct KeyMapNode *KeyMapNode;
resource_p = (struct KeyMapResource *)OpenResource("keymap.resource");
Disable();
my_list_p = &resource_p->kr_List;
if(my_list_p->lh_TailPred != (struct Node *)my_list_p)
{
printf(" Resident keymaps: ");
my_node_p = my_list_p->lh_Head;
while(my_node_p)
{
printf("%s, ",my_node_p->ln_Name);
/* The ln_Succ of the last Node is not NULL!!!! */
if(my_node_p==my_list_p->lh_TailPred){break;}
my_node_p=my_node_p->ln_Succ;
}
}
Enable();
printf(" and no more\n");
/* try to load keymap from disk */
if ((KeyMapSeglist=LoadSeg("devs:keymaps/h")))
{
KeyMapNode=BADDR(KeyMapSeglist+1);
SetKeyMapDefault(&KeyMapNode->kn_KeyMap);
}
Quote:}
/* ------------------------------------------------------------- */
Thank you
ilan