moving events into the class fc

This commit is contained in:
Markus Gans 2016-01-17 02:57:08 +01:00
parent 65047855e9
commit b21fe6a405
30 changed files with 361 additions and 324 deletions

View File

@ -1,3 +1,6 @@
2016-01-17 Markus Gans <guru.mail@muenster.de>
* Moving events into the class fc
2016-01-10 Markus Gans <guru.mail@muenster.de> 2016-01-10 Markus Gans <guru.mail@muenster.de>
* Better default color handling in FOptiAttr * Better default color handling in FOptiAttr

View File

@ -151,19 +151,16 @@ Class digramm
┌───────┐ │ : : │ ┌──────────────┐ │ ┌─────────┐1 : ┌───────┐ │ : : │ ┌──────────────┐ │ ┌─────────┐1 :
│ FTerm │◄─┘ : : ├────┤ FProgressbar │ └──┤ FSwitch ├-------: │ FTerm │◄─┘ : : ├────┤ FProgressbar │ └──┤ FSwitch ├-------:
└┬─┬─┬──┘ : : │ └──────────────┘ └─────────┘ : └┬─┬─┬──┘ : : │ └──────────────┘ └─────────┘ :
: :1:1 : : │ ┌────────────┐ : *┌─────────┐ :1:1:1 : : │ ┌────────────┐ : *┌─────────┐
: : └----------: : ├────┤ FScrollbar │ ├---┤ FString │ : : └----------: : ├────┤ FScrollbar │ ├---┤ FString │
: :1 : : │ └────────────┘ : └─────────┘ : :1 : : │ └────────────┘ : └─────────┘
:┌┴──────────┐ : : │ ┌───────────┐1 : :┌┴──────────┐ : : │ ┌───────────┐1 :
:│ FOptiAttr │ : : ├────┤ FTextView ├---------------------------: :│ FOptiAttr │ : : ├────┤ FTextView ├---------------------------:
:└───────────┘ : : │ └───────────┘ : :└───────────┘ : : │ └───────────┘ :
┌┴──────────┐ : : │ ┌──────────┐1 *┌──────────────┐1 : :1 : : │ ┌──────────┐1 *┌──────────────┐1 :
│ FOptiMove │ : : ├────┤ FListBox ├-------┤ FListBoxItem ├-----: ┌┴──────────┐ : : ├────┤ FListBox ├-------┤ FListBoxItem ├-----:
└───────────┘ : : │ └──────────┘ └──────────────┘ : │ FOptiMove │ : : │ └──────────┘ └──────────────┘ :
: : │ ┌──────────┐1 *┌──────────────┐1 : └───────────┘ : : │ ┌────────────┐1 *┌────────────┐1 :
: : ├────┤ FListBox ├-------┤ FListBoxItem ├-----:
: : │ └──────────┘ └──────────────┘ :
: : │ ┌────────────┐1 *┌────────────┐1 :
: : ├────┤ FStatusBar ├-----┤ FStatusKey ├-------: : : ├────┤ FStatusBar ├-----┤ FStatusKey ├-------:
: : │ └────┬───────┘ └────────────┘ : : : │ └────┬───────┘ └────────────┘ :
: : │ 1└----------------------------------: : : │ 1└----------------------------------:

View File

@ -54,16 +54,16 @@
┌───────┐ │ : : │ ┌──────────────┐ │ ┌─────────┐1 : ┌───────┐ │ : : │ ┌──────────────┐ │ ┌─────────┐1 :
│ FTerm │◄─┘ : : ├────┤ FProgressbar │ └──┤ FSwitch ├-------: │ FTerm │◄─┘ : : ├────┤ FProgressbar │ └──┤ FSwitch ├-------:
└┬─┬─┬──┘ : : │ └──────────────┘ └─────────┘ : └┬─┬─┬──┘ : : │ └──────────────┘ └─────────┘ :
: :1:1 : : │ ┌────────────┐ : *┌─────────┐ :1:1:1 : : │ ┌────────────┐ : *┌─────────┐
: : └----------: : ├────┤ FScrollbar │ ├---┤ FString │ : : └----------: : ├────┤ FScrollbar │ ├---┤ FString │
: :1 : : │ └────────────┘ : └─────────┘ : :1 : : │ └────────────┘ : └─────────┘
:┌┴──────────┐ : : │ ┌───────────┐1 : :┌┴──────────┐ : : │ ┌───────────┐1 :
:│ FOptiAttr │ : : ├────┤ FTextView ├---------------------------: :│ FOptiAttr │ : : ├────┤ FTextView ├---------------------------:
:└───────────┘ : : │ └───────────┘ : :└───────────┘ : : │ └───────────┘ :
┌┴──────────┐ : : │ ┌──────────┐1 *┌──────────────┐1 : :1 : : │ ┌──────────┐1 *┌──────────────┐1 :
│ FOptiMove │ : : ├────┤ FListBox ├-------┤ FListBoxItem ├-----: ┌┴──────────┐ : : ├────┤ FListBox ├-------┤ FListBoxItem ├-----:
└───────────┘ : : │ └──────────┘ └──────────────┘ : │ FOptiMove │ : : │ └──────────┘ └──────────────┘ :
: : │ ┌────────────┐1 *┌────────────┐1 : └───────────┘ : : │ ┌────────────┐1 *┌────────────┐1 :
: : ├────┤ FStatusBar ├-----┤ FStatusKey ├-------: : : ├────┤ FStatusBar ├-----┤ FStatusKey ├-------:
: : │ └────┬───────┘ └────────────┘ : : : │ └────┬───────┘ └────────────┘ :
: : │ 1└----------------------------------: : : │ 1└----------------------------------:

View File

@ -357,11 +357,11 @@ void FApplication::processKeyboardEvent()
else else
{ {
// send key down event // send key down event
FKeyEvent k_down_ev (KeyDown_Event, key); FKeyEvent k_down_ev (fc::KeyDown_Event, key);
sendEvent (widget, &k_down_ev); sendEvent (widget, &k_down_ev);
// send key press event // send key press event
FKeyEvent k_press_ev (KeyPress_Event, key); FKeyEvent k_press_ev (fc::KeyPress_Event, key);
sendEvent (widget, &k_press_ev); sendEvent (widget, &k_press_ev);
if ( ! open_menu if ( ! open_menu
@ -386,7 +386,7 @@ void FApplication::processKeyboardEvent()
break; break;
if ( iter->key == key ) if ( iter->key == key )
{ {
FAccelEvent a_ev (Accelerator_Event, focus_widget); FAccelEvent a_ev (fc::Accelerator_Event, focus_widget);
sendEvent (iter->object, &a_ev); sendEvent (iter->object, &a_ev);
break; break;
}; };
@ -399,7 +399,7 @@ void FApplication::processKeyboardEvent()
fifo_offset = int(strlen(fifo_buf)); fifo_offset = int(strlen(fifo_buf));
} }
// send key up event // send key up event
FKeyEvent k_up_ev (KeyUp_Event, key); FKeyEvent k_up_ev (fc::KeyUp_Event, key);
sendEvent (widget, &k_up_ev); sendEvent (widget, &k_up_ev);
key = 0; key = 0;
} }
@ -412,7 +412,7 @@ void FApplication::processKeyboardEvent()
&& fifo_buf[1] == 0x00 && fifo_buf[1] == 0x00
&& isKeyTimeout(&time_keypressed, key_timeout) ) && isKeyTimeout(&time_keypressed, key_timeout) )
{ {
FKeyEvent k_press_ev (KeyPress_Event, fc::Fkey_escape); FKeyEvent k_press_ev (fc::KeyPress_Event, fc::Fkey_escape);
sendEvent (widget, &k_press_ev); sendEvent (widget, &k_press_ev);
input_data_pending = false; input_data_pending = false;
} }
@ -1020,11 +1020,11 @@ void FApplication::processMouseEvent()
int key_state = 0; int key_state = 0;
if ( b_state.shift_button == Pressed ) if ( b_state.shift_button == Pressed )
key_state |= ShiftButton; key_state |= fc::ShiftButton;
if ( b_state.meta_button == Pressed ) if ( b_state.meta_button == Pressed )
key_state |= MetaButton; key_state |= fc::MetaButton;
if ( b_state.control_button == Pressed ) if ( b_state.control_button == Pressed )
key_state |= ControlButton; key_state |= fc::ControlButton;
localMousePos = clicked_widget->globalToLocalPos(*mouse); localMousePos = clicked_widget->globalToLocalPos(*mouse);
@ -1032,26 +1032,26 @@ void FApplication::processMouseEvent()
{ {
if ( b_state.left_button == Pressed ) if ( b_state.left_button == Pressed )
{ {
FMouseEvent m_down_ev ( MouseMove_Event FMouseEvent m_down_ev ( fc::MouseMove_Event
, localMousePos , localMousePos
, *mouse , *mouse
, LeftButton | key_state ); , fc::LeftButton | key_state );
sendEvent (clicked_widget, &m_down_ev); sendEvent (clicked_widget, &m_down_ev);
} }
if ( b_state.right_button == Pressed ) if ( b_state.right_button == Pressed )
{ {
FMouseEvent m_down_ev ( MouseMove_Event FMouseEvent m_down_ev ( fc::MouseMove_Event
, localMousePos , localMousePos
, *mouse , *mouse
, RightButton | key_state ); , fc::RightButton | key_state );
sendEvent (clicked_widget, &m_down_ev); sendEvent (clicked_widget, &m_down_ev);
} }
if ( b_state.middle_button == Pressed ) if ( b_state.middle_button == Pressed )
{ {
FMouseEvent m_down_ev ( MouseMove_Event FMouseEvent m_down_ev ( fc::MouseMove_Event
, localMousePos , localMousePos
, *mouse , *mouse
, MiddleButton | key_state ); , fc::MiddleButton | key_state );
sendEvent (clicked_widget, &m_down_ev); sendEvent (clicked_widget, &m_down_ev);
} }
} }
@ -1059,26 +1059,26 @@ void FApplication::processMouseEvent()
{ {
if ( b_state.left_button == DoubleClick ) if ( b_state.left_button == DoubleClick )
{ {
FMouseEvent m_dblclick_ev ( MouseDoubleClick_Event FMouseEvent m_dblclick_ev ( fc::MouseDoubleClick_Event
, localMousePos , localMousePos
, *mouse , *mouse
, LeftButton | key_state ); , fc::LeftButton | key_state );
sendEvent (clicked_widget, &m_dblclick_ev); sendEvent (clicked_widget, &m_dblclick_ev);
} }
else if ( b_state.left_button == Pressed ) else if ( b_state.left_button == Pressed )
{ {
FMouseEvent m_down_ev ( MouseDown_Event FMouseEvent m_down_ev ( fc::MouseDown_Event
, localMousePos , localMousePos
, *mouse , *mouse
, LeftButton | key_state ); , fc::LeftButton | key_state );
sendEvent (clicked_widget, &m_down_ev); sendEvent (clicked_widget, &m_down_ev);
} }
else if ( b_state.left_button == Released ) else if ( b_state.left_button == Released )
{ {
FMouseEvent m_up_ev ( MouseUp_Event FMouseEvent m_up_ev ( fc::MouseUp_Event
, localMousePos , localMousePos
, *mouse , *mouse
, LeftButton | key_state ); , fc::LeftButton | key_state );
FWidget* released_widget = clicked_widget; FWidget* released_widget = clicked_widget;
if ( b_state.right_button != Pressed if ( b_state.right_button != Pressed
&& b_state.middle_button != Pressed ) && b_state.middle_button != Pressed )
@ -1088,18 +1088,18 @@ void FApplication::processMouseEvent()
if ( b_state.right_button == Pressed ) if ( b_state.right_button == Pressed )
{ {
FMouseEvent m_down_ev ( MouseDown_Event FMouseEvent m_down_ev ( fc::MouseDown_Event
, localMousePos , localMousePos
, *mouse , *mouse
, RightButton | key_state ); , fc::RightButton | key_state );
sendEvent (clicked_widget, &m_down_ev); sendEvent (clicked_widget, &m_down_ev);
} }
else if ( b_state.right_button == Released ) else if ( b_state.right_button == Released )
{ {
FMouseEvent m_up_ev ( MouseUp_Event FMouseEvent m_up_ev ( fc::MouseUp_Event
, localMousePos , localMousePos
, *mouse , *mouse
, RightButton | key_state ); , fc::RightButton | key_state );
FWidget* released_widget = clicked_widget; FWidget* released_widget = clicked_widget;
if ( b_state.left_button != Pressed if ( b_state.left_button != Pressed
&& b_state.middle_button != Pressed ) && b_state.middle_button != Pressed )
@ -1109,10 +1109,10 @@ void FApplication::processMouseEvent()
if ( b_state.middle_button == Pressed ) if ( b_state.middle_button == Pressed )
{ {
FMouseEvent m_down_ev ( MouseDown_Event FMouseEvent m_down_ev ( fc::MouseDown_Event
, localMousePos , localMousePos
, *mouse , *mouse
, MiddleButton | key_state ); , fc::MiddleButton | key_state );
sendEvent (clicked_widget, &m_down_ev); sendEvent (clicked_widget, &m_down_ev);
// gnome-terminal sends no released on middle click // gnome-terminal sends no released on middle click
if ( gnome_terminal ) if ( gnome_terminal )
@ -1120,10 +1120,10 @@ void FApplication::processMouseEvent()
} }
else if ( b_state.middle_button == Released ) else if ( b_state.middle_button == Released )
{ {
FMouseEvent m_up_ev ( MouseUp_Event FMouseEvent m_up_ev ( fc::MouseUp_Event
, localMousePos , localMousePos
, *mouse , *mouse
, MiddleButton | key_state ); , fc::MiddleButton | key_state );
FWidget* released_widget = clicked_widget; FWidget* released_widget = clicked_widget;
if ( b_state.right_button != Pressed if ( b_state.right_button != Pressed
&& b_state.left_button != Pressed ) && b_state.left_button != Pressed )
@ -1131,22 +1131,24 @@ void FApplication::processMouseEvent()
sendEvent (released_widget, &m_up_ev); sendEvent (released_widget, &m_up_ev);
} }
} }
if ( b_state.wheel_up == Pressed ) if ( b_state.wheel_up == Pressed )
{ {
FWheelEvent wheel_ev ( MouseWheel_Event FWheelEvent wheel_ev ( fc::MouseWheel_Event
, localMousePos , localMousePos
, *mouse , *mouse
, WheelUp ); , fc::WheelUp );
FWidget* scroll_over_widget = clicked_widget; FWidget* scroll_over_widget = clicked_widget;
clicked_widget = 0; clicked_widget = 0;
sendEvent(scroll_over_widget, &wheel_ev); sendEvent(scroll_over_widget, &wheel_ev);
} }
if ( b_state.wheel_down == Pressed ) if ( b_state.wheel_down == Pressed )
{ {
FWheelEvent wheel_ev ( MouseWheel_Event FWheelEvent wheel_ev ( fc::MouseWheel_Event
, localMousePos , localMousePos
, *mouse , *mouse
, WheelDown ); , fc::WheelDown );
FWidget* scroll_over_widget = clicked_widget; FWidget* scroll_over_widget = clicked_widget;
clicked_widget = 0; clicked_widget = 0;
sendEvent (scroll_over_widget, &wheel_ev); sendEvent (scroll_over_widget, &wheel_ev);
@ -1164,7 +1166,7 @@ void FApplication::processResizeEvent()
{ {
if ( resize_term ) if ( resize_term )
{ {
FResizeEvent r_ev(Resize_Event); FResizeEvent r_ev(fc::Resize_Event);
sendEvent(rootObj, &r_ev); sendEvent(rootObj, &r_ev);
if ( r_ev.isAccepted() ) if ( r_ev.isAccepted() )
@ -1207,7 +1209,7 @@ int FApplication::processTimerEvent()
if ( (*iter).interval.tv_usec > 0 || (*iter).interval.tv_sec > 0 ) if ( (*iter).interval.tv_usec > 0 || (*iter).interval.tv_sec > 0 )
activated++; activated++;
FTimerEvent t_ev(Timer_Event, (*iter).id); FTimerEvent t_ev(fc::Timer_Event, (*iter).id);
sendEvent((*iter).object, &t_ev); sendEvent((*iter).object, &t_ev);
++iter; ++iter;
@ -1381,17 +1383,17 @@ bool FApplication::sendEvent(FObject* receiver, FEvent* event)
{ {
switch ( event->type() ) switch ( event->type() )
{ {
case KeyPress_Event: case fc::KeyPress_Event:
case KeyUp_Event: case fc::KeyUp_Event:
case KeyDown_Event: case fc::KeyDown_Event:
case MouseDown_Event: case fc::MouseDown_Event:
case MouseUp_Event: case fc::MouseUp_Event:
case MouseDoubleClick_Event: case fc::MouseDoubleClick_Event:
case MouseWheel_Event: case fc::MouseWheel_Event:
case MouseMove_Event: case fc::MouseMove_Event:
case FocusIn_Event: case fc::FocusIn_Event:
case FocusOut_Event: case fc::FocusOut_Event:
case Accelerator_Event: case fc::Accelerator_Event:
return false; return false;
default: default:
@ -1401,8 +1403,8 @@ bool FApplication::sendEvent(FObject* receiver, FEvent* event)
} }
// throw away mouse events to disabled widgets // throw away mouse events to disabled widgets
if ( event->type() >= MouseDown_Event if ( event->type() >= fc::MouseDown_Event
&& event->type() <= MouseMove_Event && event->type() <= fc::MouseMove_Event
&& ! widget->isEnabled() ) && ! widget->isEnabled() )
return false; return false;

View File

@ -604,7 +604,7 @@ void FButton::onKeyPress (FKeyEvent* ev)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FButton::onMouseDown (FMouseEvent* ev) void FButton::onMouseDown (FMouseEvent* ev)
{ {
if ( ev->getButton() != LeftButton ) if ( ev->getButton() != fc::LeftButton )
{ {
setUp(); setUp();
return; return;
@ -613,7 +613,7 @@ void FButton::onMouseDown (FMouseEvent* ev)
if ( ! hasFocus() ) if ( ! hasFocus() )
{ {
FWidget* focused_widget = getFocusWidget(); FWidget* focused_widget = getFocusWidget();
FFocusEvent out (FocusOut_Event); FFocusEvent out (fc::FocusOut_Event);
FApplication::queueEvent(focused_widget, &out); FApplication::queueEvent(focused_widget, &out);
setFocus(); setFocus();
if ( focused_widget ) if ( focused_widget )
@ -629,7 +629,7 @@ void FButton::onMouseDown (FMouseEvent* ev)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FButton::onMouseUp (FMouseEvent* ev) void FButton::onMouseUp (FMouseEvent* ev)
{ {
if ( ev->getButton() != LeftButton ) if ( ev->getButton() != fc::LeftButton )
return; return;
if ( button_down ) if ( button_down )
@ -643,7 +643,7 @@ void FButton::onMouseUp (FMouseEvent* ev)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FButton::onMouseMove (FMouseEvent* ev) void FButton::onMouseMove (FMouseEvent* ev)
{ {
if ( ev->getButton() != LeftButton ) if ( ev->getButton() != fc::LeftButton )
return; return;
FPoint gPos = ev->getGlobalPos(); FPoint gPos = ev->getGlobalPos();
@ -671,7 +671,7 @@ void FButton::onAccel (FAccelEvent* ev)
if ( ! hasFocus() ) if ( ! hasFocus() )
{ {
FWidget* focused_widget = static_cast<FWidget*>(ev->focusedWidget()); FWidget* focused_widget = static_cast<FWidget*>(ev->focusedWidget());
FFocusEvent out (FocusOut_Event); FFocusEvent out (fc::FocusOut_Event);
FApplication::queueEvent(focused_widget, &out); FApplication::queueEvent(focused_widget, &out);
setFocus(); setFocus();
if ( focused_widget ) if ( focused_widget )

View File

@ -96,7 +96,7 @@ void FButtonGroup::directFocus()
{ {
found_checked = true; found_checked = true;
FWidget* focused_widget = getFocusWidget(); FWidget* focused_widget = getFocusWidget();
FFocusEvent out (FocusOut_Event); FFocusEvent out (fc::FocusOut_Event);
FApplication::queueEvent(focused_widget, &out); FApplication::queueEvent(focused_widget, &out);
(*iter)->setFocus(); (*iter)->setFocus();
if ( focused_widget ) if ( focused_widget )
@ -112,7 +112,7 @@ void FButtonGroup::directFocus()
if ( ! found_checked ) if ( ! found_checked )
{ {
FWidget* focused_widget = getFocusWidget(); FWidget* focused_widget = getFocusWidget();
FFocusEvent out (FocusOut_Event); FFocusEvent out (fc::FocusOut_Event);
FApplication::queueEvent(focused_widget, &out); FApplication::queueEvent(focused_widget, &out);
focusFirstChild(); focusFirstChild();
if ( focused_widget ) if ( focused_widget )
@ -448,7 +448,7 @@ bool FButtonGroup::hasCheckedButton()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FButtonGroup::onMouseDown (FMouseEvent* ev) void FButtonGroup::onMouseDown (FMouseEvent* ev)
{ {
if ( ev->getButton() != LeftButton ) if ( ev->getButton() != fc::LeftButton )
return; return;
directFocus(); directFocus();
} }
@ -487,7 +487,7 @@ void FButtonGroup::onFocusIn (FFocusEvent* in_ev)
} }
if ( in_ev->isAccepted() ) if ( in_ev->isAccepted() )
{ {
if ( in_ev->getFocusType() == FocusNextWidget ) if ( in_ev->getFocusType() == fc::FocusNextWidget )
{ {
in_ev->ignore(); in_ev->ignore();
FWidget* prev_element = getFocusWidget(); FWidget* prev_element = getFocusWidget();
@ -495,7 +495,7 @@ void FButtonGroup::onFocusIn (FFocusEvent* in_ev)
prev_element->redraw(); prev_element->redraw();
getFocusWidget()->redraw(); getFocusWidget()->redraw();
} }
else if ( in_ev->getFocusType() == FocusPreviousWidget ) else if ( in_ev->getFocusType() == fc::FocusPreviousWidget )
{ {
in_ev->ignore(); in_ev->ignore();
FWidget* prev_element = getFocusWidget(); FWidget* prev_element = getFocusWidget();

View File

@ -448,7 +448,7 @@ void FDialog::onMouseDown (FMouseEvent* ev)
int mouse_x = ev->getX(); int mouse_x = ev->getX();
int mouse_y = ev->getY(); int mouse_y = ev->getY();
if ( ev->getButton() == LeftButton ) if ( ev->getButton() == fc::LeftButton )
{ {
// click on titlebar or window: raise + activate // click on titlebar or window: raise + activate
if ( mouse_x >= 4 && mouse_x <= width && mouse_y == 1 ) if ( mouse_x >= 4 && mouse_x <= width && mouse_y == 1 )
@ -477,7 +477,7 @@ void FDialog::onMouseDown (FMouseEvent* ev)
redraw(); redraw();
} }
if ( ev->getButton() == RightButton ) if ( ev->getButton() == fc::RightButton )
{ {
// click on titlebar: just activate // click on titlebar: just activate
if ( mouse_x >= 4 && mouse_x <= width && mouse_y == 1 ) if ( mouse_x >= 4 && mouse_x <= width && mouse_y == 1 )
@ -500,7 +500,7 @@ void FDialog::onMouseDown (FMouseEvent* ev)
} }
} }
if ( ev->getButton() == MiddleButton ) if ( ev->getButton() == fc::MiddleButton )
{ {
// click on titlebar: lower + activate // click on titlebar: lower + activate
if ( mouse_x >= 4 && mouse_x <= width && mouse_y == 1 ) if ( mouse_x >= 4 && mouse_x <= width && mouse_y == 1 )
@ -535,7 +535,7 @@ void FDialog::onMouseUp (FMouseEvent* ev)
int titlebar_x = TitleBarClickPos.getX(); int titlebar_x = TitleBarClickPos.getX();
int titlebar_y = TitleBarClickPos.getY(); int titlebar_y = TitleBarClickPos.getY();
if ( ev->getButton() == LeftButton ) if ( ev->getButton() == fc::LeftButton )
{ {
if ( ! TitleBarClickPos.isNull() if ( ! TitleBarClickPos.isNull()
&& titlebar_x > xpos+xmin+2 && titlebar_x > xpos+xmin+2
@ -553,7 +553,7 @@ void FDialog::onMouseUp (FMouseEvent* ev)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FDialog::onMouseMove (FMouseEvent* ev) void FDialog::onMouseMove (FMouseEvent* ev)
{ {
if ( ev->getButton() == LeftButton ) if ( ev->getButton() == fc::LeftButton )
{ {
if ( ! TitleBarClickPos.isNull() ) if ( ! TitleBarClickPos.isNull() )
{ {
@ -570,7 +570,7 @@ void FDialog::onMouseDoubleClick (FMouseEvent* ev)
{ {
int x, y; int x, y;
if ( ev->getButton() != LeftButton ) if ( ev->getButton() != fc::LeftButton )
return; return;
x = xpos + xmin - 1; x = xpos + xmin - 1;

View File

@ -22,6 +22,31 @@
class fc class fc
{ {
public: public:
// event types
enum events
{
None_Event, // invalid event
KeyPress_Event, // key pressed
KeyUp_Event, // key released
KeyDown_Event, // key pressed
MouseDown_Event, // mouse button pressed
MouseUp_Event, // mouse button released
MouseDoubleClick_Event, // mouse button double click
MouseWheel_Event, // mouse wheel rolled
MouseMove_Event, // mouse move
FocusIn_Event, // focus in
FocusOut_Event, // focus out
WindowActive_Event, // activate window
WindowInactive_Event, // deactivate window
WindowRaised_Event, // raise window
WindowLowered_Event, // lower window
Accelerator_Event, // keyboard accelerator
Resize_Event, // terminal resize
Show_Event, // widget is shown
Hide_Event, // widget is hidden
Close_Event, // widget close
Timer_Event // timer event occur
};
// internal character encoding // internal character encoding
enum encoding enum encoding
@ -830,6 +855,37 @@ class fc
Grey93 = 255 // #eeeeee Grey93 = 255 // #eeeeee
}; };
// mouse/keyboard state values
enum ButtonState
{
NoButton = 0x00,
LeftButton = 0x01,
RightButton = 0x02,
MiddleButton = 0x04,
MouseButtonMask = 0x07,
ShiftButton = 0x08,
ControlButton = 0x10,
MetaButton = 0x20,
KeyButtonMask = 0x38
};
// wheel state values
enum WheelState
{
NoWheel = 0x00,
WheelUp = 0x01,
WheelDown = 0x02,
WheelMask = 0x03
};
// type of focus
enum FocusTypes
{
FocusNextWidget = 0x00,
FocusPreviousWidget = 0x01,
FocusDefiniteWidget = 0x03
};
// xterm cursor style // xterm cursor style
enum xterm_cursor_style enum xterm_cursor_style
{ {

View File

@ -175,7 +175,7 @@ int FWheelEvent::getWheel() const
FFocusEvent::FFocusEvent (int ev_type) // constructor FFocusEvent::FFocusEvent (int ev_type) // constructor
: FEvent(ev_type) : FEvent(ev_type)
, accpt(true) , accpt(true)
, focus_type(FocusDefiniteWidget) , focus_type(fc::FocusDefiniteWidget)
{ } { }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -185,21 +185,21 @@ FFocusEvent::~FFocusEvent() // destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FFocusEvent::gotFocus() const bool FFocusEvent::gotFocus() const
{ {
return (type() == FocusIn_Event); return (type() == fc::FocusIn_Event);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FFocusEvent::lostFocus() const bool FFocusEvent::lostFocus() const
{ {
return (type() == FocusOut_Event); return (type() == fc::FocusOut_Event);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FocusTypes FFocusEvent::getFocusType() const fc::FocusTypes FFocusEvent::getFocusType() const
{ return focus_type; } { return focus_type; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FFocusEvent::setFocusType(FocusTypes ft) void FFocusEvent::setFocusType(fc::FocusTypes ft)
{ focus_type = ft; } { focus_type = ft; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -53,32 +53,10 @@
#ifndef _FEVENT_H #ifndef _FEVENT_H
#define _FEVENT_H #define _FEVENT_H
#include "fenum.h"
#include "fpoint.h" #include "fpoint.h"
#define None_Event 0 // invalid event
#define KeyPress_Event 1 // key pressed
#define KeyUp_Event 2 // key released
#define KeyDown_Event 3 // key pressed
#define MouseDown_Event 4 // mouse button pressed
#define MouseUp_Event 5 // mouse button released
#define MouseDoubleClick_Event 6 // mouse button double click
#define MouseWheel_Event 7 // mouse wheel rolled
#define MouseMove_Event 8 // mouse move
#define FocusIn_Event 9 // focus in
#define FocusOut_Event 10 // focus out
#define WindowActive_Event 11 // activate window
#define WindowInactive_Event 12 // deactivate window
#define WindowRaised_Event 13 // raise window
#define WindowLowered_Event 14 // lower window
#define Accelerator_Event 15 // keyboard accelerator
#define Resize_Event 16 // terminal resize
#define Show_Event 17 // widget is shown
#define Hide_Event 18 // widget is hidden
#define Close_Event 19 // widget close
#define Timer_Event 20 // timer event occur
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// class FEvent // class FEvent
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -130,19 +108,6 @@ class FKeyEvent : public FEvent // keyboard event
// class FMouseEvent // class FMouseEvent
//---------------------------------------------------------------------- //----------------------------------------------------------------------
enum ButtonState // mouse/keyboard state values
{
NoButton = 0x00,
LeftButton = 0x01,
RightButton = 0x02,
MiddleButton = 0x04,
MouseButtonMask = 0x07,
ShiftButton = 0x08,
ControlButton = 0x10,
MetaButton = 0x20,
KeyButtonMask = 0x38
};
#pragma pack(push) #pragma pack(push)
#pragma pack(1) #pragma pack(1)
@ -174,14 +139,6 @@ class FMouseEvent : public FEvent // mouse event
// class FWheelEvent // class FWheelEvent
//---------------------------------------------------------------------- //----------------------------------------------------------------------
enum WheelState // wheel state values
{
NoWheel = 0x00,
WheelUp = 0x01,
WheelDown = 0x02,
WheelMask = 0x03
};
#pragma pack(push) #pragma pack(push)
#pragma pack(1) #pragma pack(1)
@ -213,13 +170,6 @@ class FWheelEvent : public FEvent // wheel event
// class FFocusEvent // class FFocusEvent
//---------------------------------------------------------------------- //----------------------------------------------------------------------
enum FocusTypes
{
FocusNextWidget = 0x00,
FocusPreviousWidget = 0x01,
FocusDefiniteWidget = 0x03
};
#pragma pack(push) #pragma pack(push)
#pragma pack(1) #pragma pack(1)
@ -231,14 +181,14 @@ class FFocusEvent : public FEvent // focus event
bool gotFocus() const; bool gotFocus() const;
bool lostFocus() const; bool lostFocus() const;
FocusTypes getFocusType() const; fc::FocusTypes getFocusType() const;
void setFocusType(FocusTypes); void setFocusType(fc::FocusTypes);
bool isAccepted() const; bool isAccepted() const;
void accept(); void accept();
void ignore(); void ignore();
protected: protected:
bool accpt; bool accpt;
FocusTypes focus_type; fc::FocusTypes focus_type;
}; };
#pragma pack(pop) #pragma pack(pop)

View File

@ -17,10 +17,10 @@ FLabel::FLabel(FWidget* parent)
, multiline_text() , multiline_text()
, multiline(false) , multiline(false)
, text() , text()
, emphasis(0)
, alignment(fc::alignLeft) , alignment(fc::alignLeft)
, emphasis_color(wc.label_emphasis_fg) , emphasis_color(wc.label_emphasis_fg)
, ellipsis_color(wc.label_ellipsis_fg) , ellipsis_color(wc.label_ellipsis_fg)
, emphasis(false)
, reverse_mode(false) , reverse_mode(false)
, accel_widget(0) , accel_widget(0)
{ {
@ -33,10 +33,10 @@ FLabel::FLabel (const FString& txt, FWidget* parent)
, multiline_text() , multiline_text()
, multiline(false) , multiline(false)
, text(txt) , text(txt)
, emphasis(0)
, alignment(fc::alignLeft) , alignment(fc::alignLeft)
, emphasis_color(wc.label_emphasis_fg) , emphasis_color(wc.label_emphasis_fg)
, ellipsis_color(wc.label_ellipsis_fg) , ellipsis_color(wc.label_ellipsis_fg)
, emphasis(false)
, reverse_mode(false) , reverse_mode(false)
, accel_widget(0) , accel_widget(0)
{ {
@ -335,7 +335,7 @@ void FLabel::hide()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FLabel::onMouseDown (FMouseEvent* ev) void FLabel::onMouseDown (FMouseEvent* ev)
{ {
if ( ev->getButton() != LeftButton ) if ( ev->getButton() != fc::LeftButton )
return; return;
if ( ! isEnabled() || ! accel_widget ) if ( ! isEnabled() || ! accel_widget )
@ -344,7 +344,7 @@ void FLabel::onMouseDown (FMouseEvent* ev)
if ( ! accel_widget->hasFocus() ) if ( ! accel_widget->hasFocus() )
{ {
FWidget* focused_widget = getFocusWidget(); FWidget* focused_widget = getFocusWidget();
FFocusEvent out (FocusOut_Event); FFocusEvent out (fc::FocusOut_Event);
FApplication::queueEvent(focused_widget, &out); FApplication::queueEvent(focused_widget, &out);
accel_widget->setFocus(); accel_widget->setFocus();
if ( focused_widget ) if ( focused_widget )
@ -368,7 +368,7 @@ void FLabel::onAccel (FAccelEvent* ev)
if ( ! accel_widget->hasFocus() ) if ( ! accel_widget->hasFocus() )
{ {
FWidget* focused_widget = static_cast<FWidget*>(ev->focusedWidget()); FWidget* focused_widget = static_cast<FWidget*>(ev->focusedWidget());
FFocusEvent out (FocusOut_Event); FFocusEvent out (fc::FocusOut_Event);
FApplication::queueEvent(focused_widget, &out); FApplication::queueEvent(focused_widget, &out);
accel_widget->setFocus(); accel_widget->setFocus();
if ( focused_widget ) if ( focused_widget )
@ -418,10 +418,8 @@ void FLabel::setAlignment (uInt align)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FLabel::setEmphasis (bool on) bool FLabel::setEmphasis (bool on)
{ {
if ( on ) if ( emphasis != on )
emphasis |= EMPHASIS; emphasis = on;
else
emphasis &= ~EMPHASIS;
return on; return on;
} }

View File

@ -26,10 +26,6 @@
#include "fwidget.h" #include "fwidget.h"
#define NO_EMPHASIS 0x00000000
#define EMPHASIS 0x00000001
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// class FLabel // class FLabel
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -43,10 +39,10 @@ class FLabel : public FWidget
std::vector<FString> multiline_text; std::vector<FString> multiline_text;
bool multiline; bool multiline;
FString text; FString text;
int emphasis;
uInt alignment; uInt alignment;
short emphasis_color; short emphasis_color;
short ellipsis_color; short ellipsis_color;
bool emphasis;
bool reverse_mode; bool reverse_mode;
FWidget* accel_widget; FWidget* accel_widget;
@ -116,7 +112,7 @@ inline bool FLabel::unsetEmphasis()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FLabel::hasEmphasis() inline bool FLabel::hasEmphasis()
{ return ((emphasis & EMPHASIS) != 0); } { return emphasis; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FLabel::setReverseMode() inline bool FLabel::setReverseMode()

View File

@ -541,13 +541,13 @@ void FLineEdit::onMouseDown (FMouseEvent* ev)
{ {
int mouse_x, mouse_y; int mouse_x, mouse_y;
if ( ev->getButton() != LeftButton ) if ( ev->getButton() != fc::LeftButton )
return; return;
if ( ! hasFocus() ) if ( ! hasFocus() )
{ {
FWidget* focused_widget = getFocusWidget(); FWidget* focused_widget = getFocusWidget();
FFocusEvent out (FocusOut_Event); FFocusEvent out (fc::FocusOut_Event);
FApplication::queueEvent(focused_widget, &out); FApplication::queueEvent(focused_widget, &out);
setFocus(); setFocus();
if ( focused_widget ) if ( focused_widget )
@ -587,7 +587,7 @@ void FLineEdit::onMouseMove (FMouseEvent* ev)
{ {
int len, mouse_x, mouse_y; int len, mouse_x, mouse_y;
if ( ev->getButton() != LeftButton ) if ( ev->getButton() != fc::LeftButton )
return; return;
len = int(text.getLength()); len = int(text.getLength());
@ -698,7 +698,7 @@ void FLineEdit::onAccel (FAccelEvent* ev)
if ( ! hasFocus() ) if ( ! hasFocus() )
{ {
FWidget* focused_widget = static_cast<FWidget*>(ev->focusedWidget()); FWidget* focused_widget = static_cast<FWidget*>(ev->focusedWidget());
FFocusEvent out (FocusOut_Event); FFocusEvent out (fc::FocusOut_Event);
FApplication::queueEvent(focused_widget, &out); FApplication::queueEvent(focused_widget, &out);
setFocus(); setFocus();
if ( focused_widget ) if ( focused_widget )

View File

@ -906,18 +906,18 @@ void FListBox::onMouseDown (FMouseEvent* ev)
{ {
int yoffset_before, mouse_x, mouse_y; int yoffset_before, mouse_x, mouse_y;
if ( ev->getButton() != LeftButton if ( ev->getButton() != fc::LeftButton
&& ev->getButton() != RightButton ) && ev->getButton() != fc::RightButton )
{ {
return; return;
} }
if ( ev->getButton() == RightButton && ! isMultiSelection() ) if ( ev->getButton() == fc::RightButton && ! isMultiSelection() )
return; return;
if ( ! hasFocus() ) if ( ! hasFocus() )
{ {
FWidget* focused_widget = getFocusWidget(); FWidget* focused_widget = getFocusWidget();
FFocusEvent out (FocusOut_Event); FFocusEvent out (fc::FocusOut_Event);
FApplication::queueEvent(focused_widget, &out); FApplication::queueEvent(focused_widget, &out);
setFocus(); setFocus();
if ( focused_widget ) if ( focused_widget )
@ -936,7 +936,7 @@ void FListBox::onMouseDown (FMouseEvent* ev)
if ( current > int(count()) ) if ( current > int(count()) )
current = int(count()); current = int(count());
inc_search.clear(); inc_search.clear();
if ( ev->getButton() == RightButton ) if ( ev->getButton() == fc::RightButton )
{ {
if ( isMultiSelection() ) if ( isMultiSelection() )
{ {
@ -976,7 +976,7 @@ void FListBox::onMouseUp (FMouseEvent* ev)
scrollTimer = false; scrollTimer = false;
} }
if ( ev->getButton() == LeftButton ) if ( ev->getButton() == fc::LeftButton )
{ {
int mouse_x = ev->getX(); int mouse_x = ev->getX();
int mouse_y = ev->getY(); int mouse_y = ev->getY();
@ -995,12 +995,12 @@ void FListBox::onMouseMove (FMouseEvent* ev)
{ {
int current_before, yoffset_before, mouse_x, mouse_y; int current_before, yoffset_before, mouse_x, mouse_y;
if ( ev->getButton() != LeftButton if ( ev->getButton() != fc::LeftButton
&& ev->getButton() != RightButton ) && ev->getButton() != fc::RightButton )
{ {
return; return;
} }
if ( ev->getButton() == RightButton && ! isMultiSelection() ) if ( ev->getButton() == fc::RightButton && ! isMultiSelection() )
return; return;
current_before = current; current_before = current;
@ -1017,7 +1017,7 @@ void FListBox::onMouseMove (FMouseEvent* ev)
inc_search.clear(); inc_search.clear();
// handle multiple selections // handle multiple selections
if ( ev->getButton() == RightButton if ( ev->getButton() == fc::RightButton
&& isMultiSelection() && isMultiSelection()
&& current_before != current ) && current_before != current )
{ {
@ -1068,7 +1068,7 @@ void FListBox::onMouseMove (FMouseEvent* ev)
{ {
scrollTimer = true; scrollTimer = true;
addTimer(scrollRepeat); addTimer(scrollRepeat);
if ( ev->getButton() == RightButton ) if ( ev->getButton() == fc::RightButton )
dragScroll = FListBox::scrollUpSelect; dragScroll = FListBox::scrollUpSelect;
else else
dragScroll = FListBox::scrollUp; dragScroll = FListBox::scrollUp;
@ -1088,7 +1088,7 @@ void FListBox::onMouseMove (FMouseEvent* ev)
{ {
scrollTimer = true; scrollTimer = true;
addTimer(scrollRepeat); addTimer(scrollRepeat);
if ( ev->getButton() == RightButton ) if ( ev->getButton() == fc::RightButton )
dragScroll = FListBox::scrollDownSelect; dragScroll = FListBox::scrollDownSelect;
else else
dragScroll = FListBox::scrollDown; dragScroll = FListBox::scrollDown;
@ -1114,7 +1114,7 @@ void FListBox::onMouseDoubleClick (FMouseEvent* ev)
{ {
int mouse_x, mouse_y; int mouse_x, mouse_y;
if ( ev->getButton() != LeftButton ) if ( ev->getButton() != fc::LeftButton )
return; return;
mouse_x = ev->getX(); mouse_x = ev->getX();
@ -1245,7 +1245,7 @@ void FListBox::onWheel (FWheelEvent* ev)
switch ( wheel ) switch ( wheel )
{ {
case WheelUp: case fc::WheelUp:
if ( yoffset == 0 ) if ( yoffset == 0 )
break; break;
yoffset -= 4; yoffset -= 4;
@ -1261,7 +1261,7 @@ void FListBox::onWheel (FWheelEvent* ev)
inc_search.clear(); inc_search.clear();
break; break;
case WheelDown: case fc::WheelDown:
if ( yoffset == yoffset_end ) if ( yoffset == yoffset_end )
break; break;
yoffset += 4; yoffset += 4;
@ -1375,14 +1375,14 @@ void FListBox::cb_VBarChange (FWidget*, void*)
case FScrollbar::scrollWheelUp: case FScrollbar::scrollWheelUp:
{ {
FWheelEvent wheel_ev (MouseWheel_Event, FPoint(2,2), WheelUp); FWheelEvent wheel_ev (fc::MouseWheel_Event, FPoint(2,2), fc::WheelUp);
onWheel(&wheel_ev); onWheel(&wheel_ev);
} }
break; break;
case FScrollbar::scrollWheelDown: case FScrollbar::scrollWheelDown:
{ {
FWheelEvent wheel_ev (MouseWheel_Event, FPoint(2,2), WheelDown); FWheelEvent wheel_ev (fc::MouseWheel_Event, FPoint(2,2), fc::WheelDown);
onWheel(&wheel_ev); onWheel(&wheel_ev);
} }
break; break;

View File

@ -961,7 +961,7 @@ void FMenu::onKeyPress (FKeyEvent* ev)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMenu::onMouseDown (FMouseEvent* ev) void FMenu::onMouseDown (FMouseEvent* ev)
{ {
if ( ev->getButton() != LeftButton ) if ( ev->getButton() != fc::LeftButton )
{ {
if ( open_sub_menu ) if ( open_sub_menu )
{ {
@ -1040,7 +1040,7 @@ void FMenu::onMouseDown (FMouseEvent* ev)
{ {
unselectItem(); unselectItem();
FWidget* focused_widget = getFocusWidget(); FWidget* focused_widget = getFocusWidget();
FFocusEvent out (FocusOut_Event); FFocusEvent out (fc::FocusOut_Event);
FApplication::queueEvent(focused_widget, &out); FApplication::queueEvent(focused_widget, &out);
(*iter)->setSelected(); (*iter)->setSelected();
setSelectedItem(*iter); setSelectedItem(*iter);
@ -1081,7 +1081,7 @@ void FMenu::onMouseDown (FMouseEvent* ev)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMenu::onMouseUp (FMouseEvent* ev) void FMenu::onMouseUp (FMouseEvent* ev)
{ {
if ( ev->getButton() != LeftButton ) if ( ev->getButton() != fc::LeftButton )
return; return;
if ( mouse_down ) if ( mouse_down )
@ -1155,7 +1155,7 @@ void FMenu::onMouseUp (FMouseEvent* ev)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMenu::onMouseMove (FMouseEvent* ev) void FMenu::onMouseMove (FMouseEvent* ev)
{ {
if ( ev->getButton() != LeftButton ) if ( ev->getButton() != fc::LeftButton )
return; return;
if ( ! isActiveWindow() ) if ( ! isActiveWindow() )
@ -1223,7 +1223,7 @@ void FMenu::onMouseMove (FMouseEvent* ev)
{ {
// Mouse pointer over item // Mouse pointer over item
FWidget* focused_widget = getFocusWidget(); FWidget* focused_widget = getFocusWidget();
FFocusEvent out (FocusOut_Event); FFocusEvent out (fc::FocusOut_Event);
FApplication::queueEvent(focused_widget, &out); FApplication::queueEvent(focused_widget, &out);
(*iter)->setSelected(); (*iter)->setSelected();
setSelectedItem(*iter); setSelectedItem(*iter);
@ -1267,7 +1267,7 @@ void FMenu::onMouseMove (FMouseEvent* ev)
const FPoint& g = ev->getGlobalPos(); const FPoint& g = ev->getGlobalPos();
const FPoint& p = open_sub_menu->globalToLocalPos(g); const FPoint& p = open_sub_menu->globalToLocalPos(g);
int b = ev->getButton(); int b = ev->getButton();
FMouseEvent* _ev = new FMouseEvent (MouseMove_Event, p, g, b); FMouseEvent* _ev = new FMouseEvent (fc::MouseMove_Event, p, g, b);
open_sub_menu->mouse_down = true; open_sub_menu->mouse_down = true;
setClickedWidget(open_sub_menu); setClickedWidget(open_sub_menu);
open_sub_menu->onMouseMove(_ev); open_sub_menu->onMouseMove(_ev);
@ -1280,7 +1280,7 @@ void FMenu::onMouseMove (FMouseEvent* ev)
const FPoint& g = ev->getGlobalPos(); const FPoint& g = ev->getGlobalPos();
const FPoint& p = smenu->globalToLocalPos(g); const FPoint& p = smenu->globalToLocalPos(g);
int b = ev->getButton(); int b = ev->getButton();
FMouseEvent* _ev = new FMouseEvent (MouseMove_Event, p, g, b); FMouseEvent* _ev = new FMouseEvent (fc::MouseMove_Event, p, g, b);
smenu->mouse_down = true; smenu->mouse_down = true;
setClickedWidget(smenu); setClickedWidget(smenu);
smenu->onMouseMove(_ev); smenu->onMouseMove(_ev);
@ -1294,7 +1294,7 @@ void FMenu::onMouseMove (FMouseEvent* ev)
const FPoint& g = ev->getGlobalPos(); const FPoint& g = ev->getGlobalPos();
const FPoint& p = menubar->globalToLocalPos(g); const FPoint& p = menubar->globalToLocalPos(g);
int b = ev->getButton(); int b = ev->getButton();
FMouseEvent* _ev = new FMouseEvent (MouseMove_Event, p, g, b); FMouseEvent* _ev = new FMouseEvent (fc::MouseMove_Event, p, g, b);
setClickedWidget(menubar); setClickedWidget(menubar);
FMenuBar* mbar = reinterpret_cast<FMenuBar*>(menubar); FMenuBar* mbar = reinterpret_cast<FMenuBar*>(menubar);
mbar->mouse_down = true; mbar->mouse_down = true;

View File

@ -542,7 +542,7 @@ void FMenuBar::onKeyPress (FKeyEvent* ev)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMenuBar::onMouseDown (FMouseEvent* ev) void FMenuBar::onMouseDown (FMouseEvent* ev)
{ {
if ( ev->getButton() != LeftButton ) if ( ev->getButton() != fc::LeftButton )
{ {
mouse_down = false; mouse_down = false;
@ -589,7 +589,7 @@ void FMenuBar::onMouseDown (FMouseEvent* ev)
if ( (*iter)->isEnabled() && ! (*iter)->isSelected() ) if ( (*iter)->isEnabled() && ! (*iter)->isSelected() )
{ {
FWidget* focused_widget = getFocusWidget(); FWidget* focused_widget = getFocusWidget();
FFocusEvent out (FocusOut_Event); FFocusEvent out (fc::FocusOut_Event);
FApplication::queueEvent(focused_widget, &out); FApplication::queueEvent(focused_widget, &out);
(*iter)->setSelected(); (*iter)->setSelected();
(*iter)->setFocus(); (*iter)->setFocus();
@ -635,7 +635,7 @@ void FMenuBar::onMouseDown (FMouseEvent* ev)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMenuBar::onMouseUp (FMouseEvent* ev) void FMenuBar::onMouseUp (FMouseEvent* ev)
{ {
if ( ev->getButton() != LeftButton ) if ( ev->getButton() != fc::LeftButton )
return; return;
if ( mouse_down ) if ( mouse_down )
@ -718,7 +718,7 @@ void FMenuBar::onMouseUp (FMouseEvent* ev)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMenuBar::onMouseMove (FMouseEvent* ev) void FMenuBar::onMouseMove (FMouseEvent* ev)
{ {
if ( ev->getButton() != LeftButton ) if ( ev->getButton() != fc::LeftButton )
return; return;
if ( ! isActiveWindow() ) if ( ! isActiveWindow() )
@ -754,7 +754,7 @@ void FMenuBar::onMouseMove (FMouseEvent* ev)
if ( (*iter)->isEnabled() && ! (*iter)->isSelected() ) if ( (*iter)->isEnabled() && ! (*iter)->isSelected() )
{ {
FWidget* focused_widget = getFocusWidget(); FWidget* focused_widget = getFocusWidget();
FFocusEvent out (FocusOut_Event); FFocusEvent out (fc::FocusOut_Event);
FApplication::queueEvent(focused_widget, &out); FApplication::queueEvent(focused_widget, &out);
(*iter)->setSelected(); (*iter)->setSelected();
(*iter)->setFocus(); (*iter)->setFocus();
@ -803,7 +803,7 @@ void FMenuBar::onMouseMove (FMouseEvent* ev)
const FPoint& g = ev->getGlobalPos(); const FPoint& g = ev->getGlobalPos();
const FPoint& p = menu->globalToLocalPos(g); const FPoint& p = menu->globalToLocalPos(g);
int b = ev->getButton(); int b = ev->getButton();
FMouseEvent* _ev = new FMouseEvent (MouseMove_Event, p, g, b); FMouseEvent* _ev = new FMouseEvent (fc::MouseMove_Event, p, g, b);
menu->mouse_down = true; menu->mouse_down = true;
setClickedWidget(menu); setClickedWidget(menu);
menu->onMouseMove(_ev); menu->onMouseMove(_ev);

View File

@ -383,7 +383,7 @@ void FMenuItem::onMouseDown (FMouseEvent* ev)
if ( smenu ) if ( smenu )
{ {
const FPoint& p2 = smenu->globalToLocalPos(g); const FPoint& p2 = smenu->globalToLocalPos(g);
FMouseEvent* _ev = new FMouseEvent (MouseDown_Event, p2, g, b); FMouseEvent* _ev = new FMouseEvent (fc::MouseDown_Event, p2, g, b);
smenu->onMouseDown(_ev); smenu->onMouseDown(_ev);
delete _ev; delete _ev;
} }
@ -395,7 +395,7 @@ void FMenuItem::onMouseDown (FMouseEvent* ev)
if ( mbar ) if ( mbar )
{ {
const FPoint& p2 = mbar->globalToLocalPos(g); const FPoint& p2 = mbar->globalToLocalPos(g);
FMouseEvent* _ev = new FMouseEvent (MouseDown_Event, p2, g, b); FMouseEvent* _ev = new FMouseEvent (fc::MouseDown_Event, p2, g, b);
mbar->onMouseDown(_ev); mbar->onMouseDown(_ev);
delete _ev; delete _ev;
} }
@ -417,7 +417,7 @@ void FMenuItem::onMouseUp (FMouseEvent* ev)
if ( smenu ) if ( smenu )
{ {
const FPoint& p2 = smenu->globalToLocalPos(g); const FPoint& p2 = smenu->globalToLocalPos(g);
FMouseEvent* _ev = new FMouseEvent (MouseUp_Event, p2, g, b); FMouseEvent* _ev = new FMouseEvent (fc::MouseUp_Event, p2, g, b);
smenu->onMouseUp(_ev); smenu->onMouseUp(_ev);
delete _ev; delete _ev;
} }
@ -429,7 +429,7 @@ void FMenuItem::onMouseUp (FMouseEvent* ev)
if ( mbar ) if ( mbar )
{ {
const FPoint& p2 = mbar->globalToLocalPos(g); const FPoint& p2 = mbar->globalToLocalPos(g);
FMouseEvent* _ev = new FMouseEvent (MouseUp_Event, p2, g, b); FMouseEvent* _ev = new FMouseEvent (fc::MouseUp_Event, p2, g, b);
mbar->onMouseUp(_ev); mbar->onMouseUp(_ev);
delete _ev; delete _ev;
} }
@ -451,7 +451,7 @@ void FMenuItem::onMouseMove (FMouseEvent* ev)
if ( smenu ) if ( smenu )
{ {
const FPoint& p2 = smenu->globalToLocalPos(g); const FPoint& p2 = smenu->globalToLocalPos(g);
FMouseEvent* _ev = new FMouseEvent (MouseMove_Event, p2, g, b); FMouseEvent* _ev = new FMouseEvent (fc::MouseMove_Event, p2, g, b);
smenu->onMouseMove(_ev); smenu->onMouseMove(_ev);
delete _ev; delete _ev;
} }
@ -463,7 +463,7 @@ void FMenuItem::onMouseMove (FMouseEvent* ev)
if ( mbar ) if ( mbar )
{ {
const FPoint& p2 = mbar->globalToLocalPos(g); const FPoint& p2 = mbar->globalToLocalPos(g);
FMouseEvent* _ev = new FMouseEvent (MouseMove_Event, p2, g, b); FMouseEvent* _ev = new FMouseEvent (fc::MouseMove_Event, p2, g, b);
mbar->onMouseMove(_ev); mbar->onMouseMove(_ev);
delete _ev; delete _ev;
} }
@ -493,7 +493,7 @@ void FMenuItem::onAccel (FAccelEvent* ev)
openMenu(); openMenu();
focused_widget = static_cast<FWidget*>(ev->focusedWidget()); focused_widget = static_cast<FWidget*>(ev->focusedWidget());
FFocusEvent out (FocusOut_Event); FFocusEvent out (fc::FocusOut_Event);
FApplication::queueEvent(focused_widget, &out); FApplication::queueEvent(focused_widget, &out);
menu->unselectItem(); menu->unselectItem();
menu->selectFirstItem(); menu->selectFirstItem();

View File

@ -87,7 +87,7 @@ void FObject::delChild (FObject* obj)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FObject::event (FEvent* ev) bool FObject::event (FEvent* ev)
{ {
if ( ev->type() == Timer_Event ) if ( ev->type() == fc::Timer_Event )
{ {
onTimer ( static_cast<FTimerEvent*>(ev) ); onTimer ( static_cast<FTimerEvent*>(ev) );
return true; return true;

View File

@ -68,7 +68,7 @@ FOptiAttr::~FOptiAttr() // destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FOptiAttr::hasColor (char_data*& attr) inline bool FOptiAttr::hasColor (char_data*& attr)
{ {
if ( attr->fg_color < 0 && attr->bg_color < 0 ) if ( attr && attr->fg_color < 0 && attr->bg_color < 0 )
return false; return false;
else else
return true; return true;
@ -1312,7 +1312,10 @@ char* FOptiAttr::change_attribute (char_data*& term, char_data*& next)
} }
else if ( F_set_attributes.cap ) else if ( F_set_attributes.cap )
{ {
if ( off.pc_charset )
unsetTermPCcharset(term); unsetTermPCcharset(term);
if ( switchOn() || switchOff() )
setTermAttributes ( term setTermAttributes ( term
, next->standout , next->standout
, next->underline , next->underline
@ -1323,7 +1326,6 @@ char* FOptiAttr::change_attribute (char_data*& term, char_data*& next)
, next->invisible , next->invisible
, next->protect , next->protect
, next->alt_charset ); , next->alt_charset );
if ( next->italic ) if ( next->italic )
setTermItalic(term); setTermItalic(term);
if ( next->crossed_out ) if ( next->crossed_out )

View File

@ -209,8 +209,8 @@ void FScrollbar::onMouseDown (FMouseEvent* ev)
{ {
int mouse_x, mouse_y; int mouse_x, mouse_y;
if ( ev->getButton() != LeftButton if ( ev->getButton() != fc::LeftButton
&& ev->getButton() != MiddleButton ) && ev->getButton() != fc::MiddleButton )
return; return;
if ( min == max ) if ( min == max )
@ -219,7 +219,7 @@ void FScrollbar::onMouseDown (FMouseEvent* ev)
mouse_x = ev->getX(); mouse_x = ev->getX();
mouse_y = ev->getY(); mouse_y = ev->getY();
if ( ev->getButton() == MiddleButton ) if ( ev->getButton() == fc::MiddleButton )
{ {
processMiddleButton (mouse_x, mouse_y); processMiddleButton (mouse_x, mouse_y);
return; return;
@ -276,8 +276,8 @@ void FScrollbar::onMouseDown (FMouseEvent* ev)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FScrollbar::onMouseUp (FMouseEvent* ev) void FScrollbar::onMouseUp (FMouseEvent* ev)
{ {
if ( ev->getButton() != LeftButton if ( ev->getButton() != fc::LeftButton
&& ev->getButton() != MiddleButton ) && ev->getButton() != fc::MiddleButton )
return; return;
SliderClickPos = -1; SliderClickPos = -1;
@ -294,14 +294,14 @@ void FScrollbar::onMouseMove (FMouseEvent* ev)
{ {
int mouse_x, mouse_y, newScrollType; int mouse_x, mouse_y, newScrollType;
if ( ev->getButton() != LeftButton if ( ev->getButton() != fc::LeftButton
&& ev->getButton() != MiddleButton ) && ev->getButton() != fc::MiddleButton )
return; return;
mouse_x = ev->getX(); mouse_x = ev->getX();
mouse_y = ev->getY(); mouse_y = ev->getY();
if ( ev->getButton() == MiddleButton ) if ( ev->getButton() == fc::MiddleButton )
{ {
processMiddleButton (mouse_x, mouse_y); processMiddleButton (mouse_x, mouse_y);
return; return;
@ -365,9 +365,9 @@ void FScrollbar::onWheel (FWheelEvent* ev)
scrollType = FScrollbar::noScroll; scrollType = FScrollbar::noScroll;
} }
if ( wheel == WheelUp ) if ( wheel == fc::WheelUp )
scrollType = FScrollbar::scrollWheelUp; scrollType = FScrollbar::scrollWheelUp;
else if ( wheel == WheelDown ) else if ( wheel == fc::WheelDown )
scrollType = FScrollbar::scrollWheelDown; scrollType = FScrollbar::scrollWheelDown;
processScroll(); processScroll();

View File

@ -356,7 +356,7 @@ void FStatusBar::onMouseDown (FMouseEvent* ev)
{ {
if ( hasActivatedKey() ) if ( hasActivatedKey() )
return; return;
if ( ev->getButton() != LeftButton ) if ( ev->getButton() != fc::LeftButton )
{ {
mouse_down = false; mouse_down = false;
if ( ! keylist.empty() ) if ( ! keylist.empty() )
@ -416,7 +416,7 @@ void FStatusBar::onMouseUp (FMouseEvent* ev)
{ {
if ( hasActivatedKey() ) if ( hasActivatedKey() )
return; return;
if ( ev->getButton() != LeftButton ) if ( ev->getButton() != fc::LeftButton )
return; return;
if ( mouse_down ) if ( mouse_down )
@ -463,7 +463,7 @@ void FStatusBar::onMouseMove (FMouseEvent* ev)
{ {
if ( hasActivatedKey() ) if ( hasActivatedKey() )
return; return;
if ( ev->getButton() != LeftButton ) if ( ev->getButton() != fc::LeftButton )
return; return;
if ( mouse_down && ! keylist.empty() ) if ( mouse_down && ! keylist.empty() )

View File

@ -181,7 +181,7 @@ void FSwitch::onMouseDown (FMouseEvent* ev)
{ {
FToggleButton::onMouseDown(ev); FToggleButton::onMouseDown(ev);
if ( ev->getButton() != LeftButton ) if ( ev->getButton() != fc::LeftButton )
return; return;
button_pressed = true; button_pressed = true;
@ -193,7 +193,7 @@ void FSwitch::onMouseUp (FMouseEvent* ev)
{ {
FToggleButton::onMouseUp(ev); FToggleButton::onMouseUp(ev);
if ( ev->getButton() != LeftButton ) if ( ev->getButton() != fc::LeftButton )
return; return;
button_pressed = false; button_pressed = false;

View File

@ -999,6 +999,10 @@ void FTerm::init_pc_charset()
{ {
bool reinit = false; bool reinit = false;
// rxvt does not support pc charset
if ( rxvt_terminal || urxvt_terminal )
return;
// fallback if "S2" is not found // fallback if "S2" is not found
if ( ! tcap[t_enter_pc_charset_mode].string ) if ( ! tcap[t_enter_pc_charset_mode].string )
{ {
@ -1096,9 +1100,13 @@ void FTerm::init_termcaps()
tabstop = uInt(tgetnum(const_cast<char*>("it"))); tabstop = uInt(tgetnum(const_cast<char*>("it")));
attr_without_color = uInt(tgetnum(const_cast<char*>("NC"))); attr_without_color = uInt(tgetnum(const_cast<char*>("NC")));
// gnome-terminal has NC=16 however, it can use the dim attribute // gnome-terminal has NC=16 however, it can use the dim attribute
if ( gnome_terminal ) if ( gnome_terminal )
attr_without_color = 0; attr_without_color = 0;
// PuTTY has NC=22 however, it can show underline and reverse
if ( putty_terminal )
attr_without_color = 16;
// read termcap output strings // read termcap output strings
for (int i=0; tcap[i].tname[0] != 0; i++) for (int i=0; tcap[i].tname[0] != 0; i++)
@ -1481,6 +1489,7 @@ void FTerm::init()
tmux_terminal = \ tmux_terminal = \
background_color_erase = false; background_color_erase = false;
// term_attribute stores the current state of the terminal
term_attribute.code = '\0'; term_attribute.code = '\0';
term_attribute.fg_color = fc::Default; term_attribute.fg_color = fc::Default;
term_attribute.bg_color = fc::Default; term_attribute.bg_color = fc::Default;
@ -1498,6 +1507,7 @@ void FTerm::init()
term_attribute.alt_charset = \ term_attribute.alt_charset = \
term_attribute.pc_charset = false; term_attribute.pc_charset = false;
// next_attribute contains the state of the next printed character
next_attribute.code = '\0'; next_attribute.code = '\0';
next_attribute.fg_color = fc::Default; next_attribute.fg_color = fc::Default;
next_attribute.bg_color = fc::Default; next_attribute.bg_color = fc::Default;
@ -1695,9 +1705,9 @@ void FTerm::init()
setXTermMouseForeground ("rgb:0000/0000/0000"); setXTermMouseForeground ("rgb:0000/0000/0000");
if ( ! gnome_terminal ) if ( ! gnome_terminal )
setXTermCursorColor("rgb:ffff/ffff/ffff"); setXTermCursorColor("rgb:ffff/ffff/ffff");
if ( ! mintty_terminal ) if ( ! mintty_terminal && ! rxvt_terminal )
{ {
// mintty can't reset these settings // mintty and rxvt can't reset these settings
setXTermBackground("rgb:8080/a4a4/ecec"); setXTermBackground("rgb:8080/a4a4/ecec");
setXTermForeground("rgb:0000/0000/0000"); setXTermForeground("rgb:0000/0000/0000");
setXTermHighlightBackground("rgb:8686/8686/8686"); setXTermHighlightBackground("rgb:8686/8686/8686");
@ -1764,6 +1774,8 @@ void FTerm::init()
setPalette (fc::Yellow, 0xff, 0xff, 0x54); setPalette (fc::Yellow, 0xff, 0xff, 0x54);
setPalette (fc::White, 0xff, 0xff, 0xff); setPalette (fc::White, 0xff, 0xff, 0xff);
} }
// set 200 Hz beep (100 ms)
setBeep(200, 100); setBeep(200, 100);
signal(SIGTERM, FTerm::signal_handler); // Termination signal signal(SIGTERM, FTerm::signal_handler); // Termination signal
@ -1787,7 +1799,7 @@ void FTerm::finish()
signal(SIGQUIT, SIG_DFL); // Quit from keyboard (Ctrl-\) signal(SIGQUIT, SIG_DFL); // Quit from keyboard (Ctrl-\)
signal(SIGTERM, SIG_DFL); // Termination signal signal(SIGTERM, SIG_DFL); // Termination signal
if ( xterm && ! rxvt_terminal ) if ( xterm_title && xterm && ! rxvt_terminal )
setXTermTitle (*xterm_title); setXTermTitle (*xterm_title);
showCursor(); showCursor();
@ -1924,9 +1936,15 @@ void FTerm::finish()
if ( vterm != 0 ) if ( vterm != 0 )
{ {
if ( vterm->changes != 0 ) if ( vterm->changes != 0 )
{
delete[] vterm->changes; delete[] vterm->changes;
vterm->changes = 0;
}
if ( vterm->text != 0 ) if ( vterm->text != 0 )
{
delete[] vterm->text; delete[] vterm->text;
vterm->text = 0;
}
delete vterm; delete vterm;
} }
} }
@ -1998,7 +2016,7 @@ void FTerm::createArea (term_area*& area)
void FTerm::resizeArea (term_area* area) void FTerm::resizeArea (term_area* area)
{ {
int area_size, width, height, rsw, bsh; int area_size, width, height, rsw, bsh;
char_data default_char; FOptiAttr::char_data default_char;
line_changes unchanged; line_changes unchanged;
if ( ! area ) if ( ! area )
@ -2028,13 +2046,13 @@ void FTerm::resizeArea (term_area* area)
if ( area->text != 0 ) if ( area->text != 0 )
delete[] area->text; delete[] area->text;
area->changes = new line_changes[height + bsh]; area->changes = new line_changes[height + bsh];
area->text = new char_data[area_size]; area->text = new FOptiAttr::char_data[area_size];
} }
else if ( area->width + area->right_shadow != width + rsw ) else if ( area->width + area->right_shadow != width + rsw )
{ {
if ( area->text != 0 ) if ( area->text != 0 )
delete[] area->text; delete[] area->text;
area->text = new char_data[area_size]; area->text = new FOptiAttr::char_data[area_size];
} }
else else
return; return;
@ -2081,8 +2099,8 @@ void FTerm::restoreVTerm (const FRect& box)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTerm::restoreVTerm (int x, int y, int w, int h) void FTerm::restoreVTerm (int x, int y, int w, int h)
{ {
char_data* tc; // terminal character FOptiAttr::char_data* tc; // terminal character
char_data* sc; // shown character FOptiAttr::char_data* sc; // shown character
FWidget* widget; FWidget* widget;
x--; x--;
@ -2160,7 +2178,7 @@ void FTerm::restoreVTerm (int x, int y, int w, int h)
sc = &vstatusbar->text[(y+ty-bar_y) * vstatusbar->width + (x+tx-bar_x)]; sc = &vstatusbar->text[(y+ty-bar_y) * vstatusbar->width + (x+tx-bar_x)];
} }
memcpy (tc, sc, sizeof(char_data)); memcpy (tc, sc, sizeof(FOptiAttr::char_data));
if ( short(vterm->changes[y+ty].xmin) > x ) if ( short(vterm->changes[y+ty].xmin) > x )
vterm->changes[y+ty].xmin = uInt(x); vterm->changes[y+ty].xmin = uInt(x);
@ -2242,8 +2260,8 @@ bool FTerm::isCovered(int x, int y, FTerm::term_area* area) const
void FTerm::updateVTerm (FTerm::term_area* area) void FTerm::updateVTerm (FTerm::term_area* area)
{ {
int ax, ay, aw, ah, rsh, bsh, y_end, ol; int ax, ay, aw, ah, rsh, bsh, y_end, ol;
char_data* tc; // terminal character FOptiAttr::char_data* tc; // terminal character
char_data* ac; // area character FOptiAttr::char_data* ac; // area character
if ( ! vterm_updates ) if ( ! vterm_updates )
{ {
@ -2285,7 +2303,7 @@ void FTerm::updateVTerm (FTerm::term_area* area)
if ( ax == 0 ) if ( ax == 0 )
line_xmin = ol; line_xmin = ol;
else if ( aw + rsh + ax - ol >= vterm->width ) if ( aw + rsh + ax - ol >= vterm->width )
line_xmax = vterm->width + ol - ax - 1; line_xmax = vterm->width + ol - ax - 1;
if ( ax + line_xmin >= vterm->width ) if ( ax + line_xmin >= vterm->width )
@ -2305,7 +2323,7 @@ void FTerm::updateVTerm (FTerm::term_area* area)
tc = &vterm->text[gy * vterm->width + gx - ol]; tc = &vterm->text[gy * vterm->width + gx - ol];
if ( ! isCovered(gx-ol, gy, area) ) if ( ! isCovered(gx-ol, gy, area) )
memcpy (tc, ac, sizeof(char_data)); memcpy (tc, ac, sizeof(FOptiAttr::char_data));
else else
line_xmin++; // don't update covered character line_xmin++; // don't update covered character
} }
@ -2334,8 +2352,8 @@ void FTerm::getArea (int ax, int ay, FTerm::term_area* area)
{ {
int y_end; int y_end;
int length; int length;
char_data* tc; // terminal character FOptiAttr::char_data* tc; // terminal character
char_data* ac; // area character FOptiAttr::char_data* ac; // area character
if ( ! area ) if ( ! area )
return; return;
@ -2356,7 +2374,7 @@ void FTerm::getArea (int ax, int ay, FTerm::term_area* area)
{ {
ac = &area->text[y * area->width]; ac = &area->text[y * area->width];
tc = &vterm->text[(ay+y) * vterm->width + ax]; tc = &vterm->text[(ay+y) * vterm->width + ax];
memcpy (ac, tc, sizeof(char_data) * unsigned(length)); memcpy (ac, tc, sizeof(FOptiAttr::char_data) * unsigned(length));
if ( short(area->changes[y].xmin) > 0 ) if ( short(area->changes[y].xmin) > 0 )
area->changes[y].xmin = 0; area->changes[y].xmin = 0;
@ -2369,8 +2387,8 @@ void FTerm::getArea (int ax, int ay, FTerm::term_area* area)
void FTerm::getArea (int x, int y, int w, int h, FTerm::term_area* area) void FTerm::getArea (int x, int y, int w, int h, FTerm::term_area* area)
{ {
int y_end, length, dx, dy; int y_end, length, dx, dy;
char_data* tc; // terminal character FOptiAttr::char_data* tc; // terminal character
char_data* ac; // area character FOptiAttr::char_data* ac; // area character
if ( ! area ) if ( ! area )
return; return;
@ -2399,7 +2417,7 @@ void FTerm::getArea (int x, int y, int w, int h, FTerm::term_area* area)
tc = &vterm->text[(y+_y-1) * vterm->width + x-1]; tc = &vterm->text[(y+_y-1) * vterm->width + x-1];
ac = &area->text[(dy+_y) * line_len + dx]; ac = &area->text[(dy+_y) * line_len + dx];
memcpy (ac, tc, sizeof(char_data) * unsigned(length)); memcpy (ac, tc, sizeof(FOptiAttr::char_data) * unsigned(length));
if ( short(area->changes[dy+_y].xmin) > dx ) if ( short(area->changes[dy+_y].xmin) > dx )
area->changes[dy+_y].xmin = uInt(dx); area->changes[dy+_y].xmin = uInt(dx);
@ -2422,8 +2440,8 @@ void FTerm::putArea (const FPoint& pos, FTerm::term_area* area)
void FTerm::putArea (int ax, int ay, FTerm::term_area* area) void FTerm::putArea (int ax, int ay, FTerm::term_area* area)
{ {
int aw, ah, rsh, bsh, y_end, length, ol, sbar; int aw, ah, rsh, bsh, y_end, length, ol, sbar;
char_data* tc; // terminal character FOptiAttr::char_data* tc; // terminal character
char_data* ac; // area character FOptiAttr::char_data* ac; // area character
if ( ! area ) if ( ! area )
return; return;
@ -2468,7 +2486,7 @@ void FTerm::putArea (int ax, int ay, FTerm::term_area* area)
tc = &vterm->text[(ay+y) * vterm->width + ax]; tc = &vterm->text[(ay+y) * vterm->width + ax];
ac = &area->text[y * line_len + ol]; ac = &area->text[y * line_len + ol];
memcpy (tc, ac, sizeof(char_data) * unsigned(length)); memcpy (tc, ac, sizeof(FOptiAttr::char_data) * unsigned(length));
if ( ax < short(vterm->changes[ay+y].xmin) ) if ( ax < short(vterm->changes[ay+y].xmin) )
vterm->changes[ay+y].xmin = uInt(ax); vterm->changes[ay+y].xmin = uInt(ax);
@ -2478,10 +2496,10 @@ void FTerm::putArea (int ax, int ay, FTerm::term_area* area)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FTerm::char_data FTerm::getCoveredCharacter (int x, int y, FTerm* obj) FOptiAttr::char_data FTerm::getCoveredCharacter (int x, int y, FTerm* obj)
{ {
int xx,yy; int xx,yy;
char_data* cc; // covered character FOptiAttr::char_data* cc; // covered character
FWidget* w; FWidget* w;
x--; x--;
@ -2659,7 +2677,7 @@ bool FTerm::setOldFont()
if ( xterm || urxvt_terminal || osc_support ) if ( xterm || urxvt_terminal || osc_support )
{ {
if ( xterm_font->getLength() > 2 ) if ( xterm_font && xterm_font->getLength() > 2 )
// restore saved xterm font // restore saved xterm font
putstringf ("\033]50;%s\07", xterm_font->c_str() ); putstringf ("\033]50;%s\07", xterm_font->c_str() );
else else
@ -2772,7 +2790,7 @@ void FTerm::createVTerm()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTerm::resizeVTerm() void FTerm::resizeVTerm()
{ {
char_data default_char; FOptiAttr::char_data default_char;
line_changes unchanged; line_changes unchanged;
int term_width, term_height, vterm_size; int term_width, term_height, vterm_size;
@ -2783,18 +2801,27 @@ void FTerm::resizeVTerm()
if ( vterm->height != term_height ) if ( vterm->height != term_height )
{ {
if ( vterm->changes != 0 ) if ( vterm->changes != 0 )
{
delete[] vterm->changes; delete[] vterm->changes;
vterm->changes = 0;
}
if ( vterm->text != 0 ) if ( vterm->text != 0 )
{
delete[] vterm->text; delete[] vterm->text;
vterm->text = 0;
}
vterm->changes = new line_changes[term_height]; vterm->changes = new line_changes[term_height];
vterm->text = new char_data[vterm_size]; vterm->text = new FOptiAttr::char_data[vterm_size];
} }
else if ( vterm->width != term_width ) else if ( vterm->width != term_width )
{ {
if ( vterm->text != 0 ) if ( vterm->text != 0 )
{
delete[] vterm->text; delete[] vterm->text;
vterm->text = new char_data[vterm_size]; vterm->text = 0;
}
vterm->text = new FOptiAttr::char_data[vterm_size];
} }
else else
return; return;
@ -2877,7 +2904,7 @@ void FTerm::updateTerminal()
x <= change_xmax; x <= change_xmax;
x++ ) x++ )
{ {
char_data* print_char; FOptiAttr::char_data* print_char;
print_char = &vt->text[y * uInt(vt->width) + x]; print_char = &vt->text[y * uInt(vt->width) + x];
if ( x_term_pos == term_width if ( x_term_pos == term_width
@ -3827,7 +3854,7 @@ int FTerm::print (FTerm::term_area* area, FString& s)
short x = short(cursor->getX()); short x = short(cursor->getX());
short y = short(cursor->getY()); short y = short(cursor->getY());
char_data nc; // next character FOptiAttr::char_data nc; // next character
nc.code = *p; nc.code = *p;
nc.fg_color = next_attribute.fg_color; nc.fg_color = next_attribute.fg_color;
nc.bg_color = next_attribute.bg_color; nc.bg_color = next_attribute.bg_color;
@ -3853,7 +3880,7 @@ int FTerm::print (FTerm::term_area* area, FString& s)
&& ax < area->width + area->right_shadow && ax < area->width + area->right_shadow
&& ay < area->height + area->bottom_shadow ) && ay < area->height + area->bottom_shadow )
{ {
char_data* ac; // area character FOptiAttr::char_data* ac; // area character
int line_len = area->width + area->right_shadow; int line_len = area->width + area->right_shadow;
ac = &area->text[ay * line_len + ax]; ac = &area->text[ay * line_len + ax];
@ -3913,7 +3940,7 @@ int FTerm::print (register int c)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FTerm::print (FTerm::term_area* area, register int c) int FTerm::print (FTerm::term_area* area, register int c)
{ {
char_data nc; // next character FOptiAttr::char_data nc; // next character
FWidget* area_widget; FWidget* area_widget;
int rsh, bsh, ax, ay; int rsh, bsh, ax, ay;
short x, y; short x, y;
@ -3952,7 +3979,7 @@ int FTerm::print (FTerm::term_area* area, register int c)
&& ax < area->width + area->right_shadow && ax < area->width + area->right_shadow
&& ay < area->height + area->bottom_shadow ) && ay < area->height + area->bottom_shadow )
{ {
char_data* ac; // area character FOptiAttr::char_data* ac; // area character
int line_len = area->width + area->right_shadow; int line_len = area->width + area->right_shadow;
ac = &area->text[ay * line_len + ax]; ac = &area->text[ay * line_len + ax];
@ -3988,7 +4015,7 @@ int FTerm::print (FTerm::term_area* area, register int c)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FTerm::newFontChanges (char_data*& next_char) inline void FTerm::newFontChanges (FOptiAttr::char_data*& next_char)
{ {
// NewFont special cases // NewFont special cases
if ( isNewFont() ) if ( isNewFont() )
@ -4029,7 +4056,7 @@ inline void FTerm::newFontChanges (char_data*& next_char)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FTerm::charsetChanges (char_data*& next_char) inline void FTerm::charsetChanges (FOptiAttr::char_data*& next_char)
{ {
if ( Encoding == fc::UTF8 ) if ( Encoding == fc::UTF8 )
return; return;
@ -4059,7 +4086,7 @@ inline void FTerm::charsetChanges (char_data*& next_char)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FTerm::appendCharacter (char_data*& next_char) inline void FTerm::appendCharacter (FOptiAttr::char_data*& next_char)
{ {
newFontChanges (next_char); newFontChanges (next_char);
charsetChanges (next_char); charsetChanges (next_char);
@ -4069,10 +4096,10 @@ inline void FTerm::appendCharacter (char_data*& next_char)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FTerm::appendAttributes (char_data*& next_attr) inline void FTerm::appendAttributes (FOptiAttr::char_data*& next_attr)
{ {
char* attr_str; char* attr_str;
char_data* term_attr = &term_attribute; FOptiAttr::char_data* term_attr = &term_attribute;
// generate attribute string for the next character // generate attribute string for the next character
attr_str = opti_attr->change_attribute (term_attr, next_attr); attr_str = opti_attr->change_attribute (term_attr, next_attr);
@ -4082,7 +4109,7 @@ inline void FTerm::appendAttributes (char_data*& next_attr)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FTerm::appendLowerRight (char_data*& screen_char) int FTerm::appendLowerRight (FOptiAttr::char_data*& screen_char)
{ {
char* SA = tcap[t_enter_am_mode].string; char* SA = tcap[t_enter_am_mode].string;
char* RA = tcap[t_exit_am_mode].string; char* RA = tcap[t_exit_am_mode].string;

View File

@ -168,8 +168,6 @@ class FTerm
static const FString* AnswerBack; static const FString* AnswerBack;
static const FString* Sec_DA; static const FString* Sec_DA;
typedef FOptiAttr::char_data char_data;
typedef struct typedef struct
{ {
uChar red; uChar red;
@ -204,7 +202,7 @@ class FTerm
int bottom_shadow; int bottom_shadow;
FWidget* widget; FWidget* widget;
line_changes* changes; line_changes* changes;
char_data* text; FOptiAttr::char_data* text;
bool visible; bool visible;
} term_area; } term_area;
@ -265,8 +263,8 @@ class FTerm
void getArea (int, int, int, int, FTerm::term_area*); void getArea (int, int, int, int, FTerm::term_area*);
void putArea (const FPoint&, FTerm::term_area*); void putArea (const FPoint&, FTerm::term_area*);
void putArea (int, int, FTerm::term_area*); void putArea (int, int, FTerm::term_area*);
char_data getCoveredCharacter (const FPoint&, FTerm*); FOptiAttr::char_data getCoveredCharacter (const FPoint&, FTerm*);
char_data getCoveredCharacter (int, int, FTerm*); FOptiAttr::char_data getCoveredCharacter (int, int, FTerm*);
public: public:
FTerm (); // constructor FTerm (); // constructor
@ -388,11 +386,11 @@ class FTerm
int print (FTerm::term_area*, FString&); int print (FTerm::term_area*, FString&);
int print (int); int print (int);
int print (FTerm::term_area*, int); int print (FTerm::term_area*, int);
static void newFontChanges (char_data*&); static void newFontChanges (FOptiAttr::char_data*&);
static void charsetChanges (char_data*&); static void charsetChanges (FOptiAttr::char_data*&);
static void appendCharacter (char_data*&); static void appendCharacter (FOptiAttr::char_data*&);
static void appendAttributes (char_data*&); static void appendAttributes (FOptiAttr::char_data*&);
static int appendLowerRight (char_data*&); static int appendLowerRight (FOptiAttr::char_data*&);
static void appendOutputBuffer (std::string&); static void appendOutputBuffer (std::string&);
static void appendOutputBuffer (const char*); static void appendOutputBuffer (const char*);
static int appendOutputBuffer (int); static int appendOutputBuffer (int);
@ -433,7 +431,7 @@ inline void FTerm::getArea (const FRect& box, FTerm::term_area* area)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline FTerm::char_data FTerm::getCoveredCharacter (const FPoint& pos, FTerm* obj) inline FOptiAttr::char_data FTerm::getCoveredCharacter (const FPoint& pos, FTerm* obj)
{ return getCoveredCharacter (pos.getX(), pos.getY(), obj); } { return getCoveredCharacter (pos.getX(), pos.getY(), obj); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -298,13 +298,13 @@ void FTextView::onKeyPress (FKeyEvent* ev)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTextView::onMouseDown (FMouseEvent* ev) void FTextView::onMouseDown (FMouseEvent* ev)
{ {
if ( ev->getButton() != LeftButton ) if ( ev->getButton() != fc::LeftButton )
return; return;
if ( ! hasFocus() ) if ( ! hasFocus() )
{ {
FWidget* focused_widget = getFocusWidget(); FWidget* focused_widget = getFocusWidget();
FFocusEvent out (FocusOut_Event); FFocusEvent out (fc::FocusOut_Event);
FApplication::queueEvent(focused_widget, &out); FApplication::queueEvent(focused_widget, &out);
setFocus(); setFocus();
if ( focused_widget ) if ( focused_widget )
@ -322,7 +322,7 @@ void FTextView::onWheel (FWheelEvent* ev)
switch ( wheel ) switch ( wheel )
{ {
case WheelUp: case fc::WheelUp:
if ( yoffset == 0 ) if ( yoffset == 0 )
break; break;
yoffset -= 4; yoffset -= 4;
@ -330,7 +330,7 @@ void FTextView::onWheel (FWheelEvent* ev)
yoffset=0; yoffset=0;
break; break;
case WheelDown: case fc::WheelDown:
{ {
int yoffset_end = last_line - height - nf_offset + 2; int yoffset_end = last_line - height - nf_offset + 2;
if ( yoffset_end < 0 ) if ( yoffset_end < 0 )
@ -419,14 +419,14 @@ void FTextView::cb_VBarChange (FWidget*, void*)
case FScrollbar::scrollWheelUp: case FScrollbar::scrollWheelUp:
{ {
FWheelEvent wheel_ev (MouseWheel_Event, FPoint(2,2), WheelUp); FWheelEvent wheel_ev (fc::MouseWheel_Event, FPoint(2,2), fc::WheelUp);
onWheel(&wheel_ev); onWheel(&wheel_ev);
break; break;
} }
case FScrollbar::scrollWheelDown: case FScrollbar::scrollWheelDown:
{ {
FWheelEvent wheel_ev (MouseWheel_Event, FPoint(2,2), WheelDown); FWheelEvent wheel_ev (fc::MouseWheel_Event, FPoint(2,2), fc::WheelDown);
onWheel(&wheel_ev); onWheel(&wheel_ev);
break; break;
} }

View File

@ -464,13 +464,13 @@ bool FToggleButton::setFocus (bool on)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FToggleButton::onMouseDown (FMouseEvent* ev) void FToggleButton::onMouseDown (FMouseEvent* ev)
{ {
if ( ev->getButton() != LeftButton ) if ( ev->getButton() != fc::LeftButton )
return; return;
if ( ! hasFocus() ) if ( ! hasFocus() )
{ {
FWidget* focused_widget = getFocusWidget(); FWidget* focused_widget = getFocusWidget();
FFocusEvent out (FocusOut_Event); FFocusEvent out (fc::FocusOut_Event);
FApplication::queueEvent(focused_widget, &out); FApplication::queueEvent(focused_widget, &out);
setFocus(); setFocus();
if ( focused_widget ) if ( focused_widget )
@ -488,7 +488,7 @@ void FToggleButton::onMouseDown (FMouseEvent* ev)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FToggleButton::onMouseUp (FMouseEvent* ev) void FToggleButton::onMouseUp (FMouseEvent* ev)
{ {
if ( ev->getButton() != LeftButton ) if ( ev->getButton() != fc::LeftButton )
return; return;
if ( getGeometryGlobal().contains(ev->getGlobalPos()) ) if ( getGeometryGlobal().contains(ev->getGlobalPos()) )
@ -519,7 +519,7 @@ void FToggleButton::onAccel (FAccelEvent* ev)
if ( ! hasFocus() ) if ( ! hasFocus() )
{ {
FWidget* focused_widget = static_cast<FWidget*>(ev->focusedWidget()); FWidget* focused_widget = static_cast<FWidget*>(ev->focusedWidget());
FFocusEvent out (FocusOut_Event); FFocusEvent out (fc::FocusOut_Event);
FApplication::queueEvent(focused_widget, &out); FApplication::queueEvent(focused_widget, &out);
setFocus(); setFocus();
if ( focused_widget ) if ( focused_widget )
@ -585,21 +585,21 @@ void FToggleButton::onFocusOut (FFocusEvent* out_ev)
{ {
focus_inside_group = true; focus_inside_group = true;
out_ev->ignore(); out_ev->ignore();
if ( out_ev->getFocusType() == FocusNextWidget ) if ( out_ev->getFocusType() == fc::FocusNextWidget )
group()->focusNextChild(); group()->focusNextChild();
if ( out_ev->getFocusType() == FocusPreviousWidget ) if ( out_ev->getFocusType() == fc::FocusPreviousWidget )
group()->focusPrevChild(); group()->focusPrevChild();
redraw(); redraw();
} }
else if ( this == group()->getLastButton() else if ( this == group()->getLastButton()
&& out_ev->getFocusType() == FocusNextWidget ) && out_ev->getFocusType() == fc::FocusNextWidget )
{ {
out_ev->ignore(); out_ev->ignore();
group()->focusNextChild(); group()->focusNextChild();
redraw(); redraw();
} }
else if ( this == group()->getFirstButton() else if ( this == group()->getFirstButton()
&& out_ev->getFocusType() == FocusPreviousWidget ) && out_ev->getFocusType() == fc::FocusPreviousWidget )
{ {
out_ev->ignore(); out_ev->ignore();
group()->focusPrevChild(); group()->focusPrevChild();

View File

@ -506,7 +506,7 @@ bool FWidget::event (FEvent* ev)
{ {
switch ( ev->type() ) switch ( ev->type() )
{ {
case KeyPress_Event: case fc::KeyPress_Event:
{ {
FKeyEvent* kev = static_cast<FKeyEvent*>(ev); FKeyEvent* kev = static_cast<FKeyEvent*>(ev);
bool accpt_focus = false; bool accpt_focus = false;
@ -538,11 +538,11 @@ bool FWidget::event (FEvent* ev)
} }
break; break;
case KeyUp_Event: case fc::KeyUp_Event:
onKeyUp ( static_cast<FKeyEvent*>(ev) ); onKeyUp ( static_cast<FKeyEvent*>(ev) );
break; break;
case KeyDown_Event: case fc::KeyDown_Event:
{ {
FKeyEvent* kev = static_cast<FKeyEvent*>(ev); FKeyEvent* kev = static_cast<FKeyEvent*>(ev);
FWidget* widget = this; FWidget* widget = this;
@ -556,55 +556,55 @@ bool FWidget::event (FEvent* ev)
} }
break; break;
case MouseDown_Event: case fc::MouseDown_Event:
onMouseDown ( static_cast<FMouseEvent*>(ev) ); onMouseDown ( static_cast<FMouseEvent*>(ev) );
break; break;
case MouseUp_Event: case fc::MouseUp_Event:
onMouseUp ( static_cast<FMouseEvent*>(ev) ); onMouseUp ( static_cast<FMouseEvent*>(ev) );
break; break;
case MouseDoubleClick_Event: case fc::MouseDoubleClick_Event:
onMouseDoubleClick ( static_cast<FMouseEvent*>(ev) ); onMouseDoubleClick ( static_cast<FMouseEvent*>(ev) );
break; break;
case MouseWheel_Event: case fc::MouseWheel_Event:
onWheel ( static_cast<FWheelEvent*>(ev) ); onWheel ( static_cast<FWheelEvent*>(ev) );
break; break;
case MouseMove_Event: case fc::MouseMove_Event:
onMouseMove ( static_cast<FMouseEvent*>(ev) ); onMouseMove ( static_cast<FMouseEvent*>(ev) );
break; break;
case FocusIn_Event: case fc::FocusIn_Event:
onFocusIn ( static_cast<FFocusEvent*>(ev) ); onFocusIn ( static_cast<FFocusEvent*>(ev) );
break; break;
case FocusOut_Event: case fc::FocusOut_Event:
onFocusOut ( static_cast<FFocusEvent*>(ev) ); onFocusOut ( static_cast<FFocusEvent*>(ev) );
break; break;
case Accelerator_Event: case fc::Accelerator_Event:
onAccel ( static_cast<FAccelEvent*>(ev) ); onAccel ( static_cast<FAccelEvent*>(ev) );
break; break;
case Resize_Event: case fc::Resize_Event:
onResize ( static_cast<FResizeEvent*>(ev) ); onResize ( static_cast<FResizeEvent*>(ev) );
break; break;
case Show_Event: case fc::Show_Event:
onShow ( static_cast<FShowEvent*>(ev) ); onShow ( static_cast<FShowEvent*>(ev) );
break; break;
case Hide_Event: case fc::Hide_Event:
onHide ( static_cast<FHideEvent*>(ev) ); onHide ( static_cast<FHideEvent*>(ev) );
break; break;
case Close_Event: case fc::Close_Event:
onClose ( static_cast<FCloseEvent*>(ev) ); onClose ( static_cast<FCloseEvent*>(ev) );
break; break;
case Timer_Event: case fc::Timer_Event:
onTimer ( static_cast<FTimerEvent*>(ev) ); onTimer ( static_cast<FTimerEvent*>(ev) );
break; break;
@ -714,16 +714,16 @@ bool FWidget::focusNextChild(void)
|| ! next->acceptFocus() || ! next->acceptFocus()
|| ! next->isVisible() || ! next->isVisible()
|| next->isWindow() ); || next->isWindow() );
FFocusEvent out (FocusOut_Event); FFocusEvent out (fc::FocusOut_Event);
out.setFocusType(FocusNextWidget); out.setFocusType(fc::FocusNextWidget);
FApplication::sendEvent(this, &out); FApplication::sendEvent(this, &out);
if ( out.isAccepted() ) if ( out.isAccepted() )
{ {
if ( next == this ) if ( next == this )
return false; return false;
next->setFocus(); next->setFocus();
FFocusEvent in (FocusIn_Event); FFocusEvent in (fc::FocusIn_Event);
in.setFocusType(FocusNextWidget); in.setFocusType(fc::FocusNextWidget);
FApplication::sendEvent(next, &in); FApplication::sendEvent(next, &in);
if ( in.isAccepted() ) if ( in.isAccepted() )
{ {
@ -776,16 +776,16 @@ bool FWidget::focusPrevChild(void)
|| ! prev->acceptFocus() || ! prev->acceptFocus()
|| ! prev->isVisible() || ! prev->isVisible()
|| prev->isWindow() ); || prev->isWindow() );
FFocusEvent out (FocusOut_Event); FFocusEvent out (fc::FocusOut_Event);
out.setFocusType(FocusPreviousWidget); out.setFocusType(fc::FocusPreviousWidget);
FApplication::sendEvent(this, &out); FApplication::sendEvent(this, &out);
if ( out.isAccepted() ) if ( out.isAccepted() )
{ {
if ( prev == this ) if ( prev == this )
return false; return false;
prev->setFocus(); prev->setFocus();
FFocusEvent in (FocusIn_Event); FFocusEvent in (fc::FocusIn_Event);
in.setFocusType(FocusPreviousWidget); in.setFocusType(fc::FocusPreviousWidget);
FApplication::sendEvent(prev, &in); FApplication::sendEvent(prev, &in);
if ( in.isAccepted() ) if ( in.isAccepted() )
{ {
@ -929,7 +929,7 @@ int FWidget::numOfFocusableChildren()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FWidget::close() bool FWidget::close()
{ {
FCloseEvent ev(Close_Event); FCloseEvent ev(fc::Close_Event);
FApplication::sendEvent(this, &ev); FApplication::sendEvent(this, &ev);
if ( ev.isAccepted() ) if ( ev.isAccepted() )
@ -1308,7 +1308,7 @@ void FWidget::show()
show_root_widget = 0; show_root_widget = 0;
} }
FShowEvent show_ev (Show_Event); FShowEvent show_ev (fc::Show_Event);
FApplication::sendEvent(this, &show_ev); FApplication::sendEvent(this, &show_ev);
} }
@ -1328,7 +1328,7 @@ void FWidget::hide()
FWidget::setFocusWidget(parentWidget()); FWidget::setFocusWidget(parentWidget());
} }
} }
FHideEvent hide_ev (Hide_Event); FHideEvent hide_ev (fc::Hide_Event);
FApplication::sendEvent(this, &hide_ev); FApplication::sendEvent(this, &hide_ev);
} }
} }

View File

@ -28,19 +28,19 @@ bool FWindow::event (FEvent* ev)
{ {
switch ( ev->type() ) switch ( ev->type() )
{ {
case WindowActive_Event: case fc::WindowActive_Event:
onWindowActive (ev); onWindowActive (ev);
break; break;
case WindowInactive_Event: case fc::WindowInactive_Event:
onWindowInactive (ev); onWindowInactive (ev);
break; break;
case WindowRaised_Event: case fc::WindowRaised_Event:
onWindowRaised (ev); onWindowRaised (ev);
break; break;
case WindowLowered_Event: case fc::WindowLowered_Event:
onWindowLowered (ev); onWindowLowered (ev);
break; break;
@ -247,7 +247,7 @@ bool FWindow::raiseWindow (FWidget* obj)
{ {
window_list->erase (iter); window_list->erase (iter);
window_list->push_back (obj); window_list->push_back (obj);
FEvent ev(WindowRaised_Event); FEvent ev(fc::WindowRaised_Event);
FApplication::sendEvent(obj, &ev); FApplication::sendEvent(obj, &ev);
return true; return true;
} }
@ -280,7 +280,7 @@ bool FWindow::lowerWindow (FWidget* obj)
{ {
window_list->erase (iter); window_list->erase (iter);
window_list->insert (window_list->begin(), obj); window_list->insert (window_list->begin(), obj);
FEvent ev(WindowLowered_Event); FEvent ev(fc::WindowLowered_Event);
FApplication::sendEvent(obj, &ev); FApplication::sendEvent(obj, &ev);
return true; return true;
} }
@ -309,7 +309,7 @@ void FWindow::setActiveWindow (FWindow* window)
if ( ! window->isActiveWindow() ) if ( ! window->isActiveWindow() )
{ {
window->activateWindow(); window->activateWindow();
FEvent ev(WindowActive_Event); FEvent ev(fc::WindowActive_Event);
FApplication::sendEvent(window, &ev); FApplication::sendEvent(window, &ev);
} }
} }
@ -319,7 +319,7 @@ void FWindow::setActiveWindow (FWindow* window)
if ( w->isActiveWindow() ) if ( w->isActiveWindow() )
{ {
w->deactivateWindow(); w->deactivateWindow();
FEvent ev(WindowInactive_Event); FEvent ev(fc::WindowInactive_Event);
FApplication::sendEvent(*iter, &ev); FApplication::sendEvent(*iter, &ev);
} }
} }

View File

@ -515,7 +515,7 @@ void Calc::onKeyPress (FKeyEvent* ev)
case fc::Fkey_escape: case fc::Fkey_escape:
case fc::Fkey_escape_mintty: case fc::Fkey_escape_mintty:
{ {
FAccelEvent a_ev(Accelerator_Event, getFocusWidget()); FAccelEvent a_ev(fc::Accelerator_Event, getFocusWidget());
calculator_buttons[On]->onAccel(&a_ev); calculator_buttons[On]->onAccel(&a_ev);
} }
ev->accept(); ev->accept();

View File

@ -88,9 +88,9 @@ void AttribDlg::onWheel (FWheelEvent* ev)
{ {
int wheel = ev->getWheel(); int wheel = ev->getWheel();
if ( wheel == WheelUp ) if ( wheel == fc::WheelUp )
cb_next(); cb_next();
else if ( wheel == WheelDown ) else if ( wheel == fc::WheelDown )
cb_back(); cb_back();
} }
@ -135,6 +135,10 @@ void AttribDlg::adjustSize()
{ {
int x = ((parentWidget()->getWidth() - getWidth()) / 2 ); int x = ((parentWidget()->getWidth() - getWidth()) / 2 );
int y = ((parentWidget()->getHeight() - getHeight()) / 2 ) + 1; int y = ((parentWidget()->getHeight() - getHeight()) / 2 ) + 1;
if ( x < 1 )
x = 1;
if ( y < 1 )
y = 1;
setGeometry(x, y, 69, 21, false); setGeometry(x, y, 69, 21, false);
next_button->setGeometry(getWidth()-13, getHeight()-4, 10, 1, false); next_button->setGeometry(getWidth()-13, getHeight()-4, 10, 1, false);
@ -339,8 +343,12 @@ void AttribDemo::draw()
if ( ! isMonochron() ) if ( ! isMonochron() )
setColor(wc.label_fg, wc.label_bg); setColor(wc.label_fg, wc.label_bg);
gotoxy (xpos + xmin - 1, ypos + ymin + 13); gotoxy (xpos + xmin - 1, ypos + ymin + 13);
printf ( " Background color: %d ", short bg = static_cast<AttribDlg*>(getParent())->bgcolor;
static_cast<AttribDlg*>(getParent())->bgcolor ); print (" Background color:");
if ( bg == fc::Default )
print (" default");
else
printf ( " %d", bg);
gotoxy (xpos + xmin + 14, ypos + ymin + 15); gotoxy (xpos + xmin + 14, ypos + ymin + 15);
print ("Change background color ->"); print ("Change background color ->");