1999-11-18 20:05:24 -08:00
/*
2000-01-05 09:34:32 -08:00
* Copyright ( C ) 1997 - 2000 , Michael Jennings
1999-11-18 20:05:24 -08:00
*
* Permission is hereby granted , free of charge , to any person obtaining a copy
* of this software and associated documentation files ( the " Software " ) , to
* deal in the Software without restriction , including without limitation the
* rights to use , copy , modify , merge , publish , distribute , sublicense , and / or
* sell copies of the Software , and to permit persons to whom the Software is
* furnished to do so , subject to the following conditions :
1999-08-17 18:12:47 -07:00
*
1999-11-18 20:05:24 -08:00
* The above copyright notice and this permission notice shall be included in
* all copies of the Software , its documentation and marketing & publicity
* materials , and acknowledgment shall be given in the documentation , materials
* and software packages that this Software was used .
1999-08-17 18:12:47 -07:00
*
1999-11-18 20:05:24 -08:00
* THE SOFTWARE IS PROVIDED " AS IS " , WITHOUT WARRANTY OF ANY KIND , EXPRESS OR
* IMPLIED , INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY ,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT . IN NO EVENT SHALL
* THE AUTHORS BE LIABLE FOR ANY CLAIM , DAMAGES OR OTHER LIABILITY , WHETHER
* IN AN ACTION OF CONTRACT , TORT OR OTHERWISE , ARISING FROM , OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE .
1999-08-17 18:12:47 -07:00
*/
static const char cvs_ident [ ] = " $Id$ " ;
# include "config.h"
# include "feature.h"
# include <X11/cursorfont.h>
# include "command.h"
1999-11-18 20:05:24 -08:00
# include "draw.h"
1999-10-07 12:47:14 -07:00
# include "e.h"
1999-08-17 18:12:47 -07:00
# include "events.h"
1999-09-21 19:34:13 -07:00
# include "font.h"
1999-10-07 15:18:14 -07:00
# include "startup.h"
1999-08-17 18:12:47 -07:00
# include "menus.h"
# include "misc.h"
# include "options.h"
# include "pixmap.h"
# include "screen.h"
2001-05-09 17:20:15 -07:00
# include "script.h"
1999-08-17 18:12:47 -07:00
# include "term.h"
# include "windows.h"
menulist_t * menu_list = NULL ;
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
static event_dispatcher_data_t menu_event_data ;
1999-08-17 18:12:47 -07:00
static GC topShadowGC , botShadowGC ;
static Time button_press_time ;
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
static int button_press_x = 0 , button_press_y = 0 ;
1999-08-17 18:12:47 -07:00
static menu_t * current_menu ;
2000-03-14 19:17:45 -08:00
static inline void grab_pointer ( Window win ) ;
static inline void ungrab_pointer ( void ) ;
static inline void draw_string ( Drawable d , GC gc , int x , int y , char * str , size_t len ) ;
static inline unsigned short center_coords ( register unsigned short c1 , register unsigned short c2 ) ;
1999-10-08 11:49:57 -07:00
2000-03-14 19:17:45 -08:00
static inline void
1999-08-17 18:12:47 -07:00
grab_pointer ( Window win )
{
int success ;
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
D_EVENTS ( ( " Grabbing control of pointer for window 0x%08x. \n " , win ) ) ;
1999-08-17 18:12:47 -07:00
success = XGrabPointer ( Xdisplay , win , False ,
EnterWindowMask | LeaveWindowMask | PointerMotionMask | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask
| Button1MotionMask | Button2MotionMask | Button3MotionMask ,
GrabModeAsync , GrabModeAsync , None , None , CurrentTime ) ;
if ( success ! = GrabSuccess ) {
switch ( success ) {
case GrabNotViewable :
D_MENU ( ( " -> Unable to grab pointer -- Grab window is not viewable. \n " ) ) ;
break ;
case AlreadyGrabbed :
D_MENU ( ( " -> Unable to grab pointer -- Pointer is already grabbed by another client. \n " ) ) ;
break ;
case GrabFrozen :
D_MENU ( ( " -> Unable to grab pointer -- Pointer is frozen by another grab. \n " ) ) ;
break ;
case GrabInvalidTime :
D_MENU ( ( " -> Unable to grab pointer -- Invalid grab time. \n " ) ) ;
break ;
default :
break ;
}
}
}
2000-03-14 19:17:45 -08:00
static inline void
1999-08-17 18:12:47 -07:00
ungrab_pointer ( void )
{
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
D_EVENTS ( ( " Releasing pointer grab. \n " ) ) ;
1999-08-17 18:12:47 -07:00
XUngrabPointer ( Xdisplay , CurrentTime ) ;
}
2000-03-14 19:17:45 -08:00
static inline void
1999-08-17 18:12:47 -07:00
draw_string ( Drawable d , GC gc , int x , int y , char * str , size_t len )
{
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
D_MENU ( ( " Writing string \" %s \" (length %lu) onto drawable 0x%08x at %d, %d \n " , str , len , d , x , y ) ) ;
1999-08-17 18:12:47 -07:00
# ifdef MULTI_CHARSET
if ( current_menu & & current_menu - > fontset )
XmbDrawString ( Xdisplay , d , current_menu - > fontset , gc , x , y , str , len ) ;
else
# endif
XDrawString ( Xdisplay , d , gc , x , y , str , len ) ;
}
2000-03-14 19:17:45 -08:00
static inline unsigned short
1999-08-17 18:12:47 -07:00
center_coords ( register unsigned short c1 , register unsigned short c2 )
{
return ( ( ( c2 - c1 ) > > 1 ) + c1 ) ;
}
void
menu_init ( void )
{
XGCValues gcvalue ;
if ( ! menu_list | | menu_list - > nummenus = = 0 ) {
return ;
}
gcvalue . foreground = PixColors [ menuTopShadowColor ] ;
2000-10-30 15:05:25 -08:00
topShadowGC = LIBAST_X_CREATE_GC ( GCForeground , & gcvalue ) ;
1999-08-17 18:12:47 -07:00
gcvalue . foreground = PixColors [ menuBottomShadowColor ] ;
2000-10-30 15:05:25 -08:00
botShadowGC = LIBAST_X_CREATE_GC ( GCForeground , & gcvalue ) ;
1999-08-17 18:12:47 -07:00
event_register_dispatcher ( menu_dispatch_event , menu_event_init_dispatcher ) ;
}
void
menu_event_init_dispatcher ( void )
{
register unsigned char i ;
EVENT_DATA_ADD_HANDLER ( menu_event_data , EnterNotify , menu_handle_enter_notify ) ;
EVENT_DATA_ADD_HANDLER ( menu_event_data , LeaveNotify , menu_handle_leave_notify ) ;
1999-12-29 02:36:38 -08:00
#if 0
1999-08-17 18:12:47 -07:00
EVENT_DATA_ADD_HANDLER ( menu_event_data , GraphicsExpose , menu_handle_expose ) ;
EVENT_DATA_ADD_HANDLER ( menu_event_data , Expose , menu_handle_expose ) ;
1999-12-29 02:36:38 -08:00
# endif
1999-08-17 18:12:47 -07:00
EVENT_DATA_ADD_HANDLER ( menu_event_data , ButtonPress , menu_handle_button_press ) ;
EVENT_DATA_ADD_HANDLER ( menu_event_data , ButtonRelease , menu_handle_button_release ) ;
EVENT_DATA_ADD_HANDLER ( menu_event_data , MotionNotify , menu_handle_motion_notify ) ;
for ( i = 0 ; i < menu_list - > nummenus ; i + + ) {
event_data_add_mywin ( & menu_event_data , menu_list - > menus [ i ] - > win ) ;
}
event_data_add_parent ( & menu_event_data , TermWin . vt ) ;
event_data_add_parent ( & menu_event_data , TermWin . parent ) ;
}
unsigned char
2000-09-01 21:12:16 -07:00
menu_handle_enter_notify ( event_t * ev )
1999-08-17 18:12:47 -07:00
{
register menu_t * menu ;
1999-10-27 06:39:30 -07:00
D_EVENTS ( ( " menu_handle_enter_notify(ev [%8p] on window 0x%08x) \n " , ev , ev - > xany . window ) ) ;
1999-08-17 18:12:47 -07:00
REQUIRE_RVAL ( XEVENT_IS_MYWIN ( ev , & menu_event_data ) , 0 ) ;
/* Take control of the pointer so we get all events for it, even those outside the menu window */
menu = find_menu_by_window ( menu_list , ev - > xany . window ) ;
if ( menu & & menu ! = current_menu ) {
ungrab_pointer ( ) ;
if ( menu - > state & MENU_STATE_IS_MAPPED ) {
grab_pointer ( menu - > win ) ;
menu - > state | = MENU_STATE_IS_FOCUSED ;
current_menu = menu ;
menu_reset_submenus ( menu ) ;
menuitem_change_current ( find_item_by_coords ( current_menu , ev - > xbutton . x , ev - > xbutton . y ) ) ;
}
}
return 1 ;
}
unsigned char
2000-09-01 21:12:16 -07:00
menu_handle_leave_notify ( event_t * ev )
1999-08-17 18:12:47 -07:00
{
1999-10-27 06:39:30 -07:00
D_EVENTS ( ( " menu_handle_leave_notify(ev [%8p] on window 0x%08x) \n " , ev , ev - > xany . window ) ) ;
1999-08-17 18:12:47 -07:00
REQUIRE_RVAL ( XEVENT_IS_MYWIN ( ev , & menu_event_data ) , 0 ) ;
if ( current_menu ) {
current_menu - > state & = ~ ( MENU_STATE_IS_FOCUSED ) ;
}
return 0 ;
}
unsigned char
2000-09-01 21:12:16 -07:00
menu_handle_focus_in ( event_t * ev )
1999-08-17 18:12:47 -07:00
{
1999-10-27 06:39:30 -07:00
D_EVENTS ( ( " menu_handle_focus_in(ev [%8p] on window 0x%08x) \n " , ev , ev - > xany . window ) ) ;
1999-08-17 18:12:47 -07:00
REQUIRE_RVAL ( XEVENT_IS_MYWIN ( ev , & menu_event_data ) , 0 ) ;
return 0 ;
}
unsigned char
2000-09-01 21:12:16 -07:00
menu_handle_focus_out ( event_t * ev )
1999-08-17 18:12:47 -07:00
{
1999-10-27 06:39:30 -07:00
D_EVENTS ( ( " menu_handle_focus_out(ev [%8p] on window 0x%08x) \n " , ev , ev - > xany . window ) ) ;
1999-08-17 18:12:47 -07:00
REQUIRE_RVAL ( XEVENT_IS_MYWIN ( ev , & menu_event_data ) , 0 ) ;
return 0 ;
}
1999-12-29 02:36:38 -08:00
#if 0
1999-08-17 18:12:47 -07:00
unsigned char
2000-09-01 21:12:16 -07:00
menu_handle_expose ( event_t * ev )
1999-08-17 18:12:47 -07:00
{
XEvent unused_xevent ;
1999-10-27 06:39:30 -07:00
D_EVENTS ( ( " menu_handle_expose(ev [%8p] on window 0x%08x) \n " , ev , ev - > xany . window ) ) ;
1999-08-17 18:12:47 -07:00
REQUIRE_RVAL ( XEVENT_IS_MYWIN ( ev , & menu_event_data ) , 0 ) ;
while ( XCheckTypedWindowEvent ( Xdisplay , ev - > xany . window , Expose , & unused_xevent ) ) ;
while ( XCheckTypedWindowEvent ( Xdisplay , ev - > xany . window , GraphicsExpose , & unused_xevent ) ) ;
1999-10-28 07:02:35 -07:00
return 1 ;
1999-08-17 18:12:47 -07:00
}
1999-12-29 02:36:38 -08:00
# endif
1999-08-17 18:12:47 -07:00
unsigned char
2000-09-01 21:12:16 -07:00
menu_handle_button_press ( event_t * ev )
1999-08-17 18:12:47 -07:00
{
1999-10-27 06:39:30 -07:00
D_EVENTS ( ( " menu_handle_button_press(ev [%8p] on window 0x%08x) \n " , ev , ev - > xany . window ) ) ;
1999-08-17 18:12:47 -07:00
REQUIRE_RVAL ( XEVENT_IS_MYWIN ( ev , & menu_event_data ) , 0 ) ;
D_EVENTS ( ( " ButtonPress at %d, %d \n " , ev - > xbutton . x , ev - > xbutton . y ) ) ;
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
if ( ! current_menu | | ( ev - > xbutton . x < 0 ) | | ( ev - > xbutton . y < 0 ) | | ( ev - > xbutton . x > = current_menu - > w ) | | ( ev - > xbutton . y > = current_menu - > h ) ) {
Window unused_win , child_win ;
1999-08-17 18:12:47 -07:00
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
/* Click outside the current menu, or there is no current menu. Reset. */
ungrab_pointer ( ) ;
menu_reset_all ( menu_list ) ;
current_menu = NULL ;
XTranslateCoordinates ( Xdisplay , ev - > xany . window , Xroot , ev - > xbutton . x , ev - > xbutton . y , & ( ev - > xbutton . x ) , & ( ev - > xbutton . y ) , & unused_win ) ;
child_win = find_window_by_coords ( Xroot , 0 , 0 , ev - > xbutton . x , ev - > xbutton . y ) ;
if ( child_win ! = None ) {
XTranslateCoordinates ( Xdisplay , Xroot , child_win , ev - > xbutton . x , ev - > xbutton . y , & ( ev - > xbutton . x ) , & ( ev - > xbutton . y ) , & unused_win ) ;
ev - > xany . window = child_win ;
D_EVENTS ( ( " Sending synthetic event on to window 0x%08x at %d, %d \n " , child_win , ev - > xbutton . x , ev - > xbutton . y ) ) ;
XSendEvent ( Xdisplay , child_win , False , 0 , ev ) ;
}
} else {
button_press_time = ev - > xbutton . time ;
button_press_x = ev - > xbutton . x ;
button_press_y = ev - > xbutton . y ;
if ( current_menu & & ( current_menu - > state & MENU_STATE_IS_DRAGGING ) ) {
current_menu - > state & = ~ MENU_STATE_IS_DRAGGING ;
}
}
1999-08-17 18:12:47 -07:00
return 1 ;
}
unsigned char
2000-09-01 21:12:16 -07:00
menu_handle_button_release ( event_t * ev )
1999-08-17 18:12:47 -07:00
{
1999-10-08 11:49:57 -07:00
menuitem_t * item ;
1999-08-17 18:12:47 -07:00
1999-10-27 06:39:30 -07:00
D_EVENTS ( ( " menu_handle_button_release(ev [%8p] on window 0x%08x) \n " , ev , ev - > xany . window ) ) ;
1999-08-17 18:12:47 -07:00
REQUIRE_RVAL ( XEVENT_IS_MYWIN ( ev , & menu_event_data ) , 0 ) ;
D_EVENTS ( ( " ButtonRelease at %d, %d \n " , ev - > xbutton . x , ev - > xbutton . y ) ) ;
if ( current_menu & & ( current_menu - > state & MENU_STATE_IS_DRAGGING ) ) {
/* Dragging-and-release mode */
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
D_MENU ( ( " Drag-and-release mode, detected release. Button press time is %lu, release time is %lu \n " , button_press_time , ev - > xbutton . time ) ) ;
1999-08-17 18:12:47 -07:00
ungrab_pointer ( ) ;
if ( button_press_time & & ( ev - > xbutton . time - button_press_time > MENU_CLICK_TIME ) ) {
/* Take action here based on the current menu item */
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
if ( ( item = menuitem_get_current ( current_menu ) ) ! = NULL ) {
if ( item - > type = = MENUITEM_SUBMENU ) {
menu_display_submenu ( current_menu , item ) ;
} else {
menu_action ( item ) ;
menuitem_deselect ( current_menu ) ;
1999-08-17 18:12:47 -07:00
}
}
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
/* Reset the state of the menu system. */
menu_reset_all ( menu_list ) ;
current_menu = NULL ;
} else {
current_menu - > state & = ~ MENU_STATE_IS_DRAGGING ; /* Click, brief drag, release == single click */
1999-08-17 18:12:47 -07:00
}
} else {
/* Single-click mode */
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
D_MENU ( ( " Single click mode, detected click. Button press time is %lu, release time is %lu \n " , button_press_time , ev - > xbutton . time ) ) ;
2000-02-17 21:39:39 -08:00
if ( current_menu & & ( ev - > xbutton . x > = 0 ) & & ( ev - > xbutton . y > = 0 ) & & ( ev - > xbutton . x < current_menu - > w ) & & ( ev - > xbutton . y < current_menu - > h ) ) {
1999-08-17 18:12:47 -07:00
/* Click inside the menu window. Activate the current item. */
2000-02-17 21:39:39 -08:00
if ( ( item = menuitem_get_current ( current_menu ) ) ! = NULL ) {
if ( item - > type = = MENUITEM_SUBMENU ) {
menu_display_submenu ( current_menu , item ) ;
} else {
menu_action ( item ) ;
menuitem_deselect ( current_menu ) ;
menu_reset_all ( menu_list ) ;
}
1999-08-17 18:12:47 -07:00
}
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
} else if ( ! ( button_press_time & & ( ev - > xbutton . time - button_press_time < MENU_CLICK_TIME ) ) | | ( button_press_x & & button_press_y ) ) {
/* Single click which lasted too long, or the second click occured outside the menu */
1999-08-17 18:12:47 -07:00
ungrab_pointer ( ) ;
/* Reset the state of the menu system. */
menu_reset_all ( menu_list ) ;
current_menu = NULL ;
}
}
button_press_time = 0 ;
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
button_press_x = button_press_y = 0 ;
1999-08-17 18:12:47 -07:00
return 1 ;
}
unsigned char
2000-09-01 21:12:16 -07:00
menu_handle_motion_notify ( event_t * ev )
1999-08-17 18:12:47 -07:00
{
register menuitem_t * item = NULL ;
1999-10-27 06:39:30 -07:00
D_EVENTS ( ( " menu_handle_motion_notify(ev [%8p] on window 0x%08x) \n " , ev , ev - > xany . window ) ) ;
1999-08-17 18:12:47 -07:00
REQUIRE_RVAL ( XEVENT_IS_MYWIN ( ev , & menu_event_data ) , 0 ) ;
while ( XCheckTypedWindowEvent ( Xdisplay , ev - > xany . window , MotionNotify , ev ) ) ;
if ( ! current_menu ) {
return 1 ;
}
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
D_MENU ( ( " Mouse is in motion. Button press time is %lu, motion time is %lu \n " , button_press_time , ev - > xbutton . time ) ) ;
1999-08-17 18:12:47 -07:00
if ( ( ev - > xbutton . x > = 0 ) & & ( ev - > xbutton . y > = 0 ) & & ( ev - > xbutton . x < current_menu - > w ) & & ( ev - > xbutton . y < current_menu - > h ) ) {
/* Motion within the current menu */
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
if ( button_press_time ) {
current_menu - > state | = MENU_STATE_IS_DRAGGING ;
}
1999-08-17 18:12:47 -07:00
item = find_item_by_coords ( current_menu , ev - > xbutton . x , ev - > xbutton . y ) ;
2000-05-03 20:54:28 -07:00
if ( ! item | | item ! = menuitem_get_current ( current_menu ) ) {
menu_reset_submenus ( current_menu ) ;
}
1999-08-17 18:12:47 -07:00
menuitem_change_current ( item ) ;
} else {
/* Motion outside the current menu */
int dest_x , dest_y ;
Window child ;
menu_t * menu ;
XTranslateCoordinates ( Xdisplay , ev - > xany . window , Xroot , ev - > xbutton . x , ev - > xbutton . y , & dest_x , & dest_y , & child ) ;
menu = find_menu_by_window ( menu_list , child ) ;
1999-10-08 11:49:57 -07:00
if ( menu & & menu ! = current_menu ) {
1999-08-17 18:12:47 -07:00
D_MENU ( ( " Mouse is actually over window 0x%08x belonging to menu \" %s \" \n " , child , menu - > title ) ) ;
1999-10-08 11:49:57 -07:00
ungrab_pointer ( ) ;
grab_pointer ( menu - > win ) ;
current_menu - > state & = ~ ( MENU_STATE_IS_FOCUSED ) ;
menu - > state | = MENU_STATE_IS_FOCUSED ;
if ( ! menu_is_child ( current_menu , menu ) ) {
menu_reset_tree ( current_menu ) ;
}
current_menu = menu ;
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
current_menu - > state | = MENU_STATE_IS_DRAGGING ;
1999-08-17 18:12:47 -07:00
XTranslateCoordinates ( Xdisplay , ev - > xany . window , child , ev - > xbutton . x , ev - > xbutton . y , & dest_x , & dest_y , & child ) ;
item = find_item_by_coords ( menu , dest_x , dest_y ) ;
1999-10-08 11:49:57 -07:00
if ( ! item | | item ! = menuitem_get_current ( current_menu ) ) {
menu_reset_submenus ( current_menu ) ;
1999-08-17 18:12:47 -07:00
}
1999-10-08 11:49:57 -07:00
menuitem_change_current ( item ) ;
2000-05-03 20:54:28 -07:00
} else if ( ! menu ) {
menuitem_change_current ( NULL ) ;
1999-08-17 18:12:47 -07:00
}
}
return 1 ;
}
unsigned char
2000-09-01 21:12:16 -07:00
menu_dispatch_event ( event_t * ev )
1999-08-17 18:12:47 -07:00
{
if ( menu_event_data . handlers [ ev - > type ] ! = NULL ) {
return ( ( menu_event_data . handlers [ ev - > type ] ) ( ev ) ) ;
}
return ( 0 ) ;
}
menulist_t *
2000-09-01 21:12:16 -07:00
menulist_add_menu ( menulist_t * list , menu_t * menu )
1999-08-17 18:12:47 -07:00
{
ASSERT_RVAL ( menu ! = NULL , list ) ;
if ( list ) {
list - > nummenus + + ;
list - > menus = ( menu_t * * ) REALLOC ( list - > menus , sizeof ( menu_t * ) * list - > nummenus ) ;
} else {
list = ( menulist_t * ) MALLOC ( sizeof ( menulist_t ) ) ;
list - > nummenus = 1 ;
list - > menus = ( menu_t * * ) MALLOC ( sizeof ( menu_t * ) ) ;
}
list - > menus [ list - > nummenus - 1 ] = menu ;
return list ;
}
2000-09-01 21:12:16 -07:00
void
menulist_clear ( menulist_t * list )
{
unsigned long i ;
ASSERT ( list ! = NULL ) ;
for ( i = 0 ; i < list - > nummenus ; i + + ) {
menu_delete ( list - > menus [ i ] ) ;
}
FREE ( list - > menus ) ;
2000-10-30 15:05:25 -08:00
LIBAST_X_FREE_GC ( topShadowGC ) ;
LIBAST_X_FREE_GC ( botShadowGC ) ;
2000-09-01 21:12:16 -07:00
FREE ( list ) ;
}
1999-08-17 18:12:47 -07:00
menu_t *
menu_create ( char * title )
{
menu_t * menu ;
static Cursor cursor ;
static long mask ;
static XSetWindowAttributes xattr ;
if ( ! mask ) {
xattr . border_pixel = BlackPixel ( Xdisplay , Xscreen ) ;
xattr . save_under = TRUE ;
xattr . override_redirect = TRUE ;
xattr . colormap = cmap ;
cursor = XCreateFontCursor ( Xdisplay , XC_left_ptr ) ;
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
mask = PointerMotionMask | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask | Button1MotionMask | Button2MotionMask | Button3MotionMask ;
1999-08-17 18:12:47 -07:00
}
menu = ( menu_t * ) MALLOC ( sizeof ( menu_t ) ) ;
MEMSET ( menu , 0 , sizeof ( menu_t ) ) ;
2000-08-30 22:41:44 -07:00
menu - > title = STRDUP ( title ? title : " " ) ;
1999-08-17 18:12:47 -07:00
menu - > win = XCreateWindow ( Xdisplay , Xroot , 0 , 0 , 1 , 1 , 0 , Xdepth , InputOutput , CopyFromParent ,
2000-09-17 17:13:07 -07:00
CWOverrideRedirect | CWSaveUnder | CWBorderPixel | CWColormap , & xattr ) ;
1999-08-17 18:12:47 -07:00
XDefineCursor ( Xdisplay , menu - > win , cursor ) ;
XSelectInput ( Xdisplay , menu - > win , mask ) ;
XStoreName ( Xdisplay , menu - > win , menu - > title ) ;
menu - > swin = XCreateWindow ( Xdisplay , menu - > win , 0 , 0 , 1 , 1 , 0 , Xdepth , InputOutput , CopyFromParent ,
2000-09-17 17:13:07 -07:00
CWOverrideRedirect | CWSaveUnder | CWBorderPixel | CWColormap , & xattr ) ;
1999-08-17 18:12:47 -07:00
2000-10-30 15:05:25 -08:00
menu - > gc = LIBAST_X_CREATE_GC ( 0 , NULL ) ;
1999-10-08 11:49:57 -07:00
menuitem_clear_current ( menu ) ;
1999-08-17 18:12:47 -07:00
return menu ;
}
2000-09-01 21:12:16 -07:00
void
menu_delete ( menu_t * menu )
{
unsigned short i ;
ASSERT ( menu ! = NULL ) ;
2000-11-16 15:45:01 -08:00
D_MENU ( ( " Deleting menu \" %s \" \n " , menu - > title ) ) ;
2000-09-01 21:12:16 -07:00
for ( i = 0 ; i < menu - > numitems ; i + + ) {
menuitem_delete ( menu - > items [ i ] ) ;
}
FREE ( menu - > items ) ;
if ( menu - > title ) {
FREE ( menu - > title ) ;
}
if ( menu - > bg ) {
2000-10-30 15:05:25 -08:00
LIBAST_X_FREE_PIXMAP ( menu - > bg ) ;
2000-09-01 21:12:16 -07:00
}
if ( menu - > gc ) {
2000-10-30 15:05:25 -08:00
LIBAST_X_FREE_GC ( menu - > gc ) ;
2000-09-01 21:12:16 -07:00
}
# ifdef MULTI_CHARSET
if ( menu - > fontset ) {
XFreeFontSet ( Xdisplay , menu - > fontset ) ;
}
# endif
if ( menu - > font ) {
free_font ( menu - > font ) ;
}
if ( menu - > swin ) {
XDestroyWindow ( Xdisplay , menu - > swin ) ;
}
2000-11-16 15:45:01 -08:00
if ( menu - > win ) {
XDestroyWindow ( Xdisplay , menu - > win ) ;
}
2000-09-01 21:12:16 -07:00
FREE ( menu ) ;
}
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
unsigned char
menu_set_title ( menu_t * menu , const char * title )
{
ASSERT_RVAL ( menu ! = NULL , 0 ) ;
REQUIRE_RVAL ( title ! = NULL , 0 ) ;
FREE ( menu - > title ) ;
2000-08-30 22:41:44 -07:00
menu - > title = STRDUP ( title ) ;
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
XStoreName ( Xdisplay , menu - > win , menu - > title ) ;
return 1 ;
}
1999-08-17 18:12:47 -07:00
unsigned char
2000-09-01 21:12:16 -07:00
menu_set_font ( menu_t * menu , const char * fontname )
1999-08-17 18:12:47 -07:00
{
XFontStruct * font ;
XGCValues gcvalue ;
ASSERT_RVAL ( menu ! = NULL , 0 ) ;
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
REQUIRE_RVAL ( fontname ! = NULL , 0 ) ;
1999-08-17 18:12:47 -07:00
1999-09-21 19:34:13 -07:00
font = ( XFontStruct * ) load_font ( fontname , " fixed " , FONT_TYPE_X ) ;
1999-08-17 18:12:47 -07:00
# ifdef MULTI_CHARSET
1999-12-02 18:31:33 -08:00
menu - > fontset = create_fontset ( fontname , etmfonts [ def_font_idx ] ) ;
1999-08-17 18:12:47 -07:00
# endif
menu - > font = font ;
menu - > fwidth = font - > max_bounds . width ;
menu - > fheight = font - > ascent + font - > descent + rs_line_space ;
gcvalue . font = font - > fid ;
XChangeGC ( Xdisplay , menu - > gc , GCFont , & gcvalue ) ;
return 1 ;
}
unsigned char
2000-09-01 21:12:16 -07:00
menu_add_item ( menu_t * menu , menuitem_t * item )
1999-08-17 18:12:47 -07:00
{
ASSERT_RVAL ( menu ! = NULL , 0 ) ;
ASSERT_RVAL ( item ! = NULL , 0 ) ;
if ( menu - > numitems ) {
menu - > numitems + + ;
menu - > items = ( menuitem_t * * ) REALLOC ( menu - > items , sizeof ( menuitem_t * ) * menu - > numitems ) ;
} else {
menu - > numitems = 1 ;
menu - > items = ( menuitem_t * * ) MALLOC ( sizeof ( menuitem_t * ) ) ;
}
1999-09-16 15:40:44 -07:00
1999-08-17 18:12:47 -07:00
menu - > items [ menu - > numitems - 1 ] = item ;
return 1 ;
}
/* Return 1 if submenu is a child of menu, 0 if not. */
unsigned char
2000-09-01 21:12:16 -07:00
menu_is_child ( menu_t * menu , menu_t * submenu )
1999-08-17 18:12:47 -07:00
{
register unsigned char i ;
register menuitem_t * item ;
ASSERT_RVAL ( menu ! = NULL , 0 ) ;
ASSERT_RVAL ( submenu ! = NULL , 0 ) ;
for ( i = 0 ; i < menu - > numitems ; i + + ) {
item = menu - > items [ i ] ;
if ( item - > type = = MENUITEM_SUBMENU & & item - > action . submenu ! = NULL ) {
if ( item - > action . submenu = = submenu ) {
return 1 ;
} else if ( menu_is_child ( item - > action . submenu , submenu ) ) {
return 1 ;
}
}
}
return 0 ;
}
menu_t *
2000-09-01 21:12:16 -07:00
find_menu_by_title ( menulist_t * list , char * title )
1999-08-17 18:12:47 -07:00
{
register unsigned char i ;
1999-09-13 12:18:20 -07:00
REQUIRE_RVAL ( list ! = NULL , NULL ) ;
1999-08-17 18:12:47 -07:00
for ( i = 0 ; i < list - > nummenus ; i + + ) {
if ( ! strcasecmp ( list - > menus [ i ] - > title , title ) ) {
return ( list - > menus [ i ] ) ;
}
}
return NULL ;
}
menu_t *
2000-09-01 21:12:16 -07:00
find_menu_by_window ( menulist_t * list , Window win )
1999-08-17 18:12:47 -07:00
{
register unsigned char i ;
1999-09-13 12:18:20 -07:00
REQUIRE_RVAL ( list ! = NULL , NULL ) ;
1999-08-17 18:12:47 -07:00
for ( i = 0 ; i < list - > nummenus ; i + + ) {
if ( list - > menus [ i ] - > win = = win ) {
return ( list - > menus [ i ] ) ;
}
}
return NULL ;
}
menuitem_t *
2000-09-01 21:12:16 -07:00
find_item_by_coords ( menu_t * menu , int x , int y )
1999-08-17 18:12:47 -07:00
{
register unsigned char i ;
register menuitem_t * item ;
ASSERT_RVAL ( menu ! = NULL , NULL ) ;
for ( i = 0 ; i < menu - > numitems ; i + + ) {
item = menu - > items [ i ] ;
if ( ( x > item - > x ) & & ( y > item - > y ) & & ( x < item - > x + item - > w ) & & ( y < item - > y + item - > h ) & & ( item - > type ! = MENUITEM_SEP ) ) {
return ( item ) ;
}
}
return NULL ;
}
unsigned short
2000-09-01 21:12:16 -07:00
find_item_in_menu ( menu_t * menu , menuitem_t * item )
1999-08-17 18:12:47 -07:00
{
register unsigned char i ;
ASSERT_RVAL ( menu ! = NULL , ( unsigned short ) - 1 ) ;
ASSERT_RVAL ( item ! = NULL , ( unsigned short ) - 1 ) ;
for ( i = 0 ; i < menu - > numitems ; i + + ) {
if ( item = = menu - > items [ i ] ) {
return ( i ) ;
}
}
return ( ( unsigned short ) - 1 ) ;
}
void
1999-10-08 11:49:57 -07:00
menuitem_change_current ( menuitem_t * item )
1999-08-17 18:12:47 -07:00
{
1999-10-08 11:49:57 -07:00
menuitem_t * current ;
1999-08-17 18:12:47 -07:00
1999-10-08 11:49:57 -07:00
ASSERT ( current_menu ! = NULL ) ;
1999-08-17 18:12:47 -07:00
1999-10-08 11:49:57 -07:00
current = menuitem_get_current ( current_menu ) ;
if ( current ! = item ) {
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
D_MENU ( ( " Changing current item in menu \" %s \" from \" %s \" to \" %s \" \n " , current_menu - > title , ( current ? current - > text : " (NULL) " ) , ( item ? item - > text : " (NULL) " ) ) ) ;
1999-10-08 11:49:57 -07:00
if ( current ) {
1999-08-17 18:12:47 -07:00
/* Reset the current item */
1999-10-08 11:49:57 -07:00
menuitem_deselect ( current_menu ) ;
1999-08-17 18:12:47 -07:00
/* If we're changing from one submenu to another and neither is a child of the other, or if we're changing from a submenu to
no current item at all , reset the tree for the current submenu */
1999-10-08 11:49:57 -07:00
if ( current - > type = = MENUITEM_SUBMENU & & current - > action . submenu ! = NULL ) {
1999-08-17 18:12:47 -07:00
if ( ( item & & item - > type = = MENUITEM_SUBMENU & & item - > action . submenu ! = NULL
1999-10-08 11:49:57 -07:00
& & ! menu_is_child ( current - > action . submenu , item - > action . submenu )
& & ! menu_is_child ( item - > action . submenu , current - > action . submenu ) )
1999-08-17 18:12:47 -07:00
| | ( ! item ) ) {
1999-10-08 11:49:57 -07:00
menu_reset_tree ( current - > action . submenu ) ;
1999-08-17 18:12:47 -07:00
}
}
}
1999-10-08 11:49:57 -07:00
if ( item ) {
menuitem_set_current ( current_menu , find_item_in_menu ( current_menu , item ) ) ;
menuitem_select ( current_menu ) ;
if ( item - > type = = MENUITEM_SUBMENU ) {
1999-08-17 18:12:47 -07:00
/* Display the submenu */
1999-10-08 11:49:57 -07:00
menu_display_submenu ( current_menu , item ) ;
1999-08-17 18:12:47 -07:00
}
1999-10-08 11:49:57 -07:00
} else {
menuitem_clear_current ( current_menu ) ;
1999-08-17 18:12:47 -07:00
}
1999-10-08 11:49:57 -07:00
} else {
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
D_MENU ( ( " Current item in menu \" %s \" does not require changing. \n " , current_menu - > title ) ) ;
1999-08-17 18:12:47 -07:00
}
}
menuitem_t *
menuitem_create ( char * text )
{
menuitem_t * menuitem ;
1999-10-07 15:18:14 -07:00
menuitem = ( menuitem_t * ) MALLOC ( sizeof ( menuitem_t ) ) ;
MEMSET ( menuitem , 0 , sizeof ( menuitem_t ) ) ;
1999-09-16 15:40:44 -07:00
1999-08-17 18:12:47 -07:00
if ( text ) {
2000-08-30 22:41:44 -07:00
menuitem - > text = STRDUP ( text ) ;
1999-08-17 18:12:47 -07:00
menuitem - > len = strlen ( text ) ;
}
return menuitem ;
}
2000-09-01 21:12:16 -07:00
void
menuitem_delete ( menuitem_t * item )
{
ASSERT ( item ! = NULL ) ;
if ( item - > icon ) {
free_simage ( item - > icon ) ;
}
if ( item - > type = = MENUITEM_STRING | | item - > type = = MENUITEM_ECHO ) {
FREE ( item - > action . string ) ;
2001-05-09 17:20:15 -07:00
} else if ( item - > type = = MENUITEM_SCRIPT ) {
FREE ( item - > action . script ) ;
2000-09-01 21:12:16 -07:00
}
if ( item - > text ) {
FREE ( item - > text ) ;
}
if ( item - > rtext ) {
FREE ( item - > rtext ) ;
}
FREE ( item ) ;
}
1999-08-17 18:12:47 -07:00
unsigned char
2000-09-01 21:12:16 -07:00
menuitem_set_text ( menuitem_t * item , const char * text )
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
{
ASSERT_RVAL ( item ! = NULL , 0 ) ;
REQUIRE_RVAL ( text ! = NULL , 0 ) ;
if ( item - > text ) {
FREE ( item - > text ) ;
}
2000-08-30 22:41:44 -07:00
item - > text = STRDUP ( text ) ;
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
item - > len = strlen ( text ) ;
return 1 ;
}
unsigned char
2000-09-01 21:12:16 -07:00
menuitem_set_icon ( menuitem_t * item , simage_t * icon )
1999-08-17 18:12:47 -07:00
{
ASSERT_RVAL ( item ! = NULL , 0 ) ;
ASSERT_RVAL ( icon ! = NULL , 0 ) ;
item - > icon = icon ;
return 1 ;
}
unsigned char
2000-09-01 21:12:16 -07:00
menuitem_set_action ( menuitem_t * item , unsigned char type , char * action )
1999-08-17 18:12:47 -07:00
{
ASSERT_RVAL ( item ! = NULL , 0 ) ;
item - > type = type ;
switch ( type ) {
case MENUITEM_SUBMENU :
item - > action . submenu = find_menu_by_title ( menu_list , action ) ;
break ;
2001-05-09 17:20:15 -07:00
case MENUITEM_SCRIPT :
item - > action . script = STRDUP ( action ) ;
break ;
1999-08-17 18:12:47 -07:00
case MENUITEM_STRING :
case MENUITEM_ECHO :
1999-09-16 15:40:44 -07:00
item - > action . string = ( char * ) MALLOC ( strlen ( action ) + 2 ) ;
strcpy ( item - > action . string , action ) ;
1999-08-17 18:12:47 -07:00
parse_escaped_string ( item - > action . string ) ;
break ;
default :
break ;
}
return 1 ;
}
unsigned char
2000-09-01 21:12:16 -07:00
menuitem_set_rtext ( menuitem_t * item , char * rtext )
1999-08-17 18:12:47 -07:00
{
ASSERT_RVAL ( item ! = NULL , 0 ) ;
ASSERT_RVAL ( rtext ! = NULL , 0 ) ;
2000-08-30 22:41:44 -07:00
item - > rtext = STRDUP ( rtext ) ;
1999-08-17 18:12:47 -07:00
item - > rlen = strlen ( rtext ) ;
return 1 ;
}
void
2000-09-01 21:12:16 -07:00
menu_reset ( menu_t * menu )
1999-08-17 18:12:47 -07:00
{
ASSERT ( menu ! = NULL ) ;
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
D_MENU ( ( " menu_reset(menu %8p \" %s \" ), window 0x%08x \n " , menu , menu - > title , menu - > win ) ) ;
1999-10-08 11:49:57 -07:00
if ( ! ( menu - > state & MENU_STATE_IS_MAPPED ) ) {
return ;
1999-08-17 18:12:47 -07:00
}
1999-10-08 11:49:57 -07:00
menu - > state & = ~ ( MENU_STATE_IS_CURRENT | MENU_STATE_IS_DRAGGING | MENU_STATE_IS_MAPPED ) ;
XUnmapWindow ( Xdisplay , menu - > swin ) ;
XUnmapWindow ( Xdisplay , menu - > win ) ;
menuitem_clear_current ( menu ) ;
1999-08-17 18:12:47 -07:00
}
void
2000-09-01 21:12:16 -07:00
menu_reset_all ( menulist_t * list )
1999-08-17 18:12:47 -07:00
{
register unsigned short i ;
ASSERT ( list ! = NULL ) ;
if ( list - > nummenus = = 0 )
return ;
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
D_MENU ( ( " menu_reset_all(%8p) called \n " , list ) ) ;
2000-02-17 21:39:39 -08:00
if ( current_menu & & menuitem_get_current ( current_menu ) ! = NULL ) {
1999-10-08 11:49:57 -07:00
menuitem_deselect ( current_menu ) ;
1999-08-17 18:12:47 -07:00
}
for ( i = 0 ; i < list - > nummenus ; i + + ) {
1999-10-08 11:49:57 -07:00
menu_reset ( list - > menus [ i ] ) ;
1999-08-17 18:12:47 -07:00
}
current_menu = NULL ;
}
void
2000-09-01 21:12:16 -07:00
menu_reset_tree ( menu_t * menu )
1999-08-17 18:12:47 -07:00
{
register unsigned short i ;
register menuitem_t * item ;
ASSERT ( menu ! = NULL ) ;
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
D_MENU ( ( " menu_reset_tree(menu %8p \" %s \" ), window 0x%08x \n " , menu , menu - > title , menu - > win ) ) ;
1999-10-08 11:49:57 -07:00
if ( ! ( menu - > state & MENU_STATE_IS_MAPPED ) ) {
return ;
}
1999-08-17 18:12:47 -07:00
for ( i = 0 ; i < menu - > numitems ; i + + ) {
item = menu - > items [ i ] ;
if ( item - > type = = MENUITEM_SUBMENU & & item - > action . submenu ! = NULL ) {
menu_reset_tree ( item - > action . submenu ) ;
}
}
1999-10-08 11:49:57 -07:00
menu_reset ( menu ) ;
1999-08-17 18:12:47 -07:00
}
void
2000-09-01 21:12:16 -07:00
menu_reset_submenus ( menu_t * menu )
1999-08-17 18:12:47 -07:00
{
register unsigned short i ;
register menuitem_t * item ;
ASSERT ( menu ! = NULL ) ;
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
D_MENU ( ( " menu_reset_submenus(menu %8p \" %s \" ), window 0x%08x \n " , menu , menu - > title , menu - > win ) ) ;
1999-08-17 18:12:47 -07:00
for ( i = 0 ; i < menu - > numitems ; i + + ) {
item = menu - > items [ i ] ;
if ( item - > type = = MENUITEM_SUBMENU & & item - > action . submenu ! = NULL ) {
menu_reset_tree ( item - > action . submenu ) ;
}
}
}
void
2000-09-01 21:12:16 -07:00
menuitem_select ( menu_t * menu )
1999-08-17 18:12:47 -07:00
{
2000-07-15 00:12:09 -07:00
static Pixel top = 0 , bottom = 0 ;
1999-10-08 11:49:57 -07:00
menuitem_t * item ;
1999-08-17 18:12:47 -07:00
ASSERT ( menu ! = NULL ) ;
2000-07-15 00:12:09 -07:00
if ( top = = 0 ) {
top = get_top_shadow_color ( images [ image_submenu ] . selected - > bg , " submenu top shadow color " ) ;
bottom = get_bottom_shadow_color ( images [ image_submenu ] . selected - > bg , " submenu bottom shadow color " ) ;
}
1999-10-08 11:49:57 -07:00
item = menuitem_get_current ( menu ) ;
REQUIRE ( item ! = NULL ) ;
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
D_MENU ( ( " Selecting new current item \" %s \" within menu \" %s \" (window 0x%08x, selection window 0x%08x) \n " , item - > text , menu - > title , menu - > win , menu - > swin ) ) ;
1999-08-17 18:12:47 -07:00
item - > state | = MENU_STATE_IS_CURRENT ;
XMoveWindow ( Xdisplay , menu - > swin , item - > x , item - > y ) ;
XMapWindow ( Xdisplay , menu - > swin ) ;
if ( item - > type = = MENUITEM_SUBMENU ) {
2000-01-11 23:49:02 -08:00
render_simage ( images [ image_submenu ] . selected , menu - > swin , item - > w - MENU_VGAP , item - > h , image_submenu , 0 ) ;
if ( image_mode_is ( image_submenu , MODE_AUTO ) ) {
enl_ipc_sync ( ) ;
2000-01-18 21:18:14 -08:00
} else if ( ! image_mode_is ( image_submenu , MODE_MASK ) ) {
2000-07-15 00:12:09 -07:00
draw_shadow_from_colors ( menu - > swin , top , bottom , 0 , 0 , item - > w - MENU_VGAP , item - > h , 2 ) ;
draw_arrow_from_colors ( menu - > swin , top , bottom , item - > w - 3 * MENU_HGAP , ( item - > h - MENU_VGAP ) / 2 , MENU_VGAP , 2 , DRAW_ARROW_RIGHT ) ;
2000-01-11 23:49:02 -08:00
}
1999-08-17 18:12:47 -07:00
} else {
2000-01-18 21:18:14 -08:00
if ( image_mode_is ( image_menu , MODE_MASK ) ) {
render_simage ( images [ image_menu ] . selected , menu - > swin , item - > w - MENU_VGAP , item - > h , image_menu , 0 ) ;
} else {
2000-07-15 00:12:09 -07:00
draw_shadow_from_colors ( menu - > swin , top , bottom , 0 , 0 , item - > w - MENU_VGAP , item - > h , 2 ) ;
2000-01-18 21:18:14 -08:00
}
1999-10-07 12:47:14 -07:00
if ( image_mode_is ( image_menu , MODE_AUTO ) ) {
enl_ipc_sync ( ) ;
}
1999-08-17 18:12:47 -07:00
}
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
XSetForeground ( Xdisplay , menu - > gc , images [ image_menu ] . selected - > fg ) ;
1999-08-17 18:12:47 -07:00
draw_string ( menu - > swin , menu - > gc , MENU_HGAP , item - > h - MENU_VGAP , item - > text , item - > len ) ;
1999-08-20 13:25:04 -07:00
if ( item - > rtext ) {
draw_string ( menu - > swin , menu - > gc , item - > w - XTextWidth ( menu - > font , item - > rtext , item - > rlen ) - 2 * MENU_HGAP , item - > h - MENU_VGAP , item - > rtext , item - > rlen ) ;
}
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
XSetForeground ( Xdisplay , menu - > gc , images [ image_menu ] . norm - > fg ) ;
1999-08-17 18:12:47 -07:00
}
void
2000-09-01 21:12:16 -07:00
menuitem_deselect ( menu_t * menu )
1999-08-17 18:12:47 -07:00
{
1999-10-08 11:49:57 -07:00
menuitem_t * item ;
1999-08-17 18:12:47 -07:00
ASSERT ( menu ! = NULL ) ;
1999-10-08 11:49:57 -07:00
item = menuitem_get_current ( menu ) ;
REQUIRE ( item ! = NULL ) ;
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
D_MENU ( ( " Deselecting item \" %s \" \n " , item - > text ) ) ;
1999-08-17 18:12:47 -07:00
item - > state & = ~ ( MENU_STATE_IS_CURRENT ) ;
XUnmapWindow ( Xdisplay , menu - > swin ) ;
}
void
2000-09-01 21:12:16 -07:00
menu_display_submenu ( menu_t * menu , menuitem_t * item )
1999-08-17 18:12:47 -07:00
{
menu_t * submenu ;
ASSERT ( menu ! = NULL ) ;
ASSERT ( item ! = NULL ) ;
REQUIRE ( item - > action . submenu ! = NULL ) ;
submenu = item - > action . submenu ;
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
D_MENU ( ( " Displaying submenu \" %s \" (window 0x%08x) of menu \" %s \" (window 0x%08x) \n " , submenu - > title , submenu - > win , menu - > title , menu - > win ) ) ;
1999-08-17 18:12:47 -07:00
menu_invoke ( item - > x + item - > w , item - > y , menu - > win , submenu , CurrentTime ) ;
/* Invoking the submenu makes it current. Undo that behavior. */
ungrab_pointer ( ) ;
grab_pointer ( menu - > win ) ;
current_menu - > state & = ~ ( MENU_STATE_IS_CURRENT ) ;
current_menu = menu ;
menu - > state | = MENU_STATE_IS_CURRENT ;
}
2000-01-11 23:49:02 -08:00
void
menu_move ( menu_t * menu , unsigned short x , unsigned short y ) {
ASSERT ( menu ! = NULL ) ;
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
D_MENU ( ( " Moving menu \" %s \" to %hu, %hu \n " , menu - > title , x , y ) ) ;
2000-01-11 23:49:02 -08:00
menu - > x = x ;
menu - > y = y ;
XMoveWindow ( Xdisplay , menu - > win , menu - > x , menu - > y ) ;
if ( image_mode_is ( image_menu , ( MODE_TRANS | MODE_VIEWPORT ) ) ) {
menu_draw ( menu ) ;
}
}
1999-08-17 18:12:47 -07:00
void
2000-09-01 21:12:16 -07:00
menu_draw ( menu_t * menu )
1999-08-17 18:12:47 -07:00
{
register unsigned short i , len ;
unsigned long width , height ;
#if 0
char * safeaction ;
# endif
unsigned short str_x , str_y ;
XGCValues gcvalue ;
1999-12-29 02:36:38 -08:00
int ascent , descent , direction , dx , dy ;
1999-08-17 18:12:47 -07:00
XCharStruct chars ;
Screen * scr ;
ASSERT ( menu ! = NULL ) ;
scr = ScreenOfDisplay ( Xdisplay , Xscreen ) ;
if ( ! menu - > font ) {
Fri Nov 19 23:05:31 PST 1999 Michael Jennings <mej@eterm.org>
Once again, I've rendered old themes obselete. :-)
I added a new config file attribute and command-line parameter. The
option is --default-font-index, but I wouldn't necessarily use it.
The config file attribute makes more sense. :-)
Anyway, your themes will now need to have a line like this:
font default <index>
in the attributes section. This tells Eterm which font it should use
on startup. (<index> is a number between 0 and the highest-numbered
font you define.) You can now have up to 256 fonts. Font 0 is no
longer necessarily the default font; it is the smallest font. And the
larger the font index, the larger the font should be. (Of course,
this assumes you want Ctrl-> and Ctrl-< to increase/decrease your font
size. In reality, you can have your fonts in any order, and those
keys will cycle through them in order.)
Before, font 0 was always the default, and you didn't have much
freedom in rearranging your fonts. Plus, you were limited to 5. Not
any more. :-) The new system is much more straight-forward, logical,
and powerful.
So please be sure to update your themes by hand, or remove your theme
directory before installing this new version. If your theme lacks
the "font default" line, your Eterms will start with the wrong font.
:-]
SVN revision: 1344
1999-11-19 21:17:29 -08:00
menu_set_font ( menu , etfonts [ def_font_idx ] ) ;
1999-08-17 18:12:47 -07:00
}
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
gcvalue . foreground = images [ image_menu ] . norm - > fg ;
2000-01-10 01:41:12 -08:00
gcvalue . graphics_exposures = False ;
XChangeGC ( Xdisplay , menu - > gc , GCForeground | GCGraphicsExposures , & gcvalue ) ;
1999-08-17 18:12:47 -07:00
if ( ! menu - > w ) {
1999-08-20 13:25:04 -07:00
unsigned short longest ;
1999-08-17 18:12:47 -07:00
len = strlen ( menu - > title ) ;
1999-08-19 16:48:05 -07:00
longest = XTextWidth ( menu - > font , menu - > title , len ) ;
1999-08-17 18:12:47 -07:00
height = menu - > fheight + 3 * MENU_VGAP ;
for ( i = 0 ; i < menu - > numitems ; i + + ) {
unsigned short j = menu - > items [ i ] - > len ;
menuitem_t * item = menu - > items [ i ] ;
1999-08-19 16:48:05 -07:00
width = XTextWidth ( menu - > font , item - > text , j ) ;
1999-08-17 18:12:47 -07:00
if ( item - > rtext ) {
1999-08-20 13:25:04 -07:00
width + = XTextWidth ( menu - > font , item - > rtext , item - > rlen ) + ( 2 * MENU_HGAP ) ;
1999-08-17 18:12:47 -07:00
}
1999-08-20 13:25:04 -07:00
longest = ( longest > width ) ? longest : width ;
1999-08-17 18:12:47 -07:00
height + = ( ( item - > type = = MENUITEM_SEP ) ? ( MENU_VGAP ) : ( menu - > fheight ) ) + MENU_VGAP ;
}
1999-08-19 16:48:05 -07:00
width = longest + ( 4 * MENU_HGAP ) ;
1999-08-17 18:12:47 -07:00
if ( images [ image_submenu ] . selected - > iml - > pad ) {
width + = images [ image_submenu ] . selected - > iml - > pad - > left + images [ image_submenu ] . selected - > iml - > pad - > right ;
}
2000-01-18 21:18:14 -08:00
if ( ! image_mode_is ( image_menu , MODE_MASK ) | | ! image_mode_is ( image_submenu , MODE_MASK ) ) {
width + = 3 * MENU_VGAP ;
}
1999-08-17 18:12:47 -07:00
menu - > w = width ;
menu - > h = height ;
}
1999-12-29 02:36:38 -08:00
/* If the menu will come up offscreen, move all the other menus out of the way. */
dx = scr - > width - menu - > w - menu - > x ;
dy = scr - > height - menu - > h - menu - > y ;
D_MENU ( ( " -> Menu is %hux%hu at %hu, %hu, dx is %d, dy is %d \n " , menu - > w , menu - > h , menu - > x , menu - > y , dx , dy ) ) ;
if ( dx < 0 | | dy < 0 ) {
register short i ;
if ( dx > = 0 ) {
dx = 0 ;
2001-05-09 23:06:08 -07:00
} else if ( menu - > w > scr - > width ) {
dx = - menu - > x ;
menu - > x = 0 ;
1999-12-29 02:36:38 -08:00
} else {
menu - > x = scr - > width - menu - > w ;
}
if ( dy > = 0 ) {
dy = 0 ;
2001-05-09 23:06:08 -07:00
} else if ( menu - > h > scr - > height ) {
dy = - menu - > y ;
menu - > y = 0 ;
1999-12-29 02:36:38 -08:00
} else {
menu - > y = scr - > height - menu - > h ;
}
D_MENU ( ( " -> New x, y is %hu, %hu \n " , menu - > x , menu - > y ) ) ;
for ( i = menu_list - > nummenus - 1 ; i > = 0 ; i - - ) {
menu_t * tmp = menu_list - > menus [ i ] ;
2001-01-10 13:07:11 -08:00
if ( tmp = = menu ) {
continue ;
}
1999-12-29 02:36:38 -08:00
D_MENU ( ( " -> Checking menu \" %s \" to see if it needs to be moved. \n " , tmp - > title ) ) ;
if ( tmp - > state & MENU_STATE_IS_MAPPED ) {
2001-05-09 23:06:08 -07:00
int x = tmp - > x + dx , y = tmp - > y + dy ;
int this_dx , this_dy ;
if ( x < 0 ) {
x = 0 ;
this_dx = - tmp - > x ;
} else {
this_dx = dx ;
}
if ( y < 0 ) {
y = 0 ;
this_dy = - tmp - > y ;
} else {
this_dy = 0 ;
}
D_MENU ( ( " -> Moving menu to %d, %d (a change of %d, %d from %d, %d) \n " , x , y , this_dx , this_dy , tmp - > x , tmp - > y ) ) ;
XWarpPointer ( Xdisplay , tmp - > win , None , 0 , 0 , tmp - > w , tmp - > h , this_dx , this_dy ) ;
menu_move ( tmp , x , y ) ;
1999-12-29 02:36:38 -08:00
}
}
1999-08-17 18:12:47 -07:00
}
2000-01-11 23:49:02 -08:00
XMoveResizeWindow ( Xdisplay , menu - > win , menu - > x , menu - > y , menu - > w , menu - > h ) ;
2000-01-18 20:17:20 -08:00
/* Size and render selected item window */
XResizeWindow ( Xdisplay , menu - > swin , menu - > w - 2 * MENU_HGAP , menu - > fheight + MENU_VGAP ) ;
/* This must come before the rendering of the menu window so that pmap->pixmap is guaranteed to be the menu background. */
render_simage ( images [ image_menu ] . selected , menu - > swin , menu - > w - 2 * MENU_HGAP , menu - > fheight + MENU_VGAP , image_menu , 0 ) ;
if ( image_mode_is ( image_menu , MODE_AUTO ) ) {
enl_ipc_sync ( ) ;
}
XUnmapWindow ( Xdisplay , menu - > swin ) ;
2000-01-11 23:49:02 -08:00
/* Draw menu background */
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
render_simage ( images [ image_menu ] . norm , menu - > win , menu - > w , menu - > h , image_menu , RENDER_FORCE_PIXMAP ) ;
menu - > bg = images [ image_menu ] . norm - > pmap - > pixmap ;
2000-01-18 20:17:20 -08:00
if ( ! image_mode_is ( image_menu , MODE_MASK ) ) {
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
draw_shadow_from_colors ( menu - > bg , PixColors [ menuTopShadowColor ] , PixColors [ menuBottomShadowColor ] , 0 , 0 , menu - > w , menu - > h , 2 ) ;
2000-01-11 23:49:02 -08:00
}
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
D_MENU ( ( " Menu background is 0x%08x \n " , menu - > bg ) ) ;
1999-12-29 02:36:38 -08:00
XMapWindow ( Xdisplay , menu - > win ) ;
2000-01-25 13:26:16 -08:00
XRaiseWindow ( Xdisplay , menu - > win ) ;
1999-08-17 18:12:47 -07:00
str_x = 2 * MENU_HGAP ;
if ( images [ image_menu ] . selected - > iml - > pad ) {
str_x + = images [ image_menu ] . selected - > iml - > pad - > left ;
}
str_y = menu - > fheight + MENU_VGAP ;
len = strlen ( menu - > title ) ;
XTextExtents ( menu - > font , menu - > title , len , & direction , & ascent , & descent , & chars ) ;
1999-12-29 02:36:38 -08:00
draw_string ( menu - > bg , menu - > gc , center_coords ( 2 * MENU_HGAP , menu - > w - 2 * MENU_HGAP ) - ( chars . width > > 1 ) ,
1999-08-17 18:12:47 -07:00
str_y - chars . descent - MENU_VGAP / 2 , menu - > title , len ) ;
1999-12-29 02:36:38 -08:00
draw_shadow ( menu - > bg , topShadowGC , botShadowGC , str_x , str_y - chars . descent - MENU_VGAP / 2 + 1 , menu - > w - ( 4 * MENU_HGAP ) , MENU_VGAP , 2 ) ;
1999-08-17 18:12:47 -07:00
str_y + = MENU_VGAP ;
for ( i = 0 ; i < menu - > numitems ; i + + ) {
menuitem_t * item = menu - > items [ i ] ;
if ( item - > type = = MENUITEM_SEP ) {
str_y + = 2 * MENU_VGAP ;
if ( ! item - > x ) {
item - > x = MENU_HGAP ;
item - > y = str_y - 2 * MENU_VGAP ;
item - > w = menu - > w - MENU_HGAP ;
item - > h = 2 * MENU_VGAP ;
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
D_MENU ( ( " Hot Area at %hu, %hu to %hu, %hu (width %hu, height %hu) \n " , item - > x , item - > y , item - > x + item - > w , item - > y + item - > h , item - > w , item - > h ) ) ;
1999-08-17 18:12:47 -07:00
}
1999-12-29 02:36:38 -08:00
draw_shadow ( menu - > bg , botShadowGC , topShadowGC , str_x , str_y - MENU_VGAP - MENU_VGAP / 2 , menu - > w - 4 * MENU_HGAP , MENU_VGAP , 2 ) ;
1999-08-17 18:12:47 -07:00
} else {
str_y + = menu - > fheight + MENU_VGAP ;
if ( ! item - > x ) {
item - > x = MENU_HGAP ;
item - > y = str_y - menu - > fheight - MENU_VGAP / 2 ;
item - > w = menu - > w - MENU_HGAP ;
item - > h = menu - > fheight + MENU_VGAP ;
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
D_MENU ( ( " Hot Area at %hu, %hu to %hu, %hu (width %hu, height %hu) \n " , item - > x , item - > y , item - > x + item - > w , item - > y + item - > h , item - > w , item - > h ) ) ;
1999-08-17 18:12:47 -07:00
}
switch ( item - > type ) {
case MENUITEM_SUBMENU :
2000-01-18 21:18:14 -08:00
if ( image_mode_is ( image_submenu , MODE_MASK ) ) {
2000-09-17 18:38:22 -07:00
paste_simage ( images [ image_submenu ] . norm , image_submenu , menu - > win , menu - > bg , item - > x , item - > y , item - > w - MENU_VGAP , item - > h ) ;
2000-01-18 21:18:14 -08:00
} else {
draw_arrow_from_colors ( menu - > bg , PixColors [ menuTopShadowColor ] , PixColors [ menuBottomShadowColor ] ,
item - > x + item - > w - 3 * MENU_HGAP , item - > y + ( item - > h - MENU_VGAP ) / 2 , MENU_VGAP , 2 , DRAW_ARROW_RIGHT ) ;
}
1999-08-17 18:12:47 -07:00
break ;
#if 0
1999-12-29 02:36:38 -08:00
case MENUITEM_STRING :
2000-08-30 22:41:44 -07:00
safeaction = STRDUP ( item - > action . string ) ;
safe_str ( safeaction , strlen ( safeaction ) ) ;
1999-08-17 18:12:47 -07:00
D_MENU ( ( " Item %hu: %s (string %s) \n " , i , item - > text , safeaction ) ) ;
FREE ( safeaction ) ;
break ;
case MENUITEM_ECHO :
2000-08-30 22:41:44 -07:00
safeaction = STRDUP ( item - > action . string ) ;
safe_str ( safeaction , strlen ( safeaction ) ) ;
1999-08-17 18:12:47 -07:00
D_MENU ( ( " Item %hu: %s (echo %s) \n " , i , item - > text , safeaction ) ) ;
FREE ( safeaction ) ;
break ;
default :
fatal_error ( " Internal Program Error: Unknown menuitem type: %u \n " , item - > type ) ;
break ;
1999-12-29 02:36:38 -08:00
# endif
2000-01-18 20:17:20 -08:00
default :
break ;
1999-08-17 18:12:47 -07:00
}
1999-12-29 02:36:38 -08:00
draw_string ( menu - > bg , menu - > gc , str_x , str_y - MENU_VGAP / 2 , item - > text , item - > len ) ;
1999-08-20 13:25:04 -07:00
if ( item - > rtext ) {
1999-12-29 02:36:38 -08:00
draw_string ( menu - > bg , menu - > gc , str_x + item - > w - XTextWidth ( menu - > font , item - > rtext , item - > rlen ) - 3 * MENU_HGAP , str_y - MENU_VGAP / 2 ,
1999-08-20 13:25:04 -07:00
item - > rtext , item - > rlen ) ;
}
1999-08-17 18:12:47 -07:00
}
}
1999-12-29 02:36:38 -08:00
XSetWindowBackgroundPixmap ( Xdisplay , menu - > win , menu - > bg ) ;
XClearWindow ( Xdisplay , menu - > win ) ;
1999-08-17 18:12:47 -07:00
}
void
2000-09-01 21:12:16 -07:00
menu_display ( int x , int y , menu_t * menu )
1999-08-17 18:12:47 -07:00
{
ASSERT ( menu ! = NULL ) ;
menu - > state | = ( MENU_STATE_IS_CURRENT ) ;
current_menu = menu ;
/* Move, render, and map menu window */
menu - > x = x ;
menu - > y = y ;
D_MENU ( ( " Displaying menu \" %s \" (window 0x%08x) at root coordinates %d, %d \n " , menu - > title , menu - > win , menu - > x , menu - > y ) ) ;
menu_draw ( menu ) ;
1999-12-29 02:36:38 -08:00
menu - > state | = ( MENU_STATE_IS_MAPPED ) ;
1999-08-17 18:12:47 -07:00
/* Take control of the pointer so we get all events for it, even those outside the menu window */
grab_pointer ( menu - > win ) ;
}
void
2000-09-01 21:12:16 -07:00
menu_action ( menuitem_t * item )
1999-08-17 18:12:47 -07:00
{
ASSERT ( item ! = NULL ) ;
D_MENU ( ( " menu_action() called to invoke %s \n " , item - > text ) ) ;
switch ( item - > type ) {
case MENUITEM_SEP :
D_MENU ( ( " Internal Program Error: menu_action() called for a separator. \n " ) ) ;
break ;
case MENUITEM_SUBMENU :
D_MENU ( ( " Internal Program Error: menu_action() called for a submenu. \n " ) ) ;
break ;
case MENUITEM_STRING :
1999-10-27 11:10:40 -07:00
cmd_write ( ( unsigned char * ) item - > action . string , strlen ( item - > action . string ) ) ;
1999-08-17 18:12:47 -07:00
break ;
case MENUITEM_ECHO :
1999-10-27 11:10:40 -07:00
tt_write ( ( unsigned char * ) item - > action . string , strlen ( item - > action . string ) ) ;
1999-08-17 18:12:47 -07:00
break ;
2001-05-09 17:20:15 -07:00
case MENUITEM_SCRIPT :
script_parse ( ( char * ) item - > action . script ) ;
break ;
1999-08-17 18:12:47 -07:00
default :
fatal_error ( " Internal Program Error: Unknown menuitem type: %u \n " , item - > type ) ;
break ;
}
}
void
2000-09-01 21:12:16 -07:00
menu_invoke ( int x , int y , Window win , menu_t * menu , Time timestamp )
1999-08-17 18:12:47 -07:00
{
int root_x , root_y ;
Window unused ;
REQUIRE ( menu ! = NULL ) ;
1999-10-28 08:22:58 -07:00
if ( timestamp ! = CurrentTime ) {
button_press_time = timestamp ;
1999-08-17 18:12:47 -07:00
}
if ( win ! = Xroot ) {
XTranslateCoordinates ( Xdisplay , win , Xroot , x , y , & root_x , & root_y , & unused ) ;
}
menu_display ( root_x , root_y , menu ) ;
}
void
1999-10-28 08:22:58 -07:00
menu_invoke_by_title ( int x , int y , Window win , char * title , Time timestamp )
1999-08-17 18:12:47 -07:00
{
menu_t * menu ;
REQUIRE ( title ! = NULL ) ;
REQUIRE ( menu_list ! = NULL ) ;
menu = find_menu_by_title ( menu_list , title ) ;
if ( ! menu ) {
D_MENU ( ( " Menu \" %s \" not found! \n " , title ) ) ;
return ;
}
1999-10-28 08:22:58 -07:00
menu_invoke ( x , y , win , menu , timestamp ) ;
1999-08-17 18:12:47 -07:00
}