mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-11 16:32:59 +00:00
Modularize translations.
This commit is contained in:
parent
da6f3d6be5
commit
d60279cefd
@ -203,6 +203,22 @@ static XmSyntheticResource syn_resources[] =
|
||||
},
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* XfeArrow translations */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
static char arrow_translations[] ="\
|
||||
<Key>space: ArmAndActivate()\n\
|
||||
c<Btn1Down>: Focus()\n\
|
||||
<Btn1Down>: Arm()\n\
|
||||
<Btn1Up>: Activate() Disarm()\n\
|
||||
~c ~s ~a ~m<Key>Return: ArmAndActivate()\n\
|
||||
~c ~s ~a ~m<Key>space: ArmAndActivate()\n\
|
||||
:<Key>osfHelp: Help()\n\
|
||||
<Enter>: Enter()\n\
|
||||
<Leave>: Leave()";
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* XfeArrow widget class record initialization */
|
||||
|
@ -557,6 +557,30 @@ static XtActionsRec actions[] =
|
||||
{ "Btn3Up", _XfeButtonBtn3Up },
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* XfeButton translations */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
static char default_translations[] ="\
|
||||
<Key>space: ArmAndActivate()\n\
|
||||
c<Btn1Down>: Focus()\n\
|
||||
<Btn1Down>: Arm()\n\
|
||||
<Btn1Up>: Activate() Disarm()\n\
|
||||
<Btn3Down>: Btn3Down()\n\
|
||||
<Btn3Up>: Btn3Up()\n\
|
||||
~c ~s ~a ~m<Key>Return: ArmAndActivate()\n\
|
||||
~c ~s ~a ~m<Key>space: ArmAndActivate()\n\
|
||||
:<Key>osfHelp: Help()\n\
|
||||
<Enter>: Enter()\n\
|
||||
<Leave>: Leave()";
|
||||
|
||||
static char motion_add_translations[] ="\
|
||||
<Motion>: Motion()";
|
||||
|
||||
static char _XfeButtonMotionRemoveTranslations[] ="\
|
||||
<Motion>: ";
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* XfeButton widget class record initialization */
|
||||
@ -594,7 +618,7 @@ _XFE_WIDGET_CLASS_RECORD(button,Button) =
|
||||
NULL, /* accept_focus */
|
||||
XtVersion, /* version */
|
||||
NULL, /* callback_private */
|
||||
_XfeButtonDefaultTranslations, /* tm_table */
|
||||
default_translations, /* tm_table */
|
||||
XtInheritQueryGeometry, /* query_geometry */
|
||||
XtInheritDisplayAccelerator, /* display accel */
|
||||
NULL, /* extension */
|
||||
@ -819,7 +843,7 @@ Initialize(Widget rw,Widget nw,ArgList args,Cardinal *nargs)
|
||||
/* Need to track motion if trigger is not anywhere */
|
||||
if (bp->button_trigger != XmBUTTON_TRIGGER_ANYWHERE)
|
||||
{
|
||||
XfeOverrideTranslations(nw,_XfeButtonMotionAddTranslations);
|
||||
XfeOverrideTranslations(nw,motion_add_translations);
|
||||
}
|
||||
|
||||
/* Finish of initialization */
|
||||
@ -902,7 +926,7 @@ SetValues(Widget ow,Widget rw,Widget nw,ArgList args,Cardinal *nargs)
|
||||
/* Yes motion tracking */
|
||||
else
|
||||
{
|
||||
XfeOverrideTranslations(nw,_XfeButtonMotionAddTranslations);
|
||||
XfeOverrideTranslations(nw,motion_add_translations);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -265,6 +265,15 @@ static XtActionsRec actions[] =
|
||||
{ "BtnUp", BtnUp },
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* XfeBypassShell translations */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
static char default_translations[] ="\
|
||||
<BtnUp>: BtnUp()\n\
|
||||
<BtnDown>: BtnDown()";
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* Widget Class Record Initialization */
|
||||
@ -306,7 +315,7 @@ _XFE_WIDGET_CLASS_RECORD(bypassshell,BypassShell) =
|
||||
NULL, /* access_focus */
|
||||
XtVersion, /* version */
|
||||
NULL, /* callback_private */
|
||||
_XfeBypassShellDefaultTranslations, /* tm_table */
|
||||
default_translations, /* tm_table */
|
||||
NULL, /* query_geometry */
|
||||
NULL, /* display accelerator */
|
||||
NULL, /* extension */
|
||||
|
@ -230,6 +230,18 @@ static XtResource resources[] =
|
||||
},
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* XfeLabel translations */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
static char default_translations[] ="\
|
||||
<Btn1Down>: Btn1Down()\n\
|
||||
c<Btn1Down>: Focus()\n\
|
||||
:<Key>osfHelp: Help()\n\
|
||||
<Enter>: Enter()\n\
|
||||
<Leave>: Leave()";
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* XfeButton actions */
|
||||
@ -277,7 +289,7 @@ _XFE_WIDGET_CLASS_RECORD(label,Label) =
|
||||
NULL, /* accept_focus */
|
||||
XtVersion, /* version */
|
||||
NULL, /* callback_private */
|
||||
_XfeLabelDefaultTranslations, /* tm_table */
|
||||
default_translations, /* tm_table */
|
||||
XtInheritQueryGeometry, /* query_geometry */
|
||||
XtInheritDisplayAccelerator, /* display accel */
|
||||
NULL, /* extension */
|
||||
|
@ -106,7 +106,6 @@ CSRCS = \
|
||||
SetValues.c \
|
||||
ShellUtil.c \
|
||||
StringUtil.c \
|
||||
Translations.c \
|
||||
Util.c \
|
||||
WmUtil.c \
|
||||
$(NULL)
|
||||
|
@ -111,7 +111,6 @@ CSRCS = \
|
||||
SetValues.c \
|
||||
ShellUtil.c \
|
||||
StringUtil.c \
|
||||
Translations.c \
|
||||
Util.c \
|
||||
WmUtil.c \
|
||||
$(NULL)
|
||||
|
@ -429,6 +429,17 @@ static XmPrimitiveClassExtRec primClassExtRec =
|
||||
NULL, /* widget_margins */
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* XfePrimitive translations */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
static char default_translations[] ="\
|
||||
c<Btn1Down>: Focus()\n\
|
||||
:<Key>osfHelp: Help()\n\
|
||||
<Enter>: Enter()\n\
|
||||
<Leave>: Leave()";
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* XfePrimitive widget class record initialization */
|
||||
@ -466,7 +477,7 @@ _XFE_WIDGET_CLASS_RECORD(primitive,Primitive) =
|
||||
NULL, /* accept_focus */
|
||||
XtVersion, /* version */
|
||||
NULL, /* callback_private */
|
||||
_XfePrimitiveDefaultTranslations, /* tm_table */
|
||||
default_translations, /* tm_table */
|
||||
QueryGeometry, /* query_geometry */
|
||||
XtInheritDisplayAccelerator, /* display accel */
|
||||
NULL, /* extension */
|
||||
|
@ -1,148 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* Name: <Xfe/Translations.c> */
|
||||
/* Description: Xfe widgets default and extra translations. */
|
||||
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
#include <Xfe/XfeP.h>
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* XfeArrow translations */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* extern */ char _XfeArrowDefaultTranslations[] ="\
|
||||
<Key>space: ArmAndActivate()\n\
|
||||
c<Btn1Down>: Focus()\n\
|
||||
<Btn1Down>: Arm()\n\
|
||||
<Btn1Up>: Activate() Disarm()\n\
|
||||
~c ~s ~a ~m<Key>Return: ArmAndActivate()\n\
|
||||
~c ~s ~a ~m<Key>space: ArmAndActivate()\n\
|
||||
:<Key>osfHelp: Help()\n\
|
||||
<Enter>: Enter()\n\
|
||||
<Leave>: Leave()";
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* XfeLabel translations */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* extern */ char _XfeLabelDefaultTranslations[] ="\
|
||||
<Btn1Down>: Btn1Down()\n\
|
||||
c<Btn1Down>: Focus()\n\
|
||||
:<Key>osfHelp: Help()\n\
|
||||
<Enter>: Enter()\n\
|
||||
<Leave>: Leave()";
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* XfeButton translations */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* extern */ char _XfeButtonDefaultTranslations[] ="\
|
||||
<Key>space: ArmAndActivate()\n\
|
||||
c<Btn1Down>: Focus()\n\
|
||||
<Btn1Down>: Arm()\n\
|
||||
<Btn1Up>: Activate() Disarm()\n\
|
||||
<Btn3Down>: Btn3Down()\n\
|
||||
<Btn3Up>: Btn3Up()\n\
|
||||
~c ~s ~a ~m<Key>Return: ArmAndActivate()\n\
|
||||
~c ~s ~a ~m<Key>space: ArmAndActivate()\n\
|
||||
:<Key>osfHelp: Help()\n\
|
||||
<Enter>: Enter()\n\
|
||||
<Leave>: Leave()";
|
||||
|
||||
/* extern */ char _XfeButtonMotionAddTranslations[] ="\
|
||||
<Motion>: Motion()";
|
||||
|
||||
/* extern */ char _XfeButtonMotionRemoveTranslations[] ="\
|
||||
<Motion>: ";
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* XfePrimitive translations */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* extern */ char _XfePrimitiveDefaultTranslations[] ="\
|
||||
c<Btn1Down>: Focus()\n\
|
||||
:<Key>osfHelp: Help()\n\
|
||||
<Enter>: Enter()\n\
|
||||
<Leave>: Leave()";
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* XfeBypassShell translations */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* extern */ char _XfeBypassShellDefaultTranslations[] ="\
|
||||
<BtnUp>: BtnUp()\n\
|
||||
<BtnDown>: BtnDown()";
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* XfeButton extra translations */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* extern */ char _XfeBmButtonExtraTranslations[] ="\
|
||||
<Btn1Motion>: Motion()\n\
|
||||
<Motion>: Motion()";
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* XfeToolBar extra translations */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* extern */ char _XfeToolBarExtraTranslations[] ="\
|
||||
<Btn3Down>: Btn3Down()\n\
|
||||
<Btn3Up>: Btn3Up()";
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* Translation / Action functions */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* extern */ void
|
||||
XfeOverrideTranslations(Widget w,String table)
|
||||
/*----------------------------------------------------------------------*/
|
||||
{
|
||||
XtTranslations parsed = NULL;
|
||||
|
||||
assert( _XfeIsAlive(w) );
|
||||
assert( table != NULL );
|
||||
|
||||
parsed = XtParseTranslationTable(table);
|
||||
|
||||
XtOverrideTranslations(w,parsed);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* extern */ void
|
||||
XfeAddActions(Widget w,XtActionList actions,Cardinal num_actions)
|
||||
/*----------------------------------------------------------------------*/
|
||||
{
|
||||
assert( _XfeIsAlive(w) );
|
||||
assert( actions != NULL );
|
||||
assert( num_actions > 0 );
|
||||
|
||||
XtAppAddActions(XtWidgetToApplicationContext(w),actions,num_actions);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
@ -740,3 +740,34 @@ XfeRepTypeRegister(String rep_type,String * names)
|
||||
XmRepTypeRegister(rep_type,names,NULL,num_names);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* Translation / Action functions */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* extern */ void
|
||||
XfeOverrideTranslations(Widget w,String table)
|
||||
/*----------------------------------------------------------------------*/
|
||||
{
|
||||
XtTranslations parsed = NULL;
|
||||
|
||||
assert( _XfeIsAlive(w) );
|
||||
assert( table != NULL );
|
||||
|
||||
parsed = XtParseTranslationTable(table);
|
||||
|
||||
XtOverrideTranslations(w,parsed);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* extern */ void
|
||||
XfeAddActions(Widget w,XtActionList actions,Cardinal num_actions)
|
||||
/*----------------------------------------------------------------------*/
|
||||
{
|
||||
assert( _XfeIsAlive(w) );
|
||||
assert( actions != NULL );
|
||||
assert( num_actions > 0 );
|
||||
|
||||
XtAppAddActions(XtWidgetToApplicationContext(w),actions,num_actions);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
@ -308,22 +308,6 @@ if (_XfeIsAlive(_w) && XtIsRealized(_w)) \
|
||||
#define XfePrepare20 (1 << 19)
|
||||
#define XfePrepareAll (~(0))
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* Widget translations */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
extern char _XfeArrowDefaultTranslations[];
|
||||
extern char _XfeBmButtonExtraTranslations[];
|
||||
extern char _XfeButtonDefaultTranslations[];
|
||||
extern char _XfeButtonMotionAddTranslations[];
|
||||
extern char _XfeButtonMotionRemoveTranslations[];
|
||||
extern char _XfeBypassShellDefaultTranslations[];
|
||||
extern char _XfeLabelDefaultTranslations[];
|
||||
extern char _XfePrimitiveDefaultTranslations[];
|
||||
extern char _XfeToolBarExtraTranslations[];
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* Callbacks */
|
||||
|
@ -183,6 +183,15 @@ static XtActionsRec actions[] =
|
||||
{ "Leave", Leave },
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* XfeButton extra translations */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
/*extern*/ char _XfeBmButtonExtraTranslations[] ="\
|
||||
<Btn1Motion>: Motion()\n\
|
||||
<Motion>: Motion()";
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* XfeBmButton widget class record initialization */
|
||||
|
@ -116,6 +116,13 @@ _XfeBmProcWithoutDrawing (Widget w,
|
||||
XtWidgetProc proc);
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* XfeBmButton translations which are shared with XfeBmCacade. */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
extern char _XfeBmButtonExtraTranslations[];
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* Means the cursor is outside the target accent button/cascade. */
|
||||
|
@ -483,6 +483,14 @@ static XtActionsRec actions[] =
|
||||
{ "Btn3Up", Btn3Up },
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* XfeToolBar extra translations */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
static char extra_translations[] ="\
|
||||
<Btn3Down>: Btn3Down()\n\
|
||||
<Btn3Up>: Btn3Up()";
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
@ -736,7 +744,7 @@ Initialize(Widget rw,Widget nw,ArgList args,Cardinal *nargs)
|
||||
}
|
||||
|
||||
/* Add Button3 translations */
|
||||
XfeOverrideTranslations(nw,_XfeToolBarExtraTranslations);
|
||||
XfeOverrideTranslations(nw,extra_translations);
|
||||
|
||||
/* Initialize private members */
|
||||
#if 0
|
||||
|
Loading…
Reference in New Issue
Block a user