Some code optimizations
This commit is contained in:
parent
fea7624124
commit
89f6d718f3
|
@ -1,5 +1,8 @@
|
||||||
|
2015-09-20 Markus Gans <guru.mail@muenster.de>
|
||||||
|
* Some code optimizations
|
||||||
|
|
||||||
2015-09-18 Markus Gans <guru.mail@muenster.de>
|
2015-09-18 Markus Gans <guru.mail@muenster.de>
|
||||||
* fixed compile error on 32-bit architectures
|
* Fixed compile error on 32-bit architectures
|
||||||
|
|
||||||
2015-08-08 Markus Gans <guru.mail@muenster.de>
|
2015-08-08 Markus Gans <guru.mail@muenster.de>
|
||||||
* Bug fix in FDialog (use GlobalPos to move)
|
* Bug fix in FDialog (use GlobalPos to move)
|
||||||
|
|
|
@ -85,7 +85,7 @@ endif
|
||||||
# $@ = name of the targets
|
# $@ = name of the targets
|
||||||
# $< = the first dependency
|
# $< = the first dependency
|
||||||
.cpp.o:
|
.cpp.o:
|
||||||
$(CXX) -c $(CCXFLAGS) -fpic -o $@ $<
|
$(CXX) -c $(CCXFLAGS) $(INCLUDES) -fpic -o $@ $<
|
||||||
|
|
||||||
all: dep $(OBJS)
|
all: dep $(OBJS)
|
||||||
$(CXX) $(CCXFLAGS) $(INCLUDES) $(LDFLAGS) -shared -Wl,-soname,$(LIB).$(MAJOR) -o $(LIB).$(VERSION) $(OBJS)
|
$(CXX) $(CCXFLAGS) $(INCLUDES) $(LDFLAGS) -shared -Wl,-soname,$(LIB).$(MAJOR) -o $(LIB).$(VERSION) $(OBJS)
|
||||||
|
@ -125,7 +125,7 @@ clean:
|
||||||
$(RM) $(LIB)* $(OBJS) .depend *.gch *.plist *~
|
$(RM) $(LIB)* $(OBJS) .depend *.gch *.plist *~
|
||||||
|
|
||||||
dep:
|
dep:
|
||||||
$(CXX) -MM *.cpp >.depend
|
$(CXX) $(INCLUDES) -MM *.cpp >.depend
|
||||||
|
|
||||||
#
|
#
|
||||||
# include .depend if it exists
|
# include .depend if it exists
|
||||||
|
|
|
@ -85,7 +85,7 @@ endif
|
||||||
# $@ = name of the targets
|
# $@ = name of the targets
|
||||||
# $< = the first dependency
|
# $< = the first dependency
|
||||||
.cpp.o:
|
.cpp.o:
|
||||||
$(CXX) -c $(CCXFLAGS) -fpic -o $@ $<
|
$(CXX) -c $(CCXFLAGS) $(INCLUDES) -fpic -o $@ $<
|
||||||
|
|
||||||
all: dep $(OBJS)
|
all: dep $(OBJS)
|
||||||
$(CXX) $(CCXFLAGS) $(INCLUDES) $(LDFLAGS) -shared -Wl,-soname,$(LIB).$(MAJOR) -o $(LIB).$(VERSION) $(OBJS)
|
$(CXX) $(CCXFLAGS) $(INCLUDES) $(LDFLAGS) -shared -Wl,-soname,$(LIB).$(MAJOR) -o $(LIB).$(VERSION) $(OBJS)
|
||||||
|
@ -125,7 +125,7 @@ clean:
|
||||||
$(RM) $(LIB)* $(OBJS) .depend *.prof *~
|
$(RM) $(LIB)* $(OBJS) .depend *.prof *~
|
||||||
|
|
||||||
dep:
|
dep:
|
||||||
$(CXX) -MM *.cpp >.depend
|
$(CXX) $(INCLUDES) -MM *.cpp >.depend
|
||||||
|
|
||||||
#
|
#
|
||||||
# include .depend if it exists
|
# include .depend if it exists
|
||||||
|
|
60
src/fapp.cpp
60
src/fapp.cpp
|
@ -27,7 +27,7 @@ std::deque<FApplication::eventPair>* FApplication::event_queue = 0;
|
||||||
|
|
||||||
// constructors and destructor
|
// constructors and destructor
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FApplication::FApplication (int &argc, char* argv[])
|
FApplication::FApplication (int &_argc, char* _argv[])
|
||||||
{
|
{
|
||||||
assert ( ! rootObj
|
assert ( ! rootObj
|
||||||
&& "FApplication: There should be only one application object" );
|
&& "FApplication: There should be only one application object" );
|
||||||
|
@ -35,13 +35,13 @@ FApplication::FApplication (int &argc, char* argv[])
|
||||||
rootObj = this;
|
rootObj = this;
|
||||||
static char* empty = const_cast<char*>("");
|
static char* empty = const_cast<char*>("");
|
||||||
|
|
||||||
if ( argc == 0 || argv == 0 )
|
if ( _argc == 0 || _argv == 0 )
|
||||||
{
|
{
|
||||||
argc = 0;
|
_argc = 0;
|
||||||
argv = ∅
|
_argv = ∅
|
||||||
}
|
}
|
||||||
|
|
||||||
init(argc, argv);
|
init(_argc, _argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -57,10 +57,10 @@ FApplication::~FApplication() // destructor
|
||||||
|
|
||||||
// private methods of FApplication
|
// private methods of FApplication
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FApplication::init (int argc, char* argv[])
|
void FApplication::init (int _argc, char* _argv[])
|
||||||
{
|
{
|
||||||
app_argc = argc;
|
app_argc = _argc;
|
||||||
app_argv = argv;
|
app_argv = _argv;
|
||||||
|
|
||||||
// init keyboard values
|
// init keyboard values
|
||||||
key = 0;
|
key = 0;
|
||||||
|
@ -222,8 +222,12 @@ void FApplication::processKeyboardEvent()
|
||||||
case mouse_event:
|
case mouse_event:
|
||||||
gpmMouseEvent = true;
|
gpmMouseEvent = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case keyboard_event:
|
case keyboard_event:
|
||||||
isKeyPressed = true;
|
isKeyPressed = true;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -386,8 +390,8 @@ bool FApplication::parseX11Mouse()
|
||||||
button_down = 0x61
|
button_down = 0x61
|
||||||
};
|
};
|
||||||
|
|
||||||
x = uChar(x11_mouse[1]) - 0x20;
|
x = uChar(x11_mouse[1] - 0x20);
|
||||||
y = uChar(x11_mouse[2]) - 0x20;
|
y = uChar(x11_mouse[2] - 0x20);
|
||||||
newMousePosition.setPoint(x,y);
|
newMousePosition.setPoint(x,y);
|
||||||
memset(&b_state, 0x00, sizeof(b_state));
|
memset(&b_state, 0x00, sizeof(b_state));
|
||||||
|
|
||||||
|
@ -455,6 +459,9 @@ bool FApplication::parseX11Mouse()
|
||||||
case button3_pressed_move:
|
case button3_pressed_move:
|
||||||
b_state.right_button = Released;
|
b_state.right_button = Released;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -469,6 +476,9 @@ bool FApplication::parseX11Mouse()
|
||||||
time_mousepressed.tv_usec = 0;
|
time_mousepressed.tv_usec = 0;
|
||||||
b_state.wheel_down = Pressed;
|
b_state.wheel_down = Pressed;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if ( uChar(x11_mouse[1]) == mouse->getX() + 0x20
|
if ( uChar(x11_mouse[1]) == mouse->getX() + 0x20
|
||||||
&& uChar(x11_mouse[2]) == mouse->getY() + 0x20
|
&& uChar(x11_mouse[2]) == mouse->getY() + 0x20
|
||||||
|
@ -601,6 +611,9 @@ bool FApplication::parseSGRMouse()
|
||||||
time_mousepressed.tv_usec = 0;
|
time_mousepressed.tv_usec = 0;
|
||||||
b_state.wheel_down = Pressed;
|
b_state.wheel_down = Pressed;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // *p == released
|
else // *p == released
|
||||||
|
@ -621,6 +634,9 @@ bool FApplication::parseSGRMouse()
|
||||||
case button3_move:
|
case button3_move:
|
||||||
b_state.right_button = Released;
|
b_state.right_button = Released;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( *mouse == newMousePosition
|
if ( *mouse == newMousePosition
|
||||||
|
@ -783,6 +799,9 @@ bool FApplication::parseUrxvtMouse()
|
||||||
case button3_pressed_move:
|
case button3_pressed_move:
|
||||||
b_state.right_button = Released;
|
b_state.right_button = Released;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -797,6 +816,9 @@ bool FApplication::parseUrxvtMouse()
|
||||||
time_mousepressed.tv_usec = 0;
|
time_mousepressed.tv_usec = 0;
|
||||||
b_state.wheel_down = Pressed;
|
b_state.wheel_down = Pressed;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if ( *mouse == newMousePosition
|
if ( *mouse == newMousePosition
|
||||||
&& b_state.wheel_up != Pressed
|
&& b_state.wheel_up != Pressed
|
||||||
|
@ -864,6 +886,9 @@ bool FApplication::processGpmEvent()
|
||||||
b_state.middle_button = Released;
|
b_state.middle_button = Released;
|
||||||
if ( gpm_ev.buttons & GPM_B_RIGHT )
|
if ( gpm_ev.buttons & GPM_B_RIGHT )
|
||||||
b_state.right_button = Released;
|
b_state.right_button = Released;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
mouse->setPoint(gpm_ev.x, gpm_ev.y);
|
mouse->setPoint(gpm_ev.x, gpm_ev.y);
|
||||||
flush_out();
|
flush_out();
|
||||||
|
@ -877,7 +902,7 @@ bool FApplication::processGpmEvent()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FApplication::processMouseEvent()
|
void FApplication::processMouseEvent()
|
||||||
{
|
{
|
||||||
bool event = false;
|
bool Event = false;
|
||||||
|
|
||||||
#ifdef F_HAVE_LIBGPM
|
#ifdef F_HAVE_LIBGPM
|
||||||
if ( ! gpmMouseEvent
|
if ( ! gpmMouseEvent
|
||||||
|
@ -898,19 +923,19 @@ void FApplication::processMouseEvent()
|
||||||
|
|
||||||
#ifdef F_HAVE_LIBGPM
|
#ifdef F_HAVE_LIBGPM
|
||||||
if ( gpmMouseEvent )
|
if ( gpmMouseEvent )
|
||||||
event = processGpmEvent();
|
Event = processGpmEvent();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( x11_mouse[0] )
|
if ( x11_mouse[0] )
|
||||||
event = parseX11Mouse();
|
Event = parseX11Mouse();
|
||||||
|
|
||||||
if ( sgr_mouse[0] )
|
if ( sgr_mouse[0] )
|
||||||
event = parseSGRMouse();
|
Event = parseSGRMouse();
|
||||||
|
|
||||||
if ( urxvt_mouse[0] )
|
if ( urxvt_mouse[0] )
|
||||||
event = parseUrxvtMouse();
|
Event = parseUrxvtMouse();
|
||||||
|
|
||||||
if ( ! event )
|
if ( ! Event )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( ! clicked_widget
|
if ( ! clicked_widget
|
||||||
|
@ -1283,6 +1308,9 @@ bool FApplication::sendEvent(FObject* receiver, FEvent* event)
|
||||||
case FocusOut_Event:
|
case FocusOut_Event:
|
||||||
case Accelerator_Event:
|
case Accelerator_Event:
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ class FApplication : public FWidget
|
||||||
FApplication (const FApplication&); // Disabled copy constructor
|
FApplication (const FApplication&); // Disabled copy constructor
|
||||||
FApplication& operator = (const FApplication&); // and operator '='
|
FApplication& operator = (const FApplication&); // and operator '='
|
||||||
|
|
||||||
void init (int argc, char* argv[]);
|
void init (int _argc, char* _argv[]);
|
||||||
void cmd_options();
|
void cmd_options();
|
||||||
bool KeyPressed();
|
bool KeyPressed();
|
||||||
ssize_t readKey();
|
ssize_t readKey();
|
||||||
|
|
|
@ -104,8 +104,8 @@ void FButton::draw()
|
||||||
FString txt;
|
FString txt;
|
||||||
int d, i, j, x, mono_offset, margin;
|
int d, i, j, x, mono_offset, margin;
|
||||||
int length, hotkeypos, hotkey_offset, space;
|
int length, hotkeypos, hotkey_offset, space;
|
||||||
bool isActiveFocus, isActive, isFocus, isFlat;
|
bool is_ActiveFocus, is_Active, is_Focus, is_Flat;
|
||||||
bool isNonFlatShadow, isNoUnderline;
|
bool is_NonFlatShadow, is_NoUnderline;
|
||||||
|
|
||||||
if ( text.isNull() || text.isEmpty() )
|
if ( text.isNull() || text.isEmpty() )
|
||||||
return;
|
return;
|
||||||
|
@ -124,18 +124,18 @@ void FButton::draw()
|
||||||
src = const_cast<wchar_t*>(txt.wc_str());
|
src = const_cast<wchar_t*>(txt.wc_str());
|
||||||
dest = const_cast<wchar_t*>(ButtonText);
|
dest = const_cast<wchar_t*>(ButtonText);
|
||||||
|
|
||||||
isActiveFocus = (flags & (ACTIVE+FOCUS)) == (ACTIVE+FOCUS);
|
is_ActiveFocus = (flags & (ACTIVE+FOCUS)) == (ACTIVE+FOCUS);
|
||||||
isActive = ((flags & ACTIVE) != 0);
|
is_Active = ((flags & ACTIVE) != 0);
|
||||||
isFocus = ((flags & FOCUS) != 0);
|
is_Focus = ((flags & FOCUS) != 0);
|
||||||
isFlat = ((flags & FLAT) != 0);
|
is_Flat = isFlat();
|
||||||
isNonFlatShadow = ((flags & (SHADOW+FLAT)) == SHADOW);
|
is_NonFlatShadow = ((flags & (SHADOW+FLAT)) == SHADOW);
|
||||||
isNoUnderline = ((flags & NO_UNDERLINE) != 0);
|
is_NoUnderline = ((flags & NO_UNDERLINE) != 0);
|
||||||
|
|
||||||
setUpdateVTerm(false);
|
setUpdateVTerm(false);
|
||||||
if ( button_down && click_animation )
|
if ( button_down && click_animation )
|
||||||
{
|
{
|
||||||
// noshadow + indent one character to the right
|
// noshadow + indent one character to the right
|
||||||
if ( isFlat )
|
if ( is_Flat )
|
||||||
clearFlatBorder();
|
clearFlatBorder();
|
||||||
clearShadow();
|
clearShadow();
|
||||||
setColor ( parentWidget()->getForegroundColor(),
|
setColor ( parentWidget()->getForegroundColor(),
|
||||||
|
@ -150,10 +150,10 @@ void FButton::draw()
|
||||||
else
|
else
|
||||||
d = 0;
|
d = 0;
|
||||||
|
|
||||||
if ( ! isActive && isMonochron() )
|
if ( ! is_Active && isMonochron() )
|
||||||
space = fc::MediumShade; // ▒
|
space = fc::MediumShade; // ▒
|
||||||
|
|
||||||
if ( (isMonochron() || getMaxColor() < 16) && isActiveFocus )
|
if ( (isMonochron() || getMaxColor() < 16) && is_ActiveFocus )
|
||||||
{
|
{
|
||||||
txt = "<" + txt + ">";
|
txt = "<" + txt + ">";
|
||||||
length = int(txt.getLength());
|
length = int(txt.getLength());
|
||||||
|
@ -183,10 +183,10 @@ void FButton::draw()
|
||||||
else
|
else
|
||||||
margin = 0;
|
margin = 0;
|
||||||
|
|
||||||
if ( isMonochron() && (isActive || isFocus) )
|
if ( isMonochron() && (is_Active || is_Focus) )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
||||||
if ( isFlat )
|
if ( is_Flat )
|
||||||
{
|
{
|
||||||
if ( margin == 1 )
|
if ( margin == 1 )
|
||||||
{
|
{
|
||||||
|
@ -217,7 +217,7 @@ void FButton::draw()
|
||||||
|
|
||||||
if ( ! button_down
|
if ( ! button_down
|
||||||
&& ! isNewFont()
|
&& ! isNewFont()
|
||||||
&& (isFlat || ! hasShadow() || isMonochron()) )
|
&& (is_Flat || ! hasShadow() || isMonochron()) )
|
||||||
{
|
{
|
||||||
// clear the right █ from button down
|
// clear the right █ from button down
|
||||||
setColor ( parentWidget()->getForegroundColor(),
|
setColor ( parentWidget()->getForegroundColor(),
|
||||||
|
@ -257,18 +257,18 @@ void FButton::draw()
|
||||||
setCursorPos ( xpos+xmin-1+margin+i+hotkeypos,
|
setCursorPos ( xpos+xmin-1+margin+i+hotkeypos,
|
||||||
ypos+ymin-1+j ); // hotkey
|
ypos+ymin-1+j ); // hotkey
|
||||||
|
|
||||||
if ( isMonochron() && isActiveFocus )
|
if ( isMonochron() && is_ActiveFocus )
|
||||||
setBold();
|
setBold();
|
||||||
|
|
||||||
for (int z=0; x < i+length && z < width; z++,x++)
|
for (int z=0; x < i+length && z < width; z++,x++)
|
||||||
{
|
{
|
||||||
if ( (z == hotkeypos) && isActive )
|
if ( (z == hotkeypos) && is_Active )
|
||||||
{
|
{
|
||||||
setColor (button_hotkey_fg, button_bg);
|
setColor (button_hotkey_fg, button_bg);
|
||||||
if ( ! isNoUnderline )
|
if ( ! is_NoUnderline )
|
||||||
setUnderline();
|
setUnderline();
|
||||||
print ( ButtonText[z] );
|
print ( ButtonText[z] );
|
||||||
if ( ! isNoUnderline )
|
if ( ! is_NoUnderline )
|
||||||
unsetUnderline();
|
unsetUnderline();
|
||||||
setColor (button_fg, button_bg);
|
setColor (button_fg, button_bg);
|
||||||
}
|
}
|
||||||
|
@ -278,7 +278,7 @@ void FButton::draw()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isMonochron() && isActiveFocus )
|
if ( isMonochron() && is_ActiveFocus )
|
||||||
unsetBold();
|
unsetBold();
|
||||||
|
|
||||||
for (x=i+length; x < width-1; x++)
|
for (x=i+length; x < width-1; x++)
|
||||||
|
@ -303,7 +303,7 @@ void FButton::draw()
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(false);
|
setReverse(false);
|
||||||
|
|
||||||
if ( isNonFlatShadow && ! button_down )
|
if ( is_NonFlatShadow && ! button_down )
|
||||||
{
|
{
|
||||||
setColor ( parentWidget()->getForegroundColor(),
|
setColor ( parentWidget()->getForegroundColor(),
|
||||||
parentWidget()->getBackgroundColor() );
|
parentWidget()->getBackgroundColor() );
|
||||||
|
@ -314,7 +314,7 @@ void FButton::draw()
|
||||||
setUpdateVTerm(true);
|
setUpdateVTerm(true);
|
||||||
delete[] ButtonText;
|
delete[] ButtonText;
|
||||||
|
|
||||||
if ( isFocus && statusBar() )
|
if ( is_Focus && statusBar() )
|
||||||
{
|
{
|
||||||
FString msg = getStatusbarMessage();
|
FString msg = getStatusbarMessage();
|
||||||
FString curMsg = statusBar()->getMessage();
|
FString curMsg = statusBar()->getMessage();
|
||||||
|
@ -527,14 +527,14 @@ bool FButton::setDown (bool on)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FButton::onKeyPress (FKeyEvent* event)
|
void FButton::onKeyPress (FKeyEvent* ev)
|
||||||
{
|
{
|
||||||
int key;
|
int key;
|
||||||
|
|
||||||
if ( ! isEnabled() )
|
if ( ! isEnabled() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
key = event->key();
|
key = ev->key();
|
||||||
|
|
||||||
switch ( key )
|
switch ( key )
|
||||||
{
|
{
|
||||||
|
@ -547,15 +547,18 @@ void FButton::onKeyPress (FKeyEvent* event)
|
||||||
addTimer(click_time);
|
addTimer(click_time);
|
||||||
}
|
}
|
||||||
processClick();
|
processClick();
|
||||||
event->accept();
|
ev->accept();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FButton::onMouseDown (FMouseEvent* event)
|
void FButton::onMouseDown (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
if ( event->getButton() != LeftButton )
|
if ( ev->getButton() != LeftButton )
|
||||||
{
|
{
|
||||||
setUp();
|
setUp();
|
||||||
return;
|
return;
|
||||||
|
@ -572,32 +575,32 @@ void FButton::onMouseDown (FMouseEvent* event)
|
||||||
if ( statusBar() )
|
if ( statusBar() )
|
||||||
statusBar()->drawMessage();
|
statusBar()->drawMessage();
|
||||||
}
|
}
|
||||||
FPoint gPos = event->getGlobalPos();
|
FPoint gPos = ev->getGlobalPos();
|
||||||
if ( getGeometryGlobal().contains(gPos) )
|
if ( getGeometryGlobal().contains(gPos) )
|
||||||
setDown();
|
setDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FButton::onMouseUp (FMouseEvent* event)
|
void FButton::onMouseUp (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
if ( event->getButton() != LeftButton )
|
if ( ev->getButton() != LeftButton )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( button_down )
|
if ( button_down )
|
||||||
{
|
{
|
||||||
setUp();
|
setUp();
|
||||||
if ( getGeometryGlobal().contains(event->getGlobalPos()) )
|
if ( getGeometryGlobal().contains(ev->getGlobalPos()) )
|
||||||
processClick();
|
processClick();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FButton::onMouseMove (FMouseEvent* event)
|
void FButton::onMouseMove (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
if ( event->getButton() != LeftButton )
|
if ( ev->getButton() != LeftButton )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FPoint gPos = event->getGlobalPos();
|
FPoint gPos = ev->getGlobalPos();
|
||||||
if ( click_animation )
|
if ( click_animation )
|
||||||
{
|
{
|
||||||
if ( getGeometryGlobal().contains(gPos) )
|
if ( getGeometryGlobal().contains(gPos) )
|
||||||
|
@ -615,13 +618,13 @@ void FButton::onTimer (FTimerEvent* ev)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FButton::onAccel (FAccelEvent* event)
|
void FButton::onAccel (FAccelEvent* ev)
|
||||||
{
|
{
|
||||||
if ( isEnabled() )
|
if ( isEnabled() )
|
||||||
{
|
{
|
||||||
if ( ! hasFocus() )
|
if ( ! hasFocus() )
|
||||||
{
|
{
|
||||||
FWidget* focused_widget = static_cast<FWidget*>(event->focusedWidget());
|
FWidget* focused_widget = static_cast<FWidget*>(ev->focusedWidget());
|
||||||
FFocusEvent out (FocusOut_Event);
|
FFocusEvent out (FocusOut_Event);
|
||||||
FApplication::queueEvent(focused_widget, &out);
|
FApplication::queueEvent(focused_widget, &out);
|
||||||
setFocus();
|
setFocus();
|
||||||
|
@ -640,7 +643,7 @@ void FButton::onAccel (FAccelEvent* event)
|
||||||
addTimer(click_time);
|
addTimer(click_time);
|
||||||
|
|
||||||
processClick();
|
processClick();
|
||||||
event->accept();
|
ev->accept();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -430,9 +430,9 @@ bool FButtonGroup::hasCheckedButton()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FButtonGroup::onMouseDown (FMouseEvent* event)
|
void FButtonGroup::onMouseDown (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
if ( event->getButton() != LeftButton )
|
if ( ev->getButton() != LeftButton )
|
||||||
return;
|
return;
|
||||||
directFocus();
|
directFocus();
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,7 @@ static uInt character[][fc::NUM_OF_ENCODINGS] =
|
||||||
{0x1afb, 0, 0xfb, 0} // ✓ - NF_check_mark
|
{0x1afb, 0, 0xfb, 0} // ✓ - NF_check_mark
|
||||||
};
|
};
|
||||||
|
|
||||||
const int lastCharItem = (sizeof(character) / sizeof(character[0])) - 1;
|
const int lastCharItem = int(sizeof(character) / sizeof(character[0])) - 1;
|
||||||
|
|
||||||
|
|
||||||
static int vt100_key_to_utf8[][2] =
|
static int vt100_key_to_utf8[][2] =
|
||||||
|
@ -154,7 +154,7 @@ static int vt100_key_to_utf8[][2] =
|
||||||
{fc::vt100_key_diamond , fc::Bullet} // ◆
|
{fc::vt100_key_diamond , fc::Bullet} // ◆
|
||||||
};
|
};
|
||||||
|
|
||||||
const int lastKeyItem = ( sizeof(vt100_key_to_utf8) /
|
const int lastKeyItem = int ( sizeof(vt100_key_to_utf8) /
|
||||||
sizeof(vt100_key_to_utf8[0]) ) - 1;
|
sizeof(vt100_key_to_utf8[0]) ) - 1;
|
||||||
|
|
||||||
|
|
||||||
|
@ -290,7 +290,8 @@ static uInt cp437_to_ucs[][2] =
|
||||||
{0xff, 0x00a0} // no-break space
|
{0xff, 0x00a0} // no-break space
|
||||||
};
|
};
|
||||||
|
|
||||||
const uInt lastCP437Item = (sizeof(cp437_to_ucs) / sizeof(cp437_to_ucs[0])) - 1;
|
const uInt lastCP437Item = uInt ( sizeof(cp437_to_ucs) /
|
||||||
|
sizeof(cp437_to_ucs[0]) ) - 1;
|
||||||
|
|
||||||
|
|
||||||
#endif // _FCHARMAP_H
|
#endif // _FCHARMAP_H
|
||||||
|
|
|
@ -94,7 +94,7 @@ void FDialog::init()
|
||||||
createArea (vwin);
|
createArea (vwin);
|
||||||
setGeometry (1, 1, 10, 10, false); // initialize geometry values
|
setGeometry (1, 1, 10, 10, false); // initialize geometry values
|
||||||
focus_widget = 0;
|
focus_widget = 0;
|
||||||
this->text = "";
|
this->tb_text = "";
|
||||||
maximized = false;
|
maximized = false;
|
||||||
ignore_padding = true;
|
ignore_padding = true;
|
||||||
window_object = true;
|
window_object = true;
|
||||||
|
@ -185,7 +185,7 @@ void FDialog::drawBorder()
|
||||||
void FDialog::drawTitleBar()
|
void FDialog::drawTitleBar()
|
||||||
{
|
{
|
||||||
int i,x;
|
int i,x;
|
||||||
uInt length = text.getLength();
|
uInt length = tb_text.getLength();
|
||||||
|
|
||||||
// draw the title button
|
// draw the title button
|
||||||
gotoxy (xpos+xmin-1, ypos+ymin-1);
|
gotoxy (xpos+xmin-1, ypos+ymin-1);
|
||||||
|
@ -215,7 +215,7 @@ void FDialog::drawTitleBar()
|
||||||
print (' ');
|
print (' ');
|
||||||
|
|
||||||
// the title bar text
|
// the title bar text
|
||||||
print (text);
|
print (tb_text);
|
||||||
|
|
||||||
// fill the rest of the bar
|
// fill the rest of the bar
|
||||||
for (; x+1+int(length) <= width-2; x++)
|
for (; x+1+int(length) <= width-2; x++)
|
||||||
|
@ -369,23 +369,23 @@ void FDialog::onHide (FHideEvent*)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::onClose (FCloseEvent* event)
|
void FDialog::onClose (FCloseEvent* ev)
|
||||||
{
|
{
|
||||||
event->accept();
|
ev->accept();
|
||||||
result_code = FDialog::Reject;
|
result_code = FDialog::Reject;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public methods of FDialog
|
// public methods of FDialog
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::onKeyPress (FKeyEvent* event)
|
void FDialog::onKeyPress (FKeyEvent* ev)
|
||||||
{
|
{
|
||||||
if ( ! isEnabled() || this == getMainWidget() )
|
if ( ! isEnabled() || this == getMainWidget() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( event->key() == fc::Fkey_escape
|
if ( ev->key() == fc::Fkey_escape
|
||||||
|| event->key() == fc::Fkey_escape_mintty )
|
|| ev->key() == fc::Fkey_escape_mintty )
|
||||||
{
|
{
|
||||||
event->accept();
|
ev->accept();
|
||||||
if ( isModal() )
|
if ( isModal() )
|
||||||
done (FDialog::Reject);
|
done (FDialog::Reject);
|
||||||
else
|
else
|
||||||
|
@ -394,16 +394,16 @@ void FDialog::onKeyPress (FKeyEvent* event)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::onMouseDown (FMouseEvent* event)
|
void FDialog::onMouseDown (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
int mouse_x = event->getX();
|
int mouse_x = ev->getX();
|
||||||
int mouse_y = event->getY();
|
int mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( event->getButton() == LeftButton )
|
if ( ev->getButton() == 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 )
|
||||||
TitleBarClickPos.setPoint (event->getGlobalX(), event->getGlobalY());
|
TitleBarClickPos.setPoint (ev->getGlobalX(), ev->getGlobalY());
|
||||||
else
|
else
|
||||||
TitleBarClickPos.setPoint (0,0);
|
TitleBarClickPos.setPoint (0,0);
|
||||||
|
|
||||||
|
@ -428,7 +428,7 @@ void FDialog::onMouseDown (FMouseEvent* event)
|
||||||
redraw();
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( event->getButton() == RightButton )
|
if ( ev->getButton() == 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 )
|
||||||
|
@ -451,7 +451,7 @@ void FDialog::onMouseDown (FMouseEvent* event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( event->getButton() == MiddleButton )
|
if ( ev->getButton() == 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 )
|
||||||
|
@ -481,12 +481,12 @@ void FDialog::onMouseDown (FMouseEvent* event)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::onMouseUp (FMouseEvent* event)
|
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 ( event->getButton() == LeftButton )
|
if ( ev->getButton() == LeftButton )
|
||||||
{
|
{
|
||||||
if ( ! TitleBarClickPos.isNull()
|
if ( ! TitleBarClickPos.isNull()
|
||||||
&& titlebar_x >= xpos+xmin+3
|
&& titlebar_x >= xpos+xmin+3
|
||||||
|
@ -494,41 +494,41 @@ void FDialog::onMouseUp (FMouseEvent* event)
|
||||||
&& titlebar_y == ypos+ymin-1 )
|
&& titlebar_y == ypos+ymin-1 )
|
||||||
{
|
{
|
||||||
FPoint currentPos(getGeometry().getX(), getGeometry().getY());
|
FPoint currentPos(getGeometry().getX(), getGeometry().getY());
|
||||||
FPoint deltaPos = event->getGlobalPos() - TitleBarClickPos;
|
FPoint deltaPos = ev->getGlobalPos() - TitleBarClickPos;
|
||||||
move (currentPos + deltaPos);
|
move (currentPos + deltaPos);
|
||||||
TitleBarClickPos = event->getGlobalPos();
|
TitleBarClickPos = ev->getGlobalPos();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::onMouseMove (FMouseEvent* event)
|
void FDialog::onMouseMove (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
if ( event->getButton() == LeftButton )
|
if ( ev->getButton() == LeftButton )
|
||||||
{
|
{
|
||||||
if ( ! TitleBarClickPos.isNull() )
|
if ( ! TitleBarClickPos.isNull() )
|
||||||
{
|
{
|
||||||
FPoint currentPos(getGeometry().getX(), getGeometry().getY());
|
FPoint currentPos(getGeometry().getX(), getGeometry().getY());
|
||||||
FPoint deltaPos = event->getGlobalPos() - TitleBarClickPos;
|
FPoint deltaPos = ev->getGlobalPos() - TitleBarClickPos;
|
||||||
move (currentPos + deltaPos);
|
move (currentPos + deltaPos);
|
||||||
TitleBarClickPos = event->getGlobalPos();
|
TitleBarClickPos = ev->getGlobalPos();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::onMouseDoubleClick (FMouseEvent* event)
|
void FDialog::onMouseDoubleClick (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
if ( event->getButton() != LeftButton )
|
if ( ev->getButton() != LeftButton )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
x = xpos + xmin - 1;
|
x = xpos + xmin - 1;
|
||||||
y = ypos + ymin - 1;
|
y = ypos + ymin - 1;
|
||||||
FRect title_button(x, y, 3, 1);
|
FRect title_button(x, y, 3, 1);
|
||||||
|
|
||||||
FPoint gPos = event->getGlobalPos();
|
FPoint gPos = ev->getGlobalPos();
|
||||||
if ( title_button.contains(gPos) )
|
if ( title_button.contains(gPos) )
|
||||||
{
|
{
|
||||||
setClickedWidget(0);
|
setClickedWidget(0);
|
||||||
|
|
|
@ -24,7 +24,7 @@ class FDialog : public FWindow
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FString text;
|
FString tb_text;
|
||||||
int result_code;
|
int result_code;
|
||||||
bool maximized;
|
bool maximized;
|
||||||
FPoint TitleBarClickPos;
|
FPoint TitleBarClickPos;
|
||||||
|
@ -181,10 +181,10 @@ inline bool FDialog::hasShadow()
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FDialog::setText (FString txt)
|
inline void FDialog::setText (FString txt)
|
||||||
{ this->text = txt; }
|
{ this->tb_text = txt; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FString FDialog::getText() const
|
inline FString FDialog::getText() const
|
||||||
{ return this->text; }
|
{ return this->tb_text; }
|
||||||
|
|
||||||
#endif // _FDIALOG_H
|
#endif // _FDIALOG_H
|
||||||
|
|
152
src/fevent.cpp
152
src/fevent.cpp
|
@ -10,11 +10,15 @@
|
||||||
// class FKeyEvent
|
// class FKeyEvent
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
FKeyEvent::FKeyEvent(int type, int key) : FEvent(type) // constructor
|
FKeyEvent::FKeyEvent(int ev_type, int key_num) // constructor
|
||||||
{
|
: FEvent(ev_type)
|
||||||
k = key;
|
, k(key_num)
|
||||||
accpt = false;
|
, accpt(false)
|
||||||
}
|
{ }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
FKeyEvent::~FKeyEvent() // destructor
|
||||||
|
{ }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FKeyEvent::key() const
|
int FKeyEvent::key() const
|
||||||
|
@ -37,24 +41,28 @@ void FKeyEvent::ignore()
|
||||||
// class FMouseEvent
|
// class FMouseEvent
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
FMouseEvent::FMouseEvent (int type, // constructor
|
FMouseEvent::FMouseEvent ( int ev_type, // constructor
|
||||||
const FPoint& pos,
|
const FPoint& pos,
|
||||||
int button) : FEvent(type),
|
int button )
|
||||||
p(pos),
|
: FEvent(ev_type)
|
||||||
b(button)
|
, p(pos)
|
||||||
{
|
, b(button)
|
||||||
}
|
{ }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FMouseEvent::FMouseEvent (int type, // constructor
|
FMouseEvent::FMouseEvent ( int ev_type, // constructor
|
||||||
const FPoint& pos,
|
const FPoint& pos,
|
||||||
const FPoint& globalPos,
|
const FPoint& globalPos,
|
||||||
int button) : FEvent(type),
|
int button )
|
||||||
p(pos),
|
: FEvent(ev_type)
|
||||||
g(globalPos),
|
, p(pos)
|
||||||
b(button)
|
, g(globalPos)
|
||||||
{
|
, b(button)
|
||||||
}
|
{ }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
FMouseEvent::~FMouseEvent() // destructor
|
||||||
|
{ }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
const FPoint& FMouseEvent::getPos() const
|
const FPoint& FMouseEvent::getPos() const
|
||||||
|
@ -89,24 +97,28 @@ int FMouseEvent::getButton() const
|
||||||
// class FWheelEvent
|
// class FWheelEvent
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
FWheelEvent::FWheelEvent (int type, // constructor
|
FWheelEvent::FWheelEvent ( int ev_type, // constructor
|
||||||
const FPoint& pos,
|
const FPoint& pos,
|
||||||
int wheel) : FEvent(type),
|
int wheel )
|
||||||
p(pos),
|
: FEvent(ev_type)
|
||||||
w(wheel)
|
, p(pos)
|
||||||
{
|
, w(wheel)
|
||||||
}
|
{ }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FWheelEvent::FWheelEvent (int type, // constructor
|
FWheelEvent::FWheelEvent (int ev_type, // constructor
|
||||||
const FPoint& pos,
|
const FPoint& pos,
|
||||||
const FPoint& globalPos,
|
const FPoint& globalPos,
|
||||||
int wheel) : FEvent(type),
|
int wheel)
|
||||||
p(pos),
|
: FEvent(ev_type)
|
||||||
g(globalPos),
|
, p(pos)
|
||||||
w(wheel)
|
, g(globalPos)
|
||||||
{
|
, w(wheel)
|
||||||
}
|
{ }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
FWheelEvent::~FWheelEvent() // destructor
|
||||||
|
{ }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
const FPoint& FWheelEvent::getPos() const
|
const FPoint& FWheelEvent::getPos() const
|
||||||
|
@ -141,11 +153,15 @@ int FWheelEvent::getWheel() const
|
||||||
// class FFocusEvent
|
// class FFocusEvent
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
FFocusEvent::FFocusEvent (int type) : FEvent(type) // constructor
|
FFocusEvent::FFocusEvent (int ev_type) // constructor
|
||||||
{
|
: FEvent(ev_type)
|
||||||
accpt = true;
|
, accpt(true)
|
||||||
focus_type = FocusDefiniteWidget;
|
, focus_type(FocusDefiniteWidget)
|
||||||
}
|
{ }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
FFocusEvent::~FFocusEvent() // destructor
|
||||||
|
{ }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FFocusEvent::gotFocus() const
|
bool FFocusEvent::gotFocus() const
|
||||||
|
@ -184,11 +200,15 @@ void FFocusEvent::ignore()
|
||||||
// class FAccelEvent
|
// class FAccelEvent
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
FAccelEvent::FAccelEvent(int type, void* focused) : FEvent(type) // constructor
|
FAccelEvent::FAccelEvent(int ev_type, void* focused) // constructor
|
||||||
{
|
: FEvent(ev_type)
|
||||||
focus_widget = focused;
|
, accpt(false)
|
||||||
accpt = false;
|
, focus_widget(focused)
|
||||||
}
|
{ }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
FAccelEvent::~FAccelEvent() // destructor
|
||||||
|
{ }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void* FAccelEvent::focusedWidget() const
|
void* FAccelEvent::focusedWidget() const
|
||||||
|
@ -211,8 +231,14 @@ void FAccelEvent::ignore()
|
||||||
// class FResizeEvent
|
// class FResizeEvent
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
FResizeEvent::FResizeEvent(int type) : FEvent(type) // constructor
|
FResizeEvent::FResizeEvent(int ev_type) // constructor
|
||||||
{ accpt = false; }
|
: FEvent(ev_type)
|
||||||
|
, accpt(false)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
FResizeEvent::~FResizeEvent() // destructor
|
||||||
|
{ }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FResizeEvent::isAccepted() const
|
bool FResizeEvent::isAccepted() const
|
||||||
|
@ -231,24 +257,38 @@ void FResizeEvent::ignore()
|
||||||
// class FShowEvent
|
// class FShowEvent
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
FShowEvent::FShowEvent(int type) : FEvent(type) // constructor
|
FShowEvent::FShowEvent(int ev_type) // constructor
|
||||||
{
|
: FEvent(ev_type)
|
||||||
}
|
{ }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
FShowEvent::~FShowEvent() // destructor
|
||||||
|
{ }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// class FHideEvent
|
// class FHideEvent
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
FHideEvent::FHideEvent(int type) : FEvent(type) // constructor
|
FHideEvent::FHideEvent(int ev_type) // constructor
|
||||||
{
|
: FEvent(ev_type)
|
||||||
}
|
{ }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
FHideEvent::~FHideEvent() // destructor
|
||||||
|
{ }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// class FCloseEvent
|
// class FCloseEvent
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
FCloseEvent::FCloseEvent(int type) : FEvent(type) // constructor
|
FCloseEvent::FCloseEvent(int ev_type) // constructor
|
||||||
{ accpt = false; }
|
: FEvent(ev_type)
|
||||||
|
, accpt(false)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
FCloseEvent::~FCloseEvent() // destructor
|
||||||
|
{ }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FCloseEvent::isAccepted() const
|
bool FCloseEvent::isAccepted() const
|
||||||
|
@ -267,8 +307,14 @@ void FCloseEvent::ignore()
|
||||||
// class FTimerEvent
|
// class FTimerEvent
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
FTimerEvent::FTimerEvent(int type, int timer_id) : FEvent(type) // constructor
|
FTimerEvent::FTimerEvent(int ev_type, int timer_id) // constructor
|
||||||
{ id = timer_id; }
|
: FEvent(ev_type)
|
||||||
|
, id(timer_id)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
FTimerEvent::~FTimerEvent() // destructor
|
||||||
|
{ }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FTimerEvent::timerId() const
|
int FTimerEvent::timerId() const
|
||||||
|
|
27
src/fevent.h
27
src/fevent.h
|
@ -53,12 +53,13 @@ class FEvent // event base class
|
||||||
|
|
||||||
// FEvent inline functions
|
// FEvent inline functions
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FEvent::FEvent(int type) // constructor
|
inline FEvent::FEvent(int ev_type) // constructor
|
||||||
{ t = type; }
|
: t(ev_type)
|
||||||
|
{ }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FEvent::~FEvent() // destructor
|
inline FEvent::~FEvent() // destructor
|
||||||
{}
|
{ }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FEvent::type() const
|
inline int FEvent::type() const
|
||||||
|
@ -76,6 +77,8 @@ class FKeyEvent : public FEvent // keyboard event
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FKeyEvent (int, int);
|
FKeyEvent (int, int);
|
||||||
|
~FKeyEvent();
|
||||||
|
|
||||||
int key() const;
|
int key() const;
|
||||||
bool isAccepted() const;
|
bool isAccepted() const;
|
||||||
void accept();
|
void accept();
|
||||||
|
@ -115,6 +118,7 @@ class FMouseEvent : public FEvent // mouse event
|
||||||
public:
|
public:
|
||||||
FMouseEvent (int, const FPoint&, int);
|
FMouseEvent (int, const FPoint&, int);
|
||||||
FMouseEvent (int, const FPoint&, const FPoint&, int);
|
FMouseEvent (int, const FPoint&, const FPoint&, int);
|
||||||
|
~FMouseEvent();
|
||||||
|
|
||||||
const FPoint& getPos() const;
|
const FPoint& getPos() const;
|
||||||
const FPoint& getGlobalPos() const;
|
const FPoint& getGlobalPos() const;
|
||||||
|
@ -149,11 +153,12 @@ enum WheelState // wheel state values
|
||||||
#pragma pack(push)
|
#pragma pack(push)
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
|
|
||||||
class FWheelEvent : public FEvent // mouse event
|
class FWheelEvent : public FEvent // wheel event
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FWheelEvent (int, const FPoint&, int);
|
FWheelEvent (int, const FPoint&, int);
|
||||||
FWheelEvent (int, const FPoint&, const FPoint&, int);
|
FWheelEvent (int, const FPoint&, const FPoint&, int);
|
||||||
|
~FWheelEvent();
|
||||||
|
|
||||||
const FPoint& getPos() const;
|
const FPoint& getPos() const;
|
||||||
const FPoint& getGlobalPos() const;
|
const FPoint& getGlobalPos() const;
|
||||||
|
@ -191,6 +196,8 @@ class FFocusEvent : public FEvent // focus event
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit FFocusEvent (int);
|
explicit FFocusEvent (int);
|
||||||
|
~FFocusEvent();
|
||||||
|
|
||||||
bool gotFocus() const;
|
bool gotFocus() const;
|
||||||
bool lostFocus() const;
|
bool lostFocus() const;
|
||||||
FocusTypes getFocusType() const;
|
FocusTypes getFocusType() const;
|
||||||
|
@ -218,14 +225,16 @@ class FAccelEvent : public FEvent // focus event
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FAccelEvent (int, void*);
|
FAccelEvent (int, void*);
|
||||||
|
~FAccelEvent();
|
||||||
|
|
||||||
void* focusedWidget() const;
|
void* focusedWidget() const;
|
||||||
bool isAccepted() const;
|
bool isAccepted() const;
|
||||||
void accept();
|
void accept();
|
||||||
void ignore();
|
void ignore();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void* focus_widget;
|
|
||||||
bool accpt;
|
bool accpt;
|
||||||
|
void* focus_widget;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define F_ACCEL_EVENT(x) ((FAccelEvent*)x)
|
#define F_ACCEL_EVENT(x) ((FAccelEvent*)x)
|
||||||
|
@ -240,6 +249,8 @@ class FResizeEvent : public FEvent // resize event
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit FResizeEvent (int);
|
explicit FResizeEvent (int);
|
||||||
|
~FResizeEvent();
|
||||||
|
|
||||||
bool isAccepted() const;
|
bool isAccepted() const;
|
||||||
void accept();
|
void accept();
|
||||||
void ignore();
|
void ignore();
|
||||||
|
@ -259,6 +270,7 @@ class FShowEvent : public FEvent // show event
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit FShowEvent (int);
|
explicit FShowEvent (int);
|
||||||
|
~FShowEvent();
|
||||||
};
|
};
|
||||||
|
|
||||||
#define F_SHOW_EVENT(x) ((FShowEvent*)x)
|
#define F_SHOW_EVENT(x) ((FShowEvent*)x)
|
||||||
|
@ -272,6 +284,7 @@ class FHideEvent : public FEvent // hide event
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit FHideEvent (int);
|
explicit FHideEvent (int);
|
||||||
|
~FHideEvent();
|
||||||
};
|
};
|
||||||
|
|
||||||
#define F_HIDE_EVENT(x) ((FHideEvent*)x)
|
#define F_HIDE_EVENT(x) ((FHideEvent*)x)
|
||||||
|
@ -285,6 +298,8 @@ class FCloseEvent : public FEvent // close event
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit FCloseEvent(int);
|
explicit FCloseEvent(int);
|
||||||
|
~FCloseEvent();
|
||||||
|
|
||||||
bool isAccepted() const;
|
bool isAccepted() const;
|
||||||
void accept();
|
void accept();
|
||||||
void ignore();
|
void ignore();
|
||||||
|
@ -307,6 +322,8 @@ class FTimerEvent : public FEvent // timer event
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FTimerEvent(int, int);
|
FTimerEvent(int, int);
|
||||||
|
~FTimerEvent();
|
||||||
|
|
||||||
int timerId() const;
|
int timerId() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -263,10 +263,12 @@ int FFileDialog::changeDir (const FString& dirname)
|
||||||
case -1:
|
case -1:
|
||||||
setPath(lastdir);
|
setPath(lastdir);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
case -2:
|
case -2:
|
||||||
setPath(lastdir);
|
setPath(lastdir);
|
||||||
readDir();
|
readDir();
|
||||||
return -2;
|
return -2;
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
if ( newdir == FString("..") )
|
if ( newdir == FString("..") )
|
||||||
{
|
{
|
||||||
|
@ -305,20 +307,22 @@ int FFileDialog::changeDir (const FString& dirname)
|
||||||
printPath(directory);
|
printPath(directory);
|
||||||
filename->redraw();
|
filename->redraw();
|
||||||
filebrowser->redraw();
|
filebrowser->redraw();
|
||||||
}
|
|
||||||
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FFileDialog::printPath (const FString& txt)
|
void FFileDialog::printPath (const FString& txt)
|
||||||
{
|
{
|
||||||
FString text = txt;
|
FString path = txt;
|
||||||
uInt max_width = uInt(filebrowser->getWidth()) - 4;
|
uInt max_width = uInt(filebrowser->getWidth()) - 4;
|
||||||
|
|
||||||
if ( text.getLength() > max_width )
|
if ( path.getLength() > max_width )
|
||||||
filebrowser->setText(".." + text.right(max_width-2));
|
filebrowser->setText(".." + path.right(max_width-2));
|
||||||
else
|
else
|
||||||
filebrowser->setText(text);
|
filebrowser->setText(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -442,23 +446,26 @@ void FFileDialog::adjustSize()
|
||||||
|
|
||||||
// public methods of FFileDialog
|
// public methods of FFileDialog
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FFileDialog::onKeyPress (FKeyEvent* event)
|
void FFileDialog::onKeyPress (FKeyEvent* ev)
|
||||||
{
|
{
|
||||||
if ( ! isEnabled() )
|
if ( ! isEnabled() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FDialog::onKeyPress (event);
|
FDialog::onKeyPress (ev);
|
||||||
|
|
||||||
if ( ! filebrowser->hasFocus() )
|
if ( ! filebrowser->hasFocus() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int key = event->key();
|
int key = ev->key();
|
||||||
switch ( key )
|
switch ( key )
|
||||||
{
|
{
|
||||||
case fc::Fkey_erase:
|
case fc::Fkey_erase:
|
||||||
case fc::Fkey_backspace:
|
case fc::Fkey_backspace:
|
||||||
changeDir("..");
|
changeDir("..");
|
||||||
event->accept();
|
ev->accept();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -130,8 +130,10 @@ int FLabel::getXOffset(int length)
|
||||||
return width - length;
|
return width - length;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -298,9 +300,9 @@ void FLabel::hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FLabel::onMouseDown (FMouseEvent* event)
|
void FLabel::onMouseDown (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
if ( event->getButton() != LeftButton )
|
if ( ev->getButton() != LeftButton )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( ! isEnabled() || ! accel_widget )
|
if ( ! isEnabled() || ! accel_widget )
|
||||||
|
@ -325,14 +327,14 @@ void FLabel::onMouseDown (FMouseEvent* event)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FLabel::onAccel (FAccelEvent* event)
|
void FLabel::onAccel (FAccelEvent* ev)
|
||||||
{
|
{
|
||||||
if ( ! isEnabled() || ! accel_widget )
|
if ( ! isEnabled() || ! accel_widget )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( ! accel_widget->hasFocus() )
|
if ( ! accel_widget->hasFocus() )
|
||||||
{
|
{
|
||||||
FWidget* focused_widget = static_cast<FWidget*>(event->focusedWidget());
|
FWidget* focused_widget = static_cast<FWidget*>(ev->focusedWidget());
|
||||||
FFocusEvent out (FocusOut_Event);
|
FFocusEvent out (FocusOut_Event);
|
||||||
FApplication::queueEvent(focused_widget, &out);
|
FApplication::queueEvent(focused_widget, &out);
|
||||||
accel_widget->setFocus();
|
accel_widget->setFocus();
|
||||||
|
@ -346,7 +348,7 @@ void FLabel::onAccel (FAccelEvent* event)
|
||||||
flush_out();
|
flush_out();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
event->accept();
|
ev->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -224,6 +224,7 @@ void FLineEdit::adjustLabel()
|
||||||
case label_above:
|
case label_above:
|
||||||
label->setGeometry(xpos, ypos-1, label_length, 1);
|
label->setGeometry(xpos, ypos-1, label_length, 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case label_left:
|
case label_left:
|
||||||
label->setGeometry(xpos-label_length, ypos, label_length, 1);
|
label->setGeometry(xpos-label_length, ypos, label_length, 1);
|
||||||
break;
|
break;
|
||||||
|
@ -275,6 +276,7 @@ void FLineEdit::hide()
|
||||||
case label_above:
|
case label_above:
|
||||||
gotoxy (xpos+xmin-1, ypos+ymin-2);
|
gotoxy (xpos+xmin-1, ypos+ymin-2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case label_left:
|
case label_left:
|
||||||
gotoxy (xpos+xmin-int(lable_Length)-1, ypos+ymin-1);
|
gotoxy (xpos+xmin-int(lable_Length)-1, ypos+ymin-1);
|
||||||
break;
|
break;
|
||||||
|
@ -364,10 +366,10 @@ bool FLineEdit::setShadow (bool on)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FLineEdit::onKeyPress (FKeyEvent* event)
|
void FLineEdit::onKeyPress (FKeyEvent* ev)
|
||||||
{
|
{
|
||||||
int len = int(text.getLength());
|
int len = int(text.getLength());
|
||||||
int key = event->key();
|
int key = ev->key();
|
||||||
|
|
||||||
switch ( key )
|
switch ( key )
|
||||||
{
|
{
|
||||||
|
@ -377,7 +379,7 @@ void FLineEdit::onKeyPress (FKeyEvent* event)
|
||||||
cursor_pos=0;
|
cursor_pos=0;
|
||||||
if ( cursor_pos < offset )
|
if ( cursor_pos < offset )
|
||||||
offset--;
|
offset--;
|
||||||
event->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_right:
|
case fc::Fkey_right:
|
||||||
|
@ -386,20 +388,20 @@ void FLineEdit::onKeyPress (FKeyEvent* event)
|
||||||
cursor_pos=len;
|
cursor_pos=len;
|
||||||
if ( cursor_pos-offset >= width-2 && offset < len-width+2 )
|
if ( cursor_pos-offset >= width-2 && offset < len-width+2 )
|
||||||
offset++;
|
offset++;
|
||||||
event->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_home:
|
case fc::Fkey_home:
|
||||||
cursor_pos=0;
|
cursor_pos=0;
|
||||||
offset=0;
|
offset=0;
|
||||||
event->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_end:
|
case fc::Fkey_end:
|
||||||
cursor_pos=len;
|
cursor_pos=len;
|
||||||
if ( cursor_pos > width-2 )
|
if ( cursor_pos > width-2 )
|
||||||
offset=len-width+2;
|
offset=len-width+2;
|
||||||
event->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_dc: // del key
|
case fc::Fkey_dc: // del key
|
||||||
|
@ -414,7 +416,7 @@ void FLineEdit::onKeyPress (FKeyEvent* event)
|
||||||
cursor_pos=0;
|
cursor_pos=0;
|
||||||
if ( offset > 0 && len-offset <= width-2 )
|
if ( offset > 0 && len-offset <= width-2 )
|
||||||
offset--;
|
offset--;
|
||||||
event->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_erase:
|
case fc::Fkey_erase:
|
||||||
|
@ -427,7 +429,7 @@ void FLineEdit::onKeyPress (FKeyEvent* event)
|
||||||
if ( offset > 0 )
|
if ( offset > 0 )
|
||||||
offset--;
|
offset--;
|
||||||
}
|
}
|
||||||
event->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_ic: // insert key
|
case fc::Fkey_ic: // insert key
|
||||||
|
@ -448,17 +450,17 @@ void FLineEdit::onKeyPress (FKeyEvent* event)
|
||||||
if ( isUrxvtTerminal() )
|
if ( isUrxvtTerminal() )
|
||||||
setXTermCursor("rgb:0000/0000/0000");
|
setXTermCursor("rgb:0000/0000/0000");
|
||||||
}
|
}
|
||||||
event->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_return:
|
case fc::Fkey_return:
|
||||||
case fc::Fkey_enter:
|
case fc::Fkey_enter:
|
||||||
processActivate();
|
processActivate();
|
||||||
event->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_tab:
|
case fc::Fkey_tab:
|
||||||
event->ignore();
|
ev->ignore();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -485,14 +487,14 @@ void FLineEdit::onKeyPress (FKeyEvent* event)
|
||||||
cursor_pos++;
|
cursor_pos++;
|
||||||
if ( cursor_pos > width-2 )
|
if ( cursor_pos > width-2 )
|
||||||
offset++;
|
offset++;
|
||||||
event->accept();
|
ev->accept();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
event->ignore();
|
ev->ignore();
|
||||||
}
|
}
|
||||||
// end of switch
|
// end of switch
|
||||||
|
|
||||||
if ( event->isAccepted()
|
if ( ev->isAccepted()
|
||||||
&& key != fc::Fkey_return
|
&& key != fc::Fkey_return
|
||||||
&& key != fc::Fkey_enter )
|
&& key != fc::Fkey_enter )
|
||||||
{
|
{
|
||||||
|
@ -502,11 +504,11 @@ void FLineEdit::onKeyPress (FKeyEvent* event)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FLineEdit::onMouseDown (FMouseEvent* event)
|
void FLineEdit::onMouseDown (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
int mouse_x, mouse_y;
|
int mouse_x, mouse_y;
|
||||||
|
|
||||||
if ( event->getButton() != LeftButton )
|
if ( ev->getButton() != LeftButton )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( ! hasFocus() )
|
if ( ! hasFocus() )
|
||||||
|
@ -522,8 +524,8 @@ void FLineEdit::onMouseDown (FMouseEvent* event)
|
||||||
statusBar()->drawMessage();
|
statusBar()->drawMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
mouse_x = event->getX();
|
mouse_x = ev->getX();
|
||||||
mouse_y = event->getY();
|
mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( mouse_x >= 2 && mouse_x <= width && mouse_y == 1 )
|
if ( mouse_x >= 2 && mouse_x <= width && mouse_y == 1 )
|
||||||
{
|
{
|
||||||
|
@ -548,16 +550,16 @@ void FLineEdit::onMouseUp (FMouseEvent*)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FLineEdit::onMouseMove (FMouseEvent* event)
|
void FLineEdit::onMouseMove (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
int len, mouse_x, mouse_y;
|
int len, mouse_x, mouse_y;
|
||||||
|
|
||||||
if ( event->getButton() != LeftButton )
|
if ( ev->getButton() != LeftButton )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
len = int(text.getLength());
|
len = int(text.getLength());
|
||||||
mouse_x = event->getX();
|
mouse_x = ev->getX();
|
||||||
mouse_y = event->getY();
|
mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( mouse_x >= 2 && mouse_x <= width && mouse_y == 1 )
|
if ( mouse_x >= 2 && mouse_x <= width && mouse_y == 1 )
|
||||||
{
|
{
|
||||||
|
@ -646,6 +648,9 @@ void FLineEdit::onTimer (FTimerEvent*)
|
||||||
cursor_pos++;
|
cursor_pos++;
|
||||||
if ( cursor_pos > len )
|
if ( cursor_pos > len )
|
||||||
cursor_pos = len;
|
cursor_pos = len;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
drawInputField();
|
drawInputField();
|
||||||
|
@ -653,13 +658,13 @@ void FLineEdit::onTimer (FTimerEvent*)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FLineEdit::onAccel (FAccelEvent* event)
|
void FLineEdit::onAccel (FAccelEvent* ev)
|
||||||
{
|
{
|
||||||
if ( isEnabled() )
|
if ( isEnabled() )
|
||||||
{
|
{
|
||||||
if ( ! hasFocus() )
|
if ( ! hasFocus() )
|
||||||
{
|
{
|
||||||
FWidget* focused_widget = static_cast<FWidget*>(event->focusedWidget());
|
FWidget* focused_widget = static_cast<FWidget*>(ev->focusedWidget());
|
||||||
FFocusEvent out (FocusOut_Event);
|
FFocusEvent out (FocusOut_Event);
|
||||||
FApplication::queueEvent(focused_widget, &out);
|
FApplication::queueEvent(focused_widget, &out);
|
||||||
this->setFocus();
|
this->setFocus();
|
||||||
|
@ -673,7 +678,7 @@ void FLineEdit::onAccel (FAccelEvent* event)
|
||||||
flush_out();
|
flush_out();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
event->accept();
|
ev->accept();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
114
src/flistbox.cpp
114
src/flistbox.cpp
|
@ -636,13 +636,13 @@ bool FListBox::setShadow (bool on)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::onKeyPress (FKeyEvent* event)
|
void FListBox::onKeyPress (FKeyEvent* ev)
|
||||||
{
|
{
|
||||||
int element_count = int(count());
|
int element_count = int(count());
|
||||||
int current_before = current;
|
int current_before = current;
|
||||||
int xoffset_before = xoffset;
|
int xoffset_before = xoffset;
|
||||||
int yoffset_before = yoffset;
|
int yoffset_before = yoffset;
|
||||||
int key = event->key();
|
int key = ev->key();
|
||||||
|
|
||||||
switch ( key )
|
switch ( key )
|
||||||
{
|
{
|
||||||
|
@ -650,7 +650,7 @@ void FListBox::onKeyPress (FKeyEvent* event)
|
||||||
case fc::Fkey_enter:
|
case fc::Fkey_enter:
|
||||||
processClick();
|
processClick();
|
||||||
inc_search.clear();
|
inc_search.clear();
|
||||||
event->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_up:
|
case fc::Fkey_up:
|
||||||
|
@ -660,7 +660,7 @@ void FListBox::onKeyPress (FKeyEvent* event)
|
||||||
if ( current <= yoffset )
|
if ( current <= yoffset )
|
||||||
yoffset--;
|
yoffset--;
|
||||||
inc_search.clear();
|
inc_search.clear();
|
||||||
event->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_down:
|
case fc::Fkey_down:
|
||||||
|
@ -670,7 +670,7 @@ void FListBox::onKeyPress (FKeyEvent* event)
|
||||||
if ( current-yoffset > height - 2 )
|
if ( current-yoffset > height - 2 )
|
||||||
yoffset++;
|
yoffset++;
|
||||||
inc_search.clear();
|
inc_search.clear();
|
||||||
event->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_left:
|
case fc::Fkey_left:
|
||||||
|
@ -678,7 +678,7 @@ void FListBox::onKeyPress (FKeyEvent* event)
|
||||||
if ( xoffset < 0 )
|
if ( xoffset < 0 )
|
||||||
xoffset = 0;
|
xoffset = 0;
|
||||||
inc_search.clear();
|
inc_search.clear();
|
||||||
event->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_right:
|
case fc::Fkey_right:
|
||||||
|
@ -688,7 +688,7 @@ void FListBox::onKeyPress (FKeyEvent* event)
|
||||||
if ( xoffset < 0 )
|
if ( xoffset < 0 )
|
||||||
xoffset = 0;
|
xoffset = 0;
|
||||||
inc_search.clear();
|
inc_search.clear();
|
||||||
event->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_ppage:
|
case fc::Fkey_ppage:
|
||||||
|
@ -702,7 +702,7 @@ void FListBox::onKeyPress (FKeyEvent* event)
|
||||||
yoffset=0;
|
yoffset=0;
|
||||||
}
|
}
|
||||||
inc_search.clear();
|
inc_search.clear();
|
||||||
event->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_npage:
|
case fc::Fkey_npage:
|
||||||
|
@ -716,14 +716,14 @@ void FListBox::onKeyPress (FKeyEvent* event)
|
||||||
yoffset = element_count - height + 2;
|
yoffset = element_count - height + 2;
|
||||||
}
|
}
|
||||||
inc_search.clear();
|
inc_search.clear();
|
||||||
event->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_home:
|
case fc::Fkey_home:
|
||||||
current = 1;
|
current = 1;
|
||||||
yoffset = 0;
|
yoffset = 0;
|
||||||
inc_search.clear();
|
inc_search.clear();
|
||||||
event->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_end:
|
case fc::Fkey_end:
|
||||||
|
@ -731,7 +731,7 @@ void FListBox::onKeyPress (FKeyEvent* event)
|
||||||
if ( current > height - 2 )
|
if ( current > height - 2 )
|
||||||
yoffset = element_count - height + 2;
|
yoffset = element_count - height + 2;
|
||||||
inc_search.clear();
|
inc_search.clear();
|
||||||
event->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_ic: // insert key
|
case fc::Fkey_ic: // insert key
|
||||||
|
@ -747,7 +747,7 @@ void FListBox::onKeyPress (FKeyEvent* event)
|
||||||
current = element_count;
|
current = element_count;
|
||||||
if ( current-yoffset > height - 2 )
|
if ( current-yoffset > height - 2 )
|
||||||
yoffset++;
|
yoffset++;
|
||||||
event->accept();
|
ev->accept();
|
||||||
}
|
}
|
||||||
inc_search.clear();
|
inc_search.clear();
|
||||||
break;
|
break;
|
||||||
|
@ -774,10 +774,10 @@ void FListBox::onKeyPress (FKeyEvent* event)
|
||||||
if ( ! inc_found )
|
if ( ! inc_found )
|
||||||
{
|
{
|
||||||
inc_search.remove(inc_len, 1);
|
inc_search.remove(inc_len, 1);
|
||||||
event->ignore();
|
ev->ignore();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
event->accept();
|
ev->accept();
|
||||||
}
|
}
|
||||||
else if ( isMultiSelection() )
|
else if ( isMultiSelection() )
|
||||||
{
|
{
|
||||||
|
@ -787,7 +787,7 @@ void FListBox::onKeyPress (FKeyEvent* event)
|
||||||
selectItem(current);
|
selectItem(current);
|
||||||
processSelect();
|
processSelect();
|
||||||
inc_search.clear();
|
inc_search.clear();
|
||||||
event->accept();
|
ev->accept();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -813,10 +813,10 @@ void FListBox::onKeyPress (FKeyEvent* event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
event->accept();
|
ev->accept();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
event->ignore();
|
ev->ignore();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -825,7 +825,7 @@ void FListBox::onKeyPress (FKeyEvent* event)
|
||||||
if ( inc_search.getLength() > 0 )
|
if ( inc_search.getLength() > 0 )
|
||||||
{
|
{
|
||||||
inc_search.clear();
|
inc_search.clear();
|
||||||
event->accept();
|
ev->accept();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -855,15 +855,15 @@ void FListBox::onKeyPress (FKeyEvent* event)
|
||||||
{
|
{
|
||||||
inc_search.remove(inc_len-1, 1);
|
inc_search.remove(inc_len-1, 1);
|
||||||
if ( inc_len == 1 )
|
if ( inc_len == 1 )
|
||||||
event->ignore();
|
ev->ignore();
|
||||||
else
|
else
|
||||||
event->accept();
|
ev->accept();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
event->accept();
|
ev->accept();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
event->ignore();
|
ev->ignore();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( current_before != current )
|
if ( current_before != current )
|
||||||
|
@ -873,7 +873,7 @@ void FListBox::onKeyPress (FKeyEvent* event)
|
||||||
processSelect();
|
processSelect();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( event->isAccepted() )
|
if ( ev->isAccepted() )
|
||||||
{
|
{
|
||||||
if ( isVisible() )
|
if ( isVisible() )
|
||||||
drawList();
|
drawList();
|
||||||
|
@ -890,16 +890,16 @@ void FListBox::onKeyPress (FKeyEvent* event)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::onMouseDown (FMouseEvent* event)
|
void FListBox::onMouseDown (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
int yoffset_before, mouse_x, mouse_y;
|
int yoffset_before, mouse_x, mouse_y;
|
||||||
|
|
||||||
if ( event->getButton() != LeftButton
|
if ( ev->getButton() != LeftButton
|
||||||
&& event->getButton() != RightButton )
|
&& ev->getButton() != RightButton )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( event->getButton() == RightButton && ! isMultiSelection() )
|
if ( ev->getButton() == RightButton && ! isMultiSelection() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( ! hasFocus() )
|
if ( ! hasFocus() )
|
||||||
|
@ -915,8 +915,8 @@ void FListBox::onMouseDown (FMouseEvent* event)
|
||||||
}
|
}
|
||||||
|
|
||||||
yoffset_before = yoffset;
|
yoffset_before = yoffset;
|
||||||
mouse_x = event->getX();
|
mouse_x = ev->getX();
|
||||||
mouse_y = event->getY();
|
mouse_y = ev->getY();
|
||||||
if ( mouse_x >= 2 && mouse_x <= width-1
|
if ( mouse_x >= 2 && mouse_x <= width-1
|
||||||
&& mouse_y >= 2 && mouse_y <= height-1 )
|
&& mouse_y >= 2 && mouse_y <= height-1 )
|
||||||
{
|
{
|
||||||
|
@ -924,7 +924,7 @@ void FListBox::onMouseDown (FMouseEvent* event)
|
||||||
if ( current > int(count()) )
|
if ( current > int(count()) )
|
||||||
current = int(count());
|
current = int(count());
|
||||||
inc_search.clear();
|
inc_search.clear();
|
||||||
if ( event->getButton() == RightButton )
|
if ( ev->getButton() == RightButton )
|
||||||
{
|
{
|
||||||
if ( isMultiSelection() )
|
if ( isMultiSelection() )
|
||||||
{
|
{
|
||||||
|
@ -954,7 +954,7 @@ void FListBox::onMouseDown (FMouseEvent* event)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::onMouseUp (FMouseEvent* event)
|
void FListBox::onMouseUp (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
if ( dragScroll != FListBox::noScroll )
|
if ( dragScroll != FListBox::noScroll )
|
||||||
{
|
{
|
||||||
|
@ -964,10 +964,10 @@ void FListBox::onMouseUp (FMouseEvent* event)
|
||||||
scrollTimer = false;
|
scrollTimer = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( event->getButton() == LeftButton )
|
if ( ev->getButton() == LeftButton )
|
||||||
{
|
{
|
||||||
int mouse_x = event->getX();
|
int mouse_x = ev->getX();
|
||||||
int mouse_y = event->getY();
|
int mouse_y = ev->getY();
|
||||||
if ( mouse_x >= 2 && mouse_x <= width-1
|
if ( mouse_x >= 2 && mouse_x <= width-1
|
||||||
&& mouse_y >= 2 && mouse_y <= height-1 )
|
&& mouse_y >= 2 && mouse_y <= height-1 )
|
||||||
{
|
{
|
||||||
|
@ -979,22 +979,22 @@ void FListBox::onMouseUp (FMouseEvent* event)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::onMouseMove (FMouseEvent* event)
|
void FListBox::onMouseMove (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
int current_before, yoffset_before, mouse_x, mouse_y;
|
int current_before, yoffset_before, mouse_x, mouse_y;
|
||||||
|
|
||||||
if ( event->getButton() != LeftButton
|
if ( ev->getButton() != LeftButton
|
||||||
&& event->getButton() != RightButton )
|
&& ev->getButton() != RightButton )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( event->getButton() == RightButton && ! isMultiSelection() )
|
if ( ev->getButton() == RightButton && ! isMultiSelection() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
current_before = current;
|
current_before = current;
|
||||||
yoffset_before = yoffset;
|
yoffset_before = yoffset;
|
||||||
mouse_x = event->getX();
|
mouse_x = ev->getX();
|
||||||
mouse_y = event->getY();
|
mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( mouse_x >= 2 && mouse_x <= width-1
|
if ( mouse_x >= 2 && mouse_x <= width-1
|
||||||
&& mouse_y >= 2 && mouse_y <= height-1 )
|
&& mouse_y >= 2 && mouse_y <= height-1 )
|
||||||
|
@ -1005,7 +1005,7 @@ void FListBox::onMouseMove (FMouseEvent* event)
|
||||||
inc_search.clear();
|
inc_search.clear();
|
||||||
|
|
||||||
// handle multiple selections
|
// handle multiple selections
|
||||||
if ( event->getButton() == RightButton
|
if ( ev->getButton() == RightButton
|
||||||
&& isMultiSelection()
|
&& isMultiSelection()
|
||||||
&& current_before != current )
|
&& current_before != current )
|
||||||
{
|
{
|
||||||
|
@ -1056,7 +1056,7 @@ void FListBox::onMouseMove (FMouseEvent* event)
|
||||||
{
|
{
|
||||||
scrollTimer = true;
|
scrollTimer = true;
|
||||||
addTimer(scrollRepeat);
|
addTimer(scrollRepeat);
|
||||||
if ( event->getButton() == RightButton )
|
if ( ev->getButton() == RightButton )
|
||||||
dragScroll = FListBox::scrollUpSelect;
|
dragScroll = FListBox::scrollUpSelect;
|
||||||
else
|
else
|
||||||
dragScroll = FListBox::scrollUp;
|
dragScroll = FListBox::scrollUp;
|
||||||
|
@ -1076,7 +1076,7 @@ void FListBox::onMouseMove (FMouseEvent* event)
|
||||||
{
|
{
|
||||||
scrollTimer = true;
|
scrollTimer = true;
|
||||||
addTimer(scrollRepeat);
|
addTimer(scrollRepeat);
|
||||||
if ( event->getButton() == RightButton )
|
if ( ev->getButton() == RightButton )
|
||||||
dragScroll = FListBox::scrollDownSelect;
|
dragScroll = FListBox::scrollDownSelect;
|
||||||
else
|
else
|
||||||
dragScroll = FListBox::scrollDown;
|
dragScroll = FListBox::scrollDown;
|
||||||
|
@ -1098,15 +1098,15 @@ void FListBox::onMouseMove (FMouseEvent* event)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::onMouseDoubleClick (FMouseEvent* event)
|
void FListBox::onMouseDoubleClick (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
int mouse_x, mouse_y;
|
int mouse_x, mouse_y;
|
||||||
|
|
||||||
if ( event->getButton() != LeftButton )
|
if ( ev->getButton() != LeftButton )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mouse_x = event->getX();
|
mouse_x = ev->getX();
|
||||||
mouse_y = event->getY();
|
mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( mouse_x >= 2 && mouse_x <= width-1
|
if ( mouse_x >= 2 && mouse_x <= width-1
|
||||||
&& mouse_y >= 2 && mouse_y <= height-1 )
|
&& mouse_y >= 2 && mouse_y <= height-1 )
|
||||||
|
@ -1159,6 +1159,9 @@ void FListBox::onTimer (FTimerEvent*)
|
||||||
yoffset += scrollDistance;
|
yoffset += scrollDistance;
|
||||||
if ( yoffset > element_count - height + 2 )
|
if ( yoffset > element_count - height + 2 )
|
||||||
yoffset = element_count - height + 2;
|
yoffset = element_count - height + 2;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle multiple selections
|
// handle multiple selections
|
||||||
|
@ -1206,7 +1209,7 @@ void FListBox::onTimer (FTimerEvent*)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::onWheel (FWheelEvent* event)
|
void FListBox::onWheel (FWheelEvent* ev)
|
||||||
{
|
{
|
||||||
int element_count, current_before, yoffset_before, yoffset_end, wheel;
|
int element_count, current_before, yoffset_before, yoffset_end, wheel;
|
||||||
|
|
||||||
|
@ -1218,7 +1221,7 @@ void FListBox::onWheel (FWheelEvent* event)
|
||||||
if ( yoffset_end < 0 )
|
if ( yoffset_end < 0 )
|
||||||
yoffset_end = 0;
|
yoffset_end = 0;
|
||||||
|
|
||||||
wheel = event->getWheel();
|
wheel = ev->getWheel();
|
||||||
|
|
||||||
if ( dragScroll != FListBox::noScroll )
|
if ( dragScroll != FListBox::noScroll )
|
||||||
{
|
{
|
||||||
|
@ -1261,6 +1264,9 @@ void FListBox::onWheel (FWheelEvent* event)
|
||||||
current = element_count;
|
current = element_count;
|
||||||
inc_search.clear();
|
inc_search.clear();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( current_before != current )
|
if ( current_before != current )
|
||||||
|
@ -1357,15 +1363,18 @@ void FListBox::cb_VBarChange (FWidget*, void*)
|
||||||
{
|
{
|
||||||
FWheelEvent wheel_ev (MouseWheel_Event, FPoint(2,2), WheelUp);
|
FWheelEvent wheel_ev (MouseWheel_Event, FPoint(2,2), 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 (MouseWheel_Event, FPoint(2,2), WheelDown);
|
||||||
onWheel(&wheel_ev);
|
onWheel(&wheel_ev);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isVisible() )
|
if ( isVisible() )
|
||||||
|
@ -1438,6 +1447,9 @@ void FListBox::cb_HBarChange (FWidget*, void*)
|
||||||
if ( xoffset > xoffset_end )
|
if ( xoffset > xoffset_end )
|
||||||
xoffset = xoffset_end;
|
xoffset = xoffset_end;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isVisible() )
|
if ( isVisible() )
|
||||||
|
|
|
@ -115,7 +115,7 @@ void FMenu::menu_dimension()
|
||||||
++iter;
|
++iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
setGeometry (xpos, ypos, maxItemWidth + 4, count() + 2);
|
setGeometry (xpos, ypos, int(maxItemWidth + 4), int(count() + 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -262,13 +262,13 @@ void FMenu::drawItems()
|
||||||
FString txt;
|
FString txt;
|
||||||
uInt txt_length;
|
uInt txt_length;
|
||||||
int hotkeypos, to_char;
|
int hotkeypos, to_char;
|
||||||
bool isActive = (*iter)->isActivated();
|
bool is_Active = (*iter)->isActivated();
|
||||||
bool isSelected = (*iter)->isSelected();
|
bool is_Selected = (*iter)->isSelected();
|
||||||
bool isNoUnderline = (((*iter)->getFlags() & NO_UNDERLINE) != 0);
|
bool is_NoUnderline = (((*iter)->getFlags() & NO_UNDERLINE) != 0);
|
||||||
|
|
||||||
if ( isActive )
|
if ( is_Active )
|
||||||
{
|
{
|
||||||
if ( isSelected )
|
if ( is_Selected )
|
||||||
{
|
{
|
||||||
foregroundColor = wc.menu_active_focus_fg;
|
foregroundColor = wc.menu_active_focus_fg;
|
||||||
backgroundColor = wc.menu_active_focus_bg;
|
backgroundColor = wc.menu_active_focus_bg;
|
||||||
|
@ -291,7 +291,7 @@ void FMenu::drawItems()
|
||||||
print (' ');
|
print (' ');
|
||||||
|
|
||||||
txt = (*iter)->getText();
|
txt = (*iter)->getText();
|
||||||
txt_length = int(txt.getLength());
|
txt_length = uInt(txt.getLength());
|
||||||
item_text = new wchar_t[txt_length+1];
|
item_text = new wchar_t[txt_length+1];
|
||||||
src = const_cast<wchar_t*>(txt.wc_str());
|
src = const_cast<wchar_t*>(txt.wc_str());
|
||||||
dest = const_cast<wchar_t*>(item_text);
|
dest = const_cast<wchar_t*>(item_text);
|
||||||
|
@ -308,13 +308,13 @@ void FMenu::drawItems()
|
||||||
{
|
{
|
||||||
if ( ! iswprint(wint_t(item_text[z])) )
|
if ( ! iswprint(wint_t(item_text[z])) )
|
||||||
item_text[z] = L' ';
|
item_text[z] = L' ';
|
||||||
if ( (z == hotkeypos) && isActive && ! isSelected )
|
if ( (z == hotkeypos) && is_Active && ! is_Selected )
|
||||||
{
|
{
|
||||||
setColor (wc.menu_hotkey_fg, wc.menu_hotkey_bg);
|
setColor (wc.menu_hotkey_fg, wc.menu_hotkey_bg);
|
||||||
if ( ! isNoUnderline )
|
if ( ! is_NoUnderline )
|
||||||
setUnderline();
|
setUnderline();
|
||||||
print (item_text[z]);
|
print (item_text[z]);
|
||||||
if ( ! isNoUnderline )
|
if ( ! is_NoUnderline )
|
||||||
unsetUnderline();
|
unsetUnderline();
|
||||||
setColor (foregroundColor, backgroundColor);
|
setColor (foregroundColor, backgroundColor);
|
||||||
}
|
}
|
||||||
|
@ -322,13 +322,13 @@ void FMenu::drawItems()
|
||||||
print (item_text[z]);
|
print (item_text[z]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isSelected )
|
if ( is_Selected )
|
||||||
{
|
{
|
||||||
for (uInt i=to_char; i <= maxItemWidth; i++)
|
for (uInt i=uInt(to_char); i <= maxItemWidth; i++)
|
||||||
print (' ');
|
print (' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isActive && isSelected )
|
if ( is_Active && is_Selected )
|
||||||
setReverse(false);
|
setReverse(false);
|
||||||
delete[] item_text;
|
delete[] item_text;
|
||||||
|
|
||||||
|
@ -345,9 +345,9 @@ void FMenu::processActivate()
|
||||||
|
|
||||||
// public methods of FMenu
|
// public methods of FMenu
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenu::onMouseDown (FMouseEvent* event)
|
void FMenu::onMouseDown (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
if ( event->getButton() != LeftButton )
|
if ( ev->getButton() != LeftButton )
|
||||||
{
|
{
|
||||||
mouse_down = false;
|
mouse_down = false;
|
||||||
if ( ! itemlist.empty() )
|
if ( ! itemlist.empty() )
|
||||||
|
@ -384,8 +384,8 @@ void FMenu::onMouseDown (FMouseEvent* event)
|
||||||
x1 = X;
|
x1 = X;
|
||||||
txt_length = int((*iter)->getText().getLength());
|
txt_length = int((*iter)->getText().getLength());
|
||||||
x2 = x1 + txt_length + 1;
|
x2 = x1 + txt_length + 1;
|
||||||
mouse_x = event->getX();
|
mouse_x = ev->getX();
|
||||||
mouse_y = event->getY();
|
mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( mouse_x >= x1
|
if ( mouse_x >= x1
|
||||||
&& mouse_x <= x2
|
&& mouse_x <= x2
|
||||||
|
@ -402,9 +402,9 @@ void FMenu::onMouseDown (FMouseEvent* event)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenu::onMouseUp (FMouseEvent* event)
|
void FMenu::onMouseUp (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
if ( event->getButton() != LeftButton )
|
if ( ev->getButton() != LeftButton )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( mouse_down )
|
if ( mouse_down )
|
||||||
|
@ -426,8 +426,8 @@ void FMenu::onMouseUp (FMouseEvent* event)
|
||||||
|
|
||||||
if ( (*iter)->isSelected() )
|
if ( (*iter)->isSelected() )
|
||||||
{
|
{
|
||||||
int mouse_x = event->getX();
|
int mouse_x = ev->getX();
|
||||||
int mouse_y = event->getY();
|
int mouse_y = ev->getY();
|
||||||
if ( mouse_x < x1 || mouse_x > x2 || mouse_y != 1 )
|
if ( mouse_x < x1 || mouse_x > x2 || mouse_y != 1 )
|
||||||
(*iter)->unsetSelected();
|
(*iter)->unsetSelected();
|
||||||
this->redraw();
|
this->redraw();
|
||||||
|
@ -440,9 +440,9 @@ void FMenu::onMouseUp (FMouseEvent* event)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenu::onMouseMove (FMouseEvent* event)
|
void FMenu::onMouseMove (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
if ( event->getButton() != LeftButton )
|
if ( ev->getButton() != LeftButton )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( mouse_down && ! itemlist.empty() )
|
if ( mouse_down && ! itemlist.empty() )
|
||||||
|
@ -460,8 +460,8 @@ void FMenu::onMouseMove (FMouseEvent* event)
|
||||||
int txt_length = int((*iter)->getText().getLength());
|
int txt_length = int((*iter)->getText().getLength());
|
||||||
int x2 = x1 + txt_length + 1;
|
int x2 = x1 + txt_length + 1;
|
||||||
|
|
||||||
int mouse_x = event->getX();
|
int mouse_x = ev->getX();
|
||||||
int mouse_y = event->getY();
|
int mouse_y = ev->getY();
|
||||||
if ( mouse_x >= x1
|
if ( mouse_x >= x1
|
||||||
&& mouse_x <= x2
|
&& mouse_x <= x2
|
||||||
&& mouse_y == 1 )
|
&& mouse_y == 1 )
|
||||||
|
@ -504,15 +504,15 @@ void FMenu::setGeometry (int xx, int yy, int ww, int hh, bool adjust)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenu::insert (FMenuItem* item)
|
void FMenu::insert (FMenuItem* i)
|
||||||
{
|
{
|
||||||
FMenuList::insert(item);
|
FMenuList::insert(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenu::remove (FMenuItem* item)
|
void FMenu::remove (FMenuItem* i)
|
||||||
{
|
{
|
||||||
FMenuList::remove(item);
|
FMenuList::remove(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -81,8 +81,8 @@ inline const char* FMenu::getClassName() const
|
||||||
{ return "FMenu"; }
|
{ return "FMenu"; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FMenu::onAccel (FAccelEvent* event)
|
inline void FMenu::onAccel (FAccelEvent* ev)
|
||||||
{ item->onAccel(event); }
|
{ item->onAccel(ev); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FMenuItem* FMenu::getItem() const
|
inline FMenuItem* FMenu::getItem() const
|
||||||
|
|
|
@ -89,9 +89,9 @@ void FMenuBar::draw()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenuBar::drawItems()
|
void FMenuBar::drawItems()
|
||||||
{
|
{
|
||||||
bool isActive;
|
bool is_Active;
|
||||||
bool isSelected;
|
bool is_Selected;
|
||||||
bool isNoUnderline;
|
bool is_NoUnderline;
|
||||||
std::vector<FMenuItem*>::const_iterator iter, end;
|
std::vector<FMenuItem*>::const_iterator iter, end;
|
||||||
int screenWidth;
|
int screenWidth;
|
||||||
|
|
||||||
|
@ -118,13 +118,13 @@ void FMenuBar::drawItems()
|
||||||
uInt txt_length;
|
uInt txt_length;
|
||||||
int hotkeypos, to_char;
|
int hotkeypos, to_char;
|
||||||
|
|
||||||
isActive = (*iter)->isActivated();
|
is_Active = (*iter)->isActivated();
|
||||||
isSelected = (*iter)->isSelected();
|
is_Selected = (*iter)->isSelected();
|
||||||
isNoUnderline = (((*iter)->getFlags() & NO_UNDERLINE) != 0);
|
is_NoUnderline = (((*iter)->getFlags() & NO_UNDERLINE) != 0);
|
||||||
|
|
||||||
if ( isActive )
|
if ( is_Active )
|
||||||
{
|
{
|
||||||
if ( isSelected )
|
if ( is_Selected )
|
||||||
{
|
{
|
||||||
foregroundColor = wc.menu_active_focus_fg;
|
foregroundColor = wc.menu_active_focus_fg;
|
||||||
backgroundColor = wc.menu_active_focus_bg;
|
backgroundColor = wc.menu_active_focus_bg;
|
||||||
|
@ -147,7 +147,7 @@ void FMenuBar::drawItems()
|
||||||
print (vmenubar, ' ');
|
print (vmenubar, ' ');
|
||||||
|
|
||||||
txt = (*iter)->getText();
|
txt = (*iter)->getText();
|
||||||
txt_length = int(txt.getLength());
|
txt_length = uInt(txt.getLength());
|
||||||
item_text = new wchar_t[txt_length+1];
|
item_text = new wchar_t[txt_length+1];
|
||||||
src = const_cast<wchar_t*>(txt.wc_str());
|
src = const_cast<wchar_t*>(txt.wc_str());
|
||||||
dest = const_cast<wchar_t*>(item_text);
|
dest = const_cast<wchar_t*>(item_text);
|
||||||
|
@ -155,7 +155,7 @@ void FMenuBar::drawItems()
|
||||||
if ( x-1 <= screenWidth )
|
if ( x-1 <= screenWidth )
|
||||||
to_char = int(txt_length);
|
to_char = int(txt_length);
|
||||||
else
|
else
|
||||||
to_char = txt_length - (screenWidth-x-1);
|
to_char = int(txt_length) - (screenWidth-x-1);
|
||||||
|
|
||||||
hotkeypos = getHotkeyPos (src, dest, txt_length);
|
hotkeypos = getHotkeyPos (src, dest, txt_length);
|
||||||
|
|
||||||
|
@ -164,19 +164,19 @@ void FMenuBar::drawItems()
|
||||||
txt_length--;
|
txt_length--;
|
||||||
to_char--;
|
to_char--;
|
||||||
}
|
}
|
||||||
x += txt_length;
|
x += int(txt_length);
|
||||||
|
|
||||||
for (int z=0; z < to_char; z++)
|
for (int z=0; z < to_char; z++)
|
||||||
{
|
{
|
||||||
if ( ! iswprint(wint_t(item_text[z])) )
|
if ( ! iswprint(wint_t(item_text[z])) )
|
||||||
item_text[z] = L' ';
|
item_text[z] = L' ';
|
||||||
if ( (z == hotkeypos) && isActive && ! isSelected )
|
if ( (z == hotkeypos) && is_Active && ! is_Selected )
|
||||||
{
|
{
|
||||||
setColor (wc.menu_hotkey_fg, wc.menu_hotkey_bg);
|
setColor (wc.menu_hotkey_fg, wc.menu_hotkey_bg);
|
||||||
if ( ! isNoUnderline )
|
if ( ! is_NoUnderline )
|
||||||
setUnderline();
|
setUnderline();
|
||||||
print (vmenubar, item_text[z]);
|
print (vmenubar, item_text[z]);
|
||||||
if ( ! isNoUnderline )
|
if ( ! is_NoUnderline )
|
||||||
unsetUnderline();
|
unsetUnderline();
|
||||||
setColor (foregroundColor, backgroundColor);
|
setColor (foregroundColor, backgroundColor);
|
||||||
}
|
}
|
||||||
|
@ -187,7 +187,7 @@ void FMenuBar::drawItems()
|
||||||
if ( x > screenWidth )
|
if ( x > screenWidth )
|
||||||
{
|
{
|
||||||
print ( vmenubar,
|
print ( vmenubar,
|
||||||
txt.left(uInt(txt_length+screenWidth-x-1)) );
|
txt.left(uInt(int(txt_length)+screenWidth-x-1)) );
|
||||||
print ( vmenubar, ".." );
|
print ( vmenubar, ".." );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -196,7 +196,7 @@ void FMenuBar::drawItems()
|
||||||
print (vmenubar, ' ');
|
print (vmenubar, ' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isActive && isSelected )
|
if ( is_Active && is_Selected )
|
||||||
setReverse(false);
|
setReverse(false);
|
||||||
delete[] item_text;
|
delete[] item_text;
|
||||||
|
|
||||||
|
@ -221,9 +221,9 @@ void FMenuBar::adjustSize()
|
||||||
|
|
||||||
// public methods of FMenuBar
|
// public methods of FMenuBar
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenuBar::onMouseDown (FMouseEvent* event)
|
void FMenuBar::onMouseDown (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
if ( event->getButton() != LeftButton )
|
if ( ev->getButton() != LeftButton )
|
||||||
{
|
{
|
||||||
mouse_down = false;
|
mouse_down = false;
|
||||||
if ( ! itemlist.empty() )
|
if ( ! itemlist.empty() )
|
||||||
|
@ -262,8 +262,8 @@ void FMenuBar::onMouseDown (FMouseEvent* event)
|
||||||
if ( (*iter)->hasHotkey() )
|
if ( (*iter)->hasHotkey() )
|
||||||
txt_length--;
|
txt_length--;
|
||||||
x2 = x1 + txt_length;
|
x2 = x1 + txt_length;
|
||||||
mouse_x = event->getX();
|
mouse_x = ev->getX();
|
||||||
mouse_y = event->getY();
|
mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( mouse_x >= x1
|
if ( mouse_x >= x1
|
||||||
&& mouse_x <= x2
|
&& mouse_x <= x2
|
||||||
|
@ -285,9 +285,9 @@ void FMenuBar::onMouseDown (FMouseEvent* event)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenuBar::onMouseUp (FMouseEvent* event)
|
void FMenuBar::onMouseUp (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
if ( event->getButton() != LeftButton )
|
if ( ev->getButton() != LeftButton )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( mouse_down )
|
if ( mouse_down )
|
||||||
|
@ -311,8 +311,8 @@ void FMenuBar::onMouseUp (FMouseEvent* event)
|
||||||
|
|
||||||
if ( (*iter)->isSelected() )
|
if ( (*iter)->isSelected() )
|
||||||
{
|
{
|
||||||
int mouse_x = event->getX();
|
int mouse_x = ev->getX();
|
||||||
int mouse_y = event->getY();
|
int mouse_y = ev->getY();
|
||||||
if ( mouse_x < x1 || mouse_x > x2 || mouse_y != 1 )
|
if ( mouse_x < x1 || mouse_x > x2 || mouse_y != 1 )
|
||||||
(*iter)->unsetSelected();
|
(*iter)->unsetSelected();
|
||||||
else
|
else
|
||||||
|
@ -329,9 +329,9 @@ void FMenuBar::onMouseUp (FMouseEvent* event)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenuBar::onMouseMove (FMouseEvent* event)
|
void FMenuBar::onMouseMove (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
if ( event->getButton() != LeftButton )
|
if ( ev->getButton() != LeftButton )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( mouse_down && ! itemlist.empty() )
|
if ( mouse_down && ! itemlist.empty() )
|
||||||
|
@ -351,8 +351,8 @@ void FMenuBar::onMouseMove (FMouseEvent* event)
|
||||||
txt_length--;
|
txt_length--;
|
||||||
int x2 = x1 + txt_length;
|
int x2 = x1 + txt_length;
|
||||||
|
|
||||||
int mouse_x = event->getX();
|
int mouse_x = ev->getX();
|
||||||
int mouse_y = event->getY();
|
int mouse_y = ev->getY();
|
||||||
if ( mouse_x >= x1
|
if ( mouse_x >= x1
|
||||||
&& mouse_x <= x2
|
&& mouse_x <= x2
|
||||||
&& mouse_y == 1 )
|
&& mouse_y == 1 )
|
||||||
|
|
|
@ -147,7 +147,7 @@ void FMenuItem::processClicked()
|
||||||
|
|
||||||
// public methods of FMenuItem
|
// public methods of FMenuItem
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenuItem::onAccel (FAccelEvent* event)
|
void FMenuItem::onAccel (FAccelEvent* ev)
|
||||||
{
|
{
|
||||||
if ( isSelected() )
|
if ( isSelected() )
|
||||||
{
|
{
|
||||||
|
@ -155,7 +155,7 @@ void FMenuItem::onAccel (FAccelEvent* event)
|
||||||
FWidget* w = reinterpret_cast<FWidget*>(superMenu());
|
FWidget* w = reinterpret_cast<FWidget*>(superMenu());
|
||||||
if ( isMenuBar(w) )
|
if ( isMenuBar(w) )
|
||||||
w->redraw();
|
w->redraw();
|
||||||
event->accept();
|
ev->accept();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,17 +58,17 @@ bool FMenuList::hasSelectedItem()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenuList::insert (FMenuItem* item)
|
void FMenuList::insert (FMenuItem* i)
|
||||||
{
|
{
|
||||||
itemlist.push_back(item);
|
itemlist.push_back(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenuList::remove (FMenuItem* item)
|
void FMenuList::remove (FMenuItem* i)
|
||||||
{
|
{
|
||||||
std::vector<FMenuItem*>::iterator iter;
|
std::vector<FMenuItem*>::iterator iter;
|
||||||
|
|
||||||
//delAccelerator (item);
|
//delAccelerator (i);
|
||||||
|
|
||||||
if ( itemlist.empty() )
|
if ( itemlist.empty() )
|
||||||
return;
|
return;
|
||||||
|
@ -76,10 +76,10 @@ void FMenuList::remove (FMenuItem* item)
|
||||||
iter = itemlist.begin();
|
iter = itemlist.begin();
|
||||||
while ( iter != itemlist.end() )
|
while ( iter != itemlist.end() )
|
||||||
{
|
{
|
||||||
if ( (*iter) == item )
|
if ( (*iter) == i )
|
||||||
{
|
{
|
||||||
iter = itemlist.erase(iter);
|
iter = itemlist.erase(iter);
|
||||||
item->setSuperMenu(0);
|
i->setSuperMenu(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -47,7 +47,7 @@ FObject::~FObject() // destructor
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete children objects
|
// delete children objects
|
||||||
FObject::object_list children = this->children();
|
FObject::object_list children = this->getChildren();
|
||||||
if ( ! children.empty() )
|
if ( ! children.empty() )
|
||||||
{
|
{
|
||||||
FObject::object_list::const_iterator iter;
|
FObject::object_list::const_iterator iter;
|
||||||
|
|
|
@ -64,10 +64,10 @@ class FObject
|
||||||
virtual ~FObject();
|
virtual ~FObject();
|
||||||
virtual const char* getClassName() const;
|
virtual const char* getClassName() const;
|
||||||
|
|
||||||
FObject* parent() const;
|
FObject* getParent() const;
|
||||||
bool hasParent() const;
|
bool hasParent() const;
|
||||||
void removeParent();
|
void removeParent();
|
||||||
object_list children() const;
|
object_list getChildren() const;
|
||||||
bool hasChildren() const;
|
bool hasChildren() const;
|
||||||
void addChild (FObject*);
|
void addChild (FObject*);
|
||||||
void delChild (FObject*);
|
void delChild (FObject*);
|
||||||
|
@ -93,7 +93,7 @@ inline const char* FObject::getClassName() const
|
||||||
{ return "FObject"; }
|
{ return "FObject"; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FObject* FObject::parent() const
|
inline FObject* FObject::getParent() const
|
||||||
{ return parentObj; }
|
{ return parentObj; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -105,7 +105,7 @@ inline void FObject::removeParent()
|
||||||
{ parentObj = 0; }
|
{ parentObj = 0; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FObject::object_list FObject::children() const
|
inline FObject::object_list FObject::getChildren() const
|
||||||
{ return children_list; }
|
{ return children_list; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -93,7 +93,7 @@ int FOptiMove::cap_duration (char*& cap, int affcnt)
|
||||||
ms += num * 10;
|
ms += num * 10;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ms += char_duration;
|
ms += float(char_duration);
|
||||||
}
|
}
|
||||||
return int(ms);
|
return int(ms);
|
||||||
}
|
}
|
||||||
|
@ -611,6 +611,9 @@ char* FOptiMove::cursor_move (int xold, int yold, int xnew, int ynew)
|
||||||
move_ptr += strlen(move_buf);
|
move_ptr += strlen(move_buf);
|
||||||
relative_move (move_ptr, screen_width-1, yold-1, xnew, ynew);
|
relative_move (move_ptr, screen_width-1, yold-1, xnew, ynew);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( move_time < LONG_DURATION )
|
if ( move_time < LONG_DURATION )
|
||||||
|
|
|
@ -49,15 +49,15 @@ FPoint& FPoint::operator = (const FPoint& p)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FPoint& FPoint::operator += (const FPoint& p)
|
FPoint& FPoint::operator += (const FPoint& p)
|
||||||
{
|
{
|
||||||
xpos += p.xpos;
|
xpos = short(xpos + p.xpos);
|
||||||
ypos += p.ypos;
|
ypos = short(ypos + p.ypos);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FPoint& FPoint::operator -= (const FPoint& p)
|
FPoint& FPoint::operator -= (const FPoint& p)
|
||||||
{
|
{
|
||||||
xpos -= p.xpos;
|
xpos = short(xpos - p.xpos);
|
||||||
ypos -= p.ypos;
|
ypos = short(ypos - p.ypos);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
11
src/fpoint.h
11
src/fpoint.h
|
@ -48,14 +48,15 @@ class FPoint
|
||||||
// FPoint inline functions
|
// FPoint inline functions
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FPoint::FPoint()
|
inline FPoint::FPoint()
|
||||||
{ xpos = ypos = 0; }
|
: xpos(0)
|
||||||
|
, ypos(0)
|
||||||
|
{ }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FPoint::FPoint (int x, int y)
|
inline FPoint::FPoint (int x, int y)
|
||||||
{
|
: xpos(short(x))
|
||||||
xpos = short(x);
|
, ypos(short(y))
|
||||||
ypos = short(y);
|
{ }
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const char* FPoint::getClassName()
|
inline const char* FPoint::getClassName()
|
||||||
|
|
|
@ -10,12 +10,11 @@
|
||||||
// constructor and destructor
|
// constructor and destructor
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FRect::FRect (const FPoint& p1, const FPoint& p2)
|
FRect::FRect (const FPoint& p1, const FPoint& p2)
|
||||||
{
|
: X1(short(p1.getX()))
|
||||||
X1 = short(p1.getX());
|
, Y1(short(p1.getY()))
|
||||||
Y1 = short(p1.getY());
|
, X2(short(p2.getX()))
|
||||||
X2 = short(p2.getX());
|
, Y2(short(p2.getY()))
|
||||||
Y2 = short(p2.getY());
|
{ }
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FRect::~FRect() // destructor
|
FRect::~FRect() // destructor
|
||||||
|
@ -56,7 +55,7 @@ void FRect::setY2 (int n)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FRect::setX (int n)
|
void FRect::setX (int n)
|
||||||
{
|
{
|
||||||
short dX = X2 - X1;
|
short dX = short(X2 - X1);
|
||||||
X1 = short(n);
|
X1 = short(n);
|
||||||
X2 = short(X1 + dX);
|
X2 = short(X1 + dX);
|
||||||
}
|
}
|
||||||
|
@ -64,7 +63,7 @@ void FRect::setX (int n)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FRect::setY (int n)
|
void FRect::setY (int n)
|
||||||
{
|
{
|
||||||
short dY = Y2 - Y1;
|
short dY = short(Y2 - Y1);
|
||||||
Y1 = short(n);
|
Y1 = short(n);
|
||||||
Y2 = short(Y1 + dY);
|
Y2 = short(Y1 + dY);
|
||||||
}
|
}
|
||||||
|
@ -99,19 +98,19 @@ void FRect::setRect (int x, int y, int width, int height)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FRect::move (int dx, int dy)
|
void FRect::move (int dx, int dy)
|
||||||
{
|
{
|
||||||
X1 += short(dx);
|
X1 = short(X1 + dx);
|
||||||
Y1 += short(dy);
|
Y1 = short(Y1 + dy);
|
||||||
X2 += short(dx);
|
X2 = short(X2 + dx);
|
||||||
Y2 += short(dy);
|
Y2 = short(Y2 + dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FRect::move (const FPoint& d)
|
void FRect::move (const FPoint& d)
|
||||||
{
|
{
|
||||||
X1 += short(d.getX());
|
X1 = short(X1 + d.getX());
|
||||||
Y1 += short(d.getY());
|
Y1 = short(Y1 + d.getY());
|
||||||
X2 += short(d.getX());
|
X2 = short(X2 + d.getX());
|
||||||
Y2 += short(d.getY());
|
Y2 = short(Y2 + d.getY());
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
20
src/frect.h
20
src/frect.h
|
@ -71,19 +71,19 @@ class FRect
|
||||||
// FRect inline functions
|
// FRect inline functions
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FRect::FRect()
|
inline FRect::FRect()
|
||||||
{
|
: X1(0)
|
||||||
X1 = Y1 = 0;
|
, Y1(0)
|
||||||
X2 = Y2 = -1;
|
, X2(-1)
|
||||||
}
|
, Y2(-1)
|
||||||
|
{ }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FRect::FRect (int x, int y, int width, int height)
|
inline FRect::FRect (int x, int y, int width, int height)
|
||||||
{
|
: X1(short(x))
|
||||||
X1 = short(x);
|
, Y1(short(y))
|
||||||
Y1 = short(y);
|
, X2(short(x+width-1))
|
||||||
X2 = short(x+width-1);
|
, Y2(short(y+height-1))
|
||||||
Y2 = short(y+height-1);
|
{ }
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const char* FRect::getClassName()
|
inline const char* FRect::getClassName()
|
||||||
|
|
|
@ -143,7 +143,7 @@ void FScrollbar::processMiddleButton (int x, int y)
|
||||||
{
|
{
|
||||||
if ( y >1 && y < height )
|
if ( y >1 && y < height )
|
||||||
{
|
{
|
||||||
new_val = int( round ( float(max-min) * (y-2-(SliderLength/2))
|
new_val = int( round ( float(max-min) * (y-2.0-(SliderLength/2))
|
||||||
/ float(BarLength-SliderLength) ) );
|
/ float(BarLength-SliderLength) ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -154,7 +154,7 @@ void FScrollbar::processMiddleButton (int x, int y)
|
||||||
int nf = isNewFont() ? 1 : 0;
|
int nf = isNewFont() ? 1 : 0;
|
||||||
if ( x > 1+nf && x < width-nf )
|
if ( x > 1+nf && x < width-nf )
|
||||||
{
|
{
|
||||||
new_val = int( round ( float(max-min) * (x-2-nf-(SliderLength/2))
|
new_val = int( round ( float(max-min) * (x-2.0-nf-(SliderLength/2))
|
||||||
/ float(BarLength-SliderLength) ) );
|
/ float(BarLength-SliderLength) ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -180,21 +180,21 @@ void FScrollbar::processScroll()
|
||||||
|
|
||||||
// public methods of FScrollbar
|
// public methods of FScrollbar
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FScrollbar::onMouseDown (FMouseEvent* event)
|
void FScrollbar::onMouseDown (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
int mouse_x, mouse_y;
|
int mouse_x, mouse_y;
|
||||||
|
|
||||||
if ( event->getButton() != LeftButton
|
if ( ev->getButton() != LeftButton
|
||||||
&& event->getButton() != MiddleButton )
|
&& ev->getButton() != MiddleButton )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( min == max )
|
if ( min == max )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mouse_x = event->getX();
|
mouse_x = ev->getX();
|
||||||
mouse_y = event->getY();
|
mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( event->getButton() == MiddleButton )
|
if ( ev->getButton() == MiddleButton )
|
||||||
{
|
{
|
||||||
processMiddleButton (mouse_x, mouse_y);
|
processMiddleButton (mouse_x, mouse_y);
|
||||||
return;
|
return;
|
||||||
|
@ -249,10 +249,10 @@ void FScrollbar::onMouseDown (FMouseEvent* event)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FScrollbar::onMouseUp (FMouseEvent* event)
|
void FScrollbar::onMouseUp (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
if ( event->getButton() != LeftButton
|
if ( ev->getButton() != LeftButton
|
||||||
&& event->getButton() != MiddleButton )
|
&& ev->getButton() != MiddleButton )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SliderClickPos = -1;
|
SliderClickPos = -1;
|
||||||
|
@ -265,18 +265,18 @@ void FScrollbar::onMouseUp (FMouseEvent* event)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FScrollbar::onMouseMove (FMouseEvent* event)
|
void FScrollbar::onMouseMove (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
int mouse_x, mouse_y, newScrollType;
|
int mouse_x, mouse_y, newScrollType;
|
||||||
|
|
||||||
if ( event->getButton() != LeftButton
|
if ( ev->getButton() != LeftButton
|
||||||
&& event->getButton() != MiddleButton )
|
&& ev->getButton() != MiddleButton )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mouse_x = event->getX();
|
mouse_x = ev->getX();
|
||||||
mouse_y = event->getY();
|
mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( event->getButton() == MiddleButton )
|
if ( ev->getButton() == MiddleButton )
|
||||||
{
|
{
|
||||||
processMiddleButton (mouse_x, mouse_y);
|
processMiddleButton (mouse_x, mouse_y);
|
||||||
return;
|
return;
|
||||||
|
@ -293,7 +293,7 @@ void FScrollbar::onMouseMove (FMouseEvent* event)
|
||||||
int dy = mouse_y - SliderClickPos;
|
int dy = mouse_y - SliderClickPos;
|
||||||
SliderClickPos = mouse_y;
|
SliderClickPos = mouse_y;
|
||||||
|
|
||||||
new_val = int( round ( float(max-min) * (SliderPos + dy)
|
new_val = int( round ( float((max-min) * (SliderPos + dy))
|
||||||
/ float(BarLength-SliderLength) ) );
|
/ float(BarLength-SliderLength) ) );
|
||||||
}
|
}
|
||||||
else // horizontal
|
else // horizontal
|
||||||
|
@ -301,7 +301,7 @@ void FScrollbar::onMouseMove (FMouseEvent* event)
|
||||||
int dx = mouse_x - SliderClickPos;
|
int dx = mouse_x - SliderClickPos;
|
||||||
SliderClickPos = mouse_x;
|
SliderClickPos = mouse_x;
|
||||||
|
|
||||||
new_val = int( round ( float(max-min) * (SliderPos + dx)
|
new_val = int( round ( float((max-min) * (SliderPos + dx))
|
||||||
/ float(BarLength-SliderLength) ) );
|
/ float(BarLength-SliderLength) ) );
|
||||||
}
|
}
|
||||||
if ( new_val != val )
|
if ( new_val != val )
|
||||||
|
@ -330,9 +330,9 @@ void FScrollbar::onMouseMove (FMouseEvent* event)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FScrollbar::onWheel (FWheelEvent* event)
|
void FScrollbar::onWheel (FWheelEvent* ev)
|
||||||
{
|
{
|
||||||
int wheel = event->getWheel();
|
int wheel = ev->getWheel();
|
||||||
|
|
||||||
if ( scrollType != FScrollbar::noScroll )
|
if ( scrollType != FScrollbar::noScroll )
|
||||||
{
|
{
|
||||||
|
@ -425,7 +425,7 @@ void FScrollbar::setSteps (float st)
|
||||||
else
|
else
|
||||||
steps = st;
|
steps = st;
|
||||||
if ( pageSize == 0 )
|
if ( pageSize == 0 )
|
||||||
pageSize = int(max/steps);
|
pageSize = int(float(max)/steps);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -450,7 +450,7 @@ void FScrollbar::calculateSliderValues()
|
||||||
BarLength = length - 4;
|
BarLength = length - 4;
|
||||||
else
|
else
|
||||||
BarLength = length - 2;
|
BarLength = length - 2;
|
||||||
SliderLength = int(float(BarLength / steps));
|
SliderLength = int(float(BarLength) / steps);
|
||||||
|
|
||||||
if ( SliderLength < 1 )
|
if ( SliderLength < 1 )
|
||||||
SliderLength = 1;
|
SliderLength = 1;
|
||||||
|
|
|
@ -77,13 +77,13 @@ void FStatusKey::processActivate()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FStatusKey::onAccel (FAccelEvent* event)
|
void FStatusKey::onAccel (FAccelEvent* ev)
|
||||||
{
|
{
|
||||||
if ( ! isActivated() )
|
if ( ! isActivated() )
|
||||||
{
|
{
|
||||||
setActive();
|
setActive();
|
||||||
statusbar()->redraw();
|
statusbar()->redraw();
|
||||||
event->accept();
|
ev->accept();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,11 +329,11 @@ void FStatusBar::adjustSize()
|
||||||
|
|
||||||
// public methods of FStatusBar
|
// public methods of FStatusBar
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FStatusBar::onMouseDown (FMouseEvent* event)
|
void FStatusBar::onMouseDown (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
if ( hasActivatedKey() )
|
if ( hasActivatedKey() )
|
||||||
return;
|
return;
|
||||||
if ( event->getButton() != LeftButton )
|
if ( ev->getButton() != LeftButton )
|
||||||
{
|
{
|
||||||
mouse_down = false;
|
mouse_down = false;
|
||||||
if ( ! keylist.empty() )
|
if ( ! keylist.empty() )
|
||||||
|
@ -371,8 +371,8 @@ void FStatusBar::onMouseDown (FMouseEvent* event)
|
||||||
kname_len = int(getKeyName((*iter)->getKey()).getLength());
|
kname_len = int(getKeyName((*iter)->getKey()).getLength());
|
||||||
txt_length = int((*iter)->getText().getLength());
|
txt_length = int((*iter)->getText().getLength());
|
||||||
x2 = x1 + kname_len + txt_length + 1;
|
x2 = x1 + kname_len + txt_length + 1;
|
||||||
mouse_x = event->getX();
|
mouse_x = ev->getX();
|
||||||
mouse_y = event->getY();
|
mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( mouse_x >= x1
|
if ( mouse_x >= x1
|
||||||
&& mouse_x <= x2
|
&& mouse_x <= x2
|
||||||
|
@ -389,11 +389,11 @@ void FStatusBar::onMouseDown (FMouseEvent* event)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FStatusBar::onMouseUp (FMouseEvent* event)
|
void FStatusBar::onMouseUp (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
if ( hasActivatedKey() )
|
if ( hasActivatedKey() )
|
||||||
return;
|
return;
|
||||||
if ( event->getButton() != LeftButton )
|
if ( ev->getButton() != LeftButton )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( mouse_down )
|
if ( mouse_down )
|
||||||
|
@ -417,8 +417,8 @@ void FStatusBar::onMouseUp (FMouseEvent* event)
|
||||||
if ( (*iter)->hasMouseFocus() )
|
if ( (*iter)->hasMouseFocus() )
|
||||||
{
|
{
|
||||||
(*iter)->unsetMouseFocus();
|
(*iter)->unsetMouseFocus();
|
||||||
int mouse_x = event->getX();
|
int mouse_x = ev->getX();
|
||||||
int mouse_y = event->getY();
|
int mouse_y = ev->getY();
|
||||||
if ( mouse_x >= x1 && mouse_x <= x2 && mouse_y == 1 )
|
if ( mouse_x >= x1 && mouse_x <= x2 && mouse_y == 1 )
|
||||||
(*iter)->setActive();
|
(*iter)->setActive();
|
||||||
this->redraw();
|
this->redraw();
|
||||||
|
@ -431,11 +431,11 @@ void FStatusBar::onMouseUp (FMouseEvent* event)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FStatusBar::onMouseMove (FMouseEvent* event)
|
void FStatusBar::onMouseMove (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
if ( hasActivatedKey() )
|
if ( hasActivatedKey() )
|
||||||
return;
|
return;
|
||||||
if ( event->getButton() != LeftButton )
|
if ( ev->getButton() != LeftButton )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( mouse_down && ! keylist.empty() )
|
if ( mouse_down && ! keylist.empty() )
|
||||||
|
@ -454,8 +454,8 @@ void FStatusBar::onMouseMove (FMouseEvent* event)
|
||||||
int txt_length = int((*iter)->getText().getLength());
|
int txt_length = int((*iter)->getText().getLength());
|
||||||
int x2 = x1 + kname_len + txt_length + 1;
|
int x2 = x1 + kname_len + txt_length + 1;
|
||||||
|
|
||||||
int mouse_x = event->getX();
|
int mouse_x = ev->getX();
|
||||||
int mouse_y = event->getY();
|
int mouse_y = ev->getY();
|
||||||
if ( mouse_x >= x1
|
if ( mouse_x >= x1
|
||||||
&& mouse_x <= x2
|
&& mouse_x <= x2
|
||||||
&& mouse_y == 1 )
|
&& mouse_y == 1 )
|
||||||
|
|
236
src/fstring.cpp
236
src/fstring.cpp
|
@ -11,15 +11,18 @@
|
||||||
// constructors and destructor
|
// constructors and destructor
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString::FString()
|
FString::FString()
|
||||||
{
|
: string(0)
|
||||||
length = 0;
|
, length(0)
|
||||||
bufsize = 0;
|
, bufsize(0)
|
||||||
string = 0;
|
, c_string(0)
|
||||||
c_string = 0;
|
{ }
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString::FString (int len)
|
FString::FString (int len)
|
||||||
|
: string(0)
|
||||||
|
, length(0)
|
||||||
|
, bufsize(0)
|
||||||
|
, c_string(0)
|
||||||
{
|
{
|
||||||
if ( len >= 0 )
|
if ( len >= 0 )
|
||||||
initLength(uInt(len));
|
initLength(uInt(len));
|
||||||
|
@ -29,18 +32,21 @@ FString::FString (int len)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString::FString (uInt len)
|
FString::FString (uInt len)
|
||||||
|
: string(0)
|
||||||
|
, length(0)
|
||||||
|
, bufsize(0)
|
||||||
|
, c_string(0)
|
||||||
{
|
{
|
||||||
initLength(len);
|
initLength(len);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString::FString (int len, wchar_t c)
|
FString::FString (int len, wchar_t c)
|
||||||
|
: string(0)
|
||||||
|
, length(0)
|
||||||
|
, bufsize(0)
|
||||||
|
, c_string(0)
|
||||||
{
|
{
|
||||||
string = 0;
|
|
||||||
length = 0;
|
|
||||||
bufsize = 0;
|
|
||||||
c_string = 0;
|
|
||||||
|
|
||||||
if ( len >= 0 )
|
if ( len >= 0 )
|
||||||
_replace ( FString(uInt(len), c).string );
|
_replace ( FString(uInt(len), c).string );
|
||||||
else
|
else
|
||||||
|
@ -49,6 +55,10 @@ FString::FString (int len, wchar_t c)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString::FString (uInt len, wchar_t c)
|
FString::FString (uInt len, wchar_t c)
|
||||||
|
: string(0)
|
||||||
|
, length(0)
|
||||||
|
, bufsize(0)
|
||||||
|
, c_string(0)
|
||||||
{
|
{
|
||||||
register wchar_t* ps;
|
register wchar_t* ps;
|
||||||
register wchar_t* pe;
|
register wchar_t* pe;
|
||||||
|
@ -63,6 +73,10 @@ FString::FString (uInt len, wchar_t c)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString::FString (int len, char c)
|
FString::FString (int len, char c)
|
||||||
|
: string(0)
|
||||||
|
, length(0)
|
||||||
|
, bufsize(0)
|
||||||
|
, c_string(0)
|
||||||
{
|
{
|
||||||
string = 0;
|
string = 0;
|
||||||
length = 0;
|
length = 0;
|
||||||
|
@ -77,6 +91,10 @@ FString::FString (int len, char c)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString::FString (uInt len, char c)
|
FString::FString (uInt len, char c)
|
||||||
|
: string(0)
|
||||||
|
, length(0)
|
||||||
|
, bufsize(0)
|
||||||
|
, c_string(0)
|
||||||
{
|
{
|
||||||
register wchar_t* ps;
|
register wchar_t* ps;
|
||||||
register wchar_t* pe;
|
register wchar_t* pe;
|
||||||
|
@ -91,84 +109,83 @@ FString::FString (uInt len, char c)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString::FString (const FString& s)
|
FString::FString (const FString& s)
|
||||||
|
: string(0)
|
||||||
|
, length(0)
|
||||||
|
, bufsize(0)
|
||||||
|
, c_string(0)
|
||||||
{
|
{
|
||||||
string = 0;
|
|
||||||
length = 0;
|
|
||||||
bufsize = 0;
|
|
||||||
c_string = 0;
|
|
||||||
if ( s.string )
|
if ( s.string )
|
||||||
_replace (s.string);
|
_replace (s.string);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString::FString (const std::wstring& s)
|
FString::FString (const std::wstring& s)
|
||||||
|
: string(0)
|
||||||
|
, length(0)
|
||||||
|
, bufsize(0)
|
||||||
|
, c_string(0)
|
||||||
{
|
{
|
||||||
string = 0;
|
|
||||||
length = 0;
|
|
||||||
bufsize = 0;
|
|
||||||
c_string = 0;
|
|
||||||
if ( ! s.empty() )
|
if ( ! s.empty() )
|
||||||
_replace ( s.c_str() );
|
_replace ( s.c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString::FString (const wchar_t* s)
|
FString::FString (const wchar_t* s)
|
||||||
|
: string(0)
|
||||||
|
, length(0)
|
||||||
|
, bufsize(0)
|
||||||
|
, c_string(0)
|
||||||
{
|
{
|
||||||
string = 0;
|
|
||||||
length = 0;
|
|
||||||
bufsize = 0;
|
|
||||||
c_string = 0;
|
|
||||||
if ( s )
|
if ( s )
|
||||||
_replace (s);
|
_replace (s);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString::FString (const std::string& s)
|
FString::FString (const std::string& s)
|
||||||
|
: string(0)
|
||||||
|
, length(0)
|
||||||
|
, bufsize(0)
|
||||||
|
, c_string(0)
|
||||||
{
|
{
|
||||||
string = 0;
|
|
||||||
length = 0;
|
|
||||||
bufsize = 0;
|
|
||||||
c_string = 0;
|
|
||||||
|
|
||||||
if ( ! s.empty() )
|
if ( ! s.empty() )
|
||||||
{
|
{
|
||||||
const wchar_t* wc_str;
|
const wchar_t* wc_string;
|
||||||
wc_str = c_to_wc_str(s.c_str());
|
wc_string = c_to_wc_str(s.c_str());
|
||||||
|
|
||||||
if ( wc_str )
|
if ( wc_string )
|
||||||
{
|
{
|
||||||
_replace( wc_str );
|
_replace( wc_string );
|
||||||
if ( *wc_str )
|
if ( *wc_string )
|
||||||
delete[] wc_str;
|
delete[] wc_string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString::FString (const char* s)
|
FString::FString (const char* s)
|
||||||
|
: string(0)
|
||||||
|
, length(0)
|
||||||
|
, bufsize(0)
|
||||||
|
, c_string(0)
|
||||||
{
|
{
|
||||||
const wchar_t* wc_str;
|
const wchar_t* wc_string;
|
||||||
|
wc_string = c_to_wc_str(s);
|
||||||
|
|
||||||
string = 0;
|
if ( wc_string )
|
||||||
length = 0;
|
|
||||||
bufsize = 0;
|
|
||||||
c_string = 0;
|
|
||||||
|
|
||||||
wc_str = c_to_wc_str(s);
|
|
||||||
|
|
||||||
if ( wc_str )
|
|
||||||
{
|
{
|
||||||
_replace( wc_str );
|
_replace( wc_string );
|
||||||
if ( *wc_str )
|
if ( *wc_string )
|
||||||
delete[] wc_str;
|
delete[] wc_string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString::FString (const wchar_t c)
|
FString::FString (const wchar_t c)
|
||||||
|
: string(0)
|
||||||
|
, length(0)
|
||||||
|
, bufsize(0)
|
||||||
|
, c_string(0)
|
||||||
{
|
{
|
||||||
string = 0;
|
|
||||||
c_string = 0;
|
|
||||||
wchar_t s[2];
|
wchar_t s[2];
|
||||||
s[0] = c;
|
s[0] = c;
|
||||||
s[1] = L'\0';
|
s[1] = L'\0';
|
||||||
|
@ -177,9 +194,11 @@ FString::FString (const wchar_t c)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString::FString (const char c)
|
FString::FString (const char c)
|
||||||
|
: string(0)
|
||||||
|
, length(0)
|
||||||
|
, bufsize(0)
|
||||||
|
, c_string(0)
|
||||||
{
|
{
|
||||||
string = 0;
|
|
||||||
c_string = 0;
|
|
||||||
wchar_t s[2];
|
wchar_t s[2];
|
||||||
s[0] = wchar_t(c & 0xff);
|
s[0] = wchar_t(c & 0xff);
|
||||||
s[1] = L'\0';
|
s[1] = L'\0';
|
||||||
|
@ -207,13 +226,6 @@ inline void FString::initLength (uInt len)
|
||||||
string = new wchar_t[bufsize];
|
string = new wchar_t[bufsize];
|
||||||
wmemset(string, L'\0', bufsize);
|
wmemset(string, L'\0', bufsize);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
length = 0;
|
|
||||||
bufsize = 0;
|
|
||||||
string = 0;
|
|
||||||
}
|
|
||||||
c_string = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -270,8 +282,8 @@ inline void FString::_insert (uInt pos, uInt len, const wchar_t* s)
|
||||||
if ( (length + len + 1) <= bufsize )
|
if ( (length + len + 1) <= bufsize )
|
||||||
{
|
{
|
||||||
// output string <= bufsize
|
// output string <= bufsize
|
||||||
for (x = length+1; x >= pos+1; x--)
|
for (x = length; x > pos-1; x--)
|
||||||
string[x+len-1] = string[x-1];
|
string[x+len] = string[x];
|
||||||
for (x=0; x < len; x++)
|
for (x=0; x < len; x++)
|
||||||
string[x+pos] = s[x];
|
string[x+pos] = s[x];
|
||||||
length += len;
|
length += len;
|
||||||
|
@ -296,7 +308,7 @@ inline void FString::_insert (uInt pos, uInt len, const wchar_t* s)
|
||||||
sptr[y++] = string[x];
|
sptr[y++] = string[x];
|
||||||
for (x=0; x < len; x++)
|
for (x=0; x < len; x++)
|
||||||
sptr[y++] = s[x];
|
sptr[y++] = s[x];
|
||||||
for (x=pos; x <= length; x++)
|
for (x=pos; x < length+1; x++)
|
||||||
sptr[y++] = string[x];
|
sptr[y++] = string[x];
|
||||||
length += len;
|
length += len;
|
||||||
delete[](string);
|
delete[](string);
|
||||||
|
@ -310,7 +322,7 @@ inline void FString::_remove (uInt pos, uInt len)
|
||||||
{
|
{
|
||||||
if ( (bufsize - length - 1 + len) <= FWDBUFFER )
|
if ( (bufsize - length - 1 + len) <= FWDBUFFER )
|
||||||
{
|
{
|
||||||
for (uInt i=pos; (i+len) <= length; i++)
|
for (uInt i=pos; (i+len) < length+1; i++)
|
||||||
string[i] = string[i+len];
|
string[i] = string[i+len];
|
||||||
length -= len;
|
length -= len;
|
||||||
}
|
}
|
||||||
|
@ -331,7 +343,7 @@ inline void FString::_remove (uInt pos, uInt len)
|
||||||
uInt x, y = 0;
|
uInt x, y = 0;
|
||||||
for (x=0; x < pos; x++)
|
for (x=0; x < pos; x++)
|
||||||
sptr[y++] = string[x];
|
sptr[y++] = string[x];
|
||||||
for (x=pos+len; x <= length; x++)
|
for (x=pos+len; x < length+1; x++)
|
||||||
sptr[y++] = string[x];
|
sptr[y++] = string[x];
|
||||||
delete[](string);
|
delete[](string);
|
||||||
string = sptr;
|
string = sptr;
|
||||||
|
@ -534,12 +546,12 @@ const FString& FString::operator = (const wchar_t* s)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString& FString::operator = (const std::string& s)
|
FString& FString::operator = (const std::string& s)
|
||||||
{
|
{
|
||||||
const wchar_t* wc_str = c_to_wc_str(s.c_str());
|
const wchar_t* wc_string = c_to_wc_str(s.c_str());
|
||||||
if ( wc_str )
|
if ( wc_string )
|
||||||
{
|
{
|
||||||
_replace( wc_str );
|
_replace( wc_string );
|
||||||
if ( *wc_str )
|
if ( *wc_string )
|
||||||
delete[] wc_str;
|
delete[] wc_string;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
length = bufsize = 0, string = 0;
|
length = bufsize = 0, string = 0;
|
||||||
|
@ -549,12 +561,12 @@ FString& FString::operator = (const std::string& s)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
const FString& FString::operator = (const char* s)
|
const FString& FString::operator = (const char* s)
|
||||||
{
|
{
|
||||||
const wchar_t* wc_str = c_to_wc_str(s);
|
const wchar_t* wc_string = c_to_wc_str(s);
|
||||||
if ( wc_str )
|
if ( wc_string )
|
||||||
{
|
{
|
||||||
_replace( wc_str );
|
_replace( wc_string );
|
||||||
if ( *wc_str )
|
if ( *wc_string )
|
||||||
delete[] wc_str;
|
delete[] wc_string;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
length = bufsize = 0, string = 0;
|
length = bufsize = 0, string = 0;
|
||||||
|
@ -605,12 +617,12 @@ const FString& FString::operator += (const wchar_t* s)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
const FString& FString::operator += (const std::string& s)
|
const FString& FString::operator += (const std::string& s)
|
||||||
{
|
{
|
||||||
const wchar_t* wc_str = c_to_wc_str(s.c_str());
|
const wchar_t* wc_string = c_to_wc_str(s.c_str());
|
||||||
if ( wc_str )
|
if ( wc_string )
|
||||||
{
|
{
|
||||||
_insert (length, uInt(s.length()), wc_str);
|
_insert (length, uInt(s.length()), wc_string);
|
||||||
if ( *wc_str )
|
if ( *wc_string )
|
||||||
delete[] wc_str;
|
delete[] wc_string;
|
||||||
}
|
}
|
||||||
return (*this);
|
return (*this);
|
||||||
}
|
}
|
||||||
|
@ -618,12 +630,12 @@ const FString& FString::operator += (const std::string& s)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
const FString& FString::operator += (const char* s)
|
const FString& FString::operator += (const char* s)
|
||||||
{
|
{
|
||||||
const wchar_t* wc_str = c_to_wc_str(s);
|
const wchar_t* wc_string = c_to_wc_str(s);
|
||||||
if ( wc_str )
|
if ( wc_string )
|
||||||
{
|
{
|
||||||
_insert (length, uInt(strlen(s)), wc_str);
|
_insert (length, uInt(strlen(s)), wc_string);
|
||||||
if ( *wc_str )
|
if ( *wc_string )
|
||||||
delete[] wc_str;
|
delete[] wc_string;
|
||||||
}
|
}
|
||||||
return (*this);
|
return (*this);
|
||||||
}
|
}
|
||||||
|
@ -671,12 +683,12 @@ const FString FString::operator + (const wchar_t* s)
|
||||||
const FString FString::operator + (const std::string& s)
|
const FString FString::operator + (const std::string& s)
|
||||||
{
|
{
|
||||||
FString tmp(string);
|
FString tmp(string);
|
||||||
wchar_t* wc_str = c_to_wc_str(s.c_str());
|
wchar_t* wc_string = c_to_wc_str(s.c_str());
|
||||||
if ( ! wc_str )
|
if ( ! wc_string )
|
||||||
return (tmp);
|
return (tmp);
|
||||||
tmp._insert (length, uInt(wcslen(wc_str)), wc_str);
|
tmp._insert (length, uInt(wcslen(wc_string)), wc_string);
|
||||||
if ( *wc_str )
|
if ( *wc_string )
|
||||||
delete[] wc_str;
|
delete[] wc_string;
|
||||||
return (tmp);
|
return (tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -684,12 +696,12 @@ const FString FString::operator + (const std::string& s)
|
||||||
const FString FString::operator + (const char* s)
|
const FString FString::operator + (const char* s)
|
||||||
{
|
{
|
||||||
FString tmp(string);
|
FString tmp(string);
|
||||||
wchar_t* wc_str = c_to_wc_str(s);
|
wchar_t* wc_string = c_to_wc_str(s);
|
||||||
if ( ! wc_str )
|
if ( ! wc_string )
|
||||||
return (tmp);
|
return (tmp);
|
||||||
tmp._insert (length, uInt(wcslen(wc_str)), wc_str);
|
tmp._insert (length, uInt(wcslen(wc_string)), wc_string);
|
||||||
if ( *wc_str )
|
if ( *wc_string )
|
||||||
delete[] wc_str;
|
delete[] wc_string;
|
||||||
return (tmp);
|
return (tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -853,7 +865,7 @@ FString& FString::sprintf (const wchar_t* format, ...)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString& FString::sprintf (const char* format, ...)
|
FString& FString::sprintf (const char* format, ...)
|
||||||
{
|
{
|
||||||
const wchar_t* wc_str;
|
const wchar_t* wc_string;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
char* buffer;
|
char* buffer;
|
||||||
int len;
|
int len;
|
||||||
|
@ -872,12 +884,12 @@ FString& FString::sprintf (const char* format, ...)
|
||||||
va_end (args);
|
va_end (args);
|
||||||
}
|
}
|
||||||
|
|
||||||
wc_str = c_to_wc_str(buffer);
|
wc_string = c_to_wc_str(buffer);
|
||||||
if ( wc_str )
|
if ( wc_string )
|
||||||
{
|
{
|
||||||
this->_replace(wc_str);
|
this->_replace(wc_string);
|
||||||
if ( *wc_str )
|
if ( *wc_string )
|
||||||
delete[] wc_str;
|
delete[] wc_string;
|
||||||
}
|
}
|
||||||
if ( buffer != buf )
|
if ( buffer != buf )
|
||||||
delete[] buffer;
|
delete[] buffer;
|
||||||
|
@ -1126,7 +1138,7 @@ double FString::toDouble() const
|
||||||
{
|
{
|
||||||
if ( ret >= HUGE_VAL || ret <= -HUGE_VAL )
|
if ( ret >= HUGE_VAL || ret <= -HUGE_VAL )
|
||||||
throw std::overflow_error ("overflow");
|
throw std::overflow_error ("overflow");
|
||||||
if ( ret == 0.0l )
|
if ( fabs(ret) < DBL_EPSILON ) // ret == 0.0l
|
||||||
throw std::underflow_error ("underflow");
|
throw std::underflow_error ("underflow");
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -1266,12 +1278,12 @@ FString& FString::setString (const wchar_t* s)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString& FString::setString (const char* s)
|
FString& FString::setString (const char* s)
|
||||||
{
|
{
|
||||||
const wchar_t* wc_str = c_to_wc_str(s);
|
const wchar_t* wc_string = c_to_wc_str(s);
|
||||||
if ( wc_str )
|
if ( wc_string )
|
||||||
{
|
{
|
||||||
_replace (wc_str);
|
_replace (wc_string);
|
||||||
if ( *wc_str )
|
if ( *wc_string )
|
||||||
delete[] wc_str;
|
delete[] wc_string;
|
||||||
}
|
}
|
||||||
return (*this);
|
return (*this);
|
||||||
}
|
}
|
||||||
|
@ -1985,13 +1997,13 @@ FString FString::replaceControlCodes() const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString FString::expandTabs (uInt tabstop) const
|
FString FString::expandTabs (uInt tabstop) const
|
||||||
{
|
{
|
||||||
uLong end;
|
uLong last;
|
||||||
FString instr(this->string);
|
FString instr(this->string);
|
||||||
FString outstr("");
|
FString outstr("");
|
||||||
|
|
||||||
std::vector<FString> tab_split = instr.split("\t");
|
std::vector<FString> tab_split = instr.split("\t");
|
||||||
end = tab_split.size();
|
last = tab_split.size();
|
||||||
for (uInt i=0; i < end; i++)
|
for (uInt i=0; i < last; i++)
|
||||||
{
|
{
|
||||||
uInt len = tab_split[i].getLength();
|
uInt len = tab_split[i].getLength();
|
||||||
outstr += tab_split[i] + FString(tabstop - len % tabstop, L' ');
|
outstr += tab_split[i] + FString(tabstop - len % tabstop, L' ');
|
||||||
|
@ -2130,12 +2142,12 @@ bool FString::includes (const wchar_t* s)
|
||||||
bool FString::includes (const char* s)
|
bool FString::includes (const char* s)
|
||||||
{
|
{
|
||||||
bool ret;
|
bool ret;
|
||||||
const wchar_t* wc_str = c_to_wc_str(s);
|
const wchar_t* wc_string = c_to_wc_str(s);
|
||||||
if ( ! wc_str )
|
if ( ! wc_string )
|
||||||
return false;
|
return false;
|
||||||
ret = bool(wcsstr(string, wc_str) != 0);
|
ret = bool(wcsstr(string, wc_string) != 0);
|
||||||
if ( *wc_str )
|
if ( *wc_string )
|
||||||
delete[] wc_str;
|
delete[] wc_string;
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,35 +119,38 @@ void FSwitch::setText (FString txt)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FSwitch::onKeyPress (FKeyEvent* event)
|
void FSwitch::onKeyPress (FKeyEvent* ev)
|
||||||
{
|
{
|
||||||
switch ( event->key() )
|
switch ( ev->key() )
|
||||||
{
|
{
|
||||||
case fc::Fkey_home:
|
case fc::Fkey_home:
|
||||||
case fc::Fkey_left:
|
case fc::Fkey_left:
|
||||||
setChecked();
|
setChecked();
|
||||||
event->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_end:
|
case fc::Fkey_end:
|
||||||
case fc::Fkey_right:
|
case fc::Fkey_right:
|
||||||
unsetChecked();
|
unsetChecked();
|
||||||
event->accept();
|
ev->accept();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( event->isAccepted() )
|
if ( ev->isAccepted() )
|
||||||
draw();
|
draw();
|
||||||
else
|
else
|
||||||
FToggleButton::onKeyPress(event);
|
FToggleButton::onKeyPress(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FSwitch::onMouseDown (FMouseEvent* event)
|
void FSwitch::onMouseDown (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
FToggleButton::onMouseDown(event);
|
FToggleButton::onMouseDown(ev);
|
||||||
|
|
||||||
if ( event->getButton() != LeftButton )
|
if ( ev->getButton() != LeftButton )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
button_pressed = true;
|
button_pressed = true;
|
||||||
|
@ -155,11 +158,11 @@ void FSwitch::onMouseDown (FMouseEvent* event)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FSwitch::onMouseUp (FMouseEvent* event)
|
void FSwitch::onMouseUp (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
FToggleButton::onMouseUp(event);
|
FToggleButton::onMouseUp(ev);
|
||||||
|
|
||||||
if ( event->getButton() != LeftButton )
|
if ( ev->getButton() != LeftButton )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
button_pressed = false;
|
button_pressed = false;
|
||||||
|
|
|
@ -171,7 +171,7 @@ void FTerm::outb_Attribute_Controller (int index, int data)
|
||||||
outb (index & 0x1F, AttrC_Index);
|
outb (index & 0x1F, AttrC_Index);
|
||||||
outb (uChar(data), AttrC_DataW);
|
outb (uChar(data), AttrC_DataW);
|
||||||
inb (AttrC_DataSwitch);
|
inb (AttrC_DataSwitch);
|
||||||
outb ((index & 0x1F) | 0x20, AttrC_Index);
|
outb (uChar((index & 0x1F) | 0x20), AttrC_Index);
|
||||||
outb (uChar(data), AttrC_DataW);
|
outb (uChar(data), AttrC_DataW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ int FTerm::inb_Attribute_Controller (int index)
|
||||||
outb (index & 0x1F, AttrC_Index);
|
outb (index & 0x1F, AttrC_Index);
|
||||||
res = inb (AttrC_DataR);
|
res = inb (AttrC_DataR);
|
||||||
inb (AttrC_DataSwitch);
|
inb (AttrC_DataSwitch);
|
||||||
outb ((index & 0x1F) | 0x20, AttrC_Index);
|
outb (uChar((index & 0x1F) | 0x20), AttrC_Index);
|
||||||
inb (AttrC_DataR);
|
inb (AttrC_DataR);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -912,6 +912,7 @@ void FTerm::signal_handler (int signum)
|
||||||
// initialize a resize event to the root element
|
// initialize a resize event to the root element
|
||||||
resize_term = true;
|
resize_term = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SIGTERM:
|
case SIGTERM:
|
||||||
case SIGQUIT:
|
case SIGQUIT:
|
||||||
case SIGINT:
|
case SIGINT:
|
||||||
|
@ -1167,6 +1168,9 @@ void FTerm::init()
|
||||||
termtype = const_cast<char*>("rxvt");
|
termtype = const_cast<char*>("rxvt");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// end of terminal detection
|
// end of terminal detection
|
||||||
|
@ -1949,8 +1953,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(FTerm::char_data) * unsigned(length));
|
||||||
memcpy (ac, tc, sizeof(FTerm::char_data) * uLong(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;
|
||||||
|
@ -2003,7 +2006,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(FTerm::char_data) * uLong(length));
|
memcpy (ac, tc, sizeof(FTerm::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);
|
||||||
|
@ -2068,7 +2071,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(FTerm::char_data) * uLong(length));
|
memcpy (tc, ac, sizeof(FTerm::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);
|
||||||
|
@ -2177,7 +2180,8 @@ bool FTerm::setVGAFont()
|
||||||
VGAFont = false;
|
VGAFont = false;
|
||||||
// unicode character mapping
|
// unicode character mapping
|
||||||
struct unimapdesc unimap;
|
struct unimapdesc unimap;
|
||||||
unimap.entry_ct = sizeof(unicode_cp437_pairs) / sizeof(unipair);
|
unimap.entry_ct = uChar ( sizeof(unicode_cp437_pairs) /
|
||||||
|
sizeof(unipair) );
|
||||||
unimap.entries = &unicode_cp437_pairs[0];
|
unimap.entries = &unicode_cp437_pairs[0];
|
||||||
setUnicodeMap(&unimap);
|
setUnicodeMap(&unimap);
|
||||||
}
|
}
|
||||||
|
@ -2231,7 +2235,8 @@ bool FTerm::setNewFont()
|
||||||
if ( ret != 0 )
|
if ( ret != 0 )
|
||||||
NewFont = false;
|
NewFont = false;
|
||||||
// unicode character mapping
|
// unicode character mapping
|
||||||
unimap.entry_ct = sizeof(unicode_cp437_pairs) / sizeof(unipair);
|
unimap.entry_ct = uInt16 ( sizeof(unicode_cp437_pairs) /
|
||||||
|
sizeof(unipair) );
|
||||||
unimap.entries = &unicode_cp437_pairs[0];
|
unimap.entries = &unicode_cp437_pairs[0];
|
||||||
setUnicodeMap(&unimap);
|
setUnicodeMap(&unimap);
|
||||||
}
|
}
|
||||||
|
@ -2789,8 +2794,12 @@ void FTerm::setPalette (int index, int r, int g, int b)
|
||||||
case 0:
|
case 0:
|
||||||
::printf ("\033]11;#%2.2x%2.2x%2.2x\033\\", r, g, b);
|
::printf ("\033]11;#%2.2x%2.2x%2.2x\033\\", r, g, b);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 7:
|
case 7:
|
||||||
::printf ("\033]10;#%2.2x%2.2x%2.2x\033\\", r, g, b);
|
::printf ("\033]10;#%2.2x%2.2x%2.2x\033\\", r, g, b);
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2948,9 +2957,13 @@ bool FTerm::gpmMouse (bool on)
|
||||||
{
|
{
|
||||||
case -1:
|
case -1:
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case -2:
|
case -2:
|
||||||
Gpm_Close();
|
Gpm_Close();
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -3575,7 +3588,11 @@ int FTerm::print (FTerm::term_area* area, FString& s)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '\t':
|
case '\t':
|
||||||
cursor->x_ref() += tabstop - uInt(cursor->x_ref()) + 1 % tabstop;
|
cursor->x_ref() = short ( uInt(cursor->x_ref())
|
||||||
|
+ tabstop
|
||||||
|
- uInt(cursor->x_ref())
|
||||||
|
+ 1
|
||||||
|
% tabstop );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '\b':
|
case '\b':
|
||||||
|
@ -3784,6 +3801,10 @@ inline void FTerm::appendAttributes (char_data*& screen_attr)
|
||||||
case fc::NF_rev_menu_button3:
|
case fc::NF_rev_menu_button3:
|
||||||
case fc::NF_rev_border_line_right_and_left:
|
case fc::NF_rev_border_line_right_and_left:
|
||||||
setTermColor (screen_attr->bg_color, screen_attr->fg_color);
|
setTermColor (screen_attr->bg_color, screen_attr->fg_color);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,42 +188,42 @@ void FTextView::hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTextView::onKeyPress (FKeyEvent* event)
|
void FTextView::onKeyPress (FKeyEvent* ev)
|
||||||
{
|
{
|
||||||
int last_line = int(getRows());
|
int last_line = int(getRows());
|
||||||
int key = event->key();
|
int key = ev->key();
|
||||||
|
|
||||||
switch ( key )
|
switch ( key )
|
||||||
{
|
{
|
||||||
case fc::Fkey_up:
|
case fc::Fkey_up:
|
||||||
if ( yoffset > 0 )
|
if ( yoffset > 0 )
|
||||||
yoffset--;
|
yoffset--;
|
||||||
event->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_down:
|
case fc::Fkey_down:
|
||||||
if ( yoffset+height+nf_offset-2 < last_line )
|
if ( yoffset+height+nf_offset-2 < last_line )
|
||||||
yoffset++;
|
yoffset++;
|
||||||
event->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_right:
|
case fc::Fkey_right:
|
||||||
if ( xoffset+width-nf_offset-2 < int(maxLineWidth) )
|
if ( xoffset+width-nf_offset-2 < int(maxLineWidth) )
|
||||||
xoffset++;
|
xoffset++;
|
||||||
event->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_left:
|
case fc::Fkey_left:
|
||||||
if ( xoffset > 0 )
|
if ( xoffset > 0 )
|
||||||
xoffset--;
|
xoffset--;
|
||||||
event->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_ppage:
|
case fc::Fkey_ppage:
|
||||||
yoffset -= height-2;
|
yoffset -= height-2;
|
||||||
if ( yoffset < 0 )
|
if ( yoffset < 0 )
|
||||||
yoffset = 0;
|
yoffset = 0;
|
||||||
event->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_npage:
|
case fc::Fkey_npage:
|
||||||
|
@ -233,22 +233,25 @@ void FTextView::onKeyPress (FKeyEvent* event)
|
||||||
yoffset = last_line - height - nf_offset + 2;
|
yoffset = last_line - height - nf_offset + 2;
|
||||||
if ( yoffset < 0 )
|
if ( yoffset < 0 )
|
||||||
yoffset = 0;
|
yoffset = 0;
|
||||||
event->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_home:
|
case fc::Fkey_home:
|
||||||
yoffset = 0;
|
yoffset = 0;
|
||||||
event->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_end:
|
case fc::Fkey_end:
|
||||||
if ( last_line >= height )
|
if ( last_line >= height )
|
||||||
yoffset = last_line - height - nf_offset + 2;
|
yoffset = last_line - height - nf_offset + 2;
|
||||||
event->accept();
|
ev->accept();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( event->isAccepted() )
|
if ( ev->isAccepted() )
|
||||||
{
|
{
|
||||||
if ( isVisible() )
|
if ( isVisible() )
|
||||||
drawText();
|
drawText();
|
||||||
|
@ -264,9 +267,9 @@ void FTextView::onKeyPress (FKeyEvent* event)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTextView::onMouseDown (FMouseEvent* event)
|
void FTextView::onMouseDown (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
if ( event->getButton() != LeftButton )
|
if ( ev->getButton() != LeftButton )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( ! hasFocus() )
|
if ( ! hasFocus() )
|
||||||
|
@ -283,10 +286,10 @@ void FTextView::onMouseDown (FMouseEvent* event)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTextView::onWheel (FWheelEvent* event)
|
void FTextView::onWheel (FWheelEvent* ev)
|
||||||
{
|
{
|
||||||
int last_line = int(getRows());
|
int last_line = int(getRows());
|
||||||
int wheel = event->getWheel();
|
int wheel = ev->getWheel();
|
||||||
|
|
||||||
switch ( wheel )
|
switch ( wheel )
|
||||||
{
|
{
|
||||||
|
@ -299,6 +302,7 @@ void FTextView::onWheel (FWheelEvent* event)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WheelDown:
|
case 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 )
|
||||||
yoffset_end = 0;
|
yoffset_end = 0;
|
||||||
|
@ -307,6 +311,10 @@ void FTextView::onWheel (FWheelEvent* event)
|
||||||
yoffset += 4;
|
yoffset += 4;
|
||||||
if ( yoffset > yoffset_end )
|
if ( yoffset > yoffset_end )
|
||||||
yoffset = yoffset_end;
|
yoffset = yoffset_end;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,6 +399,9 @@ void FTextView::cb_VBarChange (FWidget*, void*)
|
||||||
onWheel(&wheel_ev);
|
onWheel(&wheel_ev);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isVisible() )
|
if ( isVisible() )
|
||||||
|
@ -465,6 +476,9 @@ void FTextView::cb_HBarChange (FWidget*, void*)
|
||||||
if ( xoffset > xoffset_end )
|
if ( xoffset > xoffset_end )
|
||||||
xoffset = xoffset_end;
|
xoffset = xoffset_end;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isVisible() )
|
if ( isVisible() )
|
||||||
|
|
|
@ -264,14 +264,14 @@ bool FToggleButton::isCheckboxButton() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FToggleButton::onKeyPress (FKeyEvent* event)
|
void FToggleButton::onKeyPress (FKeyEvent* ev)
|
||||||
{
|
{
|
||||||
int key;
|
int key;
|
||||||
|
|
||||||
if ( ! isEnabled() )
|
if ( ! isEnabled() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
key = event->key();
|
key = ev->key();
|
||||||
|
|
||||||
switch ( key )
|
switch ( key )
|
||||||
{
|
{
|
||||||
|
@ -292,25 +292,28 @@ void FToggleButton::onKeyPress (FKeyEvent* event)
|
||||||
processToggle();
|
processToggle();
|
||||||
}
|
}
|
||||||
processClick();
|
processClick();
|
||||||
event->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_down:
|
case fc::Fkey_down:
|
||||||
case fc::Fkey_right:
|
case fc::Fkey_right:
|
||||||
focus_inside_group = true;
|
focus_inside_group = true;
|
||||||
focusNextChild();
|
focusNextChild();
|
||||||
event->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_up:
|
case fc::Fkey_up:
|
||||||
case fc::Fkey_left:
|
case fc::Fkey_left:
|
||||||
focus_inside_group = true;
|
focus_inside_group = true;
|
||||||
focusPrevChild();
|
focusPrevChild();
|
||||||
event->accept();
|
ev->accept();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( event->isAccepted() )
|
if ( ev->isAccepted() )
|
||||||
{
|
{
|
||||||
draw();
|
draw();
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
|
@ -436,9 +439,9 @@ bool FToggleButton::setFocus(bool on)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FToggleButton::onMouseDown (FMouseEvent* event)
|
void FToggleButton::onMouseDown (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
if ( event->getButton() != LeftButton )
|
if ( ev->getButton() != LeftButton )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( ! hasFocus() )
|
if ( ! hasFocus() )
|
||||||
|
@ -460,12 +463,12 @@ void FToggleButton::onMouseDown (FMouseEvent* event)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FToggleButton::onMouseUp (FMouseEvent* event)
|
void FToggleButton::onMouseUp (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
if ( event->getButton() != LeftButton )
|
if ( ev->getButton() != LeftButton )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( getGeometryGlobal().contains(event->getGlobalPos()) )
|
if ( getGeometryGlobal().contains(ev->getGlobalPos()) )
|
||||||
{
|
{
|
||||||
if ( isRadioButton() )
|
if ( isRadioButton() )
|
||||||
{
|
{
|
||||||
|
@ -486,13 +489,13 @@ void FToggleButton::onMouseUp (FMouseEvent* event)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FToggleButton::onAccel (FAccelEvent* event)
|
void FToggleButton::onAccel (FAccelEvent* ev)
|
||||||
{
|
{
|
||||||
if ( isEnabled() )
|
if ( isEnabled() )
|
||||||
{
|
{
|
||||||
if ( ! hasFocus() )
|
if ( ! hasFocus() )
|
||||||
{
|
{
|
||||||
FWidget* focused_widget = static_cast<FWidget*>(event->focusedWidget());
|
FWidget* focused_widget = static_cast<FWidget*>(ev->focusedWidget());
|
||||||
FFocusEvent out (FocusOut_Event);
|
FFocusEvent out (FocusOut_Event);
|
||||||
FApplication::queueEvent(focused_widget, &out);
|
FApplication::queueEvent(focused_widget, &out);
|
||||||
setFocus();
|
setFocus();
|
||||||
|
@ -521,7 +524,7 @@ void FToggleButton::onAccel (FAccelEvent* event)
|
||||||
flush_out();
|
flush_out();
|
||||||
}
|
}
|
||||||
processClick();
|
processClick();
|
||||||
event->accept();
|
ev->accept();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -428,7 +428,7 @@ void FWidget::adjustSize()
|
||||||
FObject::object_list children;
|
FObject::object_list children;
|
||||||
FObject::object_list::const_iterator iter, end;
|
FObject::object_list::const_iterator iter, end;
|
||||||
|
|
||||||
children = this->children();
|
children = this->getChildren();
|
||||||
iter = children.begin();
|
iter = children.begin();
|
||||||
end = children.end();
|
end = children.end();
|
||||||
|
|
||||||
|
@ -633,7 +633,7 @@ void FWidget::onAccel (FAccelEvent*)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FWidget::onResize (FResizeEvent* event)
|
void FWidget::onResize (FResizeEvent* ev)
|
||||||
{
|
{
|
||||||
if ( openConsole() == 0 )
|
if ( openConsole() == 0 )
|
||||||
{
|
{
|
||||||
|
@ -642,7 +642,7 @@ void FWidget::onResize (FResizeEvent* event)
|
||||||
}
|
}
|
||||||
rootObject->resize();
|
rootObject->resize();
|
||||||
rootObject->redraw();
|
rootObject->redraw();
|
||||||
event->accept();
|
ev->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -656,9 +656,9 @@ void FWidget::onHide (FHideEvent*)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FWidget::onClose (FCloseEvent* event)
|
void FWidget::onClose (FCloseEvent* ev)
|
||||||
{
|
{
|
||||||
event->accept();
|
ev->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -666,12 +666,12 @@ bool FWidget::focusNextChild(void)
|
||||||
{
|
{
|
||||||
if ( hasParent() )
|
if ( hasParent() )
|
||||||
{
|
{
|
||||||
if ( parent()->hasChildren() )
|
if ( getParent()->hasChildren() )
|
||||||
{
|
{
|
||||||
FObject::object_list children;
|
FObject::object_list children;
|
||||||
FObject::object_list::iterator iter, end;
|
FObject::object_list::iterator iter, end;
|
||||||
|
|
||||||
children = parent()->children();
|
children = getParent()->getChildren();
|
||||||
iter = children.begin();
|
iter = children.begin();
|
||||||
end = children.end();
|
end = children.end();
|
||||||
|
|
||||||
|
@ -727,12 +727,12 @@ bool FWidget::focusPrevChild(void)
|
||||||
{
|
{
|
||||||
if ( hasParent() )
|
if ( hasParent() )
|
||||||
{
|
{
|
||||||
if ( parent()->hasChildren() )
|
if ( getParent()->hasChildren() )
|
||||||
{
|
{
|
||||||
FObject::object_list children;
|
FObject::object_list children;
|
||||||
FObject::object_list::iterator iter, begin;
|
FObject::object_list::iterator iter, begin;
|
||||||
|
|
||||||
children = parent()->children();
|
children = getParent()->getChildren();
|
||||||
iter = children.end();
|
iter = children.end();
|
||||||
begin = children.begin();
|
begin = children.begin();
|
||||||
do
|
do
|
||||||
|
@ -826,7 +826,7 @@ FWidget* FWidget::childWidgetAt (FWidget* p, int x, int y)
|
||||||
FObject::object_list children;
|
FObject::object_list children;
|
||||||
FObject::object_list::const_iterator iter, end;
|
FObject::object_list::const_iterator iter, end;
|
||||||
|
|
||||||
children = p->children();
|
children = p->getChildren();
|
||||||
iter = children.begin();
|
iter = children.begin();
|
||||||
end = children.end();
|
end = children.end();
|
||||||
|
|
||||||
|
@ -884,7 +884,7 @@ int FWidget::numOfFocusableChildren()
|
||||||
|
|
||||||
int num = 0;
|
int num = 0;
|
||||||
|
|
||||||
children = this->children();
|
children = this->getChildren();
|
||||||
iter = children.begin();
|
iter = children.begin();
|
||||||
end = children.end();
|
end = children.end();
|
||||||
|
|
||||||
|
@ -901,10 +901,10 @@ int FWidget::numOfFocusableChildren()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FWidget::close()
|
bool FWidget::close()
|
||||||
{
|
{
|
||||||
FCloseEvent event(Close_Event);
|
FCloseEvent ev(Close_Event);
|
||||||
FApplication::sendEvent(this, &event);
|
FApplication::sendEvent(this, &ev);
|
||||||
|
|
||||||
if ( event.isAccepted() )
|
if ( ev.isAccepted() )
|
||||||
{
|
{
|
||||||
if ( this == getMainWidget() )
|
if ( this == getMainWidget() )
|
||||||
quit();
|
quit();
|
||||||
|
@ -1165,7 +1165,7 @@ void FWidget::redraw()
|
||||||
FObject::object_list children;
|
FObject::object_list children;
|
||||||
FObject::object_list::const_iterator iter, end;
|
FObject::object_list::const_iterator iter, end;
|
||||||
|
|
||||||
children = this->children();
|
children = this->getChildren();
|
||||||
iter = children.begin();
|
iter = children.begin();
|
||||||
end = children.end();
|
end = children.end();
|
||||||
|
|
||||||
|
@ -1256,7 +1256,7 @@ void FWidget::show()
|
||||||
FObject::object_list children;
|
FObject::object_list children;
|
||||||
FObject::object_list::const_iterator iter, end;
|
FObject::object_list::const_iterator iter, end;
|
||||||
|
|
||||||
children = this->children();
|
children = this->getChildren();
|
||||||
iter = children.begin();
|
iter = children.begin();
|
||||||
end = children.end();
|
end = children.end();
|
||||||
|
|
||||||
|
@ -1276,8 +1276,8 @@ void FWidget::show()
|
||||||
show_root_widget = 0;
|
show_root_widget = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
FShowEvent show (Show_Event);
|
FShowEvent show_ev (Show_Event);
|
||||||
FApplication::sendEvent( this, &show );
|
FApplication::sendEvent(this, &show_ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -1296,8 +1296,8 @@ void FWidget::hide()
|
||||||
FWidget::setFocusWidget(parentWidget());
|
FWidget::setFocusWidget(parentWidget());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FHideEvent hide (Hide_Event);
|
FHideEvent hide_ev (Hide_Event);
|
||||||
FApplication::sendEvent( this, &hide );
|
FApplication::sendEvent(this, &hide_ev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1322,7 +1322,7 @@ bool FWidget::focusFirstChild (void)
|
||||||
if ( ! this->hasChildren() )
|
if ( ! this->hasChildren() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
children = this->children();
|
children = this->getChildren();
|
||||||
iter = children.begin();
|
iter = children.begin();
|
||||||
end = children.end();
|
end = children.end();
|
||||||
|
|
||||||
|
@ -1358,7 +1358,7 @@ bool FWidget::focusLastChild (void)
|
||||||
if ( ! this->hasChildren() )
|
if ( ! this->hasChildren() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
children = this->children();
|
children = this->getChildren();
|
||||||
iter = children.end();
|
iter = children.end();
|
||||||
begin = children.begin();
|
begin = children.begin();
|
||||||
|
|
||||||
|
@ -2051,6 +2051,9 @@ void FWidget::setDoubleFlatLine(int side, bool bit)
|
||||||
size = double_flatline_mask.left.size();
|
size = double_flatline_mask.left.size();
|
||||||
double_flatline_mask.left.assign(size, bit);
|
double_flatline_mask.left.assign(size, bit);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -152,6 +152,7 @@ class FWidget : public FObject, public FTerm
|
||||||
|
|
||||||
struct dbl_line_mask
|
struct dbl_line_mask
|
||||||
{
|
{
|
||||||
|
~dbl_line_mask() {}
|
||||||
std::vector<bool> top;
|
std::vector<bool> top;
|
||||||
std::vector<bool> right;
|
std::vector<bool> right;
|
||||||
std::vector<bool> bottom;
|
std::vector<bool> bottom;
|
||||||
|
@ -391,7 +392,7 @@ inline const char* FWidget::getClassName() const
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FWidget* FWidget::parentWidget() const
|
inline FWidget* FWidget::parentWidget() const
|
||||||
{ return static_cast<FWidget*>(parent()); }
|
{ return static_cast<FWidget*>(getParent()); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FWidget::isRootWidget() const
|
inline bool FWidget::isRootWidget() const
|
||||||
|
|
|
@ -35,10 +35,10 @@ private:
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
Button::Button (FWidget* parent) : FButton(parent)
|
Button::Button (FWidget* parent)
|
||||||
{
|
: FButton(parent)
|
||||||
checked = false;
|
, checked(false)
|
||||||
}
|
{ }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Button::setChecked(bool on)
|
void Button::setChecked(bool on)
|
||||||
|
@ -64,15 +64,15 @@ void Button::setChecked(bool on)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Button::onKeyPress (FKeyEvent* event)
|
void Button::onKeyPress (FKeyEvent* ev)
|
||||||
{
|
{
|
||||||
int key = event->key();
|
int key = ev->key();
|
||||||
|
|
||||||
// catch the enter key
|
// catch the enter key
|
||||||
if ( key == fc::Fkey_return || key == fc::Fkey_enter )
|
if ( key == fc::Fkey_return || key == fc::Fkey_enter )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FButton::onKeyPress(event);
|
FButton::onKeyPress(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -170,17 +170,22 @@ class Calc : public FDialog
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
Calc::Calc (FWidget* parent) : FDialog(parent)
|
Calc::Calc (FWidget* parent)
|
||||||
|
: FDialog(parent)
|
||||||
|
, error(false)
|
||||||
|
, arcus_mode(false)
|
||||||
|
, hyperbolic_mode(false)
|
||||||
|
, a(0.0L)
|
||||||
|
, b(0.0L)
|
||||||
|
, max_char(32)
|
||||||
|
, last_key(-1)
|
||||||
|
, infix_operator('\0')
|
||||||
|
, last_infix_operator('\0')
|
||||||
|
, input("")
|
||||||
|
, bracket_stack()
|
||||||
|
, calculator_buttons()
|
||||||
{
|
{
|
||||||
error = false;
|
|
||||||
arcus_mode = false;
|
|
||||||
hyperbolic_mode = false;
|
|
||||||
input = "";
|
|
||||||
clearInfixOperator();
|
clearInfixOperator();
|
||||||
last_infix_operator = '\0';
|
|
||||||
max_char = 32;
|
|
||||||
last_key = -1;
|
|
||||||
a = b = 0.0L;
|
|
||||||
|
|
||||||
const wchar_t* button_text[Calc::NUM_OF_BUTTONS] =
|
const wchar_t* button_text[Calc::NUM_OF_BUTTONS] =
|
||||||
{
|
{
|
||||||
|
@ -428,7 +433,7 @@ void Calc::calcInfixOperator()
|
||||||
switch ( infix_operator )
|
switch ( infix_operator )
|
||||||
{
|
{
|
||||||
case '*':
|
case '*':
|
||||||
if ( a != 0.0L )
|
if ( fabs(a) > LDBL_EPSILON ) // a != 0.0L
|
||||||
{
|
{
|
||||||
// ln(a * b) = ln(a) + ln(b)
|
// ln(a * b) = ln(a) + ln(b)
|
||||||
if ( log(abs(a)) + log(abs(b)) <= log(LDBL_MAX) )
|
if ( log(abs(a)) + log(abs(b)) <= log(LDBL_MAX) )
|
||||||
|
@ -441,14 +446,14 @@ void Calc::calcInfixOperator()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '/':
|
case '/':
|
||||||
if ( b != 0.0L )
|
if ( fabs(b) > LDBL_EPSILON ) // b != 0.0L
|
||||||
a /= b;
|
a /= b;
|
||||||
else
|
else
|
||||||
error = true;
|
error = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '+':
|
case '+':
|
||||||
if ( a != 0.0L )
|
if ( fabs(a) > LDBL_EPSILON ) // a != 0.0L
|
||||||
{
|
{
|
||||||
if ( log(abs(a)) + log(abs(1 + b/a)) <= log(LDBL_MAX) )
|
if ( log(abs(a)) + log(abs(1 + b/a)) <= log(LDBL_MAX) )
|
||||||
a += b;
|
a += b;
|
||||||
|
@ -460,7 +465,7 @@ void Calc::calcInfixOperator()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '-':
|
case '-':
|
||||||
if ( a != 0.0L )
|
if ( fabs(b) > LDBL_EPSILON ) // b != 0.0L
|
||||||
{
|
{
|
||||||
if ( log(abs(a)) + log(abs(1 - b/a)) <= log(LDBL_MAX) )
|
if ( log(abs(a)) + log(abs(1 - b/a)) <= log(LDBL_MAX) )
|
||||||
a -= b;
|
a -= b;
|
||||||
|
@ -476,15 +481,18 @@ void Calc::calcInfixOperator()
|
||||||
if ( errno == EDOM || errno == ERANGE )
|
if ( errno == EDOM || errno == ERANGE )
|
||||||
error = true;
|
error = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
clearInfixOperator();
|
clearInfixOperator();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Calc::onKeyPress (FKeyEvent* event)
|
void Calc::onKeyPress (FKeyEvent* ev)
|
||||||
{
|
{
|
||||||
int len = int(input.getLength());
|
int len = int(input.getLength());
|
||||||
int key = event->key();
|
int key = ev->key();
|
||||||
|
|
||||||
switch ( key )
|
switch ( key )
|
||||||
{
|
{
|
||||||
|
@ -500,14 +508,19 @@ void Calc::onKeyPress (FKeyEvent* event)
|
||||||
drawDispay();
|
drawDispay();
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
}
|
}
|
||||||
event->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
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(Accelerator_Event, getFocusWidget());
|
||||||
calculator_buttons[On]->onAccel(&a_ev);
|
calculator_buttons[On]->onAccel(&a_ev);
|
||||||
event->accept();
|
}
|
||||||
|
ev->accept();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -520,7 +533,7 @@ void Calc::onAccel (FAccelEvent* ev)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Calc::onClose (FCloseEvent* event)
|
void Calc::onClose (FCloseEvent* ev)
|
||||||
{
|
{
|
||||||
int ret = FMessageBox::info ( this, "Quit",
|
int ret = FMessageBox::info ( this, "Quit",
|
||||||
"Do you really want\n"
|
"Do you really want\n"
|
||||||
|
@ -528,7 +541,7 @@ void Calc::onClose (FCloseEvent* event)
|
||||||
FMessageBox::Yes,
|
FMessageBox::Yes,
|
||||||
FMessageBox::No );
|
FMessageBox::No );
|
||||||
|
|
||||||
(ret == FMessageBox::Yes) ? event->accept() : event->ignore();
|
(ret == FMessageBox::Yes) ? ev->accept() : ev->ignore();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -566,7 +579,7 @@ void Calc::cb_buttonClicked (FWidget*, void* data_ptr)
|
||||||
{
|
{
|
||||||
if ( arcus_mode )
|
if ( arcus_mode )
|
||||||
*x = asin(*x) * 180.0L/PI;
|
*x = asin(*x) * 180.0L/PI;
|
||||||
else if ( fmod(*x,180.0L) == 0.0L )
|
else if ( fmod(*x,180.0L) < LDBL_EPSILON ) // x/180 = 0
|
||||||
*x = 0.0L;
|
*x = 0.0L;
|
||||||
else
|
else
|
||||||
*x = sin(*x * PI/180.0L);
|
*x = sin(*x * PI/180.0L);
|
||||||
|
@ -598,7 +611,7 @@ void Calc::cb_buttonClicked (FWidget*, void* data_ptr)
|
||||||
{
|
{
|
||||||
if ( arcus_mode )
|
if ( arcus_mode )
|
||||||
*x = acos(*x) * 180.0L/PI;
|
*x = acos(*x) * 180.0L/PI;
|
||||||
else if ( fmod(*x - 90.0L,180.0L) == 0.0L )
|
else if ( fmod(*x - 90.0L,180.0L) < LDBL_EPSILON ) // (x - 90)/180 == 0
|
||||||
*x = 0.0L;
|
*x = 0.0L;
|
||||||
else
|
else
|
||||||
*x = cos(*x * PI/180.0L);
|
*x = cos(*x * PI/180.0L);
|
||||||
|
@ -632,9 +645,10 @@ void Calc::cb_buttonClicked (FWidget*, void* data_ptr)
|
||||||
if ( arcus_mode )
|
if ( arcus_mode )
|
||||||
*x = atan(*x) * 180.0L/PI;
|
*x = atan(*x) * 180.0L/PI;
|
||||||
else
|
else
|
||||||
if ( fmod(*x,180.0L) != 0.0L && fmod(*x,90.0L) == 0.0L )
|
// Test if (x/180) != 0 and x/90 == 0
|
||||||
|
if ( fmod(*x,180.0L) > LDBL_EPSILON && fmod(*x,90.0L) < LDBL_EPSILON )
|
||||||
error = true;
|
error = true;
|
||||||
else if ( fmod(*x,180.0L) == 0.0L )
|
else if ( fmod(*x,180.0L) < LDBL_EPSILON ) // x/180 == 0
|
||||||
*x = 0.0L;
|
*x = 0.0L;
|
||||||
else
|
else
|
||||||
*x = tan(*x * PI/180.0L);
|
*x = tan(*x * PI/180.0L);
|
||||||
|
@ -649,7 +663,7 @@ void Calc::cb_buttonClicked (FWidget*, void* data_ptr)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Reciprocal: // 1/x
|
case Reciprocal: // 1/x
|
||||||
if ( *x == 0.0L )
|
if ( fabs(*x) < LDBL_EPSILON ) // x == 0
|
||||||
error = true;
|
error = true;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -902,6 +916,9 @@ void Calc::cb_buttonClicked (FWidget*, void* data_ptr)
|
||||||
calcInfixOperator();
|
calcInfixOperator();
|
||||||
setDisplay(a);
|
setDisplay(a);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
} // end of switch
|
} // end of switch
|
||||||
|
|
||||||
if ( ! input.isEmpty() )
|
if ( ! input.isEmpty() )
|
||||||
|
|
|
@ -103,7 +103,7 @@ void Mandelbrot::onAccel (FAccelEvent* ev)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Mandelbrot::onClose (FCloseEvent* event)
|
void Mandelbrot::onClose (FCloseEvent* ev)
|
||||||
{
|
{
|
||||||
int ret = FMessageBox::info ( this, "Quit",
|
int ret = FMessageBox::info ( this, "Quit",
|
||||||
"Do you really want\n"
|
"Do you really want\n"
|
||||||
|
@ -111,9 +111,9 @@ void Mandelbrot::onClose (FCloseEvent* event)
|
||||||
FMessageBox::Yes,
|
FMessageBox::Yes,
|
||||||
FMessageBox::No );
|
FMessageBox::No );
|
||||||
if ( ret == FMessageBox::Yes )
|
if ( ret == FMessageBox::Yes )
|
||||||
event->accept();
|
ev->accept();
|
||||||
else
|
else
|
||||||
event->ignore();
|
ev->ignore();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -64,9 +64,9 @@ watch::watch (FWidget* parent) : FDialog(parent)
|
||||||
sec = seconds_sw->setChecked();
|
sec = seconds_sw->setChecked();
|
||||||
|
|
||||||
// Create button
|
// Create button
|
||||||
FButton* quit = new FButton(L"&Quit", this);
|
FButton* quit_btn = new FButton(L"&Quit", this);
|
||||||
quit->setGeometry(6, 9, 9, 1);
|
quit_btn->setGeometry(6, 9, 9, 1);
|
||||||
quit->setShadow();
|
quit_btn->setShadow();
|
||||||
|
|
||||||
|
|
||||||
// Connect switch signal "toggled" with a callback member function
|
// Connect switch signal "toggled" with a callback member function
|
||||||
|
@ -88,7 +88,7 @@ watch::watch (FWidget* parent) : FDialog(parent)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Connect button signal "clicked" with a callback member function
|
// Connect button signal "clicked" with a callback member function
|
||||||
quit->addCallback
|
quit_btn->addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
this,
|
this,
|
||||||
|
@ -129,7 +129,7 @@ void watch::onTimer (FTimerEvent*)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void watch::onClose (FCloseEvent* event)
|
void watch::onClose (FCloseEvent* ev)
|
||||||
{
|
{
|
||||||
int ret = FMessageBox::info ( this, "Quit",
|
int ret = FMessageBox::info ( this, "Quit",
|
||||||
"Do you really want\n"
|
"Do you really want\n"
|
||||||
|
@ -137,9 +137,9 @@ void watch::onClose (FCloseEvent* event)
|
||||||
FMessageBox::Yes,
|
FMessageBox::Yes,
|
||||||
FMessageBox::No );
|
FMessageBox::No );
|
||||||
if ( ret == FMessageBox::Yes )
|
if ( ret == FMessageBox::Yes )
|
||||||
event->accept();
|
ev->accept();
|
||||||
else
|
else
|
||||||
event->ignore();
|
ev->ignore();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue