Replacing the widget position variables by FRect objects
This commit is contained in:
parent
9551924b73
commit
9475f34499
20
ChangeLog
20
ChangeLog
|
@ -1,3 +1,21 @@
|
||||||
|
2016-09-25 Markus Gans <guru.mail@muenster.de>
|
||||||
|
* Splitting gotoxy in printPos (local position)
|
||||||
|
and printPosTerm (global terminal position)
|
||||||
|
* Replacing the widget position variables by FRect objects
|
||||||
|
* Rename getGeometryShadow() to getGeometryWithShadow()
|
||||||
|
* Rename getGeometryGlobal() to getTermGeometry()
|
||||||
|
* Rename getGeometryGlobalShadow() to getTermGeometryWithShadow()
|
||||||
|
* Rename globalToLocalPos() to termToWidgetPos()
|
||||||
|
* Rename getGlobalX() to getTermX()
|
||||||
|
* Rename getGlobalY() to getTermY()
|
||||||
|
* Rename getGlobalPos() to getTermPos()
|
||||||
|
* setColor() without parameters sets the default widget colors
|
||||||
|
* New methods setMinimumSize(), setMaximumSize(), setFixedSize()
|
||||||
|
and setSize()
|
||||||
|
|
||||||
|
2016-09-12 Markus Gans <guru.mail@muenster.de>
|
||||||
|
* Activate the title bar menu with ctrl+^
|
||||||
|
|
||||||
2016-09-11 Markus Gans <guru.mail@muenster.de>
|
2016-09-11 Markus Gans <guru.mail@muenster.de>
|
||||||
* New zoom interaction-elements to maximize a FDialog
|
* New zoom interaction-elements to maximize a FDialog
|
||||||
|
|
||||||
|
@ -346,7 +364,7 @@
|
||||||
|
|
||||||
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)
|
||||||
* Don't check mouse click position on titlebar again
|
* Don't check mouse click position on title bar again
|
||||||
while FDialog is in move
|
while FDialog is in move
|
||||||
|
|
||||||
2015-07-26 Markus Gans <guru.mail@muenster.de>
|
2015-07-26 Markus Gans <guru.mail@muenster.de>
|
||||||
|
|
34
src/fapp.cpp
34
src/fapp.cpp
|
@ -1444,7 +1444,7 @@ void FApplication::processMouseEvent()
|
||||||
&& menuBar()->hasSelectedItem()
|
&& menuBar()->hasSelectedItem()
|
||||||
&& ! b_state.mouse_moved )
|
&& ! b_state.mouse_moved )
|
||||||
{
|
{
|
||||||
if ( ! menuBar()->getGeometryGlobal().contains(*mouse) )
|
if ( ! menuBar()->getTermGeometry().contains(*mouse) )
|
||||||
{
|
{
|
||||||
if ( statusBar() )
|
if ( statusBar() )
|
||||||
statusBar()->clearMessage();
|
statusBar()->clearMessage();
|
||||||
|
@ -1466,7 +1466,7 @@ void FApplication::processMouseEvent()
|
||||||
|
|
||||||
if ( clicked_widget )
|
if ( clicked_widget )
|
||||||
{
|
{
|
||||||
FPoint localMousePos;
|
FPoint widgetMousePos;
|
||||||
int key_state = 0;
|
int key_state = 0;
|
||||||
|
|
||||||
if ( b_state.shift_button == Pressed )
|
if ( b_state.shift_button == Pressed )
|
||||||
|
@ -1478,14 +1478,14 @@ void FApplication::processMouseEvent()
|
||||||
if ( b_state.control_button == Pressed )
|
if ( b_state.control_button == Pressed )
|
||||||
key_state |= fc::ControlButton;
|
key_state |= fc::ControlButton;
|
||||||
|
|
||||||
localMousePos = clicked_widget->globalToLocalPos(*mouse);
|
widgetMousePos = clicked_widget->termToWidgetPos(*mouse);
|
||||||
|
|
||||||
if ( b_state.mouse_moved )
|
if ( b_state.mouse_moved )
|
||||||
{
|
{
|
||||||
if ( b_state.left_button == Pressed )
|
if ( b_state.left_button == Pressed )
|
||||||
{
|
{
|
||||||
FMouseEvent m_down_ev ( fc::MouseMove_Event
|
FMouseEvent m_down_ev ( fc::MouseMove_Event
|
||||||
, localMousePos
|
, widgetMousePos
|
||||||
, *mouse
|
, *mouse
|
||||||
, fc::LeftButton | key_state );
|
, fc::LeftButton | key_state );
|
||||||
sendEvent (clicked_widget, &m_down_ev);
|
sendEvent (clicked_widget, &m_down_ev);
|
||||||
|
@ -1494,7 +1494,7 @@ void FApplication::processMouseEvent()
|
||||||
if ( b_state.right_button == Pressed )
|
if ( b_state.right_button == Pressed )
|
||||||
{
|
{
|
||||||
FMouseEvent m_down_ev ( fc::MouseMove_Event
|
FMouseEvent m_down_ev ( fc::MouseMove_Event
|
||||||
, localMousePos
|
, widgetMousePos
|
||||||
, *mouse
|
, *mouse
|
||||||
, fc::RightButton | key_state );
|
, fc::RightButton | key_state );
|
||||||
sendEvent (clicked_widget, &m_down_ev);
|
sendEvent (clicked_widget, &m_down_ev);
|
||||||
|
@ -1503,7 +1503,7 @@ void FApplication::processMouseEvent()
|
||||||
if ( b_state.middle_button == Pressed )
|
if ( b_state.middle_button == Pressed )
|
||||||
{
|
{
|
||||||
FMouseEvent m_down_ev ( fc::MouseMove_Event
|
FMouseEvent m_down_ev ( fc::MouseMove_Event
|
||||||
, localMousePos
|
, widgetMousePos
|
||||||
, *mouse
|
, *mouse
|
||||||
, fc::MiddleButton | key_state );
|
, fc::MiddleButton | key_state );
|
||||||
sendEvent (clicked_widget, &m_down_ev);
|
sendEvent (clicked_widget, &m_down_ev);
|
||||||
|
@ -1514,7 +1514,7 @@ void FApplication::processMouseEvent()
|
||||||
if ( b_state.left_button == DoubleClick )
|
if ( b_state.left_button == DoubleClick )
|
||||||
{
|
{
|
||||||
FMouseEvent m_dblclick_ev ( fc::MouseDoubleClick_Event
|
FMouseEvent m_dblclick_ev ( fc::MouseDoubleClick_Event
|
||||||
, localMousePos
|
, widgetMousePos
|
||||||
, *mouse
|
, *mouse
|
||||||
, fc::LeftButton | key_state );
|
, fc::LeftButton | key_state );
|
||||||
sendEvent (clicked_widget, &m_dblclick_ev);
|
sendEvent (clicked_widget, &m_dblclick_ev);
|
||||||
|
@ -1522,7 +1522,7 @@ void FApplication::processMouseEvent()
|
||||||
else if ( b_state.left_button == Pressed )
|
else if ( b_state.left_button == Pressed )
|
||||||
{
|
{
|
||||||
FMouseEvent m_down_ev ( fc::MouseDown_Event
|
FMouseEvent m_down_ev ( fc::MouseDown_Event
|
||||||
, localMousePos
|
, widgetMousePos
|
||||||
, *mouse
|
, *mouse
|
||||||
, fc::LeftButton | key_state );
|
, fc::LeftButton | key_state );
|
||||||
sendEvent (clicked_widget, &m_down_ev);
|
sendEvent (clicked_widget, &m_down_ev);
|
||||||
|
@ -1530,7 +1530,7 @@ void FApplication::processMouseEvent()
|
||||||
else if ( b_state.left_button == Released )
|
else if ( b_state.left_button == Released )
|
||||||
{
|
{
|
||||||
FMouseEvent m_up_ev ( fc::MouseUp_Event
|
FMouseEvent m_up_ev ( fc::MouseUp_Event
|
||||||
, localMousePos
|
, widgetMousePos
|
||||||
, *mouse
|
, *mouse
|
||||||
, fc::LeftButton | key_state );
|
, fc::LeftButton | key_state );
|
||||||
FWidget* released_widget = clicked_widget;
|
FWidget* released_widget = clicked_widget;
|
||||||
|
@ -1545,7 +1545,7 @@ void FApplication::processMouseEvent()
|
||||||
if ( b_state.right_button == Pressed )
|
if ( b_state.right_button == Pressed )
|
||||||
{
|
{
|
||||||
FMouseEvent m_down_ev ( fc::MouseDown_Event
|
FMouseEvent m_down_ev ( fc::MouseDown_Event
|
||||||
, localMousePos
|
, widgetMousePos
|
||||||
, *mouse
|
, *mouse
|
||||||
, fc::RightButton | key_state );
|
, fc::RightButton | key_state );
|
||||||
sendEvent (clicked_widget, &m_down_ev);
|
sendEvent (clicked_widget, &m_down_ev);
|
||||||
|
@ -1553,7 +1553,7 @@ void FApplication::processMouseEvent()
|
||||||
else if ( b_state.right_button == Released )
|
else if ( b_state.right_button == Released )
|
||||||
{
|
{
|
||||||
FMouseEvent m_up_ev ( fc::MouseUp_Event
|
FMouseEvent m_up_ev ( fc::MouseUp_Event
|
||||||
, localMousePos
|
, widgetMousePos
|
||||||
, *mouse
|
, *mouse
|
||||||
, fc::RightButton | key_state );
|
, fc::RightButton | key_state );
|
||||||
FWidget* released_widget = clicked_widget;
|
FWidget* released_widget = clicked_widget;
|
||||||
|
@ -1568,7 +1568,7 @@ void FApplication::processMouseEvent()
|
||||||
if ( b_state.middle_button == Pressed )
|
if ( b_state.middle_button == Pressed )
|
||||||
{
|
{
|
||||||
FMouseEvent m_down_ev ( fc::MouseDown_Event
|
FMouseEvent m_down_ev ( fc::MouseDown_Event
|
||||||
, localMousePos
|
, widgetMousePos
|
||||||
, *mouse
|
, *mouse
|
||||||
, fc::MiddleButton | key_state );
|
, fc::MiddleButton | key_state );
|
||||||
sendEvent (clicked_widget, &m_down_ev);
|
sendEvent (clicked_widget, &m_down_ev);
|
||||||
|
@ -1580,7 +1580,7 @@ void FApplication::processMouseEvent()
|
||||||
else if ( b_state.middle_button == Released )
|
else if ( b_state.middle_button == Released )
|
||||||
{
|
{
|
||||||
FMouseEvent m_up_ev ( fc::MouseUp_Event
|
FMouseEvent m_up_ev ( fc::MouseUp_Event
|
||||||
, localMousePos
|
, widgetMousePos
|
||||||
, *mouse
|
, *mouse
|
||||||
, fc::MiddleButton | key_state );
|
, fc::MiddleButton | key_state );
|
||||||
FWidget* released_widget = clicked_widget;
|
FWidget* released_widget = clicked_widget;
|
||||||
|
@ -1598,7 +1598,7 @@ void FApplication::processMouseEvent()
|
||||||
if ( b_state.wheel_up == Pressed )
|
if ( b_state.wheel_up == Pressed )
|
||||||
{
|
{
|
||||||
FWheelEvent wheel_ev ( fc::MouseWheel_Event
|
FWheelEvent wheel_ev ( fc::MouseWheel_Event
|
||||||
, localMousePos
|
, widgetMousePos
|
||||||
, *mouse
|
, *mouse
|
||||||
, fc::WheelUp );
|
, fc::WheelUp );
|
||||||
FWidget* scroll_over_widget = clicked_widget;
|
FWidget* scroll_over_widget = clicked_widget;
|
||||||
|
@ -1609,7 +1609,7 @@ void FApplication::processMouseEvent()
|
||||||
if ( b_state.wheel_down == Pressed )
|
if ( b_state.wheel_down == Pressed )
|
||||||
{
|
{
|
||||||
FWheelEvent wheel_ev ( fc::MouseWheel_Event
|
FWheelEvent wheel_ev ( fc::MouseWheel_Event
|
||||||
, localMousePos
|
, widgetMousePos
|
||||||
, *mouse
|
, *mouse
|
||||||
, fc::WheelDown );
|
, fc::WheelDown );
|
||||||
FWidget* scroll_over_widget = clicked_widget;
|
FWidget* scroll_over_widget = clicked_widget;
|
||||||
|
@ -1865,7 +1865,7 @@ bool FApplication::sendEvent(FObject* receiver, FEvent* event)
|
||||||
if ( modal_dialogs > 0 )
|
if ( modal_dialogs > 0 )
|
||||||
{
|
{
|
||||||
FWidget* window;
|
FWidget* window;
|
||||||
if ( widget->isWindow() )
|
if ( widget->isWindowWidget() )
|
||||||
window = widget;
|
window = widget;
|
||||||
else
|
else
|
||||||
window = FWindow::getWindowWidget(widget);
|
window = FWindow::getWindowWidget(widget);
|
||||||
|
@ -1873,7 +1873,7 @@ bool FApplication::sendEvent(FObject* receiver, FEvent* event)
|
||||||
// block events for widgets in non modal windows
|
// block events for widgets in non modal windows
|
||||||
if ( window
|
if ( window
|
||||||
&& (window->getFlags() & fc::modal) == 0
|
&& (window->getFlags() & fc::modal) == 0
|
||||||
&& ! window->isMenu() )
|
&& ! window->isMenuWidget() )
|
||||||
{
|
{
|
||||||
switch ( event->type() )
|
switch ( event->type() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -180,9 +180,9 @@ void FButton::draw()
|
||||||
setColor ( parent_widget->getForegroundColor()
|
setColor ( parent_widget->getForegroundColor()
|
||||||
, parent_widget->getBackgroundColor() );
|
, parent_widget->getBackgroundColor() );
|
||||||
|
|
||||||
for (int y=1; y <= height; y++)
|
for (int y=1; y <= getHeight(); y++)
|
||||||
{
|
{
|
||||||
gotoxy (xpos+xmin-1, ypos+ymin-2+y);
|
printPos (1, y);
|
||||||
print (' '); // clear one left █
|
print (' '); // clear one left █
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ void FButton::draw()
|
||||||
if ( hotkeypos != -1 )
|
if ( hotkeypos != -1 )
|
||||||
hotkey_offset = 1;
|
hotkey_offset = 1;
|
||||||
|
|
||||||
if ( (length - hotkey_offset + mono_offset - hotkey_offset) <= width )
|
if ( (length - hotkey_offset + mono_offset - hotkey_offset) <= getWidth() )
|
||||||
margin = 1;
|
margin = 1;
|
||||||
else
|
else
|
||||||
margin = 0;
|
margin = 0;
|
||||||
|
@ -233,11 +233,11 @@ void FButton::draw()
|
||||||
{
|
{
|
||||||
if ( margin == 1 )
|
if ( margin == 1 )
|
||||||
{
|
{
|
||||||
setColor (foregroundColor, button_bg);
|
setColor (getForegroundColor(), button_bg);
|
||||||
|
|
||||||
for (int y=0; y < height; y++)
|
for (int y=0; y < getHeight(); y++)
|
||||||
{
|
{
|
||||||
gotoxy (xpos+xmin-1+d, ypos+ymin-1+y);
|
printPos (1+d, 1+y);
|
||||||
print (space); // full block █
|
print (space); // full block █
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -250,19 +250,17 @@ void FButton::draw()
|
||||||
if ( parent_widget )
|
if ( parent_widget )
|
||||||
setColor (button_bg, parent_widget->getBackgroundColor());
|
setColor (button_bg, parent_widget->getBackgroundColor());
|
||||||
|
|
||||||
gotoxy (xpos+xmin-1+d, ypos+ymin-1);
|
for (int y=0; y < getHeight(); y++)
|
||||||
|
|
||||||
for (int y=1; y <= height; y++)
|
|
||||||
{
|
{
|
||||||
// Cygwin terminal use IBM Codepage 850
|
printPos (1+d, 1+y);
|
||||||
|
|
||||||
|
// Cygwin terminal use IBM Codepage 850
|
||||||
if ( isCygwinTerminal() )
|
if ( isCygwinTerminal() )
|
||||||
print (fc::FullBlock); // █
|
print (fc::FullBlock); // █
|
||||||
else if ( isTeraTerm() )
|
else if ( isTeraTerm() )
|
||||||
print (0xdb);
|
print (0xdb);
|
||||||
else
|
else
|
||||||
print (fc::RightHalfBlock); // ▐
|
print (fc::RightHalfBlock); // ▐
|
||||||
|
|
||||||
gotoxy (xpos+xmin-1+d, ypos+ymin-1+y);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,12 +273,12 @@ void FButton::draw()
|
||||||
setColor ( parent_widget->getForegroundColor()
|
setColor ( parent_widget->getForegroundColor()
|
||||||
, parent_widget->getBackgroundColor() );
|
, parent_widget->getBackgroundColor() );
|
||||||
|
|
||||||
for (int y=1; y <= height; y++)
|
for (int y=1; y <= getHeight(); y++)
|
||||||
{
|
{
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
||||||
gotoxy (xpos+xmin-1+width, ypos+ymin-2+y);
|
printPos (1+getWidth(), y);
|
||||||
print (' '); // clear right
|
print (' '); // clear right
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
|
@ -291,31 +289,29 @@ void FButton::draw()
|
||||||
if ( hotkeypos != -1 )
|
if ( hotkeypos != -1 )
|
||||||
length--;
|
length--;
|
||||||
|
|
||||||
i = width - length - 1;
|
i = getWidth() - length - 1;
|
||||||
i = int(i / 2);
|
i = int(i / 2);
|
||||||
|
|
||||||
if ( height > 1 )
|
if ( getHeight() > 1 )
|
||||||
j = int((height-1) / 2);
|
j = int((getHeight()-1) / 2);
|
||||||
else
|
else
|
||||||
j=0;
|
j=0;
|
||||||
|
|
||||||
gotoxy (xpos+xmin-1+margin+d, ypos+ymin-1+j);
|
printPos (1+margin+d, 1+j);
|
||||||
setColor (button_fg, button_bg);
|
setColor (button_fg, button_bg);
|
||||||
|
|
||||||
for (x=0; x < i; x++)
|
for (x=0; x < i; x++)
|
||||||
print (space); // █
|
print (space); // █
|
||||||
|
|
||||||
if ( hotkeypos == -1 )
|
if ( hotkeypos == -1 )
|
||||||
setCursorPos ( xpos+xmin-1+margin+i
|
setCursorPos (1+margin+i, 1+j ); // first character
|
||||||
, ypos+ymin-1+j ); // first character
|
|
||||||
else
|
else
|
||||||
setCursorPos ( xpos+xmin-1+margin+i+hotkeypos
|
setCursorPos (1+margin+i+hotkeypos, 1+j ); // hotkey
|
||||||
, ypos+ymin-1+j ); // hotkey
|
|
||||||
|
|
||||||
if ( is_ActiveFocus && (isMonochron() || getMaxColor() < 16) )
|
if ( is_ActiveFocus && (isMonochron() || getMaxColor() < 16) )
|
||||||
setBold();
|
setBold();
|
||||||
|
|
||||||
for (int z=0; x < i+length && z < width; z++,x++)
|
for (int z=0; x < i+length && z < getWidth(); z++,x++)
|
||||||
{
|
{
|
||||||
if ( (z == hotkeypos) && is_Active )
|
if ( (z == hotkeypos) && is_Active )
|
||||||
{
|
{
|
||||||
|
@ -346,23 +342,23 @@ void FButton::draw()
|
||||||
if ( is_ActiveFocus && (isMonochron() || getMaxColor() < 16) )
|
if ( is_ActiveFocus && (isMonochron() || getMaxColor() < 16) )
|
||||||
unsetBold();
|
unsetBold();
|
||||||
|
|
||||||
for (x=i+length; x < width-1; x++)
|
for (x=i+length; x < getWidth()-1; x++)
|
||||||
print (space); // █
|
print (space); // █
|
||||||
|
|
||||||
if ( height > 1 )
|
if ( getHeight() > 1 )
|
||||||
{
|
{
|
||||||
for (i=0; i < j; i++)
|
for (i=0; i < j; i++)
|
||||||
{
|
{
|
||||||
gotoxy (xpos+xmin+d, ypos+ymin-1+i);
|
printPos (2+d, 1+i);
|
||||||
|
|
||||||
for (int z=1; z < width; z++)
|
for (int z=1; z < getWidth(); z++)
|
||||||
print (space); // █
|
print (space); // █
|
||||||
}
|
}
|
||||||
for (i=j+1; i < height; i++)
|
for (i=j+1; i < getHeight(); i++)
|
||||||
{
|
{
|
||||||
gotoxy (xpos+xmin+d, ypos+ymin-1+i);
|
printPos (2+d, 1+i);
|
||||||
|
|
||||||
for (int z=1; z < width; z++)
|
for (int z=1; z < getWidth(); z++)
|
||||||
print (space); // █
|
print (space); // █
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -411,8 +407,8 @@ void FButton::updateButtonColor()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
button_fg = foregroundColor;
|
button_fg = getForegroundColor();
|
||||||
button_bg = backgroundColor;
|
button_bg = getBackgroundColor() ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // inactive
|
else // inactive
|
||||||
|
@ -514,14 +510,18 @@ void FButton::hide()
|
||||||
setColor (fg, bg);
|
setColor (fg, bg);
|
||||||
s = hasShadow() ? 1 : 0;
|
s = hasShadow() ? 1 : 0;
|
||||||
f = isFlat() ? 1 : 0;
|
f = isFlat() ? 1 : 0;
|
||||||
size = width + s + (f << 1);
|
size = getWidth() + s + (f << 1);
|
||||||
|
|
||||||
|
if ( size < 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
blank = new char[size+1];
|
blank = new char[size+1];
|
||||||
memset(blank, ' ', uLong(size));
|
memset(blank, ' ', uLong(size));
|
||||||
blank[size] = '\0';
|
blank[size] = '\0';
|
||||||
|
|
||||||
for (int y=0; y < height+s+(f << 1); y++)
|
for (int y=0; y < getHeight()+s+(f << 1); y++)
|
||||||
{
|
{
|
||||||
gotoxy (xpos+xmin-1-f, ypos+ymin-1+y-f);
|
printPos (1-f, 1+y-f);
|
||||||
print (blank);
|
print (blank);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -679,9 +679,9 @@ void FButton::onMouseDown (FMouseEvent* ev)
|
||||||
statusBar()->drawMessage();
|
statusBar()->drawMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
FPoint gPos = ev->getGlobalPos();
|
FPoint tPos = ev->getTermPos();
|
||||||
|
|
||||||
if ( getGeometryGlobal().contains(gPos) )
|
if ( getTermGeometry().contains(tPos) )
|
||||||
setDown();
|
setDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -695,7 +695,7 @@ void FButton::onMouseUp (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
setUp();
|
setUp();
|
||||||
|
|
||||||
if ( getGeometryGlobal().contains(ev->getGlobalPos()) )
|
if ( getTermGeometry().contains(ev->getTermPos()) )
|
||||||
processClick();
|
processClick();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -706,11 +706,11 @@ void FButton::onMouseMove (FMouseEvent* ev)
|
||||||
if ( ev->getButton() != fc::LeftButton )
|
if ( ev->getButton() != fc::LeftButton )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FPoint gPos = ev->getGlobalPos();
|
FPoint tPos = ev->getTermPos();
|
||||||
|
|
||||||
if ( click_animation )
|
if ( click_animation )
|
||||||
{
|
{
|
||||||
if ( getGeometryGlobal().contains(gPos) )
|
if ( getTermGeometry().contains(tPos) )
|
||||||
setDown();
|
setDown();
|
||||||
else
|
else
|
||||||
setUp();
|
setUp();
|
||||||
|
|
|
@ -54,16 +54,16 @@ FButtonGroup::~FButtonGroup() // destructor
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FButtonGroup::init()
|
void FButtonGroup::init()
|
||||||
{
|
{
|
||||||
top_padding = 1;
|
setTopPadding(1);
|
||||||
left_padding = 1;
|
setLeftPadding(1);
|
||||||
bottom_padding = 1;
|
setBottomPadding(1);
|
||||||
right_padding = 1;
|
setRightPadding(1);
|
||||||
|
|
||||||
if ( isEnabled() )
|
if ( isEnabled() )
|
||||||
flags |= fc::active;
|
flags |= fc::active;
|
||||||
|
|
||||||
foregroundColor = wc.label_fg;
|
setForegroundColor (wc.label_fg);
|
||||||
backgroundColor = wc.label_bg;
|
setBackgroundColor (wc.label_bg);
|
||||||
buttonlist.clear(); // no buttons yet
|
buttonlist.clear(); // no buttons yet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ void FButtonGroup::draw()
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
||||||
setColor (foregroundColor, backgroundColor);
|
setColor();
|
||||||
|
|
||||||
if ( border )
|
if ( border )
|
||||||
drawBorder();
|
drawBorder();
|
||||||
|
@ -252,9 +252,9 @@ void FButtonGroup::drawLabel()
|
||||||
length--;
|
length--;
|
||||||
|
|
||||||
if ( border )
|
if ( border )
|
||||||
gotoxy (xpos+xmin, ypos+ymin-1);
|
printPos (2, 1);
|
||||||
else
|
else
|
||||||
gotoxy (xpos+xmin-2, ypos+ymin-1);
|
printPos (0, 1);
|
||||||
|
|
||||||
if ( isEnabled() )
|
if ( isEnabled() )
|
||||||
setColor(wc.label_emphasis_fg, wc.label_bg);
|
setColor(wc.label_emphasis_fg, wc.label_bg);
|
||||||
|
@ -319,14 +319,18 @@ void FButtonGroup::hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
setColor (fg, bg);
|
setColor (fg, bg);
|
||||||
size = width;
|
size = getWidth();
|
||||||
|
|
||||||
|
if ( size < 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
blank = new char[size+1];
|
blank = new char[size+1];
|
||||||
memset(blank, ' ', uLong(size));
|
memset(blank, ' ', uLong(size));
|
||||||
blank[size] = '\0';
|
blank[size] = '\0';
|
||||||
|
|
||||||
for (int y=0; y < height; y++)
|
for (int y=0; y < getHeight(); y++)
|
||||||
{
|
{
|
||||||
gotoxy (xpos+xmin-1, ypos+ymin-1+y);
|
printPos (1, 1+y);
|
||||||
print (blank);
|
print (blank);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,8 +53,8 @@ void FCheckBox::drawCheckButton()
|
||||||
if ( ! isVisible() )
|
if ( ! isVisible() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gotoxy (xpos+xmin-1, ypos+ymin-1);
|
printPos (1,1);
|
||||||
setColor (foregroundColor, backgroundColor);
|
setColor();
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
{
|
{
|
||||||
|
|
357
src/fdialog.cpp
357
src/fdialog.cpp
|
@ -63,8 +63,8 @@ FDialog::~FDialog() // destructor
|
||||||
|
|
||||||
if ( ! is_quit )
|
if ( ! is_quit )
|
||||||
{
|
{
|
||||||
const FRect& geometry = getGeometryGlobalShadow();
|
const FRect& t_geometry = getTermGeometryWithShadow();
|
||||||
restoreVTerm (geometry);
|
restoreVTerm (t_geometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( vwin != 0 )
|
if ( vwin != 0 )
|
||||||
|
@ -86,34 +86,23 @@ FDialog::~FDialog() // destructor
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::init()
|
void FDialog::init()
|
||||||
{
|
{
|
||||||
FWidget* old_focus;
|
FWidget* old_focus;
|
||||||
FWidget* rootObj = getRootWidget();
|
setTopPadding(2);
|
||||||
|
setLeftPadding(1);
|
||||||
xmin = 1 + rootObj->getLeftPadding();
|
setBottomPadding(1);
|
||||||
ymin = 1 + rootObj->getTopPadding();
|
setRightPadding(1);
|
||||||
xmax = rootObj->getWidth();
|
ignorePadding();
|
||||||
ymax = rootObj->getHeight();
|
setDialogWidget();
|
||||||
width = 10;
|
// initialize geometry values
|
||||||
height = 10;
|
setGeometry (1, 1, 10, 10, false);
|
||||||
client_xmin = 1;
|
|
||||||
client_ymin = 1;
|
|
||||||
client_xmax = width;
|
|
||||||
client_ymax = height;
|
|
||||||
top_padding = 2;
|
|
||||||
left_padding = 1;
|
|
||||||
bottom_padding = 1;
|
|
||||||
right_padding = 1;
|
|
||||||
createArea (vwin);
|
createArea (vwin);
|
||||||
setGeometry (1, 1, 10, 10, false); // initialize geometry values
|
|
||||||
ignore_padding = true;
|
|
||||||
dialog_object = true;
|
|
||||||
addDialog(this);
|
addDialog(this);
|
||||||
addWindow(this);
|
addWindow(this);
|
||||||
setActiveWindow(this);
|
setActiveWindow(this);
|
||||||
setTransparentShadow();
|
setTransparentShadow();
|
||||||
|
|
||||||
foregroundColor = wc.dialog_fg;
|
setForegroundColor (wc.dialog_fg);
|
||||||
backgroundColor = wc.dialog_bg;
|
setBackgroundColor (wc.dialog_bg);
|
||||||
|
|
||||||
if ( hasFocus() )
|
if ( hasFocus() )
|
||||||
flags |= fc::focus;
|
flags |= fc::focus;
|
||||||
|
@ -132,7 +121,7 @@ void FDialog::init()
|
||||||
accelerator_list = new Accelerators();
|
accelerator_list = new Accelerators();
|
||||||
// Add the dialog menu
|
// Add the dialog menu
|
||||||
dialog_menu = new FMenu ("-", this);
|
dialog_menu = new FMenu ("-", this);
|
||||||
dialog_menu->move (xpos, ypos+1);
|
dialog_menu->move (getX(), getY()+1);
|
||||||
dgl_menuitem = dialog_menu->getItem();
|
dgl_menuitem = dialog_menu->getItem();
|
||||||
|
|
||||||
if ( dgl_menuitem )
|
if ( dgl_menuitem )
|
||||||
|
@ -141,8 +130,8 @@ void FDialog::init()
|
||||||
dgl_menuitem->unsetFocusable();
|
dgl_menuitem->unsetFocusable();
|
||||||
}
|
}
|
||||||
|
|
||||||
zoom_item = new FMenuItem ("&Zoom", dialog_menu);
|
zoom_item = new FMenuItem (dialog_menu);
|
||||||
zoom_item->setStatusbarMessage ("Enlarge or restore the window size");
|
setZoomItem();
|
||||||
zoom_item->setDisable();
|
zoom_item->setDisable();
|
||||||
|
|
||||||
zoom_item->addCallback
|
zoom_item->addCallback
|
||||||
|
@ -164,48 +153,47 @@ void FDialog::init()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::drawBorder()
|
void FDialog::drawBorder()
|
||||||
{
|
{
|
||||||
int x1, x2, y1, y2;
|
int x1 = 1;
|
||||||
x1 = xpos+xmin-1;
|
int x2 = 1 + getWidth() - 1;
|
||||||
x2 = xpos+xmin-2+width;
|
int y1 = 2;
|
||||||
y1 = ypos+ymin;
|
int y2 = 1 + getHeight() - 1;
|
||||||
y2 = ypos+ymin-2+height;
|
|
||||||
|
|
||||||
//if ( resize )
|
//if ( resize )
|
||||||
// setColor (wc.dialog_resize_fg, backgroundColor);
|
// setColor (wc.dialog_resize_fg, getBackgroundColor());
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
{
|
{
|
||||||
for (int y=y1; y <= y2; y++)
|
for (int y=y1; y <= y2; y++)
|
||||||
{
|
{
|
||||||
gotoxy (x1, y);
|
printPos (x1, y);
|
||||||
// border left ⎸
|
// border left ⎸
|
||||||
print (fc::NF_border_line_left);
|
print (fc::NF_border_line_left);
|
||||||
gotoxy (x2, y);
|
printPos (x2, y);
|
||||||
// border right⎹
|
// border right⎹
|
||||||
print (fc::NF_rev_border_line_right);
|
print (fc::NF_rev_border_line_right);
|
||||||
}
|
}
|
||||||
|
|
||||||
gotoxy (x1, y2);
|
printPos (x1, y2);
|
||||||
// lower left corner border ⎣
|
// lower left corner border ⎣
|
||||||
print (fc::NF_border_corner_lower_left);
|
print (fc::NF_border_corner_lower_left);
|
||||||
|
|
||||||
for (int x=1; x < width-1; x++) // low line _
|
for (int x=1; x < getWidth()-1; x++) // low line _
|
||||||
print (fc::NF_border_line_bottom);
|
print (fc::NF_border_line_bottom);
|
||||||
|
|
||||||
gotoxy (x2, y2);
|
printPos (x2, y2);
|
||||||
// lower right corner border ⎦
|
// lower right corner border ⎦
|
||||||
print (fc::NF_rev_border_corner_lower_right);
|
print (fc::NF_rev_border_corner_lower_right);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gotoxy (x1, y1);
|
printPos (x1, y1);
|
||||||
print (fc::BoxDrawingsDownAndRight); // ┌
|
print (fc::BoxDrawingsDownAndRight); // ┌
|
||||||
|
|
||||||
for (int x=x1+1; x < x2; x++)
|
for (int x=x1+1; x < x2; x++)
|
||||||
print (fc::BoxDrawingsHorizontal); // ─
|
print (fc::BoxDrawingsHorizontal); // ─
|
||||||
|
|
||||||
print (fc::BoxDrawingsDownAndLeft); // ┐
|
print (fc::BoxDrawingsDownAndLeft); // ┐
|
||||||
gotoxy (x1, y2);
|
printPos (x1, y2);
|
||||||
print (fc::BoxDrawingsUpAndRight); // └
|
print (fc::BoxDrawingsUpAndRight); // └
|
||||||
|
|
||||||
for (int x=x1+1; x < x2; x++)
|
for (int x=x1+1; x < x2; x++)
|
||||||
|
@ -215,9 +203,9 @@ void FDialog::drawBorder()
|
||||||
|
|
||||||
for (int y=y1+1; y < y2; y++)
|
for (int y=y1+1; y < y2; y++)
|
||||||
{
|
{
|
||||||
gotoxy (x1, y);
|
printPos (x1, y);
|
||||||
print (fc::BoxDrawingsVertical); // │
|
print (fc::BoxDrawingsVertical); // │
|
||||||
gotoxy (x2, y);
|
printPos (x2, y);
|
||||||
print (fc::BoxDrawingsVertical); // │
|
print (fc::BoxDrawingsVertical); // │
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,7 +219,7 @@ void FDialog::drawTitleBar()
|
||||||
const int menu_btn = 3;
|
const int menu_btn = 3;
|
||||||
|
|
||||||
// draw the title button
|
// draw the title button
|
||||||
gotoxy (xpos+xmin-1, ypos+ymin-1);
|
printPos (1, 1);
|
||||||
|
|
||||||
if ( dialog_menu && dialog_menu->isVisible() )
|
if ( dialog_menu && dialog_menu->isVisible() )
|
||||||
setColor (wc.titlebar_button_focus_fg, wc.titlebar_button_focus_bg);
|
setColor (wc.titlebar_button_focus_fg, wc.titlebar_button_focus_bg);
|
||||||
|
@ -293,7 +281,7 @@ void FDialog::drawTitleBar()
|
||||||
zoom_btn = 3;
|
zoom_btn = 3;
|
||||||
|
|
||||||
length = int(tb_text.getLength());
|
length = int(tb_text.getLength());
|
||||||
i = width - length - menu_btn - zoom_btn;
|
i = getWidth() - length - menu_btn - zoom_btn;
|
||||||
i = int(i/2);
|
i = int(i/2);
|
||||||
|
|
||||||
for (x=1; x <= i; x++)
|
for (x=1; x <= i; x++)
|
||||||
|
@ -304,7 +292,7 @@ void FDialog::drawTitleBar()
|
||||||
print (tb_text);
|
print (tb_text);
|
||||||
|
|
||||||
// fill the rest of the bar
|
// fill the rest of the bar
|
||||||
for (; x+1+length < width-zoom_btn-1; x++)
|
for (; x+1+length < getWidth()-zoom_btn-1; x++)
|
||||||
print (' ');
|
print (' ');
|
||||||
|
|
||||||
if ( getMaxColor() < 16 )
|
if ( getMaxColor() < 16 )
|
||||||
|
@ -380,7 +368,7 @@ void FDialog::drawTitleBar()
|
||||||
setReverse(false);
|
setReverse(false);
|
||||||
|
|
||||||
/* print the number of window in stack */
|
/* print the number of window in stack */
|
||||||
//gotoxy(xpos+xmin+width-4, ypos+ymin-1);
|
//printPos (getWidth()-2, 1);
|
||||||
//printf ("(%d)", getWindowLayer(this));
|
//printf ("(%d)", getWindowLayer(this));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -405,6 +393,66 @@ void FDialog::leaveMenu()
|
||||||
flush_out();
|
flush_out();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FDialog::openMenu()
|
||||||
|
{
|
||||||
|
// open the titlebar menu
|
||||||
|
if ( ! dialog_menu )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ( dialog_menu->isVisible() )
|
||||||
|
{
|
||||||
|
leaveMenu();
|
||||||
|
drawTitleBar();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setOpenMenu(dialog_menu);
|
||||||
|
dialog_menu->move (getX(), getY()+1);
|
||||||
|
dialog_menu->setVisible();
|
||||||
|
drawTitleBar();
|
||||||
|
dialog_menu->show();
|
||||||
|
dialog_menu->raiseWindow(dialog_menu);
|
||||||
|
dialog_menu->redraw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FDialog::selectFirstMenuItem()
|
||||||
|
{
|
||||||
|
// focus to the first enabled menu item
|
||||||
|
FMenuItem* first_item;
|
||||||
|
dialog_menu->selectFirstItem();
|
||||||
|
first_item = dialog_menu->getSelectedItem();
|
||||||
|
|
||||||
|
if ( first_item )
|
||||||
|
first_item->setFocus();
|
||||||
|
|
||||||
|
dialog_menu->redraw();
|
||||||
|
|
||||||
|
if ( statusBar() )
|
||||||
|
statusBar()->drawMessage();
|
||||||
|
|
||||||
|
updateTerminal();
|
||||||
|
flush_out();
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FDialog::setZoomItem()
|
||||||
|
{
|
||||||
|
if ( isZoomed() )
|
||||||
|
{
|
||||||
|
zoom_item->setText ("&Unzoom");
|
||||||
|
zoom_item->setStatusbarMessage ("Restore the window size");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
zoom_item->setText ("&Zoom");
|
||||||
|
zoom_item->setStatusbarMessage ("Enlarge the window to the entire desktop");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::cb_zoom (FWidget*, void*)
|
void FDialog::cb_zoom (FWidget*, void*)
|
||||||
{
|
{
|
||||||
|
@ -413,6 +461,7 @@ void FDialog::cb_zoom (FWidget*, void*)
|
||||||
setClickedWidget(0);
|
setClickedWidget(0);
|
||||||
drawTitleBar();
|
drawTitleBar();
|
||||||
zoomWindow();
|
zoomWindow();
|
||||||
|
setZoomItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -471,7 +520,7 @@ void FDialog::drawDialogShadow()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
drawShadow();
|
drawShadow();
|
||||||
gotoxy (xpos+xmin-1, ypos+ymin-1+height);
|
printPos (1, 1+getHeight());
|
||||||
setTransparent();
|
setTransparent();
|
||||||
print(' ');
|
print(' ');
|
||||||
unsetTransparent();
|
unsetTransparent();
|
||||||
|
@ -480,17 +529,9 @@ void FDialog::drawDialogShadow()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::draw()
|
void FDialog::draw()
|
||||||
{
|
{
|
||||||
/*if ( isZoomed() && ! isRootWidget() )
|
|
||||||
{
|
|
||||||
xpos = 1;
|
|
||||||
ypos = 1;
|
|
||||||
width = xmax;
|
|
||||||
height = ymax;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
updateVTerm(false);
|
updateVTerm(false);
|
||||||
// fill the background
|
// fill the background
|
||||||
setColor (foregroundColor, backgroundColor);
|
setColor();
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
@ -527,7 +568,19 @@ void FDialog::onClose (FCloseEvent* ev)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::onKeyPress (FKeyEvent* ev)
|
void FDialog::onKeyPress (FKeyEvent* ev)
|
||||||
{
|
{
|
||||||
if ( ! isEnabled() || this == getMainWidget() )
|
if ( ! isEnabled() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ( ev->key() == fc::Fckey_caret ) // Ctrl+^
|
||||||
|
{
|
||||||
|
ev->accept();
|
||||||
|
// open the titlebar menu
|
||||||
|
openMenu();
|
||||||
|
// focus to the first enabled item
|
||||||
|
selectFirstMenuItem();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( this == getMainWidget() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( ev->key() == fc::Fkey_escape
|
if ( ev->key() == fc::Fkey_escape
|
||||||
|
@ -568,8 +621,8 @@ void FDialog::onMouseDown (FMouseEvent* ev)
|
||||||
bool has_raised;
|
bool has_raised;
|
||||||
|
|
||||||
// click on titlebar or window: raise + activate
|
// click on titlebar or window: raise + activate
|
||||||
if ( mouse_x >= 4 && mouse_x <= width-zoom_btn && mouse_y == 1 )
|
if ( mouse_x >= 4 && mouse_x <= getWidth()-zoom_btn && mouse_y == 1 )
|
||||||
TitleBarClickPos.setPoint (ev->getGlobalX(), ev->getGlobalY());
|
TitleBarClickPos.setPoint (ev->getTermX(), ev->getTermY());
|
||||||
else
|
else
|
||||||
TitleBarClickPos.setPoint (0,0);
|
TitleBarClickPos.setPoint (0,0);
|
||||||
|
|
||||||
|
@ -583,24 +636,8 @@ void FDialog::onMouseDown (FMouseEvent* ev)
|
||||||
|
|
||||||
// click on titlebar menu button
|
// click on titlebar menu button
|
||||||
if ( mouse_x < 4 && mouse_y == 1 )
|
if ( mouse_x < 4 && mouse_y == 1 )
|
||||||
{
|
openMenu();
|
||||||
if ( dialog_menu->isVisible() )
|
else if ( mouse_x > getWidth()-zoom_btn && mouse_y == 1 )
|
||||||
{
|
|
||||||
leaveMenu();
|
|
||||||
drawTitleBar();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setOpenMenu(dialog_menu);
|
|
||||||
dialog_menu->move (xpos, ypos+1);
|
|
||||||
dialog_menu->setVisible();
|
|
||||||
drawTitleBar();
|
|
||||||
dialog_menu->show();
|
|
||||||
dialog_menu->raiseWindow(dialog_menu);
|
|
||||||
dialog_menu->redraw();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ( mouse_x > width-zoom_btn && mouse_y == 1 )
|
|
||||||
{
|
{
|
||||||
zoom_button_pressed = true;
|
zoom_button_pressed = true;
|
||||||
zoom_button_active = true;
|
zoom_button_active = true;
|
||||||
|
@ -617,7 +654,7 @@ void FDialog::onMouseDown (FMouseEvent* ev)
|
||||||
if ( ev->getButton() == fc::RightButton )
|
if ( ev->getButton() == fc::RightButton )
|
||||||
{
|
{
|
||||||
// click on titlebar: just activate
|
// click on titlebar: just activate
|
||||||
if ( mouse_x >= 4 && mouse_x <= width && mouse_y == 1 )
|
if ( mouse_x >= 4 && mouse_x <= getWidth() && mouse_y == 1 )
|
||||||
{
|
{
|
||||||
if ( ! isActiveWindow() )
|
if ( ! isActiveWindow() )
|
||||||
activateDialog();
|
activateDialog();
|
||||||
|
@ -627,7 +664,7 @@ void FDialog::onMouseDown (FMouseEvent* ev)
|
||||||
if ( ev->getButton() == fc::MiddleButton )
|
if ( ev->getButton() == fc::MiddleButton )
|
||||||
{
|
{
|
||||||
// click on titlebar: lower + activate
|
// click on titlebar: lower + activate
|
||||||
if ( mouse_x >= 4 && mouse_x <= width && mouse_y == 1 )
|
if ( mouse_x >= 4 && mouse_x <= getWidth() && mouse_y == 1 )
|
||||||
{
|
{
|
||||||
bool has_lowered = lowerWindow();
|
bool has_lowered = lowerWindow();
|
||||||
|
|
||||||
|
@ -659,14 +696,14 @@ void FDialog::onMouseUp (FMouseEvent* ev)
|
||||||
int mouse_y = ev->getY();
|
int mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( ! TitleBarClickPos.isNull()
|
if ( ! TitleBarClickPos.isNull()
|
||||||
&& titlebar_x > xpos+xmin+2
|
&& titlebar_x > getTermX() + 3
|
||||||
&& titlebar_x < xpos+xmin+width
|
&& titlebar_x < getTermX() + getWidth()
|
||||||
&& titlebar_y == ypos+ymin-1 )
|
&& titlebar_y == getTermY() )
|
||||||
{
|
{
|
||||||
FPoint currentPos(getGeometry().getX(), getGeometry().getY());
|
FPoint currentPos(getGeometry().getX(), getGeometry().getY());
|
||||||
FPoint deltaPos = ev->getGlobalPos() - TitleBarClickPos;
|
FPoint deltaPos = ev->getTermPos() - TitleBarClickPos;
|
||||||
move (currentPos + deltaPos);
|
move (currentPos + deltaPos);
|
||||||
TitleBarClickPos = ev->getGlobalPos();
|
TitleBarClickPos = ev->getTermPos();
|
||||||
}
|
}
|
||||||
|
|
||||||
// click on titlebar menu button
|
// click on titlebar menu button
|
||||||
|
@ -675,27 +712,16 @@ void FDialog::onMouseUp (FMouseEvent* ev)
|
||||||
&& dialog_menu->isVisible()
|
&& dialog_menu->isVisible()
|
||||||
&& ! dialog_menu->hasSelectedItem() )
|
&& ! dialog_menu->hasSelectedItem() )
|
||||||
{
|
{
|
||||||
FMenuItem* first_item;
|
// Sets focus to the first item
|
||||||
dialog_menu->selectFirstItem();
|
selectFirstMenuItem();
|
||||||
first_item = dialog_menu->getSelectedItem();
|
|
||||||
|
|
||||||
if ( first_item )
|
|
||||||
first_item->setFocus();
|
|
||||||
|
|
||||||
dialog_menu->redraw();
|
|
||||||
|
|
||||||
if ( statusBar() )
|
|
||||||
statusBar()->drawMessage();
|
|
||||||
|
|
||||||
updateTerminal();
|
|
||||||
flush_out();
|
|
||||||
}
|
}
|
||||||
else if ( mouse_x > width - zoom_btn
|
else if ( mouse_x > getWidth() - zoom_btn
|
||||||
&& mouse_y == 1
|
&& mouse_y == 1
|
||||||
&& zoom_button_pressed )
|
&& zoom_button_pressed )
|
||||||
{
|
{
|
||||||
// zoom to maximum or restore the window size
|
// zoom to maximum or restore the window size
|
||||||
zoomWindow();
|
zoomWindow();
|
||||||
|
setZoomItem();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -727,21 +753,21 @@ void FDialog::onMouseMove (FMouseEvent* ev)
|
||||||
if ( ! TitleBarClickPos.isNull() )
|
if ( ! TitleBarClickPos.isNull() )
|
||||||
{
|
{
|
||||||
FPoint currentPos(getGeometry().getX(), getGeometry().getY());
|
FPoint currentPos(getGeometry().getX(), getGeometry().getY());
|
||||||
FPoint deltaPos = ev->getGlobalPos() - TitleBarClickPos;
|
FPoint deltaPos = ev->getTermPos() - TitleBarClickPos;
|
||||||
move (currentPos + deltaPos);
|
move (currentPos + deltaPos);
|
||||||
TitleBarClickPos = ev->getGlobalPos();
|
TitleBarClickPos = ev->getTermPos();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( dialog_menu->isVisible() && dialog_menu->isShown() )
|
if ( dialog_menu->isVisible() && dialog_menu->isShown() )
|
||||||
{
|
{
|
||||||
// Mouse event handover to the menu
|
// Mouse event handover to the menu
|
||||||
const FRect& menu_geometry = dialog_menu->getGeometryGlobal();
|
const FRect& menu_geometry = dialog_menu->getTermGeometry();
|
||||||
|
|
||||||
if ( dialog_menu->count() > 0
|
if ( dialog_menu->count() > 0
|
||||||
&& menu_geometry.contains(ev->getGlobalPos()) )
|
&& menu_geometry.contains(ev->getTermPos()) )
|
||||||
{
|
{
|
||||||
const FPoint& g = ev->getGlobalPos();
|
const FPoint& g = ev->getTermPos();
|
||||||
const FPoint& p = dialog_menu->globalToLocalPos(g);
|
const FPoint& p = dialog_menu->termToWidgetPos(g);
|
||||||
int b = ev->getButton();
|
int b = ev->getButton();
|
||||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseMove_Event, p, g, b);
|
FMouseEvent* _ev = new FMouseEvent (fc::MouseMove_Event, p, g, b);
|
||||||
dialog_menu->mouse_down = true;
|
dialog_menu->mouse_down = true;
|
||||||
|
@ -751,7 +777,7 @@ void FDialog::onMouseMove (FMouseEvent* ev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( mouse_x > width - zoom_btn && mouse_y == 1 && zoom_button_active )
|
if ( mouse_x > getWidth() - zoom_btn && mouse_y == 1 && zoom_button_active )
|
||||||
{
|
{
|
||||||
zoom_button_pressed = true;
|
zoom_button_pressed = true;
|
||||||
drawTitleBar();
|
drawTitleBar();
|
||||||
|
@ -768,18 +794,31 @@ void FDialog::onMouseMove (FMouseEvent* ev)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::onMouseDoubleClick (FMouseEvent* ev)
|
void FDialog::onMouseDoubleClick (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y, mouse_x, mouse_y, zoom_btn;
|
||||||
|
bool is_resizeable;
|
||||||
|
|
||||||
if ( ev->getButton() != fc::LeftButton )
|
if ( ev->getButton() != fc::LeftButton )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
x = xpos + xmin - 1;
|
mouse_x = ev->getX();
|
||||||
y = ypos + ymin - 1;
|
mouse_y = ev->getY();
|
||||||
FRect title_button(x, y, 3, 1);
|
is_resizeable = bool(flags & fc::resizeable);
|
||||||
FPoint gPos = ev->getGlobalPos();
|
|
||||||
|
|
||||||
if ( title_button.contains(gPos) )
|
if ( ! is_resizeable )
|
||||||
|
zoom_btn = 0;
|
||||||
|
else if ( isNewFont() )
|
||||||
|
zoom_btn = 2;
|
||||||
|
else
|
||||||
|
zoom_btn = 3;
|
||||||
|
|
||||||
|
x = getTermX();
|
||||||
|
y = getTermY();
|
||||||
|
FRect title_button(x, y, 3, 1);
|
||||||
|
FPoint tPos = ev->getTermPos();
|
||||||
|
|
||||||
|
if ( title_button.contains(tPos) )
|
||||||
{
|
{
|
||||||
|
// double click on title button
|
||||||
FWidget* window_focus_widget;
|
FWidget* window_focus_widget;
|
||||||
dialog_menu->unselectItem();
|
dialog_menu->unselectItem();
|
||||||
dialog_menu->hide();
|
dialog_menu->hide();
|
||||||
|
@ -797,6 +836,15 @@ void FDialog::onMouseDoubleClick (FMouseEvent* ev)
|
||||||
else
|
else
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
else if ( is_resizeable
|
||||||
|
&& mouse_x >= 4
|
||||||
|
&& mouse_x <= getWidth() - zoom_btn
|
||||||
|
&& mouse_y == 1 )
|
||||||
|
{
|
||||||
|
// double click on titlebar
|
||||||
|
zoomWindow(); // window zoom/unzoom
|
||||||
|
setZoomItem();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -862,7 +910,7 @@ void FDialog::onWindowRaised (FEvent*)
|
||||||
if ( ! (isVisible() && isShown()) )
|
if ( ! (isVisible() && isShown()) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
putArea (getGlobalPos(), vwin);
|
putArea (getTermPos(), vwin);
|
||||||
|
|
||||||
if ( ! window_list )
|
if ( ! window_list )
|
||||||
return;
|
return;
|
||||||
|
@ -887,7 +935,7 @@ void FDialog::onWindowLowered (FEvent*)
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != end )
|
||||||
{
|
{
|
||||||
putArea ((*iter)->getGlobalPos(), (*iter)->getVWin());
|
putArea ((*iter)->getTermPos(), (*iter)->getVWin());
|
||||||
++iter;
|
++iter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -952,29 +1000,29 @@ void FDialog::move (const FPoint& pos)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::move (int x, int y)
|
void FDialog::move (int x, int y)
|
||||||
{
|
{
|
||||||
int dx, dy, old_x, old_y;
|
int dx, dy, old_x, old_y, rsw, bsh;
|
||||||
|
|
||||||
if ( x == xpos && y == ypos )
|
if ( getX() == x && getY() == y )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( x+width < 1 || x > getColumnNumber() || y < 1 || y > getLineNumber() )
|
if ( x+getWidth() < 1 || x > getColumnNumber() || y < 1 || y > getLineNumber() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( isZoomed() )
|
if ( isZoomed() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dx = xpos - x;
|
dx = getX() - x;
|
||||||
dy = ypos - y;
|
dy = getY() - y;
|
||||||
old_x = getGlobalX();
|
old_x = getTermX();
|
||||||
old_y = getGlobalY();
|
old_y = getTermY();
|
||||||
short& rsw = shadow.x_ref(); // right shadow width;
|
const FPoint& shadow = getShadow();
|
||||||
short& bsh = shadow.y_ref(); // bottom shadow height
|
rsw = shadow.getX(); // right shadow width;
|
||||||
oldGeometry = getGeometryShadow();
|
bsh = shadow.getY(); // bottom shadow height
|
||||||
|
oldGeometry = getGeometryWithShadow();
|
||||||
|
|
||||||
FWidget::move(x,y);
|
FWidget::move(x,y);
|
||||||
xpos = x;
|
setPos(x, y, false);
|
||||||
ypos = y;
|
putArea (getTermPos(), vwin);updateTerminal();
|
||||||
putArea (getGlobalPos(), vwin);updateTerminal();
|
|
||||||
|
|
||||||
if ( getGeometry().overlap(oldGeometry) )
|
if ( getGeometry().overlap(oldGeometry) )
|
||||||
{
|
{
|
||||||
|
@ -988,25 +1036,25 @@ void FDialog::move (int x, int y)
|
||||||
if ( dx > 0 )
|
if ( dx > 0 )
|
||||||
{
|
{
|
||||||
if ( dy > 0 )
|
if ( dy > 0 )
|
||||||
restoreVTerm (old_x+width+rsw-dx, old_y, dx, height+bsh-dy);
|
restoreVTerm (old_x+getWidth()+rsw-dx, old_y, dx, getHeight()+bsh-dy);
|
||||||
else
|
else
|
||||||
restoreVTerm (old_x+width+rsw-dx, old_y+abs(dy), dx, height+bsh-abs(dy));
|
restoreVTerm (old_x+getWidth()+rsw-dx, old_y+abs(dy), dx, getHeight()+bsh-abs(dy));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( dy > 0 )
|
if ( dy > 0 )
|
||||||
restoreVTerm (old_x, old_y, abs(dx), height+bsh-dy);
|
restoreVTerm (old_x, old_y, abs(dx), getHeight()+bsh-dy);
|
||||||
else
|
else
|
||||||
restoreVTerm (old_x, old_y+abs(dy), abs(dx), height+bsh-abs(dy));
|
restoreVTerm (old_x, old_y+abs(dy), abs(dx), getHeight()+bsh-abs(dy));
|
||||||
}
|
}
|
||||||
if ( dy > 0 )
|
if ( dy > 0 )
|
||||||
restoreVTerm (old_x, old_y+height+bsh-dy, width+rsw, dy);
|
restoreVTerm (old_x, old_y+getHeight()+bsh-dy, getWidth()+rsw, dy);
|
||||||
else
|
else
|
||||||
restoreVTerm (old_x, old_y, width+rsw, abs(dy));
|
restoreVTerm (old_x, old_y, getWidth()+rsw, abs(dy));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
restoreVTerm (old_x, old_y, width+rsw, height+bsh);
|
restoreVTerm (old_x, old_y, getWidth()+rsw, getHeight()+bsh);
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle overlaid windows
|
// handle overlaid windows
|
||||||
|
@ -1020,7 +1068,7 @@ void FDialog::move (int x, int y)
|
||||||
while ( iter != end )
|
while ( iter != end )
|
||||||
{
|
{
|
||||||
if ( overlaid )
|
if ( overlaid )
|
||||||
putArea ((*iter)->getGlobalPos(), (*iter)->getVWin());
|
putArea ((*iter)->getTermPos(), (*iter)->getVWin());
|
||||||
|
|
||||||
if ( vwin == (*iter)->getVWin() )
|
if ( vwin == (*iter)->getVWin() )
|
||||||
overlaid = true;
|
overlaid = true;
|
||||||
|
@ -1038,7 +1086,6 @@ void FDialog::move (int x, int y)
|
||||||
&& focus_widget->hasVisibleCursor() )
|
&& focus_widget->hasVisibleCursor() )
|
||||||
{
|
{
|
||||||
FPoint cursor_pos = focus_widget->getCursorPos();
|
FPoint cursor_pos = focus_widget->getCursorPos();
|
||||||
cursor_pos -= FPoint(dx,dy);
|
|
||||||
|
|
||||||
if ( ! focus_widget->setCursorPos(cursor_pos) )
|
if ( ! focus_widget->setCursorPos(cursor_pos) )
|
||||||
hideCursor();
|
hideCursor();
|
||||||
|
@ -1069,7 +1116,7 @@ void FDialog::activateDialog()
|
||||||
if ( ! focusFirstChild() )
|
if ( ! focusFirstChild() )
|
||||||
old_focus->unsetFocus();
|
old_focus->unsetFocus();
|
||||||
|
|
||||||
if ( ! old_focus->isWindow() )
|
if ( ! old_focus->isWindowWidget() )
|
||||||
old_focus->redraw();
|
old_focus->redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1092,6 +1139,26 @@ bool FDialog::setFocus (bool on)
|
||||||
return on;
|
return on;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
bool FDialog::setDialogWidget (bool on)
|
||||||
|
{
|
||||||
|
if ( isDialogWidget() == on )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if ( on )
|
||||||
|
{
|
||||||
|
flags |= fc::dialog_widget;
|
||||||
|
setTermOffsetWithPadding();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
flags &= ~fc::dialog_widget;
|
||||||
|
setParentOffset();
|
||||||
|
}
|
||||||
|
|
||||||
|
return on;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FDialog::setModal (bool on)
|
bool FDialog::setModal (bool on)
|
||||||
{
|
{
|
||||||
|
@ -1119,17 +1186,13 @@ bool FDialog::setTransparentShadow (bool on)
|
||||||
{
|
{
|
||||||
flags |= fc::shadow;
|
flags |= fc::shadow;
|
||||||
flags |= fc::trans_shadow;
|
flags |= fc::trans_shadow;
|
||||||
shadow.setPoint(2,1);
|
setShadowSize (2,1);
|
||||||
adjustWidgetSizeShadow = getGeometry() + getShadow();
|
|
||||||
adjustWidgetSizeGlobalShadow = getGeometryGlobal() + getShadow();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flags &= ~fc::shadow;
|
flags &= ~fc::shadow;
|
||||||
flags &= ~fc::trans_shadow;
|
flags &= ~fc::trans_shadow;
|
||||||
shadow.setPoint(0,0);
|
setShadowSize (0,0);
|
||||||
adjustWidgetSizeShadow = getGeometry() + getShadow();
|
|
||||||
adjustWidgetSizeGlobalShadow = getGeometryGlobal() + getShadow();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resizeArea (vwin);
|
resizeArea (vwin);
|
||||||
|
@ -1146,17 +1209,13 @@ bool FDialog::setShadow (bool on)
|
||||||
{
|
{
|
||||||
flags |= fc::shadow;
|
flags |= fc::shadow;
|
||||||
flags &= ~fc::trans_shadow;
|
flags &= ~fc::trans_shadow;
|
||||||
shadow.setPoint(1,1);
|
setShadowSize (1,1);
|
||||||
adjustWidgetSizeShadow = getGeometry() + getShadow();
|
|
||||||
adjustWidgetSizeGlobalShadow = getGeometryGlobal() + getShadow();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flags &= ~fc::shadow;
|
flags &= ~fc::shadow;
|
||||||
flags &= ~fc::trans_shadow;
|
flags &= ~fc::trans_shadow;
|
||||||
shadow.setPoint(0,0);
|
setShadowSize (0,0);
|
||||||
adjustWidgetSizeShadow = getGeometry() + getShadow();
|
|
||||||
adjustWidgetSizeGlobalShadow = getGeometryGlobal() + getShadow();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resizeArea (vwin);
|
resizeArea (vwin);
|
||||||
|
|
|
@ -65,9 +65,14 @@ class FDialog : public FWindow
|
||||||
FDialog (const FDialog&);
|
FDialog (const FDialog&);
|
||||||
FDialog& operator = (const FDialog&);
|
FDialog& operator = (const FDialog&);
|
||||||
void init();
|
void init();
|
||||||
void drawBorder();
|
// make every drawBorder from FWidget available
|
||||||
|
using FWidget::drawBorder;
|
||||||
|
virtual void drawBorder();
|
||||||
void drawTitleBar();
|
void drawTitleBar();
|
||||||
void leaveMenu();
|
void leaveMenu();
|
||||||
|
void openMenu();
|
||||||
|
void selectFirstMenuItem();
|
||||||
|
void setZoomItem();
|
||||||
void cb_zoom (FWidget*, void*);
|
void cb_zoom (FWidget*, void*);
|
||||||
void cb_close (FWidget*, void*);
|
void cb_close (FWidget*, void*);
|
||||||
static void addDialog (FWidget*);
|
static void addDialog (FWidget*);
|
||||||
|
@ -104,26 +109,29 @@ class FDialog : public FWindow
|
||||||
void move (const FPoint&);
|
void move (const FPoint&);
|
||||||
void move (int, int);
|
void move (int, int);
|
||||||
|
|
||||||
bool setFocus(bool);
|
bool setFocus (bool);
|
||||||
bool setFocus();
|
bool setFocus();
|
||||||
bool unsetFocus();
|
bool unsetFocus();
|
||||||
bool setModal(bool);
|
bool setDialogWidget (bool);
|
||||||
|
bool setDialogWidget();
|
||||||
|
bool unsetDialogWidget();
|
||||||
|
bool setModal (bool);
|
||||||
bool setModal();
|
bool setModal();
|
||||||
bool unsetModal();
|
bool unsetModal();
|
||||||
bool isModal();
|
bool isModal();
|
||||||
bool setScrollable(bool);
|
bool setScrollable (bool);
|
||||||
bool setScrollable();
|
bool setScrollable();
|
||||||
bool unsetScrollable();
|
bool unsetScrollable();
|
||||||
bool isScrollable();
|
bool isScrollable();
|
||||||
bool setResizeable(bool);
|
bool setResizeable (bool);
|
||||||
bool setResizeable();
|
bool setResizeable();
|
||||||
bool unsetResizeable();
|
bool unsetResizeable();
|
||||||
bool isResizeable();
|
bool isResizeable();
|
||||||
bool setTransparentShadow(bool);
|
bool setTransparentShadow (bool);
|
||||||
bool setTransparentShadow();
|
bool setTransparentShadow();
|
||||||
bool unsetTransparentShadow();
|
bool unsetTransparentShadow();
|
||||||
bool hasTransparentShadow();
|
bool hasTransparentShadow();
|
||||||
bool setShadow(bool);
|
bool setShadow (bool);
|
||||||
bool setShadow();
|
bool setShadow();
|
||||||
bool unsetShadow();
|
bool unsetShadow();
|
||||||
bool hasShadow();
|
bool hasShadow();
|
||||||
|
@ -148,6 +156,14 @@ inline bool FDialog::setFocus()
|
||||||
inline bool FDialog::unsetFocus()
|
inline bool FDialog::unsetFocus()
|
||||||
{ return setFocus(false); }
|
{ return setFocus(false); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FDialog::setDialogWidget()
|
||||||
|
{ return setDialogWidget(true); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FDialog::unsetDialogWidget()
|
||||||
|
{ return setDialogWidget(false); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FDialog::setModal()
|
inline bool FDialog::setModal()
|
||||||
{ return setModal(true); }
|
{ return setModal(true); }
|
||||||
|
|
21
src/fenum.h
21
src/fenum.h
|
@ -51,15 +51,18 @@ class fc
|
||||||
// properties of a widget
|
// properties of a widget
|
||||||
enum widget_flags
|
enum widget_flags
|
||||||
{
|
{
|
||||||
shadow = 0x00000001,
|
shadow = 0x00000001,
|
||||||
trans_shadow = 0x00000002,
|
trans_shadow = 0x00000002,
|
||||||
active = 0x00000004,
|
active = 0x00000004,
|
||||||
focus = 0x00000008,
|
focus = 0x00000008,
|
||||||
scrollable = 0x00000010,
|
scrollable = 0x00000010,
|
||||||
resizeable = 0x00000020,
|
resizeable = 0x00000020,
|
||||||
modal = 0x00000040,
|
modal = 0x00000040,
|
||||||
flat = 0x00000080,
|
window_widget = 0x00000080,
|
||||||
no_underline = 0x00000100
|
dialog_widget = 0x00000100,
|
||||||
|
menu_widget = 0x00000200,
|
||||||
|
flat = 0x00000400,
|
||||||
|
no_underline = 0x00000800
|
||||||
};
|
};
|
||||||
|
|
||||||
// internal character encoding
|
// internal character encoding
|
||||||
|
|
|
@ -63,18 +63,18 @@ FMouseEvent::FMouseEvent ( int ev_type // constructor
|
||||||
, int button )
|
, int button )
|
||||||
: FEvent(ev_type)
|
: FEvent(ev_type)
|
||||||
, p(pos)
|
, p(pos)
|
||||||
, g()
|
, tp()
|
||||||
, b(button)
|
, b(button)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FMouseEvent::FMouseEvent ( int ev_type // constructor
|
FMouseEvent::FMouseEvent ( int ev_type // constructor
|
||||||
, const FPoint& pos
|
, const FPoint& pos
|
||||||
, const FPoint& globalPos
|
, const FPoint& termPos
|
||||||
, int button )
|
, int button )
|
||||||
: FEvent(ev_type)
|
: FEvent(ev_type)
|
||||||
, p(pos)
|
, p(pos)
|
||||||
, g(globalPos)
|
, tp(termPos)
|
||||||
, b(button)
|
, b(button)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
@ -87,8 +87,8 @@ const FPoint& FMouseEvent::getPos() const
|
||||||
{ return p; }
|
{ return p; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
const FPoint& FMouseEvent::getGlobalPos() const
|
const FPoint& FMouseEvent::getTermPos() const
|
||||||
{ return g; }
|
{ return tp; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FMouseEvent::getX() const
|
int FMouseEvent::getX() const
|
||||||
|
@ -99,12 +99,12 @@ int FMouseEvent::getY() const
|
||||||
{ return p.getY(); }
|
{ return p.getY(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FMouseEvent::getGlobalX() const
|
int FMouseEvent::getTermX() const
|
||||||
{ return g.getX(); }
|
{ return tp.getX(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FMouseEvent::getGlobalY() const
|
int FMouseEvent::getTermY() const
|
||||||
{ return g.getY(); }
|
{ return tp.getY(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FMouseEvent::getButton() const
|
int FMouseEvent::getButton() const
|
||||||
|
@ -120,18 +120,18 @@ FWheelEvent::FWheelEvent ( int ev_type // constructor
|
||||||
, int wheel )
|
, int wheel )
|
||||||
: FEvent(ev_type)
|
: FEvent(ev_type)
|
||||||
, p(pos)
|
, p(pos)
|
||||||
, g()
|
, tp()
|
||||||
, w(wheel)
|
, w(wheel)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FWheelEvent::FWheelEvent ( int ev_type // constructor
|
FWheelEvent::FWheelEvent ( int ev_type // constructor
|
||||||
, const FPoint& pos
|
, const FPoint& pos
|
||||||
, const FPoint& globalPos
|
, const FPoint& termPos
|
||||||
, int wheel )
|
, int wheel )
|
||||||
: FEvent(ev_type)
|
: FEvent(ev_type)
|
||||||
, p(pos)
|
, p(pos)
|
||||||
, g(globalPos)
|
, tp(termPos)
|
||||||
, w(wheel)
|
, w(wheel)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
@ -144,8 +144,8 @@ const FPoint& FWheelEvent::getPos() const
|
||||||
{ return p; }
|
{ return p; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
const FPoint& FWheelEvent::getGlobalPos() const
|
const FPoint& FWheelEvent::getTermPos() const
|
||||||
{ return g; }
|
{ return tp; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FWheelEvent::getX() const
|
int FWheelEvent::getX() const
|
||||||
|
@ -156,12 +156,12 @@ int FWheelEvent::getY() const
|
||||||
{ return p.getY(); }
|
{ return p.getY(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FWheelEvent::getGlobalX() const
|
int FWheelEvent::getTermX() const
|
||||||
{ return g.getX(); }
|
{ return tp.getX(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FWheelEvent::getGlobalY() const
|
int FWheelEvent::getTermY() const
|
||||||
{ return g.getY(); }
|
{ return tp.getY(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FWheelEvent::getWheel() const
|
int FWheelEvent::getWheel() const
|
||||||
|
|
16
src/fevent.h
16
src/fevent.h
|
@ -119,16 +119,16 @@ class FMouseEvent : public FEvent // mouse event
|
||||||
~FMouseEvent();
|
~FMouseEvent();
|
||||||
|
|
||||||
const FPoint& getPos() const;
|
const FPoint& getPos() const;
|
||||||
const FPoint& getGlobalPos() const;
|
const FPoint& getTermPos() const;
|
||||||
int getX() const;
|
int getX() const;
|
||||||
int getY() const;
|
int getY() const;
|
||||||
int getGlobalX() const;
|
int getTermX() const;
|
||||||
int getGlobalY() const;
|
int getTermY() const;
|
||||||
int getButton() const;
|
int getButton() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
FPoint p;
|
FPoint p;
|
||||||
FPoint g;
|
FPoint tp;
|
||||||
int b;
|
int b;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -150,16 +150,16 @@ class FWheelEvent : public FEvent // wheel event
|
||||||
~FWheelEvent();
|
~FWheelEvent();
|
||||||
|
|
||||||
const FPoint& getPos() const;
|
const FPoint& getPos() const;
|
||||||
const FPoint& getGlobalPos() const;
|
const FPoint& getTermPos() const;
|
||||||
int getX() const;
|
int getX() const;
|
||||||
int getY() const;
|
int getY() const;
|
||||||
int getGlobalX() const;
|
int getTermX() const;
|
||||||
int getGlobalY() const;
|
int getTermY() const;
|
||||||
int getWheel() const;
|
int getWheel() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
FPoint p;
|
FPoint p;
|
||||||
FPoint g;
|
FPoint tp;
|
||||||
int w;
|
int w;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -106,22 +106,16 @@ FFileDialog::~FFileDialog() // destructor
|
||||||
void FFileDialog::init()
|
void FFileDialog::init()
|
||||||
{
|
{
|
||||||
FWidget* parent_widget;
|
FWidget* parent_widget;
|
||||||
int x, y;
|
int x, y, w, h;
|
||||||
height = 15;
|
w = 42;
|
||||||
width = 42;
|
h = 15;
|
||||||
|
setGeometry(1, 1, w, h, false);
|
||||||
if ( width < 15 )
|
|
||||||
width = 15;
|
|
||||||
|
|
||||||
if ( width < 20 )
|
|
||||||
width = 20;
|
|
||||||
|
|
||||||
parent_widget = getParentWidget();
|
parent_widget = getParentWidget();
|
||||||
|
|
||||||
if ( parent_widget )
|
if ( parent_widget )
|
||||||
{
|
{
|
||||||
x = 1 + int((parent_widget->getWidth()-width)/2);
|
x = 1 + int((parent_widget->getWidth()-w)/2);
|
||||||
y = 1 + int((parent_widget->getHeight()-height)/3);
|
y = 1 + int((parent_widget->getHeight()-h)/3);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
x = y = 1;
|
x = y = 1;
|
||||||
|
@ -153,7 +147,7 @@ void FFileDialog::init()
|
||||||
open = new FButton("&Open",this);
|
open = new FButton("&Open",this);
|
||||||
|
|
||||||
open->setGeometry(30, 10, 9, 1);
|
open->setGeometry(30, 10, 9, 1);
|
||||||
setGeometry (x, y, width, height);
|
setGeometry (x, y, getWidth(), getHeight());
|
||||||
|
|
||||||
filename->addCallback
|
filename->addCallback
|
||||||
(
|
(
|
||||||
|
@ -488,10 +482,10 @@ void FFileDialog::adjustSize()
|
||||||
h = 30;
|
h = 30;
|
||||||
|
|
||||||
setHeight (h, false);
|
setHeight (h, false);
|
||||||
X = 1 + int((max_width-width)/2);
|
X = 1 + int((max_width - getWidth()) / 2);
|
||||||
Y = 1 + int((max_height-height)/3);
|
Y = 1 + int((max_height - getHeight()) / 3);
|
||||||
setPos(X, Y, false);
|
setPos(X, Y, false);
|
||||||
filebrowser->setHeight(h-8, false);
|
filebrowser->setHeight (h-8, false);
|
||||||
hidden->setY(h-4, false);
|
hidden->setY(h-4, false);
|
||||||
cancel->setY(h-4, false);
|
cancel->setY(h-4, false);
|
||||||
open->setY(h-4, false);
|
open->setY(h-4, false);
|
||||||
|
|
|
@ -64,13 +64,13 @@ void FLabel::init()
|
||||||
|
|
||||||
if ( parent_widget )
|
if ( parent_widget )
|
||||||
{
|
{
|
||||||
foregroundColor = parent_widget->getForegroundColor();
|
setForegroundColor (parent_widget->getForegroundColor());
|
||||||
backgroundColor = parent_widget->getBackgroundColor();
|
setBackgroundColor (parent_widget->getBackgroundColor());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foregroundColor = wc.dialog_fg;
|
setForegroundColor (wc.dialog_fg);
|
||||||
backgroundColor = wc.dialog_bg;
|
setBackgroundColor (wc.dialog_bg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,14 +153,14 @@ int FLabel::getXOffset(int length)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case fc::alignCenter:
|
case fc::alignCenter:
|
||||||
if ( length < width )
|
if ( length < getWidth() )
|
||||||
return int((width - length) / 2);
|
return int((getWidth() - length) / 2);
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case fc::alignRight:
|
case fc::alignRight:
|
||||||
if ( length < width )
|
if ( length < getWidth() )
|
||||||
return width - length;
|
return getWidth() - length;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -183,10 +183,10 @@ void FLabel::printLine ( wchar_t*& line
|
||||||
for (int x=0; x < xoffset; x++)
|
for (int x=0; x < xoffset; x++)
|
||||||
print (' ');
|
print (' ');
|
||||||
|
|
||||||
if ( length <= uInt(width) )
|
if ( length <= uInt(getWidth()) )
|
||||||
to_char = int(length);
|
to_char = int(length);
|
||||||
else
|
else
|
||||||
to_char = width - 2;
|
to_char = getWidth() - 2;
|
||||||
|
|
||||||
if ( hasReverseMode() )
|
if ( hasReverseMode() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
@ -214,23 +214,23 @@ void FLabel::printLine ( wchar_t*& line
|
||||||
unsetUnderline();
|
unsetUnderline();
|
||||||
|
|
||||||
if ( hasEmphasis() )
|
if ( hasEmphasis() )
|
||||||
setColor (emphasis_color, backgroundColor);
|
setColor (emphasis_color, getBackgroundColor());
|
||||||
else
|
else
|
||||||
setColor (foregroundColor, backgroundColor);
|
setColor();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
print ( line[z] );
|
print ( line[z] );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( length > uInt(width) )
|
if ( length > uInt(getWidth()) )
|
||||||
{
|
{
|
||||||
setColor (ellipsis_color, backgroundColor);
|
setColor (ellipsis_color, getBackgroundColor());
|
||||||
print ("..");
|
print ("..");
|
||||||
setColor (foregroundColor, backgroundColor);
|
setColor();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (int x=xoffset+to_char; x < width; x++)
|
for (int x=xoffset+to_char; x < getWidth(); x++)
|
||||||
print (' ');
|
print (' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,19 +260,19 @@ void FLabel::draw()
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( hasEmphasis() )
|
if ( hasEmphasis() )
|
||||||
setColor (emphasis_color, backgroundColor);
|
setColor (emphasis_color, getBackgroundColor());
|
||||||
else
|
else
|
||||||
setColor (foregroundColor, backgroundColor);
|
setColor();
|
||||||
|
|
||||||
hotkeypos = -1;
|
hotkeypos = -1;
|
||||||
|
|
||||||
if ( multiline && height > 1 )
|
if ( multiline && getHeight() > 1 )
|
||||||
{
|
{
|
||||||
uInt y = 0;
|
uInt y = 0;
|
||||||
uInt text_lines = uInt(multiline_text.size());
|
uInt text_lines = uInt(multiline_text.size());
|
||||||
bool hotkey_printed = false;
|
bool hotkey_printed = false;
|
||||||
|
|
||||||
while ( y < text_lines && y < uInt(height) )
|
while ( y < text_lines && y < uInt(getHeight()) )
|
||||||
{
|
{
|
||||||
length = multiline_text[y].getLength();
|
length = multiline_text[y].getLength();
|
||||||
LabelText = new wchar_t[length+1]();
|
LabelText = new wchar_t[length+1]();
|
||||||
|
@ -284,7 +284,7 @@ void FLabel::draw()
|
||||||
else
|
else
|
||||||
wcsncpy(dest, src, length);
|
wcsncpy(dest, src, length);
|
||||||
|
|
||||||
gotoxy (xpos+xmin-1, ypos+ymin-1+int(y));
|
printPos (1, 1+int(y));
|
||||||
|
|
||||||
if ( hotkeypos != -1 )
|
if ( hotkeypos != -1 )
|
||||||
{
|
{
|
||||||
|
@ -314,7 +314,7 @@ void FLabel::draw()
|
||||||
if ( hotkeypos != -1 )
|
if ( hotkeypos != -1 )
|
||||||
length--;
|
length--;
|
||||||
|
|
||||||
gotoxy (xpos+xmin-1, ypos+ymin-1);
|
printPos (1,1);
|
||||||
xoffset = getXOffset (int(length));
|
xoffset = getXOffset (int(length));
|
||||||
printLine (LabelText, length, hotkeypos, xoffset);
|
printLine (LabelText, length, hotkeypos, xoffset);
|
||||||
delete[] LabelText;
|
delete[] LabelText;
|
||||||
|
@ -337,6 +337,7 @@ void FLabel::draw()
|
||||||
void FLabel::hide()
|
void FLabel::hide()
|
||||||
{
|
{
|
||||||
short fg, bg;
|
short fg, bg;
|
||||||
|
int size;
|
||||||
char* blank;
|
char* blank;
|
||||||
FWidget* parent_widget = getParentWidget();
|
FWidget* parent_widget = getParentWidget();
|
||||||
|
|
||||||
|
@ -354,9 +355,15 @@ void FLabel::hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
setColor (fg, bg);
|
setColor (fg, bg);
|
||||||
blank = new char[width+1];
|
size = getWidth();
|
||||||
memset(blank, ' ', uLong(width));
|
|
||||||
blank[width] = '\0';
|
if ( size < 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
|
blank = new char[size+1];
|
||||||
|
memset(blank, ' ', uLong(size));
|
||||||
|
blank[getWidth()] = '\0';
|
||||||
|
printPos (1,1);
|
||||||
print (blank);
|
print (blank);
|
||||||
delete[] blank;
|
delete[] blank;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ FLineEdit::FLineEdit(FWidget* parent)
|
||||||
, scrollRepeat(100)
|
, scrollRepeat(100)
|
||||||
, insert_mode(true)
|
, insert_mode(true)
|
||||||
, cursor_pos(0)
|
, cursor_pos(0)
|
||||||
, offset(0)
|
, text_offset(0)
|
||||||
, label_orientation(FLineEdit::label_left)
|
, label_orientation(FLineEdit::label_left)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
|
@ -39,7 +39,7 @@ FLineEdit::FLineEdit (const FString& txt, FWidget* parent)
|
||||||
, scrollRepeat(100)
|
, scrollRepeat(100)
|
||||||
, insert_mode(true)
|
, insert_mode(true)
|
||||||
, cursor_pos(0)
|
, cursor_pos(0)
|
||||||
, offset(0)
|
, text_offset(0)
|
||||||
, label_orientation(FLineEdit::label_left)
|
, label_orientation(FLineEdit::label_left)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
|
@ -80,19 +80,19 @@ void FLineEdit::init()
|
||||||
|
|
||||||
if ( hasFocus() )
|
if ( hasFocus() )
|
||||||
{
|
{
|
||||||
foregroundColor = wc.inputfield_active_focus_fg;
|
setForegroundColor (wc.inputfield_active_focus_fg);
|
||||||
backgroundColor = wc.inputfield_active_focus_bg;
|
setBackgroundColor (wc.inputfield_active_focus_bg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foregroundColor = wc.inputfield_active_fg;
|
setForegroundColor (wc.inputfield_active_fg);
|
||||||
backgroundColor = wc.inputfield_active_bg;
|
setBackgroundColor (wc.inputfield_active_bg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // inactive
|
else // inactive
|
||||||
{
|
{
|
||||||
foregroundColor = wc.inputfield_inactive_fg;
|
setForegroundColor (wc.inputfield_inactive_fg);
|
||||||
backgroundColor = wc.inputfield_inactive_bg;
|
setBackgroundColor (wc.inputfield_inactive_bg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ void FLineEdit::drawInputField()
|
||||||
isShadow = ((flags & fc::shadow) != 0 );
|
isShadow = ((flags & fc::shadow) != 0 );
|
||||||
|
|
||||||
updateVTerm(false);
|
updateVTerm(false);
|
||||||
gotoxy (xpos+xmin-1, ypos+ymin-1);
|
printPos (1, 1);
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
{
|
{
|
||||||
|
@ -186,8 +186,8 @@ void FLineEdit::drawInputField()
|
||||||
if ( isActiveFocus && getMaxColor() < 16 )
|
if ( isActiveFocus && getMaxColor() < 16 )
|
||||||
setBold();
|
setBold();
|
||||||
|
|
||||||
setColor (foregroundColor, backgroundColor);
|
setColor();
|
||||||
show_text = text.mid(uInt(1+offset), uInt(width-2));
|
show_text = text.mid(uInt(1+text_offset), uInt(getWidth()-2));
|
||||||
|
|
||||||
if ( isUTF8_linux_terminal() )
|
if ( isUTF8_linux_terminal() )
|
||||||
{
|
{
|
||||||
|
@ -203,7 +203,7 @@ void FLineEdit::drawInputField()
|
||||||
|
|
||||||
x = int(show_text.getLength());
|
x = int(show_text.getLength());
|
||||||
|
|
||||||
while ( x < width-1 )
|
while ( x < getWidth()-1 )
|
||||||
{
|
{
|
||||||
print (' ');
|
print (' ');
|
||||||
x++;
|
x++;
|
||||||
|
@ -224,7 +224,7 @@ void FLineEdit::drawInputField()
|
||||||
updateVTerm(true);
|
updateVTerm(true);
|
||||||
|
|
||||||
// set the cursor to the first pos.
|
// set the cursor to the first pos.
|
||||||
setCursorPos (xpos+xmin+cursor_pos-offset, ypos+ymin-1);
|
setCursorPos (2+cursor_pos-text_offset, 1);
|
||||||
|
|
||||||
if ( isCursorInside() && hasFocus() && isHiddenCursor() )
|
if ( isCursorInside() && hasFocus() && isHiddenCursor() )
|
||||||
showCursor();
|
showCursor();
|
||||||
|
@ -266,11 +266,11 @@ void FLineEdit::adjustLabel()
|
||||||
switch ( label_orientation )
|
switch ( label_orientation )
|
||||||
{
|
{
|
||||||
case label_above:
|
case label_above:
|
||||||
label->setGeometry(xpos, ypos-1, label_length, 1);
|
label->setGeometry(getX(), getY()-1, label_length, 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case label_left:
|
case label_left:
|
||||||
label->setGeometry(xpos-label_length, ypos, label_length, 1);
|
label->setGeometry(getX()-label_length, getY(), label_length, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -287,7 +287,7 @@ void FLineEdit::adjustSize()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FLineEdit::hide()
|
void FLineEdit::hide()
|
||||||
{
|
{
|
||||||
int s, size, lable_Length;
|
int s, size;
|
||||||
short fg, bg;
|
short fg, bg;
|
||||||
char* blank;
|
char* blank;
|
||||||
FWidget* parent_widget = getParentWidget();
|
FWidget* parent_widget = getParentWidget();
|
||||||
|
@ -307,42 +307,25 @@ void FLineEdit::hide()
|
||||||
|
|
||||||
setColor (fg, bg);
|
setColor (fg, bg);
|
||||||
s = hasShadow() ? 1 : 0;
|
s = hasShadow() ? 1 : 0;
|
||||||
size = width + s;
|
size = getWidth() + s;
|
||||||
|
|
||||||
|
if ( size < 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
blank = new char[size+1];
|
blank = new char[size+1];
|
||||||
memset(blank, ' ', uLong(size));
|
memset(blank, ' ', uLong(size));
|
||||||
blank[size] = '\0';
|
blank[size] = '\0';
|
||||||
|
|
||||||
for (int y=0; y < height+s; y++)
|
for (int y=0; y < getHeight()+s; y++)
|
||||||
{
|
{
|
||||||
gotoxy (xpos+xmin-1, ypos+ymin-1+y);
|
printPos (1, 1+y);
|
||||||
print (blank);
|
print (blank);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete[] blank;
|
delete[] blank;
|
||||||
lable_Length = int(label_text.getLength());
|
|
||||||
|
|
||||||
if ( lable_Length > 0 )
|
if ( label )
|
||||||
{
|
label->hide();
|
||||||
assert ( label_orientation == label_above
|
|
||||||
|| label_orientation == label_left );
|
|
||||||
|
|
||||||
switch ( label_orientation )
|
|
||||||
{
|
|
||||||
case label_above:
|
|
||||||
gotoxy (xpos+xmin-1, ypos+ymin-2);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case label_left:
|
|
||||||
gotoxy (xpos+xmin-int(lable_Length)-1, ypos+ymin-1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
blank = new char[lable_Length+1];
|
|
||||||
memset(blank, ' ', uLong(size));
|
|
||||||
blank[lable_Length] = '\0';
|
|
||||||
print (blank);
|
|
||||||
delete[] blank;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -356,20 +339,20 @@ bool FLineEdit::setEnable (bool on)
|
||||||
|
|
||||||
if ( hasFocus() )
|
if ( hasFocus() )
|
||||||
{
|
{
|
||||||
foregroundColor = wc.inputfield_active_focus_fg;
|
setForegroundColor (wc.inputfield_active_focus_fg);
|
||||||
backgroundColor = wc.inputfield_active_focus_bg;
|
setBackgroundColor (wc.inputfield_active_focus_bg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foregroundColor = wc.inputfield_active_fg;
|
setForegroundColor (wc.inputfield_active_fg);
|
||||||
backgroundColor = wc.inputfield_active_bg;
|
setBackgroundColor (wc.inputfield_active_bg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flags &= ~fc::active;
|
flags &= ~fc::active;
|
||||||
foregroundColor = wc.inputfield_inactive_fg;
|
setForegroundColor (wc.inputfield_inactive_fg);
|
||||||
backgroundColor = wc.inputfield_inactive_bg;
|
setBackgroundColor (wc.inputfield_inactive_bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
return on;
|
return on;
|
||||||
|
@ -386,8 +369,8 @@ bool FLineEdit::setFocus (bool on)
|
||||||
|
|
||||||
if ( isEnabled() )
|
if ( isEnabled() )
|
||||||
{
|
{
|
||||||
foregroundColor = wc.inputfield_active_focus_fg;
|
setForegroundColor (wc.inputfield_active_focus_fg);
|
||||||
backgroundColor = wc.inputfield_active_focus_bg;
|
setBackgroundColor (wc.inputfield_active_focus_bg);
|
||||||
|
|
||||||
if ( statusBar() )
|
if ( statusBar() )
|
||||||
{
|
{
|
||||||
|
@ -405,8 +388,8 @@ bool FLineEdit::setFocus (bool on)
|
||||||
|
|
||||||
if ( isEnabled() )
|
if ( isEnabled() )
|
||||||
{
|
{
|
||||||
foregroundColor = wc.inputfield_active_fg;
|
setForegroundColor (wc.inputfield_active_fg);
|
||||||
backgroundColor = wc.inputfield_active_bg;
|
setBackgroundColor (wc.inputfield_active_bg);
|
||||||
|
|
||||||
if ( statusBar() )
|
if ( statusBar() )
|
||||||
statusBar()->clearMessage();
|
statusBar()->clearMessage();
|
||||||
|
@ -443,8 +426,8 @@ void FLineEdit::onKeyPress (FKeyEvent* ev)
|
||||||
if ( cursor_pos < 0 )
|
if ( cursor_pos < 0 )
|
||||||
cursor_pos=0;
|
cursor_pos=0;
|
||||||
|
|
||||||
if ( cursor_pos < offset )
|
if ( cursor_pos < text_offset )
|
||||||
offset--;
|
text_offset--;
|
||||||
|
|
||||||
ev->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
@ -455,22 +438,22 @@ void FLineEdit::onKeyPress (FKeyEvent* ev)
|
||||||
if ( cursor_pos >= len )
|
if ( cursor_pos >= len )
|
||||||
cursor_pos=len;
|
cursor_pos=len;
|
||||||
|
|
||||||
if ( cursor_pos-offset >= width-2 && offset <= len-width+1 )
|
if ( cursor_pos-text_offset >= getWidth()-2 && text_offset <= len-getWidth()+1 )
|
||||||
offset++;
|
text_offset++;
|
||||||
|
|
||||||
ev->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_home:
|
case fc::Fkey_home:
|
||||||
cursor_pos=0;
|
cursor_pos=0;
|
||||||
offset=0;
|
text_offset=0;
|
||||||
ev->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_end:
|
case fc::Fkey_end:
|
||||||
cursor_pos=len;
|
cursor_pos=len;
|
||||||
if ( cursor_pos >= width-1 )
|
if ( cursor_pos >= getWidth()-1 )
|
||||||
offset=len-width+2;
|
text_offset=len-getWidth()+2;
|
||||||
ev->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -487,8 +470,8 @@ void FLineEdit::onKeyPress (FKeyEvent* ev)
|
||||||
if ( cursor_pos < 0 )
|
if ( cursor_pos < 0 )
|
||||||
cursor_pos=0;
|
cursor_pos=0;
|
||||||
|
|
||||||
if ( offset > 0 && len-offset < width-1 )
|
if ( text_offset > 0 && len-text_offset < getWidth()-1 )
|
||||||
offset--;
|
text_offset--;
|
||||||
|
|
||||||
ev->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
@ -501,8 +484,8 @@ void FLineEdit::onKeyPress (FKeyEvent* ev)
|
||||||
processChanged();
|
processChanged();
|
||||||
cursor_pos--;
|
cursor_pos--;
|
||||||
|
|
||||||
if ( offset > 0 )
|
if ( text_offset > 0 )
|
||||||
offset--;
|
text_offset--;
|
||||||
}
|
}
|
||||||
|
|
||||||
ev->accept();
|
ev->accept();
|
||||||
|
@ -567,8 +550,8 @@ void FLineEdit::onKeyPress (FKeyEvent* ev)
|
||||||
}
|
}
|
||||||
cursor_pos++;
|
cursor_pos++;
|
||||||
|
|
||||||
if ( cursor_pos >= width-1 )
|
if ( cursor_pos >= getWidth()-1 )
|
||||||
offset++;
|
text_offset++;
|
||||||
|
|
||||||
ev->accept();
|
ev->accept();
|
||||||
}
|
}
|
||||||
|
@ -613,10 +596,10 @@ void FLineEdit::onMouseDown (FMouseEvent* ev)
|
||||||
mouse_x = ev->getX();
|
mouse_x = ev->getX();
|
||||||
mouse_y = ev->getY();
|
mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( mouse_x >= 2 && mouse_x <= width && mouse_y == 1 )
|
if ( mouse_x >= 2 && mouse_x <= getWidth() && mouse_y == 1 )
|
||||||
{
|
{
|
||||||
int len = int(text.getLength());
|
int len = int(text.getLength());
|
||||||
cursor_pos = offset + mouse_x - 2;
|
cursor_pos = text_offset + mouse_x - 2;
|
||||||
|
|
||||||
if ( cursor_pos >= len )
|
if ( cursor_pos >= len )
|
||||||
cursor_pos = len;
|
cursor_pos = len;
|
||||||
|
@ -649,9 +632,9 @@ void FLineEdit::onMouseMove (FMouseEvent* ev)
|
||||||
mouse_x = ev->getX();
|
mouse_x = ev->getX();
|
||||||
mouse_y = ev->getY();
|
mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( mouse_x >= 2 && mouse_x <= width && mouse_y == 1 )
|
if ( mouse_x >= 2 && mouse_x <= getWidth() && mouse_y == 1 )
|
||||||
{
|
{
|
||||||
cursor_pos = offset + mouse_x - 2;
|
cursor_pos = text_offset + mouse_x - 2;
|
||||||
|
|
||||||
if ( cursor_pos >= len )
|
if ( cursor_pos >= len )
|
||||||
cursor_pos=len;
|
cursor_pos=len;
|
||||||
|
@ -664,30 +647,30 @@ void FLineEdit::onMouseMove (FMouseEvent* ev)
|
||||||
if ( mouse_x < 2 )
|
if ( mouse_x < 2 )
|
||||||
{
|
{
|
||||||
// drag left
|
// drag left
|
||||||
if ( ! scrollTimer && offset > 0 )
|
if ( ! scrollTimer && text_offset > 0 )
|
||||||
{
|
{
|
||||||
scrollTimer = true;
|
scrollTimer = true;
|
||||||
addTimer(scrollRepeat);
|
addTimer(scrollRepeat);
|
||||||
dragScroll = FLineEdit::scrollLeft;
|
dragScroll = FLineEdit::scrollLeft;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( offset == 0 )
|
if ( text_offset == 0 )
|
||||||
{
|
{
|
||||||
delOwnTimer();
|
delOwnTimer();
|
||||||
dragScroll = FLineEdit::noScroll;
|
dragScroll = FLineEdit::noScroll;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( mouse_x >= width )
|
else if ( mouse_x >= getWidth() )
|
||||||
{
|
{
|
||||||
// drag right
|
// drag right
|
||||||
if ( ! scrollTimer && offset <= len-width+1 )
|
if ( ! scrollTimer && text_offset <= len-getWidth()+1 )
|
||||||
{
|
{
|
||||||
scrollTimer = true;
|
scrollTimer = true;
|
||||||
addTimer(scrollRepeat);
|
addTimer(scrollRepeat);
|
||||||
dragScroll = FLineEdit::scrollRight;
|
dragScroll = FLineEdit::scrollRight;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( offset == len-width+2 )
|
if ( text_offset == len-getWidth()+2 )
|
||||||
{
|
{
|
||||||
delOwnTimer();
|
delOwnTimer();
|
||||||
dragScroll = FLineEdit::noScroll;
|
dragScroll = FLineEdit::noScroll;
|
||||||
|
@ -713,16 +696,16 @@ void FLineEdit::onTimer (FTimerEvent*)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case FLineEdit::scrollLeft:
|
case FLineEdit::scrollLeft:
|
||||||
if ( offset == 0)
|
if ( text_offset == 0)
|
||||||
{
|
{
|
||||||
dragScroll = FLineEdit::noScroll;
|
dragScroll = FLineEdit::noScroll;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
offset--;
|
text_offset--;
|
||||||
|
|
||||||
if ( offset < 0 )
|
if ( text_offset < 0 )
|
||||||
offset = 0;
|
text_offset = 0;
|
||||||
|
|
||||||
cursor_pos--;
|
cursor_pos--;
|
||||||
|
|
||||||
|
@ -732,16 +715,16 @@ void FLineEdit::onTimer (FTimerEvent*)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FLineEdit::scrollRight:
|
case FLineEdit::scrollRight:
|
||||||
if ( offset == len-width+2 )
|
if ( text_offset == len-getWidth()+2 )
|
||||||
{
|
{
|
||||||
dragScroll = FLineEdit::noScroll;
|
dragScroll = FLineEdit::noScroll;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
offset++;
|
text_offset++;
|
||||||
|
|
||||||
if ( offset > len-width+2 )
|
if ( text_offset > len-getWidth()+2 )
|
||||||
offset = len-width+2;
|
text_offset = len-getWidth()+2;
|
||||||
|
|
||||||
cursor_pos++;
|
cursor_pos++;
|
||||||
|
|
||||||
|
@ -857,7 +840,7 @@ void FLineEdit::onFocusOut (FFocusEvent*)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FLineEdit::clearText()
|
void FLineEdit::clearText()
|
||||||
{
|
{
|
||||||
offset = 0;
|
text_offset = 0;
|
||||||
cursor_pos = 0;
|
cursor_pos = 0;
|
||||||
text.clear();
|
text.clear();
|
||||||
}
|
}
|
||||||
|
@ -865,7 +848,7 @@ void FLineEdit::clearText()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FLineEdit::setText (FString txt)
|
void FLineEdit::setText (FString txt)
|
||||||
{
|
{
|
||||||
offset = 0;
|
text_offset = 0;
|
||||||
cursor_pos = 0;
|
cursor_pos = 0;
|
||||||
|
|
||||||
if ( txt )
|
if ( txt )
|
||||||
|
|
|
@ -51,7 +51,7 @@ class FLineEdit : public FWidget
|
||||||
int scrollRepeat;
|
int scrollRepeat;
|
||||||
bool insert_mode;
|
bool insert_mode;
|
||||||
int cursor_pos;
|
int cursor_pos;
|
||||||
int offset;
|
int text_offset;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum label_o
|
enum label_o
|
||||||
|
|
240
src/flistbox.cpp
240
src/flistbox.cpp
|
@ -98,8 +98,8 @@ void FListBox::init()
|
||||||
|
|
||||||
nf_offset = isNewFont() ? 1 : 0;
|
nf_offset = isNewFont() ? 1 : 0;
|
||||||
|
|
||||||
foregroundColor = wc.dialog_fg;
|
setForegroundColor (wc.dialog_fg);
|
||||||
backgroundColor = wc.dialog_bg;
|
setBackgroundColor (wc.dialog_bg);
|
||||||
|
|
||||||
VBar = new FScrollbar(fc::vertical, this);
|
VBar = new FScrollbar(fc::vertical, this);
|
||||||
VBar->setMinimum(0);
|
VBar->setMinimum(0);
|
||||||
|
@ -135,29 +135,24 @@ void FListBox::draw()
|
||||||
current = 1;
|
current = 1;
|
||||||
|
|
||||||
updateVTerm(false);
|
updateVTerm(false);
|
||||||
setColor (foregroundColor, backgroundColor);
|
setColor();
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
width--;
|
drawBorder (1, getWidth() - 1, 1, getHeight());
|
||||||
|
else
|
||||||
|
drawBorder();
|
||||||
|
|
||||||
drawBorder();
|
if ( isNewFont() && ! VBar->isVisible() )
|
||||||
|
|
||||||
if ( isNewFont() )
|
|
||||||
{
|
{
|
||||||
width++;
|
setColor();
|
||||||
|
|
||||||
if ( ! VBar->isVisible() )
|
for (int y=2; y < getHeight(); y++)
|
||||||
{
|
{
|
||||||
setColor (foregroundColor, backgroundColor);
|
printPos (getWidth(),y);
|
||||||
|
print (' '); // clear right side of the scrollbar
|
||||||
for (int y=ypos+ymin; y < ypos+ymin+height-2; y++)
|
|
||||||
{
|
|
||||||
gotoxy(xpos+xmin+width-2, y);
|
|
||||||
print (' '); // clear right side of the scrollbar
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,18 +196,18 @@ void FListBox::drawLabel()
|
||||||
|
|
||||||
txt = " " + text + " ";
|
txt = " " + text + " ";
|
||||||
length = txt.getLength();
|
length = txt.getLength();
|
||||||
gotoxy (xpos+xmin, ypos+ymin-1);
|
printPos (2, 1);
|
||||||
|
|
||||||
if ( isEnabled() )
|
if ( isEnabled() )
|
||||||
setColor(wc.label_emphasis_fg, wc.label_bg);
|
setColor(wc.label_emphasis_fg, wc.label_bg);
|
||||||
else
|
else
|
||||||
setColor(wc.label_inactive_fg, wc.label_inactive_bg);
|
setColor(wc.label_inactive_fg, wc.label_inactive_bg);
|
||||||
|
|
||||||
if ( length <= uInt(width-2) )
|
if ( length <= uInt(getWidth()-2) )
|
||||||
print (txt);
|
print (txt);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print (text.left(uInt(width-4)));
|
print (text.left(uInt(getWidth()-4)));
|
||||||
setColor (wc.label_ellipsis_fg, wc.label_bg);
|
setColor (wc.label_ellipsis_fg, wc.label_bg);
|
||||||
print("..");
|
print("..");
|
||||||
}
|
}
|
||||||
|
@ -225,12 +220,12 @@ void FListBox::drawList()
|
||||||
uInt start, end, inc_len;
|
uInt start, end, inc_len;
|
||||||
bool isFocus;
|
bool isFocus;
|
||||||
|
|
||||||
if ( data.empty() || height < 4 || width < 5 )
|
if ( data.empty() || getHeight() < 4 || getWidth() < 5 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
isFocus = ((flags & fc::focus) != 0);
|
isFocus = ((flags & fc::focus) != 0);
|
||||||
start = 0;
|
start = 0;
|
||||||
end = uInt(height-2);
|
end = uInt(getHeight()-2);
|
||||||
inc_len = inc_search.getLength();
|
inc_len = inc_search.getLength();
|
||||||
|
|
||||||
if ( end > count() )
|
if ( end > count() )
|
||||||
|
@ -251,7 +246,7 @@ void FListBox::drawList()
|
||||||
|
|
||||||
for (uInt y=start; y < end; y++)
|
for (uInt y=start; y < end; y++)
|
||||||
{
|
{
|
||||||
gotoxy (xpos+xmin, ypos+ymin+int(y));
|
printPos (2, 2 + int(y));
|
||||||
bool serach_mark = false;
|
bool serach_mark = false;
|
||||||
bool lineHasBrackets = hasBrackets(int(y) + yoffset + 1);
|
bool lineHasBrackets = hasBrackets(int(y) + yoffset + 1);
|
||||||
bool isLineSelected = isSelected(int(y) + yoffset + 1);
|
bool isLineSelected = isSelected(int(y) + yoffset + 1);
|
||||||
|
@ -288,8 +283,7 @@ void FListBox::drawList()
|
||||||
setColor ( wc.selected_current_element_fg
|
setColor ( wc.selected_current_element_fg
|
||||||
, wc.selected_current_element_bg );
|
, wc.selected_current_element_bg );
|
||||||
|
|
||||||
setCursorPos ( xpos+xmin+1
|
setCursorPos (3, 2 + int(y)); // first character
|
||||||
, ypos+ymin+int(y) ); // first character
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -300,17 +294,15 @@ void FListBox::drawList()
|
||||||
{
|
{
|
||||||
setColor ( wc.current_element_focus_fg
|
setColor ( wc.current_element_focus_fg
|
||||||
, wc.current_element_focus_bg );
|
, wc.current_element_focus_bg );
|
||||||
|
int b = ( lineHasBrackets ) ? 1: 0;
|
||||||
|
|
||||||
if ( inc_len > 0 )
|
if ( inc_len > 0 ) // incremental search
|
||||||
{
|
{
|
||||||
serach_mark = true;
|
serach_mark = true;
|
||||||
int b = ( lineHasBrackets ) ? 1: 0;
|
setCursorPos (2 + b + int(inc_len), 2 + int(y)); // last found character
|
||||||
setCursorPos ( xpos+xmin+int(inc_len)+b
|
|
||||||
, ypos+ymin+int(y) ); // last found character
|
|
||||||
}
|
}
|
||||||
else
|
else // only highlighted
|
||||||
setCursorPos ( xpos+xmin+1
|
setCursorPos (3 + b, 2 + int(y)); // first character
|
||||||
, ypos+ymin+int(y) ); // first character
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
setColor ( wc.current_element_fg
|
setColor ( wc.current_element_fg
|
||||||
|
@ -370,12 +362,12 @@ void FListBox::drawList()
|
||||||
|
|
||||||
element = data[y+uInt(yoffset)].getText()
|
element = data[y+uInt(yoffset)].getText()
|
||||||
.mid ( uInt(1+xoffset)
|
.mid ( uInt(1+xoffset)
|
||||||
, uInt(width-nf_offset-5) );
|
, uInt(getWidth()-nf_offset-5) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
element = data[y+uInt(yoffset)].getText()
|
element = data[y+uInt(yoffset)].getText()
|
||||||
.mid ( uInt(xoffset)
|
.mid ( uInt(xoffset)
|
||||||
, uInt(width-nf_offset-4) );
|
, uInt(getWidth()-nf_offset-4) );
|
||||||
|
|
||||||
element_str = element.wc_str();
|
element_str = element.wc_str();
|
||||||
len = element.getLength();
|
len = element.getLength();
|
||||||
|
@ -395,7 +387,7 @@ void FListBox::drawList()
|
||||||
|
|
||||||
full_length = int(data[y+uInt(yoffset)].getText().getLength());
|
full_length = int(data[y+uInt(yoffset)].getText().getLength());
|
||||||
|
|
||||||
if ( b+i < uInt(width-nf_offset-4) && xoffset <= full_length+1 )
|
if ( b+i < uInt(getWidth()-nf_offset-4) && xoffset <= full_length+1 )
|
||||||
{
|
{
|
||||||
if ( serach_mark && i == inc_len )
|
if ( serach_mark && i == inc_len )
|
||||||
setColor ( wc.current_element_focus_fg
|
setColor ( wc.current_element_focus_fg
|
||||||
|
@ -432,7 +424,7 @@ void FListBox::drawList()
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; b+i < uInt(width-nf_offset-3); i++)
|
for (; b+i < uInt(getWidth()-nf_offset-3); i++)
|
||||||
print (' ');
|
print (' ');
|
||||||
}
|
}
|
||||||
else // line has no brackets
|
else // line has no brackets
|
||||||
|
@ -441,7 +433,7 @@ void FListBox::drawList()
|
||||||
uInt i, len;
|
uInt i, len;
|
||||||
element = data[y+uInt(yoffset)].getText()
|
element = data[y+uInt(yoffset)].getText()
|
||||||
.mid ( uInt(1+xoffset)
|
.mid ( uInt(1+xoffset)
|
||||||
, uInt(width-nf_offset-4) );
|
, uInt(getWidth()-nf_offset-4) );
|
||||||
element_str = element.wc_str();
|
element_str = element.wc_str();
|
||||||
len = element.getLength();
|
len = element.getLength();
|
||||||
|
|
||||||
|
@ -464,7 +456,7 @@ void FListBox::drawList()
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; i < uInt(width-nf_offset-3); i++)
|
for (; i < uInt(getWidth()-nf_offset-3); i++)
|
||||||
print (' ');
|
print (' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -508,8 +500,8 @@ void FListBox::adjustYOffset()
|
||||||
{
|
{
|
||||||
int element_count = int(count());
|
int element_count = int(count());
|
||||||
|
|
||||||
if ( yoffset > element_count - height + 2 )
|
if ( yoffset > element_count - getHeight() + 2 )
|
||||||
yoffset = element_count - height + 2;
|
yoffset = element_count - getHeight() + 2;
|
||||||
|
|
||||||
if ( yoffset < 0 )
|
if ( yoffset < 0 )
|
||||||
yoffset = 0;
|
yoffset = 0;
|
||||||
|
@ -517,8 +509,8 @@ void FListBox::adjustYOffset()
|
||||||
if ( current < yoffset )
|
if ( current < yoffset )
|
||||||
current = yoffset;
|
current = yoffset;
|
||||||
|
|
||||||
if ( current >= yoffset + height - 1 )
|
if ( current >= yoffset + getHeight() - 1 )
|
||||||
yoffset = current - height + 2;
|
yoffset = current - getHeight() + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -529,24 +521,24 @@ void FListBox::adjustSize()
|
||||||
FWidget::adjustSize();
|
FWidget::adjustSize();
|
||||||
|
|
||||||
element_count = int(count());
|
element_count = int(count());
|
||||||
VBar->setMaximum(element_count - height + 2);
|
VBar->setMaximum(element_count - getHeight() + 2);
|
||||||
VBar->setPageSize(element_count, height - 2);
|
VBar->setPageSize(element_count, getHeight() - 2);
|
||||||
VBar->setX(width);
|
VBar->setX(getWidth());
|
||||||
VBar->setHeight (height-2, false);
|
VBar->setHeight (getHeight()-2, false);
|
||||||
VBar->resize();
|
VBar->resize();
|
||||||
|
|
||||||
HBar->setMaximum(maxLineWidth - width + nf_offset + 4);
|
HBar->setMaximum(maxLineWidth - getWidth() + nf_offset + 4);
|
||||||
HBar->setPageSize(maxLineWidth, width - nf_offset - 4);
|
HBar->setPageSize(maxLineWidth, getWidth() - nf_offset - 4);
|
||||||
HBar->setY(height);
|
HBar->setY(getHeight());
|
||||||
HBar->setWidth (width-2, false);
|
HBar->setWidth (getWidth()-2, false);
|
||||||
HBar->resize();
|
HBar->resize();
|
||||||
|
|
||||||
if ( element_count < height - 1 )
|
if ( element_count < getHeight() - 1 )
|
||||||
VBar->hide();
|
VBar->hide();
|
||||||
else
|
else
|
||||||
VBar->setVisible();
|
VBar->setVisible();
|
||||||
|
|
||||||
if ( maxLineWidth < width - nf_offset - 3 )
|
if ( maxLineWidth < getWidth() - nf_offset - 3 )
|
||||||
HBar->hide();
|
HBar->hide();
|
||||||
else
|
else
|
||||||
HBar->setVisible();
|
HBar->setVisible();
|
||||||
|
@ -602,14 +594,18 @@ void FListBox::hide()
|
||||||
|
|
||||||
setColor (fg, bg);
|
setColor (fg, bg);
|
||||||
n = isNewFont() ? 1 : 0;
|
n = isNewFont() ? 1 : 0;
|
||||||
size = width + n;
|
size = getWidth() + n;
|
||||||
|
|
||||||
|
if ( size < 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
blank = new char[size+1];
|
blank = new char[size+1];
|
||||||
memset(blank, ' ', uLong(size));
|
memset(blank, ' ', uLong(size));
|
||||||
blank[size] = '\0';
|
blank[size] = '\0';
|
||||||
|
|
||||||
for (int y=0; y < height; y++)
|
for (int y=0; y < getHeight(); y++)
|
||||||
{
|
{
|
||||||
gotoxy (xpos+xmin-1, ypos+ymin-1+y);
|
printPos (1, 1 + y);
|
||||||
print (blank);
|
print (blank);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -630,10 +626,10 @@ void FListBox::showInsideBrackets ( int index
|
||||||
{
|
{
|
||||||
maxLineWidth = len;
|
maxLineWidth = len;
|
||||||
|
|
||||||
if ( len >= width - nf_offset - 3 )
|
if ( len >= getWidth() - nf_offset - 3 )
|
||||||
{
|
{
|
||||||
HBar->setMaximum(maxLineWidth - width + nf_offset + 4);
|
HBar->setMaximum(maxLineWidth - getWidth() + nf_offset + 4);
|
||||||
HBar->setPageSize(maxLineWidth, width - nf_offset - 4);
|
HBar->setPageSize(maxLineWidth, getWidth() - nf_offset - 4);
|
||||||
HBar->setValue (xoffset);
|
HBar->setValue (xoffset);
|
||||||
|
|
||||||
if ( ! HBar->isVisible() )
|
if ( ! HBar->isVisible() )
|
||||||
|
@ -650,13 +646,13 @@ void FListBox::setGeometry (int x, int y, int w, int h, bool adjust)
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
{
|
{
|
||||||
VBar->setGeometry(width, 2, 2, height-2);
|
VBar->setGeometry (getWidth(), 2, 2, getHeight()-2);
|
||||||
HBar->setGeometry(1, height, width-2, 1);
|
HBar->setGeometry (1, getHeight(), getWidth()-2, 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VBar->setGeometry(width, 2, 1, height-2);
|
VBar->setGeometry (getWidth(), 2, 1, getHeight()-2);
|
||||||
HBar->setGeometry(2, height, width-2, 1);
|
HBar->setGeometry (2, getHeight(), getWidth()-2, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -739,7 +735,7 @@ void FListBox::onKeyPress (FKeyEvent* ev)
|
||||||
if ( current > element_count )
|
if ( current > element_count )
|
||||||
current = element_count;
|
current = element_count;
|
||||||
|
|
||||||
if ( current - yoffset >= height - 1 )
|
if ( current - yoffset >= getHeight() - 1 )
|
||||||
yoffset++;
|
yoffset++;
|
||||||
|
|
||||||
inc_search.clear();
|
inc_search.clear();
|
||||||
|
@ -759,8 +755,8 @@ void FListBox::onKeyPress (FKeyEvent* ev)
|
||||||
case fc::Fkey_right:
|
case fc::Fkey_right:
|
||||||
xoffset++;
|
xoffset++;
|
||||||
|
|
||||||
if ( xoffset > maxLineWidth - width + nf_offset + 4 )
|
if ( xoffset > maxLineWidth - getWidth() + nf_offset + 4 )
|
||||||
xoffset = maxLineWidth - width + nf_offset + 4;
|
xoffset = maxLineWidth - getWidth() + nf_offset + 4;
|
||||||
|
|
||||||
if ( xoffset < 0 )
|
if ( xoffset < 0 )
|
||||||
xoffset = 0;
|
xoffset = 0;
|
||||||
|
@ -770,14 +766,14 @@ void FListBox::onKeyPress (FKeyEvent* ev)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_ppage:
|
case fc::Fkey_ppage:
|
||||||
current -= height-3;
|
current -= getHeight()-3;
|
||||||
|
|
||||||
if ( current < 1 )
|
if ( current < 1 )
|
||||||
current=1;
|
current=1;
|
||||||
|
|
||||||
if ( current <= yoffset )
|
if ( current <= yoffset )
|
||||||
{
|
{
|
||||||
yoffset -= height-3;
|
yoffset -= getHeight()-3;
|
||||||
|
|
||||||
if ( yoffset < 0 )
|
if ( yoffset < 0 )
|
||||||
yoffset=0;
|
yoffset=0;
|
||||||
|
@ -788,17 +784,17 @@ void FListBox::onKeyPress (FKeyEvent* ev)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_npage:
|
case fc::Fkey_npage:
|
||||||
current += height-3;
|
current += getHeight()-3;
|
||||||
|
|
||||||
if ( current > element_count )
|
if ( current > element_count )
|
||||||
current = element_count;
|
current = element_count;
|
||||||
|
|
||||||
if ( current - yoffset >= height - 1 )
|
if ( current - yoffset >= getHeight() - 1 )
|
||||||
{
|
{
|
||||||
yoffset += height-3;
|
yoffset += getHeight()-3;
|
||||||
|
|
||||||
if ( yoffset > element_count - height + 2 )
|
if ( yoffset > element_count - getHeight() + 2 )
|
||||||
yoffset = element_count - height + 2;
|
yoffset = element_count - getHeight() + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
inc_search.clear();
|
inc_search.clear();
|
||||||
|
@ -815,8 +811,8 @@ void FListBox::onKeyPress (FKeyEvent* ev)
|
||||||
case fc::Fkey_end:
|
case fc::Fkey_end:
|
||||||
current = element_count;
|
current = element_count;
|
||||||
|
|
||||||
if ( current >= height - 1 )
|
if ( current >= getHeight() - 1 )
|
||||||
yoffset = element_count - height + 2;
|
yoffset = element_count - getHeight() + 2;
|
||||||
|
|
||||||
inc_search.clear();
|
inc_search.clear();
|
||||||
ev->accept();
|
ev->accept();
|
||||||
|
@ -836,7 +832,7 @@ void FListBox::onKeyPress (FKeyEvent* ev)
|
||||||
if ( current > element_count )
|
if ( current > element_count )
|
||||||
current = element_count;
|
current = element_count;
|
||||||
|
|
||||||
if ( current-yoffset >= height - 1 )
|
if ( current-yoffset >= getHeight() - 1 )
|
||||||
yoffset++;
|
yoffset++;
|
||||||
|
|
||||||
ev->accept();
|
ev->accept();
|
||||||
|
@ -1030,8 +1026,8 @@ void FListBox::onMouseDown (FMouseEvent* ev)
|
||||||
mouse_x = ev->getX();
|
mouse_x = ev->getX();
|
||||||
mouse_y = ev->getY();
|
mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( mouse_x > 1 && mouse_x < width
|
if ( mouse_x > 1 && mouse_x < getWidth()
|
||||||
&& mouse_y > 1 && mouse_y < height )
|
&& mouse_y > 1 && mouse_y < getHeight() )
|
||||||
{
|
{
|
||||||
current = yoffset + mouse_y - 1;
|
current = yoffset + mouse_y - 1;
|
||||||
|
|
||||||
|
@ -1088,8 +1084,8 @@ void FListBox::onMouseUp (FMouseEvent* ev)
|
||||||
int mouse_x = ev->getX();
|
int mouse_x = ev->getX();
|
||||||
int mouse_y = ev->getY();
|
int mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( mouse_x > 1 && mouse_x < width
|
if ( mouse_x > 1 && mouse_x < getWidth()
|
||||||
&& mouse_y > 1 && mouse_y < height )
|
&& mouse_y > 1 && mouse_y < getHeight() )
|
||||||
{
|
{
|
||||||
processChanged();
|
processChanged();
|
||||||
|
|
||||||
|
@ -1118,8 +1114,8 @@ void FListBox::onMouseMove (FMouseEvent* ev)
|
||||||
mouse_x = ev->getX();
|
mouse_x = ev->getX();
|
||||||
mouse_y = ev->getY();
|
mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( mouse_x > 1 && mouse_x < width
|
if ( mouse_x > 1 && mouse_x < getWidth()
|
||||||
&& mouse_y > 1 && mouse_y < height )
|
&& mouse_y > 1 && mouse_y < getHeight() )
|
||||||
{
|
{
|
||||||
current = yoffset + mouse_y - 1;
|
current = yoffset + mouse_y - 1;
|
||||||
|
|
||||||
|
@ -1178,7 +1174,7 @@ void FListBox::onMouseMove (FMouseEvent* ev)
|
||||||
if ( mouse_y < 2 )
|
if ( mouse_y < 2 )
|
||||||
{
|
{
|
||||||
// drag up
|
// drag up
|
||||||
if ( dragScroll != FListBox::noScroll && scrollDistance < height-2 )
|
if ( dragScroll != FListBox::noScroll && scrollDistance < getHeight()-2 )
|
||||||
scrollDistance++;
|
scrollDistance++;
|
||||||
|
|
||||||
if ( ! scrollTimer && current > 1 )
|
if ( ! scrollTimer && current > 1 )
|
||||||
|
@ -1198,10 +1194,10 @@ void FListBox::onMouseMove (FMouseEvent* ev)
|
||||||
dragScroll = FListBox::noScroll;
|
dragScroll = FListBox::noScroll;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( mouse_y >= height )
|
else if ( mouse_y >= getHeight() )
|
||||||
{
|
{
|
||||||
// drag down
|
// drag down
|
||||||
if ( dragScroll != FListBox::noScroll && scrollDistance < height-2 )
|
if ( dragScroll != FListBox::noScroll && scrollDistance < getHeight()-2 )
|
||||||
scrollDistance++;
|
scrollDistance++;
|
||||||
|
|
||||||
if ( ! scrollTimer && current < int(count()) )
|
if ( ! scrollTimer && current < int(count()) )
|
||||||
|
@ -1242,8 +1238,8 @@ void FListBox::onMouseDoubleClick (FMouseEvent* ev)
|
||||||
mouse_x = ev->getX();
|
mouse_x = ev->getX();
|
||||||
mouse_y = ev->getY();
|
mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( mouse_x > 1 && mouse_x < width
|
if ( mouse_x > 1 && mouse_x < getWidth()
|
||||||
&& mouse_y > 1 && mouse_y < height )
|
&& mouse_y > 1 && mouse_y < getHeight() )
|
||||||
{
|
{
|
||||||
if ( yoffset + mouse_y - 1 > int(count()) )
|
if ( yoffset + mouse_y - 1 > int(count()) )
|
||||||
return;
|
return;
|
||||||
|
@ -1297,11 +1293,11 @@ void FListBox::onTimer (FTimerEvent*)
|
||||||
if ( current > element_count )
|
if ( current > element_count )
|
||||||
current = element_count;
|
current = element_count;
|
||||||
|
|
||||||
if ( current - yoffset >= height - 1 )
|
if ( current - yoffset >= getHeight() - 1 )
|
||||||
yoffset += scrollDistance;
|
yoffset += scrollDistance;
|
||||||
|
|
||||||
if ( yoffset > element_count - height + 2 )
|
if ( yoffset > element_count - getHeight() + 2 )
|
||||||
yoffset = element_count - height + 2;
|
yoffset = element_count - getHeight() + 2;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -1363,7 +1359,7 @@ void FListBox::onWheel (FWheelEvent* ev)
|
||||||
element_count = int(count());
|
element_count = int(count());
|
||||||
current_before = current;
|
current_before = current;
|
||||||
yoffset_before = yoffset;
|
yoffset_before = yoffset;
|
||||||
yoffset_end = element_count - height + 2;
|
yoffset_end = element_count - getHeight() + 2;
|
||||||
|
|
||||||
if ( yoffset_end < 0 )
|
if ( yoffset_end < 0 )
|
||||||
yoffset_end = 0;
|
yoffset_end = 0;
|
||||||
|
@ -1477,7 +1473,7 @@ void FListBox::cb_VBarChange (FWidget*, void*)
|
||||||
switch ( scrollType )
|
switch ( scrollType )
|
||||||
{
|
{
|
||||||
case FScrollbar::scrollPageBackward:
|
case FScrollbar::scrollPageBackward:
|
||||||
distance = height-2;
|
distance = getHeight()-2;
|
||||||
// fall through
|
// fall through
|
||||||
case FScrollbar::scrollStepBackward:
|
case FScrollbar::scrollStepBackward:
|
||||||
current -= distance;
|
current -= distance;
|
||||||
|
@ -1494,7 +1490,7 @@ void FListBox::cb_VBarChange (FWidget*, void*)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FScrollbar::scrollPageForward:
|
case FScrollbar::scrollPageForward:
|
||||||
distance = height-2;
|
distance = getHeight()-2;
|
||||||
// fall through
|
// fall through
|
||||||
case FScrollbar::scrollStepForward:
|
case FScrollbar::scrollStepForward:
|
||||||
current += distance;
|
current += distance;
|
||||||
|
@ -1502,11 +1498,11 @@ void FListBox::cb_VBarChange (FWidget*, void*)
|
||||||
if ( current > element_count )
|
if ( current > element_count )
|
||||||
current = element_count;
|
current = element_count;
|
||||||
|
|
||||||
if ( current - yoffset >= height - 1 )
|
if ( current - yoffset >= getHeight() - 1 )
|
||||||
yoffset += distance;
|
yoffset += distance;
|
||||||
|
|
||||||
if ( yoffset > element_count - height + 2 )
|
if ( yoffset > element_count - getHeight() + 2 )
|
||||||
yoffset = element_count - height + 2;
|
yoffset = element_count - getHeight() + 2;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1520,8 +1516,8 @@ void FListBox::cb_VBarChange (FWidget*, void*)
|
||||||
int c = current - yoffset;
|
int c = current - yoffset;
|
||||||
yoffset = val;
|
yoffset = val;
|
||||||
|
|
||||||
if ( yoffset > element_count - height + 2 )
|
if ( yoffset > element_count - getHeight() + 2 )
|
||||||
yoffset = element_count - height + 2;
|
yoffset = element_count - getHeight() + 2;
|
||||||
|
|
||||||
if ( yoffset < 0 )
|
if ( yoffset < 0 )
|
||||||
yoffset = 0;
|
yoffset = 0;
|
||||||
|
@ -1576,13 +1572,13 @@ void FListBox::cb_HBarChange (FWidget*, void*)
|
||||||
{
|
{
|
||||||
int distance = 1;
|
int distance = 1;
|
||||||
int xoffset_before = xoffset;
|
int xoffset_before = xoffset;
|
||||||
int xoffset_end = maxLineWidth - width + nf_offset + 4;
|
int xoffset_end = maxLineWidth - getWidth() + nf_offset + 4;
|
||||||
int scrollType = HBar->getScrollType();
|
int scrollType = HBar->getScrollType();
|
||||||
|
|
||||||
switch ( scrollType )
|
switch ( scrollType )
|
||||||
{
|
{
|
||||||
case FScrollbar::scrollPageBackward:
|
case FScrollbar::scrollPageBackward:
|
||||||
distance = width - nf_offset - 4;
|
distance = getWidth() - nf_offset - 4;
|
||||||
// fall through
|
// fall through
|
||||||
case FScrollbar::scrollStepBackward:
|
case FScrollbar::scrollStepBackward:
|
||||||
xoffset -= distance;
|
xoffset -= distance;
|
||||||
|
@ -1592,13 +1588,13 @@ void FListBox::cb_HBarChange (FWidget*, void*)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FScrollbar::scrollPageForward:
|
case FScrollbar::scrollPageForward:
|
||||||
distance = width - nf_offset - 4;
|
distance = getWidth() - nf_offset - 4;
|
||||||
// fall through
|
// fall through
|
||||||
case FScrollbar::scrollStepForward:
|
case FScrollbar::scrollStepForward:
|
||||||
xoffset += distance;
|
xoffset += distance;
|
||||||
|
|
||||||
if ( xoffset > maxLineWidth - width + nf_offset + 4 )
|
if ( xoffset > maxLineWidth - getWidth() + nf_offset + 4 )
|
||||||
xoffset = maxLineWidth - width + nf_offset + 4;
|
xoffset = maxLineWidth - getWidth() + nf_offset + 4;
|
||||||
|
|
||||||
if ( xoffset < 0 )
|
if ( xoffset < 0 )
|
||||||
xoffset = 0;
|
xoffset = 0;
|
||||||
|
@ -1614,8 +1610,8 @@ void FListBox::cb_HBarChange (FWidget*, void*)
|
||||||
|
|
||||||
xoffset = val;
|
xoffset = val;
|
||||||
|
|
||||||
if ( xoffset > maxLineWidth - width + nf_offset + 4 )
|
if ( xoffset > maxLineWidth - getWidth() + nf_offset + 4 )
|
||||||
xoffset = maxLineWidth - width + nf_offset + 4;
|
xoffset = maxLineWidth - getWidth() + nf_offset + 4;
|
||||||
|
|
||||||
if ( xoffset < 0 )
|
if ( xoffset < 0 )
|
||||||
xoffset = 0;
|
xoffset = 0;
|
||||||
|
@ -1685,10 +1681,10 @@ void FListBox::insert ( FString item
|
||||||
{
|
{
|
||||||
maxLineWidth = len;
|
maxLineWidth = len;
|
||||||
|
|
||||||
if ( len >= width - nf_offset - 3 )
|
if ( len >= getWidth() - nf_offset - 3 )
|
||||||
{
|
{
|
||||||
HBar->setMaximum(maxLineWidth - width + nf_offset + 4);
|
HBar->setMaximum(maxLineWidth - getWidth() + nf_offset + 4);
|
||||||
HBar->setPageSize(maxLineWidth, width - nf_offset - 4);
|
HBar->setPageSize(maxLineWidth, getWidth() - nf_offset - 4);
|
||||||
HBar->calculateSliderValues();
|
HBar->calculateSliderValues();
|
||||||
|
|
||||||
if ( ! HBar->isVisible() )
|
if ( ! HBar->isVisible() )
|
||||||
|
@ -1701,11 +1697,11 @@ void FListBox::insert ( FString item
|
||||||
data.push_back (listItem);
|
data.push_back (listItem);
|
||||||
|
|
||||||
element_count = int(count());
|
element_count = int(count());
|
||||||
VBar->setMaximum(element_count - height + 2);
|
VBar->setMaximum(element_count - getHeight() + 2);
|
||||||
VBar->setPageSize(element_count, height - 2);
|
VBar->setPageSize(element_count, getHeight() - 2);
|
||||||
VBar->calculateSliderValues();
|
VBar->calculateSliderValues();
|
||||||
|
|
||||||
if ( ! VBar->isVisible() && element_count >= height - 1 )
|
if ( ! VBar->isVisible() && element_count >= getHeight() - 1 )
|
||||||
VBar->setVisible();
|
VBar->setVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1737,16 +1733,16 @@ void FListBox::remove (int item)
|
||||||
maxLineWidth = len;
|
maxLineWidth = len;
|
||||||
}
|
}
|
||||||
|
|
||||||
HBar->setMaximum(maxLineWidth - width + nf_offset + 4);
|
HBar->setMaximum(maxLineWidth - getWidth() + nf_offset + 4);
|
||||||
HBar->setPageSize(maxLineWidth, width - nf_offset - 4);
|
HBar->setPageSize(maxLineWidth, getWidth() - nf_offset - 4);
|
||||||
|
|
||||||
if ( HBar->isVisible() && maxLineWidth < width - nf_offset - 3 )
|
if ( HBar->isVisible() && maxLineWidth < getWidth() - nf_offset - 3 )
|
||||||
HBar->hide();
|
HBar->hide();
|
||||||
|
|
||||||
VBar->setMaximum(element_count - height + 2);
|
VBar->setMaximum(element_count - getHeight() + 2);
|
||||||
VBar->setPageSize(element_count, height - 2);
|
VBar->setPageSize(element_count, getHeight() - 2);
|
||||||
|
|
||||||
if ( VBar->isVisible() && element_count < height - 1 )
|
if ( VBar->isVisible() && element_count < getHeight() - 1 )
|
||||||
VBar->hide();
|
VBar->hide();
|
||||||
|
|
||||||
if ( current >= item && current > 1 )
|
if ( current >= item && current > 1 )
|
||||||
|
@ -1755,8 +1751,8 @@ void FListBox::remove (int item)
|
||||||
if ( current > element_count )
|
if ( current > element_count )
|
||||||
current = element_count;
|
current = element_count;
|
||||||
|
|
||||||
if ( yoffset > element_count - height + 2 )
|
if ( yoffset > element_count - getHeight() + 2 )
|
||||||
yoffset = element_count - height + 2;
|
yoffset = element_count - getHeight() + 2;
|
||||||
|
|
||||||
if ( yoffset < 0 )
|
if ( yoffset < 0 )
|
||||||
yoffset = 0;
|
yoffset = 0;
|
||||||
|
@ -1787,14 +1783,18 @@ void FListBox::clear()
|
||||||
|
|
||||||
// clear list from screen
|
// clear list from screen
|
||||||
setColor (wc.list_fg, wc.list_bg);
|
setColor (wc.list_fg, wc.list_bg);
|
||||||
size = width - 2;
|
size = getWidth() - 2;
|
||||||
|
|
||||||
|
if ( size < 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
blank = new char[size+1];
|
blank = new char[size+1];
|
||||||
memset(blank, ' ', uLong(size));
|
memset(blank, ' ', uLong(size));
|
||||||
blank[size] = '\0';
|
blank[size] = '\0';
|
||||||
|
|
||||||
for (int y=0; y < height-2; y++)
|
for (int y=0; y < getHeight()-2; y++)
|
||||||
{
|
{
|
||||||
gotoxy (xpos+xmin, ypos+ymin+y);
|
printPos (2, 2 + y);
|
||||||
print (blank);
|
print (blank);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ class FListBoxItem
|
||||||
FString text;
|
FString text;
|
||||||
fc::brackets_type brackets;
|
fc::brackets_type brackets;
|
||||||
bool selected;
|
bool selected;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FListBoxItem ();
|
FListBoxItem ();
|
||||||
explicit FListBoxItem (FString&);
|
explicit FListBoxItem (FString&);
|
||||||
|
@ -50,10 +51,12 @@ class FListBoxItem
|
||||||
explicit FListBoxItem (const char*);
|
explicit FListBoxItem (const char*);
|
||||||
virtual ~FListBoxItem();
|
virtual ~FListBoxItem();
|
||||||
virtual FString getText() const;
|
virtual FString getText() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setText (FString&);
|
void setText (FString&);
|
||||||
void setText (const std::string&);
|
void setText (const std::string&);
|
||||||
void setText (const char*);
|
void setText (const char*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class FListBox;
|
friend class FListBox;
|
||||||
};
|
};
|
||||||
|
|
180
src/fmenu.cpp
180
src/fmenu.cpp
|
@ -78,8 +78,8 @@ FMenu::~FMenu()
|
||||||
|
|
||||||
if ( ! fapp->isQuit() )
|
if ( ! fapp->isQuit() )
|
||||||
{
|
{
|
||||||
const FRect& geometry = getGeometryGlobalShadow();
|
const FRect& t_geometry = getTermGeometryWithShadow();
|
||||||
restoreVTerm (geometry);
|
restoreVTerm (t_geometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( vwin != 0 )
|
if ( vwin != 0 )
|
||||||
|
@ -99,30 +99,20 @@ FMenu::~FMenu()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenu::init(FWidget* parent)
|
void FMenu::init(FWidget* parent)
|
||||||
{
|
{
|
||||||
FWidget* rootObj = getRootWidget();
|
setTopPadding(1);
|
||||||
xmin = 1 + rootObj->getLeftPadding();
|
setLeftPadding(1);
|
||||||
ymin = 1 + rootObj->getTopPadding();
|
setBottomPadding(1);
|
||||||
xmax = rootObj->getWidth();
|
setRightPadding(1);
|
||||||
ymax = rootObj->getHeight();
|
|
||||||
width = 10;
|
|
||||||
height = 2;
|
|
||||||
client_xmin = 1;
|
|
||||||
client_ymin = 1;
|
|
||||||
client_xmax = width;
|
|
||||||
client_ymax = height;
|
|
||||||
top_padding = 1;
|
|
||||||
left_padding = 1;
|
|
||||||
bottom_padding = 1;
|
|
||||||
right_padding = 1;
|
|
||||||
createArea (vwin);
|
createArea (vwin);
|
||||||
|
setMenuWidget();
|
||||||
setGeometry (1, 1, 10, 2, false); // initialize geometry values
|
setGeometry (1, 1, 10, 2, false); // initialize geometry values
|
||||||
setTransparentShadow();
|
setTransparentShadow();
|
||||||
menu_object = true;
|
setMenuWidget();
|
||||||
addWindow(this);
|
addWindow(this);
|
||||||
hide();
|
hide();
|
||||||
|
|
||||||
foregroundColor = wc.menu_active_fg;
|
setForegroundColor (wc.menu_active_fg);
|
||||||
backgroundColor = wc.menu_active_bg;
|
setBackgroundColor (wc.menu_active_bg);
|
||||||
|
|
||||||
if ( item )
|
if ( item )
|
||||||
item->setMenu(this);
|
item->setMenu(this);
|
||||||
|
@ -185,10 +175,10 @@ void FMenu::menu_dimension()
|
||||||
++iter;
|
++iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
adjust_X = adjustX(xpos);
|
adjust_X = adjustX(getX());
|
||||||
|
|
||||||
// set widget geometry
|
// set widget geometry
|
||||||
setGeometry (adjust_X, ypos, int(maxItemWidth + 2), int(count() + 2));
|
setGeometry (adjust_X, getY(), int(maxItemWidth + 2), int(count() + 2));
|
||||||
|
|
||||||
// set geometry of all items
|
// set geometry of all items
|
||||||
iter = itemlist.begin();
|
iter = itemlist.begin();
|
||||||
|
@ -201,8 +191,8 @@ void FMenu::menu_dimension()
|
||||||
|
|
||||||
if ( (*iter)->hasMenu() )
|
if ( (*iter)->hasMenu() )
|
||||||
{
|
{
|
||||||
int menu_X = getGlobalX() + int(maxItemWidth) + 1;
|
int menu_X = getTermX() + int(maxItemWidth) + 1;
|
||||||
int menu_Y = (*iter)->getGlobalY() - 2;
|
int menu_Y = (*iter)->getTermY() - 2;
|
||||||
// set sub-menu position
|
// set sub-menu position
|
||||||
(*iter)->getMenu()->setPos (menu_X, menu_Y, false);
|
(*iter)->getMenu()->setPos (menu_X, menu_Y, false);
|
||||||
}
|
}
|
||||||
|
@ -226,9 +216,9 @@ void FMenu::adjustItems()
|
||||||
int menu_X, menu_Y;
|
int menu_X, menu_Y;
|
||||||
FMenu* menu = (*iter)->getMenu();
|
FMenu* menu = (*iter)->getMenu();
|
||||||
|
|
||||||
menu_X = getGlobalX() + int(maxItemWidth) + 1;
|
menu_X = getTermX() + int(maxItemWidth) + 1;
|
||||||
menu_X = menu->adjustX(menu_X);
|
menu_X = menu->adjustX(menu_X);
|
||||||
menu_Y = (*iter)->getGlobalY() - 2;
|
menu_Y = (*iter)->getTermY() - 2;
|
||||||
|
|
||||||
// set sub-menu position
|
// set sub-menu position
|
||||||
menu->move (menu_X, menu_Y);
|
menu->move (menu_X, menu_Y);
|
||||||
|
@ -260,7 +250,7 @@ int FMenu::adjustX (int x_pos)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FMenu::isWindowsMenu (FWidget* w) const
|
bool FMenu::isWindowsMenu (FWidget* w) const
|
||||||
{
|
{
|
||||||
return w->isDialog();
|
return w->isDialogWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -364,33 +354,33 @@ void FMenu::hideSuperMenus()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FMenu::containsMenuStructure (int x, int y) const
|
bool FMenu::containsMenuStructure (int x, int y)
|
||||||
{
|
{
|
||||||
// Check mouse click position for item, menu and all sub menus
|
// Check mouse click position for item, menu and all sub menus
|
||||||
FMenuItem* si = getSelectedItem();
|
FMenuItem* si = getSelectedItem();
|
||||||
|
|
||||||
if ( getGeometryGlobal().contains(x,y) )
|
if ( getTermGeometry().contains(x,y) )
|
||||||
return true;
|
return true;
|
||||||
else if ( si && si->hasMenu() && open_sub_menu )
|
else if ( si && si->hasMenu() && open_sub_menu )
|
||||||
return si->getMenu()->containsMenuStructure(x,y);
|
return si->getMenu()->containsMenuStructure(x,y);
|
||||||
else if ( item && item->getGeometryGlobal().contains(x,y) )
|
else if ( item && item->getTermGeometry().contains(x,y) )
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FMenu* FMenu::superMenuAt (int x, int y) const
|
FMenu* FMenu::superMenuAt (int x, int y)
|
||||||
{
|
{
|
||||||
// Check mouse click position for super menu
|
// Check mouse click position for super menu
|
||||||
if ( getGeometryGlobal().contains(x,y) )
|
if ( getTermGeometry().contains(x,y) )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
FWidget* super = getSuperMenu();
|
FWidget* super = getSuperMenu();
|
||||||
|
|
||||||
if ( super && isMenu(super) )
|
if ( super && isMenu(super) )
|
||||||
{
|
{
|
||||||
if ( super->getGeometryGlobal().contains(x,y) )
|
if ( super->getTermGeometry().contains(x,y) )
|
||||||
return dynamic_cast<FMenu*>(super);
|
return dynamic_cast<FMenu*>(super);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -620,7 +610,7 @@ void FMenu::draw()
|
||||||
area = area_widget->getVWin();
|
area = area_widget->getVWin();
|
||||||
|
|
||||||
if ( area )
|
if ( area )
|
||||||
putArea (xpos+xmin-1, ypos+ymin-1, area);
|
putArea (getTermX(), getTermY(), area);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -630,15 +620,14 @@ void FMenu::draw()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenu::drawBorder()
|
void FMenu::drawBorder()
|
||||||
{
|
{
|
||||||
int x1, x2, y1, y2;
|
int x1 = 1;
|
||||||
x1 = xpos+xmin-1;
|
int x2 = 1 + getWidth() - 1;
|
||||||
x2 = xpos+xmin-2+width;
|
int y1 = 1;
|
||||||
y1 = ypos+ymin-1;
|
int y2 = 1 + getHeight() - 1;
|
||||||
y2 = ypos+ymin-2+height;
|
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
{
|
{
|
||||||
gotoxy (x1, y1);
|
printPos (x1, y1);
|
||||||
print (fc::NF_border_corner_upper_left); // ⎡
|
print (fc::NF_border_corner_upper_left); // ⎡
|
||||||
|
|
||||||
for (int x=x1+1; x < x2; x++)
|
for (int x=x1+1; x < x2; x++)
|
||||||
|
@ -648,35 +637,35 @@ void FMenu::drawBorder()
|
||||||
|
|
||||||
for (int y=y1+1; y <= y2; y++)
|
for (int y=y1+1; y <= y2; y++)
|
||||||
{
|
{
|
||||||
gotoxy (x1, y);
|
printPos (x1, y);
|
||||||
// border left ⎸
|
// border left ⎸
|
||||||
print (fc::NF_border_line_left);
|
print (fc::NF_border_line_left);
|
||||||
gotoxy (x2, y);
|
printPos (x2, y);
|
||||||
// border right⎹
|
// border right⎹
|
||||||
print (fc::NF_rev_border_line_right);
|
print (fc::NF_rev_border_line_right);
|
||||||
}
|
}
|
||||||
|
|
||||||
gotoxy (x1, y2);
|
printPos (x1, y2);
|
||||||
// lower left corner border ⎣
|
// lower left corner border ⎣
|
||||||
print (fc::NF_border_corner_lower_left);
|
print (fc::NF_border_corner_lower_left);
|
||||||
|
|
||||||
for (int x=1; x < width-1; x++) // low line _
|
for (int x=1; x < getWidth()-1; x++) // low line _
|
||||||
print (fc::NF_border_line_bottom);
|
print (fc::NF_border_line_bottom);
|
||||||
|
|
||||||
gotoxy (x2, y2);
|
printPos (x2, y2);
|
||||||
// lower right corner border ⎦
|
// lower right corner border ⎦
|
||||||
print (fc::NF_rev_border_corner_lower_right);
|
print (fc::NF_rev_border_corner_lower_right);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gotoxy (x1, y1);
|
printPos (x1, y1);
|
||||||
print (fc::BoxDrawingsDownAndRight); // ┌
|
print (fc::BoxDrawingsDownAndRight); // ┌
|
||||||
|
|
||||||
for (int x=x1+1; x < x2; x++)
|
for (int x=x1+1; x < x2; x++)
|
||||||
print (fc::BoxDrawingsHorizontal); // ─
|
print (fc::BoxDrawingsHorizontal); // ─
|
||||||
|
|
||||||
print (fc::BoxDrawingsDownAndLeft); // ┐
|
print (fc::BoxDrawingsDownAndLeft); // ┐
|
||||||
gotoxy (x1, y2);
|
printPos (x1, y2);
|
||||||
print (fc::BoxDrawingsUpAndRight); // └
|
print (fc::BoxDrawingsUpAndRight); // └
|
||||||
|
|
||||||
for (int x=x1+1; x < x2; x++)
|
for (int x=x1+1; x < x2; x++)
|
||||||
|
@ -686,9 +675,9 @@ void FMenu::drawBorder()
|
||||||
|
|
||||||
for (int y=y1+1; y < y2; y++)
|
for (int y=y1+1; y < y2; y++)
|
||||||
{
|
{
|
||||||
gotoxy (x1, y);
|
printPos (x1, y);
|
||||||
print (fc::BoxDrawingsVertical); // │
|
print (fc::BoxDrawingsVertical); // │
|
||||||
gotoxy (x2, y);
|
printPos (x2, y);
|
||||||
print (fc::BoxDrawingsVertical); // │
|
print (fc::BoxDrawingsVertical); // │
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -740,16 +729,16 @@ void FMenu::drawItems()
|
||||||
{
|
{
|
||||||
if ( is_selected )
|
if ( is_selected )
|
||||||
{
|
{
|
||||||
foregroundColor = wc.menu_active_focus_fg;
|
setForegroundColor (wc.menu_active_focus_fg);
|
||||||
backgroundColor = wc.menu_active_focus_bg;
|
setBackgroundColor (wc.menu_active_focus_bg);
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(false);
|
setReverse(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foregroundColor = wc.menu_active_fg;
|
setForegroundColor (wc.menu_active_fg);
|
||||||
backgroundColor = wc.menu_active_bg;
|
setBackgroundColor (wc.menu_active_bg);
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
@ -757,15 +746,15 @@ void FMenu::drawItems()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foregroundColor = wc.menu_inactive_fg;
|
setForegroundColor (wc.menu_inactive_fg);
|
||||||
backgroundColor = wc.menu_inactive_bg;
|
setBackgroundColor (wc.menu_inactive_bg);
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
gotoxy (xpos+xmin, ypos+ymin+y);
|
printPos (2, 2 + y);
|
||||||
setColor (foregroundColor, backgroundColor);
|
setColor();
|
||||||
|
|
||||||
if ( has_checkable_items )
|
if ( has_checkable_items )
|
||||||
{
|
{
|
||||||
|
@ -792,14 +781,14 @@ void FMenu::drawItems()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setColor (wc.menu_inactive_fg, backgroundColor);
|
setColor (wc.menu_inactive_fg, getBackgroundColor());
|
||||||
|
|
||||||
if ( getEncoding() == "ASCII" )
|
if ( getEncoding() == "ASCII" )
|
||||||
print ('-');
|
print ('-');
|
||||||
else
|
else
|
||||||
print (fc::SmallBullet);
|
print (fc::SmallBullet);
|
||||||
|
|
||||||
setColor (foregroundColor, backgroundColor);
|
setColor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -818,14 +807,12 @@ void FMenu::drawItems()
|
||||||
if ( hotkeypos == -1 )
|
if ( hotkeypos == -1 )
|
||||||
{
|
{
|
||||||
if ( is_selected )
|
if ( is_selected )
|
||||||
setCursorPos ( xpos+xmin+1
|
setCursorPos (1, 2 + y); // first character
|
||||||
, ypos+ymin+y ); // first character
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( is_selected )
|
if ( is_selected )
|
||||||
setCursorPos ( xpos+xmin+1+hotkeypos
|
setCursorPos (1 + hotkeypos, 2 + y); // hotkey
|
||||||
, ypos+ymin+y ); // hotkey
|
|
||||||
|
|
||||||
txt_length--;
|
txt_length--;
|
||||||
to_char--;
|
to_char--;
|
||||||
|
@ -856,7 +843,7 @@ void FMenu::drawItems()
|
||||||
if ( ! is_noUnderline )
|
if ( ! is_noUnderline )
|
||||||
unsetUnderline();
|
unsetUnderline();
|
||||||
|
|
||||||
setColor (foregroundColor, backgroundColor);
|
setColor();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
print (item_text[z]);
|
print (item_text[z]);
|
||||||
|
@ -911,7 +898,7 @@ void FMenu::drawItems()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FMenu::drawSeparator(int y)
|
inline void FMenu::drawSeparator(int y)
|
||||||
{
|
{
|
||||||
gotoxy (xpos+xmin-1, ypos+ymin+y);
|
printPos (1, 2 + y);
|
||||||
setColor (wc.menu_active_fg, wc.menu_active_bg);
|
setColor (wc.menu_active_fg, wc.menu_active_bg);
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
|
@ -920,14 +907,14 @@ inline void FMenu::drawSeparator(int y)
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
{
|
{
|
||||||
print (fc::NF_border_line_vertical_right);
|
print (fc::NF_border_line_vertical_right);
|
||||||
FString line(width-2, wchar_t(fc::BoxDrawingsHorizontal));
|
FString line(getWidth()-2, wchar_t(fc::BoxDrawingsHorizontal));
|
||||||
print (line);
|
print (line);
|
||||||
print (fc::NF_rev_border_line_vertical_left);
|
print (fc::NF_rev_border_line_vertical_left);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print (fc::BoxDrawingsVerticalAndRight);
|
print (fc::BoxDrawingsVerticalAndRight);
|
||||||
FString line(width-2, wchar_t(fc::BoxDrawingsHorizontal));
|
FString line(getWidth()-2, wchar_t(fc::BoxDrawingsHorizontal));
|
||||||
print (line);
|
print (line);
|
||||||
print (fc::BoxDrawingsVerticalAndLeft);
|
print (fc::BoxDrawingsVerticalAndLeft);
|
||||||
}
|
}
|
||||||
|
@ -1323,19 +1310,19 @@ void FMenu::onMouseMove (FMouseEvent* ev)
|
||||||
mouse_pos = ev->getPos();
|
mouse_pos = ev->getPos();
|
||||||
mouse_pos -= FPoint(getRightPadding(),getTopPadding());
|
mouse_pos -= FPoint(getRightPadding(),getTopPadding());
|
||||||
|
|
||||||
if ( getGeometryGlobal().contains(ev->getGlobalPos()) )
|
if ( getTermGeometry().contains(ev->getTermPos()) )
|
||||||
mouse_over_menu = true;
|
mouse_over_menu = true;
|
||||||
|
|
||||||
if ( open_sub_menu )
|
if ( open_sub_menu )
|
||||||
{
|
{
|
||||||
const FRect& submenu_geometry = open_sub_menu->getGeometryGlobal();
|
const FRect& submenu_geometry = open_sub_menu->getTermGeometry();
|
||||||
if ( submenu_geometry.contains(ev->getGlobalPos()) )
|
if ( submenu_geometry.contains(ev->getTermPos()) )
|
||||||
mouse_over_submenu = true;
|
mouse_over_submenu = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isSubMenu() )
|
if ( isSubMenu() )
|
||||||
{
|
{
|
||||||
smenu = superMenuAt (ev->getGlobalPos());
|
smenu = superMenuAt (ev->getTermPos());
|
||||||
|
|
||||||
if ( smenu )
|
if ( smenu )
|
||||||
mouse_over_supermenu = true;
|
mouse_over_supermenu = true;
|
||||||
|
@ -1343,7 +1330,7 @@ void FMenu::onMouseMove (FMouseEvent* ev)
|
||||||
|
|
||||||
if ( menuBar()
|
if ( menuBar()
|
||||||
&& isMenuBar(menuBar())
|
&& isMenuBar(menuBar())
|
||||||
&& menuBar()->getGeometryGlobal().contains(ev->getGlobalPos()) )
|
&& menuBar()->getTermGeometry().contains(ev->getTermPos()) )
|
||||||
{
|
{
|
||||||
mouse_over_menubar = true;
|
mouse_over_menubar = true;
|
||||||
}
|
}
|
||||||
|
@ -1416,10 +1403,10 @@ void FMenu::onMouseMove (FMouseEvent* ev)
|
||||||
if ( mouse_over_submenu )
|
if ( mouse_over_submenu )
|
||||||
{
|
{
|
||||||
// Mouse event handover to sub-menu
|
// Mouse event handover to sub-menu
|
||||||
const FPoint& g = ev->getGlobalPos();
|
const FPoint& t = ev->getTermPos();
|
||||||
const FPoint& p = open_sub_menu->globalToLocalPos(g);
|
const FPoint& p = open_sub_menu->termToWidgetPos(t);
|
||||||
int b = ev->getButton();
|
int b = ev->getButton();
|
||||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseMove_Event, p, g, b);
|
FMouseEvent* _ev = new FMouseEvent (fc::MouseMove_Event, p, t, b);
|
||||||
open_sub_menu->mouse_down = true;
|
open_sub_menu->mouse_down = true;
|
||||||
setClickedWidget(open_sub_menu);
|
setClickedWidget(open_sub_menu);
|
||||||
open_sub_menu->onMouseMove(_ev);
|
open_sub_menu->onMouseMove(_ev);
|
||||||
|
@ -1429,10 +1416,10 @@ void FMenu::onMouseMove (FMouseEvent* ev)
|
||||||
else if ( ! mouse_over_menu && mouse_over_supermenu )
|
else if ( ! mouse_over_menu && mouse_over_supermenu )
|
||||||
{
|
{
|
||||||
// Mouse event handover to super-menu
|
// Mouse event handover to super-menu
|
||||||
const FPoint& g = ev->getGlobalPos();
|
const FPoint& t = ev->getTermPos();
|
||||||
const FPoint& p = smenu->globalToLocalPos(g);
|
const FPoint& p = smenu->termToWidgetPos(t);
|
||||||
int b = ev->getButton();
|
int b = ev->getButton();
|
||||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseMove_Event, p, g, b);
|
FMouseEvent* _ev = new FMouseEvent (fc::MouseMove_Event, p, t, b);
|
||||||
smenu->mouse_down = true;
|
smenu->mouse_down = true;
|
||||||
setClickedWidget(smenu);
|
setClickedWidget(smenu);
|
||||||
smenu->onMouseMove(_ev);
|
smenu->onMouseMove(_ev);
|
||||||
|
@ -1443,10 +1430,10 @@ void FMenu::onMouseMove (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
// Mouse event handover to the menu bar
|
// Mouse event handover to the menu bar
|
||||||
FWidget* menubar = menuBar();
|
FWidget* menubar = menuBar();
|
||||||
const FPoint& g = ev->getGlobalPos();
|
const FPoint& t = ev->getTermPos();
|
||||||
const FPoint& p = menubar->globalToLocalPos(g);
|
const FPoint& p = menubar->termToWidgetPos(t);
|
||||||
int b = ev->getButton();
|
int b = ev->getButton();
|
||||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseMove_Event, p, g, b);
|
FMouseEvent* _ev = new FMouseEvent (fc::MouseMove_Event, p, t, b);
|
||||||
setClickedWidget(menubar);
|
setClickedWidget(menubar);
|
||||||
FMenuBar* mbar = reinterpret_cast<FMenuBar*>(menubar);
|
FMenuBar* mbar = reinterpret_cast<FMenuBar*>(menubar);
|
||||||
mbar->mouse_down = true;
|
mbar->mouse_down = true;
|
||||||
|
@ -1534,7 +1521,8 @@ void FMenu::hide()
|
||||||
if ( isVisible() )
|
if ( isVisible() )
|
||||||
{
|
{
|
||||||
FWindow::hide();
|
FWindow::hide();
|
||||||
restoreVTerm (getGeometryGlobalShadow());
|
const FRect& t_geometry = getTermGeometryWithShadow();
|
||||||
|
restoreVTerm (t_geometry);
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
flush_out();
|
flush_out();
|
||||||
|
|
||||||
|
@ -1555,11 +1543,11 @@ void FMenu::hide()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenu::setGeometry (int xx, int yy, int ww, int hh, bool adjust)
|
void FMenu::setGeometry (int xx, int yy, int ww, int hh, bool adjust)
|
||||||
{
|
{
|
||||||
int old_width = width;
|
int old_width = getWidth();
|
||||||
int old_height = height;
|
int old_height = getHeight();
|
||||||
FWidget::setGeometry (xx, yy, ww, hh, adjust);
|
FWidget::setGeometry (xx, yy, ww, hh, adjust);
|
||||||
|
|
||||||
if ( vwin && (width != old_width || height != old_height) )
|
if ( vwin && (getWidth() != old_width || getHeight() != old_height) )
|
||||||
resizeArea (vwin);
|
resizeArea (vwin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1603,6 +1591,20 @@ void FMenu::cb_menuitem_toggled (FWidget* widget, void*)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
bool FMenu::setMenuWidget (bool on)
|
||||||
|
{
|
||||||
|
if ( isMenuWidget() == on )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if ( on )
|
||||||
|
flags |= fc::menu_widget;
|
||||||
|
else
|
||||||
|
flags &= ~fc::menu_widget;
|
||||||
|
|
||||||
|
return on;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FMenu::setTransparentShadow (bool on)
|
bool FMenu::setTransparentShadow (bool on)
|
||||||
{
|
{
|
||||||
|
@ -1610,17 +1612,13 @@ bool FMenu::setTransparentShadow (bool on)
|
||||||
{
|
{
|
||||||
flags |= fc::shadow;
|
flags |= fc::shadow;
|
||||||
flags |= fc::trans_shadow;
|
flags |= fc::trans_shadow;
|
||||||
shadow.setPoint(2,1);
|
setShadowSize (2,1);
|
||||||
adjustWidgetSizeShadow = getGeometry() + getShadow();
|
|
||||||
adjustWidgetSizeGlobalShadow = getGeometryGlobal() + getShadow();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flags &= ~fc::shadow;
|
flags &= ~fc::shadow;
|
||||||
flags &= ~fc::trans_shadow;
|
flags &= ~fc::trans_shadow;
|
||||||
shadow.setPoint(0,0);
|
setShadowSize (0,0);
|
||||||
adjustWidgetSizeShadow = getGeometry() + getShadow();
|
|
||||||
adjustWidgetSizeGlobalShadow = getGeometryGlobal() + getShadow();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resizeArea (vwin);
|
resizeArea (vwin);
|
||||||
|
|
86
src/fmenu.h
86
src/fmenu.h
|
@ -46,45 +46,47 @@
|
||||||
class FMenu : public FWindow, public FMenuList
|
class FMenu : public FWindow, public FMenuList
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
FMenuItem* item;
|
FMenuItem* item;
|
||||||
FWidget* super_menu;
|
FWidget* super_menu;
|
||||||
FMenu* open_sub_menu;
|
FMenu* open_sub_menu;
|
||||||
uInt maxItemWidth;
|
uInt maxItemWidth;
|
||||||
bool mouse_down;
|
bool mouse_down;
|
||||||
bool has_checkable_items;
|
bool has_checkable_items;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FMenu (const FMenu&);
|
FMenu (const FMenu&);
|
||||||
FMenu& operator = (const FMenu&);
|
FMenu& operator = (const FMenu&);
|
||||||
void init(FWidget*);
|
void init(FWidget*);
|
||||||
void menu_dimension();
|
void menu_dimension();
|
||||||
void adjustItems();
|
void adjustItems();
|
||||||
int adjustX(int);
|
int adjustX(int);
|
||||||
bool isWindowsMenu (FWidget*) const;
|
bool isWindowsMenu (FWidget*) const;
|
||||||
bool isMenuBar (FWidget*) const;
|
bool isMenuBar (FWidget*) const;
|
||||||
bool isMenu (FWidget*) const;
|
bool isMenu (FWidget*) const;
|
||||||
bool isRadioMenuItem (FWidget*) const;
|
bool isRadioMenuItem (FWidget*) const;
|
||||||
FWidget* getSuperMenu() const;
|
FWidget* getSuperMenu() const;
|
||||||
void setSuperMenu (FWidget*);
|
void setSuperMenu (FWidget*);
|
||||||
bool isSubMenu() const;
|
bool isSubMenu() const;
|
||||||
void openSubMenu (FMenu*);
|
void openSubMenu (FMenu*);
|
||||||
void hideSubMenus();
|
void hideSubMenus();
|
||||||
void hideSuperMenus();
|
void hideSuperMenus();
|
||||||
bool containsMenuStructure (const FPoint&) const;
|
bool containsMenuStructure (const FPoint&);
|
||||||
bool containsMenuStructure (int, int) const;
|
bool containsMenuStructure (int, int);
|
||||||
FMenu* superMenuAt (const FPoint&) const;
|
FMenu* superMenuAt (const FPoint&);
|
||||||
FMenu* superMenuAt (int, int) const;
|
FMenu* superMenuAt (int, int);
|
||||||
bool selectNextItem();
|
bool selectNextItem();
|
||||||
bool selectPrevItem();
|
bool selectPrevItem();
|
||||||
void keypressMenuBar (FKeyEvent*&);
|
void keypressMenuBar (FKeyEvent*&);
|
||||||
bool hotkeyMenu (FKeyEvent*&);
|
bool hotkeyMenu (FKeyEvent*&);
|
||||||
int getHotkeyPos (wchar_t*&, wchar_t*&, uInt);
|
int getHotkeyPos (wchar_t*&, wchar_t*&, uInt);
|
||||||
void draw();
|
void draw();
|
||||||
void drawBorder();
|
// make every drawBorder from FWidget available
|
||||||
void drawMenuShadow();
|
using FWidget::drawBorder;
|
||||||
void drawItems();
|
virtual void drawBorder();
|
||||||
void drawSeparator(int);
|
void drawMenuShadow();
|
||||||
void processActivate();
|
void drawItems();
|
||||||
|
void drawSeparator(int);
|
||||||
|
void processActivate();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit FMenu (FWidget* = 0); // constructor
|
explicit FMenu (FWidget* = 0); // constructor
|
||||||
|
@ -115,6 +117,9 @@ class FMenu : public FWindow, public FMenuList
|
||||||
void setSelected();
|
void setSelected();
|
||||||
void unsetSelected();
|
void unsetSelected();
|
||||||
bool isSelected() const;
|
bool isSelected() const;
|
||||||
|
bool setMenuWidget (bool);
|
||||||
|
bool setMenuWidget();
|
||||||
|
bool unsetMenuWidget();
|
||||||
bool hasHotkey() const;
|
bool hasHotkey() const;
|
||||||
void setMenu (FMenu*);
|
void setMenu (FMenu*);
|
||||||
bool hasMenu() const;
|
bool hasMenu() const;
|
||||||
|
@ -148,11 +153,11 @@ inline void FMenu::setSuperMenu (FWidget* smenu)
|
||||||
{ super_menu = smenu; }
|
{ super_menu = smenu; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FMenu::containsMenuStructure (const FPoint& p) const
|
inline bool FMenu::containsMenuStructure (const FPoint& p)
|
||||||
{ return containsMenuStructure (p.getX(), p.getY()); }
|
{ return containsMenuStructure (p.getX(), p.getY()); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FMenu* FMenu::superMenuAt (const FPoint& p) const
|
inline FMenu* FMenu::superMenuAt (const FPoint& p)
|
||||||
{ return superMenuAt (p.getX(), p.getY()); }
|
{ return superMenuAt (p.getX(), p.getY()); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -202,6 +207,13 @@ inline void FMenu::unsetSelected()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FMenu::isSelected() const
|
inline bool FMenu::isSelected() const
|
||||||
{ return item->isSelected(); }
|
{ return item->isSelected(); }
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FMenu::setMenuWidget()
|
||||||
|
{ return setMenuWidget(true); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FMenu::unsetMenuWidget()
|
||||||
|
{ return setMenuWidget(false); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FMenu::hasHotkey() const
|
inline bool FMenu::hasHotkey() const
|
||||||
|
|
|
@ -41,14 +41,13 @@ FMenuBar::~FMenuBar()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenuBar::init()
|
void FMenuBar::init()
|
||||||
{
|
{
|
||||||
xmin = ymin = 1;
|
FWidget* r = getRootWidget();
|
||||||
xpos = 1;
|
int w = r->getWidth();
|
||||||
ypos = 1;
|
// initialize geometry values
|
||||||
|
setGeometry (1, 1, w, 1, false);
|
||||||
createArea (vmenubar);
|
createArea (vmenubar);
|
||||||
vmenubar->visible = true;
|
vmenubar->visible = true;
|
||||||
ignore_padding = true;
|
ignorePadding();
|
||||||
// initialize geometry values
|
|
||||||
setGeometry (1, 1, getColumnNumber(), 1, false);
|
|
||||||
setMenuBar(this);
|
setMenuBar(this);
|
||||||
|
|
||||||
if ( getRootWidget() )
|
if ( getRootWidget() )
|
||||||
|
@ -56,8 +55,8 @@ void FMenuBar::init()
|
||||||
|
|
||||||
addAccelerator (fc::Fkey_f10);
|
addAccelerator (fc::Fkey_f10);
|
||||||
addAccelerator (fc::Fckey_space);
|
addAccelerator (fc::Fckey_space);
|
||||||
foregroundColor = wc.menu_active_fg;
|
setForegroundColor (wc.menu_active_fg);
|
||||||
backgroundColor = wc.menu_active_bg;
|
setBackgroundColor (wc.menu_active_bg);
|
||||||
unsetFocusable();
|
unsetFocusable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,9 +311,6 @@ int FMenuBar::getHotkeyPos (wchar_t*& src, wchar_t*& dest, uInt length)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenuBar::draw()
|
void FMenuBar::draw()
|
||||||
{
|
{
|
||||||
xmin = ymin = 1;
|
|
||||||
height = 1;
|
|
||||||
xpos = 1;
|
|
||||||
drawItems();
|
drawItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,14 +321,12 @@ void FMenuBar::drawItems()
|
||||||
int screenWidth;
|
int screenWidth;
|
||||||
int x = 1;
|
int x = 1;
|
||||||
screenWidth = getColumnNumber();
|
screenWidth = getColumnNumber();
|
||||||
width = screenWidth;
|
|
||||||
ypos = 1;
|
|
||||||
|
|
||||||
if ( itemlist.empty() )
|
if ( itemlist.empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
updateVTerm(false);
|
updateVTerm(false);
|
||||||
gotoxy (1,1);
|
printPos (1,1);
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
@ -361,22 +355,23 @@ void FMenuBar::drawItems()
|
||||||
{
|
{
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(false);
|
setReverse(false);
|
||||||
foregroundColor = wc.menu_active_focus_fg;
|
|
||||||
backgroundColor = wc.menu_active_focus_bg;
|
setForegroundColor (wc.menu_active_focus_fg);
|
||||||
|
setBackgroundColor (wc.menu_active_focus_bg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foregroundColor = wc.menu_active_fg;
|
setForegroundColor (wc.menu_active_fg);
|
||||||
backgroundColor = wc.menu_active_bg;
|
setBackgroundColor (wc.menu_active_bg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foregroundColor = wc.menu_inactive_fg;
|
setForegroundColor (wc.menu_inactive_fg);
|
||||||
backgroundColor = wc.menu_inactive_bg;
|
setBackgroundColor (wc.menu_inactive_bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
setColor (foregroundColor, backgroundColor);
|
setColor();
|
||||||
|
|
||||||
if ( x < screenWidth )
|
if ( x < screenWidth )
|
||||||
{
|
{
|
||||||
|
@ -431,7 +426,7 @@ void FMenuBar::drawItems()
|
||||||
if ( ! is_noUnderline )
|
if ( ! is_noUnderline )
|
||||||
unsetUnderline();
|
unsetUnderline();
|
||||||
|
|
||||||
setColor (foregroundColor, backgroundColor);
|
setColor();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
print (vmenubar, item_text[z]);
|
print (vmenubar, item_text[z]);
|
||||||
|
@ -441,12 +436,12 @@ void FMenuBar::drawItems()
|
||||||
{
|
{
|
||||||
if ( startpos < screenWidth )
|
if ( startpos < screenWidth )
|
||||||
{
|
{
|
||||||
gotoxy(screenWidth-1,1);
|
printPos (screenWidth - 1, 1);
|
||||||
print (vmenubar, "..");
|
print (vmenubar, "..");
|
||||||
}
|
}
|
||||||
else if ( startpos-1 <= screenWidth )
|
else if ( startpos-1 <= screenWidth )
|
||||||
{
|
{
|
||||||
gotoxy(screenWidth,1);
|
printPos (screenWidth, 1);
|
||||||
print (vmenubar, ' ');
|
print (vmenubar, ' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -646,7 +641,7 @@ void FMenuBar::onMouseDown (FMouseEvent* ev)
|
||||||
(*iter)->setSelected();
|
(*iter)->setSelected();
|
||||||
(*iter)->setFocus();
|
(*iter)->setFocus();
|
||||||
|
|
||||||
if ( focused_widget && ! focused_widget->isWindow() )
|
if ( focused_widget && ! focused_widget->isWindowWidget() )
|
||||||
focused_widget->redraw();
|
focused_widget->redraw();
|
||||||
|
|
||||||
(*iter)->openMenu();
|
(*iter)->openMenu();
|
||||||
|
@ -800,7 +795,7 @@ void FMenuBar::onMouseMove (FMouseEvent* ev)
|
||||||
mouse_x = ev->getX();
|
mouse_x = ev->getX();
|
||||||
mouse_y = ev->getY();
|
mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( getGeometryGlobal().contains(ev->getGlobalPos()) )
|
if ( getTermGeometry().contains(ev->getTermPos()) )
|
||||||
mouse_over_menubar = true;
|
mouse_over_menubar = true;
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != end )
|
||||||
|
@ -822,7 +817,7 @@ void FMenuBar::onMouseMove (FMouseEvent* ev)
|
||||||
(*iter)->setSelected();
|
(*iter)->setSelected();
|
||||||
(*iter)->setFocus();
|
(*iter)->setFocus();
|
||||||
|
|
||||||
if ( focused_widget && ! focused_widget->isWindow() )
|
if ( focused_widget && ! focused_widget->isWindowWidget() )
|
||||||
focused_widget->redraw();
|
focused_widget->redraw();
|
||||||
|
|
||||||
(*iter)->openMenu();
|
(*iter)->openMenu();
|
||||||
|
@ -863,16 +858,16 @@ void FMenuBar::onMouseMove (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
// Mouse event handover to the menu
|
// Mouse event handover to the menu
|
||||||
FMenu* menu = getSelectedItem()->getMenu();
|
FMenu* menu = getSelectedItem()->getMenu();
|
||||||
const FRect& menu_geometry = menu->getGeometryGlobal();
|
const FRect& menu_geometry = menu->getTermGeometry();
|
||||||
|
|
||||||
if ( menu->count() > 0
|
if ( menu->count() > 0
|
||||||
&& menu_geometry.contains(ev->getGlobalPos()) )
|
&& menu_geometry.contains(ev->getTermPos()) )
|
||||||
{
|
{
|
||||||
FMouseEvent* _ev;
|
FMouseEvent* _ev;
|
||||||
const FPoint& g = ev->getGlobalPos();
|
const FPoint& t = ev->getTermPos();
|
||||||
const FPoint& p = menu->globalToLocalPos(g);
|
const FPoint& p = menu->termToWidgetPos(t);
|
||||||
int b = ev->getButton();
|
int b = ev->getButton();
|
||||||
_ev = new FMouseEvent (fc::MouseMove_Event, p, g, b);
|
_ev = new FMouseEvent (fc::MouseMove_Event, p, t, b);
|
||||||
menu->mouse_down = true;
|
menu->mouse_down = true;
|
||||||
setClickedWidget(menu);
|
setClickedWidget(menu);
|
||||||
menu->onMouseMove(_ev);
|
menu->onMouseMove(_ev);
|
||||||
|
@ -921,10 +916,14 @@ void FMenuBar::hide()
|
||||||
bg = wc.term_bg;
|
bg = wc.term_bg;
|
||||||
setColor (fg, bg);
|
setColor (fg, bg);
|
||||||
screenWidth = getColumnNumber();
|
screenWidth = getColumnNumber();
|
||||||
|
|
||||||
|
if ( screenWidth < 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
blank = new char[screenWidth+1];
|
blank = new char[screenWidth+1];
|
||||||
memset(blank, ' ', uLong(screenWidth));
|
memset(blank, ' ', uLong(screenWidth));
|
||||||
blank[screenWidth] = '\0';
|
blank[screenWidth] = '\0';
|
||||||
gotoxy (1,1);
|
printPos (1,1);
|
||||||
print (vmenubar, blank);
|
print (vmenubar, blank);
|
||||||
delete[] blank;
|
delete[] blank;
|
||||||
}
|
}
|
||||||
|
@ -939,25 +938,10 @@ void FMenuBar::resetMenu()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenuBar::adjustSize()
|
void FMenuBar::adjustSize()
|
||||||
{
|
{
|
||||||
xmin = ymin = 1;
|
setGeometry (1, 1, getColumnNumber(), 1, false);
|
||||||
height = 1;
|
|
||||||
xpos = 1;
|
|
||||||
width = getColumnNumber();
|
|
||||||
ypos = 1;
|
|
||||||
adjustItems();
|
adjustItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
void FMenuBar::setGeometry (int xx, int yy, int ww, int hh, bool adjust)
|
|
||||||
{
|
|
||||||
int old_width = width;
|
|
||||||
int old_height = height;
|
|
||||||
FWidget::setGeometry (xx, yy, ww, hh, adjust);
|
|
||||||
|
|
||||||
if ( vmenubar && (width != old_width || height != old_height) )
|
|
||||||
resizeArea (vmenubar);
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenuBar::cb_item_deactivated (FWidget* widget, void*)
|
void FMenuBar::cb_item_deactivated (FWidget* widget, void*)
|
||||||
{
|
{
|
||||||
|
|
|
@ -76,9 +76,6 @@ class FMenuBar : public FWindow, public FMenuList
|
||||||
void hide();
|
void hide();
|
||||||
void resetMenu();
|
void resetMenu();
|
||||||
void adjustSize();
|
void adjustSize();
|
||||||
// make every setGeometry from FWidget available
|
|
||||||
using FWidget::setGeometry;
|
|
||||||
void setGeometry (int, int, int, int, bool = true);
|
|
||||||
void cb_item_deactivated (FWidget*, void*);
|
void cb_item_deactivated (FWidget*, void*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -348,7 +348,7 @@ void FMenuItem::processClicked()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FMenuItem::isWindowsMenu (FWidget* w) const
|
bool FMenuItem::isWindowsMenu (FWidget* w) const
|
||||||
{
|
{
|
||||||
return ( ! w ) ? false : w->isDialog();
|
return ( ! w ) ? false : w->isDialogWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -463,7 +463,7 @@ void FMenuItem::onMouseDoubleClick (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
if ( super_menu )
|
if ( super_menu )
|
||||||
{
|
{
|
||||||
const FPoint& g = ev->getGlobalPos();
|
const FPoint& t = ev->getTermPos();
|
||||||
int b = ev->getButton();
|
int b = ev->getButton();
|
||||||
|
|
||||||
if ( isMenu(super_menu) )
|
if ( isMenu(super_menu) )
|
||||||
|
@ -472,8 +472,8 @@ void FMenuItem::onMouseDoubleClick (FMouseEvent* ev)
|
||||||
|
|
||||||
if ( smenu )
|
if ( smenu )
|
||||||
{
|
{
|
||||||
const FPoint& p2 = smenu->globalToLocalPos(g);
|
const FPoint& p2 = smenu->termToWidgetPos(t);
|
||||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseDoubleClick_Event, p2, g, b);
|
FMouseEvent* _ev = new FMouseEvent (fc::MouseDoubleClick_Event, p2, t, b);
|
||||||
smenu->onMouseDoubleClick(_ev);
|
smenu->onMouseDoubleClick(_ev);
|
||||||
delete _ev;
|
delete _ev;
|
||||||
}
|
}
|
||||||
|
@ -485,8 +485,8 @@ void FMenuItem::onMouseDoubleClick (FMouseEvent* ev)
|
||||||
|
|
||||||
if ( mbar )
|
if ( mbar )
|
||||||
{
|
{
|
||||||
const FPoint& p2 = mbar->globalToLocalPos(g);
|
const FPoint& p2 = mbar->termToWidgetPos(t);
|
||||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseDoubleClick_Event, p2, g, b);
|
FMouseEvent* _ev = new FMouseEvent (fc::MouseDoubleClick_Event, p2, t, b);
|
||||||
mbar->onMouseDoubleClick(_ev);
|
mbar->onMouseDoubleClick(_ev);
|
||||||
delete _ev;
|
delete _ev;
|
||||||
}
|
}
|
||||||
|
@ -498,8 +498,8 @@ void FMenuItem::onMouseDoubleClick (FMouseEvent* ev)
|
||||||
|
|
||||||
if ( dgl )
|
if ( dgl )
|
||||||
{
|
{
|
||||||
const FPoint& p2 = dgl->globalToLocalPos(g);
|
const FPoint& p2 = dgl->termToWidgetPos(t);
|
||||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseDoubleClick_Event, p2, g, b);
|
FMouseEvent* _ev = new FMouseEvent (fc::MouseDoubleClick_Event, p2, t, b);
|
||||||
dgl->onMouseDoubleClick(_ev);
|
dgl->onMouseDoubleClick(_ev);
|
||||||
delete _ev;
|
delete _ev;
|
||||||
}
|
}
|
||||||
|
@ -512,7 +512,7 @@ void FMenuItem::onMouseDown (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
if ( super_menu )
|
if ( super_menu )
|
||||||
{
|
{
|
||||||
const FPoint& g = ev->getGlobalPos();
|
const FPoint& t = ev->getTermPos();
|
||||||
int b = ev->getButton();
|
int b = ev->getButton();
|
||||||
|
|
||||||
if ( isMenu(super_menu) )
|
if ( isMenu(super_menu) )
|
||||||
|
@ -521,8 +521,8 @@ void FMenuItem::onMouseDown (FMouseEvent* ev)
|
||||||
|
|
||||||
if ( smenu )
|
if ( smenu )
|
||||||
{
|
{
|
||||||
const FPoint& p2 = smenu->globalToLocalPos(g);
|
const FPoint& p2 = smenu->termToWidgetPos(t);
|
||||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseDown_Event, p2, g, b);
|
FMouseEvent* _ev = new FMouseEvent (fc::MouseDown_Event, p2, t, b);
|
||||||
smenu->onMouseDown(_ev);
|
smenu->onMouseDown(_ev);
|
||||||
delete _ev;
|
delete _ev;
|
||||||
}
|
}
|
||||||
|
@ -534,8 +534,8 @@ void FMenuItem::onMouseDown (FMouseEvent* ev)
|
||||||
|
|
||||||
if ( mbar )
|
if ( mbar )
|
||||||
{
|
{
|
||||||
const FPoint& p2 = mbar->globalToLocalPos(g);
|
const FPoint& p2 = mbar->termToWidgetPos(t);
|
||||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseDown_Event, p2, g, b);
|
FMouseEvent* _ev = new FMouseEvent (fc::MouseDown_Event, p2, t, b);
|
||||||
mbar->onMouseDown(_ev);
|
mbar->onMouseDown(_ev);
|
||||||
delete _ev;
|
delete _ev;
|
||||||
}
|
}
|
||||||
|
@ -547,8 +547,8 @@ void FMenuItem::onMouseDown (FMouseEvent* ev)
|
||||||
|
|
||||||
if ( dgl )
|
if ( dgl )
|
||||||
{
|
{
|
||||||
const FPoint& p2 = dgl->globalToLocalPos(g);
|
const FPoint& p2 = dgl->termToWidgetPos(t);
|
||||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseDown_Event, p2, g, b);
|
FMouseEvent* _ev = new FMouseEvent (fc::MouseDown_Event, p2, t, b);
|
||||||
dgl->onMouseDown(_ev);
|
dgl->onMouseDown(_ev);
|
||||||
delete _ev;
|
delete _ev;
|
||||||
}
|
}
|
||||||
|
@ -561,7 +561,7 @@ void FMenuItem::onMouseUp (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
if ( super_menu )
|
if ( super_menu )
|
||||||
{
|
{
|
||||||
const FPoint& g = ev->getGlobalPos();
|
const FPoint& t = ev->getTermPos();
|
||||||
int b = ev->getButton();
|
int b = ev->getButton();
|
||||||
|
|
||||||
if ( isMenu(super_menu) )
|
if ( isMenu(super_menu) )
|
||||||
|
@ -570,8 +570,8 @@ void FMenuItem::onMouseUp (FMouseEvent* ev)
|
||||||
|
|
||||||
if ( smenu )
|
if ( smenu )
|
||||||
{
|
{
|
||||||
const FPoint& p2 = smenu->globalToLocalPos(g);
|
const FPoint& p2 = smenu->termToWidgetPos(t);
|
||||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseUp_Event, p2, g, b);
|
FMouseEvent* _ev = new FMouseEvent (fc::MouseUp_Event, p2, t, b);
|
||||||
smenu->onMouseUp(_ev);
|
smenu->onMouseUp(_ev);
|
||||||
delete _ev;
|
delete _ev;
|
||||||
}
|
}
|
||||||
|
@ -583,8 +583,8 @@ void FMenuItem::onMouseUp (FMouseEvent* ev)
|
||||||
|
|
||||||
if ( mbar )
|
if ( mbar )
|
||||||
{
|
{
|
||||||
const FPoint& p2 = mbar->globalToLocalPos(g);
|
const FPoint& p2 = mbar->termToWidgetPos(t);
|
||||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseUp_Event, p2, g, b);
|
FMouseEvent* _ev = new FMouseEvent (fc::MouseUp_Event, p2, t, b);
|
||||||
mbar->onMouseUp(_ev);
|
mbar->onMouseUp(_ev);
|
||||||
delete _ev;
|
delete _ev;
|
||||||
}
|
}
|
||||||
|
@ -596,8 +596,8 @@ void FMenuItem::onMouseUp (FMouseEvent* ev)
|
||||||
|
|
||||||
if ( dgl )
|
if ( dgl )
|
||||||
{
|
{
|
||||||
const FPoint& p2 = dgl->globalToLocalPos(g);
|
const FPoint& p2 = dgl->termToWidgetPos(t);
|
||||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseUp_Event, p2, g, b);
|
FMouseEvent* _ev = new FMouseEvent (fc::MouseUp_Event, p2, t, b);
|
||||||
dgl->onMouseUp(_ev);
|
dgl->onMouseUp(_ev);
|
||||||
delete _ev;
|
delete _ev;
|
||||||
}
|
}
|
||||||
|
@ -610,7 +610,7 @@ void FMenuItem::onMouseMove (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
if ( super_menu )
|
if ( super_menu )
|
||||||
{
|
{
|
||||||
const FPoint& g = ev->getGlobalPos();
|
const FPoint& t = ev->getTermPos();
|
||||||
int b = ev->getButton();
|
int b = ev->getButton();
|
||||||
|
|
||||||
if ( isMenu(super_menu) )
|
if ( isMenu(super_menu) )
|
||||||
|
@ -619,8 +619,8 @@ void FMenuItem::onMouseMove (FMouseEvent* ev)
|
||||||
|
|
||||||
if ( smenu )
|
if ( smenu )
|
||||||
{
|
{
|
||||||
const FPoint& p2 = smenu->globalToLocalPos(g);
|
const FPoint& p2 = smenu->termToWidgetPos(t);
|
||||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseMove_Event, p2, g, b);
|
FMouseEvent* _ev = new FMouseEvent (fc::MouseMove_Event, p2, t, b);
|
||||||
smenu->onMouseMove(_ev);
|
smenu->onMouseMove(_ev);
|
||||||
delete _ev;
|
delete _ev;
|
||||||
}
|
}
|
||||||
|
@ -632,8 +632,8 @@ void FMenuItem::onMouseMove (FMouseEvent* ev)
|
||||||
|
|
||||||
if ( mbar )
|
if ( mbar )
|
||||||
{
|
{
|
||||||
const FPoint& p2 = mbar->globalToLocalPos(g);
|
const FPoint& p2 = mbar->termToWidgetPos(t);
|
||||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseMove_Event, p2, g, b);
|
FMouseEvent* _ev = new FMouseEvent (fc::MouseMove_Event, p2, t, b);
|
||||||
mbar->onMouseMove(_ev);
|
mbar->onMouseMove(_ev);
|
||||||
delete _ev;
|
delete _ev;
|
||||||
}
|
}
|
||||||
|
@ -645,8 +645,8 @@ void FMenuItem::onMouseMove (FMouseEvent* ev)
|
||||||
|
|
||||||
if ( dgl )
|
if ( dgl )
|
||||||
{
|
{
|
||||||
const FPoint& p2 = dgl->globalToLocalPos(g);
|
const FPoint& p2 = dgl->termToWidgetPos(t);
|
||||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseMove_Event, p2, g, b);
|
FMouseEvent* _ev = new FMouseEvent (fc::MouseMove_Event, p2, t, b);
|
||||||
dgl->onMouseMove(_ev);
|
dgl->onMouseMove(_ev);
|
||||||
delete _ev;
|
delete _ev;
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,7 @@ void FMessageBox::init(int button0, int button1, int button2)
|
||||||
|
|
||||||
button[0] = new FButton (this);
|
button[0] = new FButton (this);
|
||||||
button[0]->setText(button_text[button0]);
|
button[0]->setText(button_text[button0]);
|
||||||
button[0]->setPos(3, height-4, false);
|
button[0]->setPos(3, getHeight()-4, false);
|
||||||
button[0]->setWidth(1, false);
|
button[0]->setWidth(1, false);
|
||||||
button[0]->setHeight(1, false);
|
button[0]->setHeight(1, false);
|
||||||
button[0]->setFocus();
|
button[0]->setFocus();
|
||||||
|
@ -135,7 +135,7 @@ void FMessageBox::init(int button0, int button1, int button2)
|
||||||
{
|
{
|
||||||
button[1] = new FButton(this);
|
button[1] = new FButton(this);
|
||||||
button[1]->setText(button_text[button1]);
|
button[1]->setText(button_text[button1]);
|
||||||
button[1]->setPos(17, height-4, false);
|
button[1]->setPos(17, getHeight()-4, false);
|
||||||
button[1]->setWidth(0, false);
|
button[1]->setWidth(0, false);
|
||||||
button[1]->setHeight(1, false);
|
button[1]->setHeight(1, false);
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ void FMessageBox::init(int button0, int button1, int button2)
|
||||||
{
|
{
|
||||||
button[2] = new FButton(this);
|
button[2] = new FButton(this);
|
||||||
button[2]->setText(button_text[button2]);
|
button[2]->setText(button_text[button2]);
|
||||||
button[2]->setPos(32, height-4, false);
|
button[2]->setPos(32, getHeight()-4, false);
|
||||||
button[2]->setWidth(0, false);
|
button[2]->setWidth(0, false);
|
||||||
button[2]->setHeight(1, false);
|
button[2]->setHeight(1, false);
|
||||||
}
|
}
|
||||||
|
@ -231,7 +231,7 @@ void FMessageBox::draw()
|
||||||
|
|
||||||
int head_offset = 0;
|
int head_offset = 0;
|
||||||
int center_x = 0;
|
int center_x = 0;
|
||||||
int msg_x = int((width - int(maxLineWidth)) / 2); // center the whole block
|
int msg_x = int((getWidth() - int(maxLineWidth)) / 2); // center the whole block
|
||||||
updateVTerm(false);
|
updateVTerm(false);
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
|
@ -239,18 +239,18 @@ void FMessageBox::draw()
|
||||||
|
|
||||||
if ( ! headline_text.isNull() )
|
if ( ! headline_text.isNull() )
|
||||||
{
|
{
|
||||||
setColor(emphasis_color, backgroundColor);
|
setColor(emphasis_color, getBackgroundColor());
|
||||||
uInt headline_length = headline_text.getLength();
|
uInt headline_length = headline_text.getLength();
|
||||||
|
|
||||||
if ( center_text ) // center one line
|
if ( center_text ) // center one line
|
||||||
center_x = int((maxLineWidth - headline_length) / 2);
|
center_x = int((maxLineWidth - headline_length) / 2);
|
||||||
|
|
||||||
gotoxy (xpos+xmin-1+msg_x+center_x, ypos+ymin+2);
|
printPos (1 + msg_x + center_x, 4);
|
||||||
print (headline_text);
|
print (headline_text);
|
||||||
head_offset = 2;
|
head_offset = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
setColor(foregroundColor, backgroundColor);
|
setColor();
|
||||||
|
|
||||||
for (int i=0; i < int(text_num_lines); i++)
|
for (int i=0; i < int(text_num_lines); i++)
|
||||||
{
|
{
|
||||||
|
@ -259,7 +259,7 @@ void FMessageBox::draw()
|
||||||
if ( center_text ) // center one line
|
if ( center_text ) // center one line
|
||||||
center_x = int((maxLineWidth - line_length) / 2);
|
center_x = int((maxLineWidth - line_length) / 2);
|
||||||
|
|
||||||
gotoxy (xpos+xmin-1+msg_x+center_x, ypos+ymin+2+head_offset+i);
|
printPos (1 + msg_x + center_x, 4 + head_offset + i);
|
||||||
print(text_components[i]);
|
print(text_components[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,16 +314,16 @@ void FMessageBox::adjustButtons()
|
||||||
btn_width += button[n]->getWidth() + gap;
|
btn_width += button[n]->getWidth() + gap;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( btn_width >= width-4 )
|
if ( btn_width >= getWidth()-4 )
|
||||||
{
|
{
|
||||||
int max_width;
|
int max_width;
|
||||||
FWidget* root_widget = getRootWidget();
|
FWidget* root_widget = getRootWidget();
|
||||||
setWidth(btn_width + 5);
|
setWidth(btn_width + 5);
|
||||||
max_width = ( root_widget ) ? root_widget->getClientWidth() : 80;
|
max_width = ( root_widget ) ? root_widget->getClientWidth() : 80;
|
||||||
setX (int((max_width-width) / 2));
|
setX (int((max_width-getWidth()) / 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
int btn_x = int((width-btn_width) / 2);
|
int btn_x = int((getWidth()-btn_width) / 2);
|
||||||
|
|
||||||
for (uInt n=0; n < numButtons; n++)
|
for (uInt n=0; n < numButtons; n++)
|
||||||
{
|
{
|
||||||
|
@ -363,8 +363,8 @@ void FMessageBox::adjustSize()
|
||||||
max_height = 24;
|
max_height = 24;
|
||||||
}
|
}
|
||||||
|
|
||||||
X = 1 + int((max_width-width)/2);
|
X = 1 + int((max_width-getWidth())/2);
|
||||||
Y = 1 + int((max_height-height)/3);
|
Y = 1 + int((max_height-getHeight())/3);
|
||||||
setPos(X, Y, false);
|
setPos(X, Y, false);
|
||||||
FDialog::adjustSize();
|
FDialog::adjustSize();
|
||||||
}
|
}
|
||||||
|
@ -410,19 +410,19 @@ FMessageBox& FMessageBox::operator = (const FMessageBox& mbox)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMessageBox::setHeadline (const FString& headline)
|
void FMessageBox::setHeadline (const FString& headline)
|
||||||
{
|
{
|
||||||
int old_height = height;
|
int old_height = getHeight();
|
||||||
headline_text = headline;
|
headline_text = headline;
|
||||||
setHeight(height + 2, true);
|
setHeight(getHeight() + 2, true);
|
||||||
|
|
||||||
for (uInt n=0; n < numButtons; n++)
|
for (uInt n=0; n < numButtons; n++)
|
||||||
button[n]->setY(height-4, false);
|
button[n]->setY(getHeight()-4, false);
|
||||||
|
|
||||||
uInt len = headline_text.getLength();
|
uInt len = headline_text.getLength();
|
||||||
|
|
||||||
if ( len > maxLineWidth )
|
if ( len > maxLineWidth )
|
||||||
maxLineWidth = len;
|
maxLineWidth = len;
|
||||||
|
|
||||||
if ( vwin && height != old_height )
|
if ( vwin && getHeight() != old_height )
|
||||||
resizeArea (vwin);
|
resizeArea (vwin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,13 +445,13 @@ void FMessageBox::setText (const FString& txt)
|
||||||
{
|
{
|
||||||
text = txt;
|
text = txt;
|
||||||
msg_dimension();
|
msg_dimension();
|
||||||
button[0]->setY(height-4, false);
|
button[0]->setY(getHeight()-4, false);
|
||||||
|
|
||||||
if ( *button_digit[1] != 0 )
|
if ( *button_digit[1] != 0 )
|
||||||
button[1]->setY(height-4, false);
|
button[1]->setY(getHeight()-4, false);
|
||||||
|
|
||||||
if ( *button_digit[2] != 0 )
|
if ( *button_digit[2] != 0 )
|
||||||
button[2]->setY(height-4, false);
|
button[2]->setY(getHeight()-4, false);
|
||||||
|
|
||||||
adjustButtons();
|
adjustButtons();
|
||||||
}
|
}
|
||||||
|
@ -520,8 +520,8 @@ int FMessageBox::error ( FWidget* parent
|
||||||
mbox->beep();
|
mbox->beep();
|
||||||
mbox->setHeadline("Warning:");
|
mbox->setHeadline("Warning:");
|
||||||
mbox->setCenterText();
|
mbox->setCenterText();
|
||||||
mbox->foregroundColor = mbox->wc.error_box_fg;
|
mbox->setForegroundColor(mbox->wc.error_box_fg);
|
||||||
mbox->backgroundColor = mbox->wc.error_box_bg;
|
mbox->setBackgroundColor(mbox->wc.error_box_bg);
|
||||||
mbox->emphasis_color = mbox->wc.error_box_emphasis_fg;
|
mbox->emphasis_color = mbox->wc.error_box_emphasis_fg;
|
||||||
reply = mbox->exec();
|
reply = mbox->exec();
|
||||||
delete mbox;
|
delete mbox;
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
FProgressbar::FProgressbar(FWidget* parent)
|
FProgressbar::FProgressbar(FWidget* parent)
|
||||||
: FWidget(parent)
|
: FWidget(parent)
|
||||||
, percentage(-1)
|
, percentage(-1)
|
||||||
, BarLength(width)
|
, BarLength(getWidth())
|
||||||
{
|
{
|
||||||
unsetFocusable();
|
unsetFocusable();
|
||||||
setShadow();
|
setShadow();
|
||||||
|
@ -37,7 +37,7 @@ void FProgressbar::drawPercentage()
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
||||||
gotoxy (xpos+xmin+width-5, ypos+ymin-2);
|
printPos (getWidth() - 3, 0);
|
||||||
|
|
||||||
if ( percentage < 0 || percentage > 100 )
|
if ( percentage < 0 || percentage > 100 )
|
||||||
print ("--- %");
|
print ("--- %");
|
||||||
|
@ -53,7 +53,7 @@ void FProgressbar::drawBar()
|
||||||
{
|
{
|
||||||
int i = 1;
|
int i = 1;
|
||||||
float length = float(BarLength*percentage)/100;
|
float length = float(BarLength*percentage)/100;
|
||||||
gotoxy (xpos+xmin-1, ypos+ymin-1);
|
printPos (1,1);
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
{
|
{
|
||||||
|
@ -195,19 +195,23 @@ void FProgressbar::hide()
|
||||||
|
|
||||||
setColor (fg, bg);
|
setColor (fg, bg);
|
||||||
s = hasShadow() ? 1 : 0;
|
s = hasShadow() ? 1 : 0;
|
||||||
size = width + s;
|
size = getWidth() + s;
|
||||||
|
|
||||||
|
if ( size < 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
blank = new char[size+1];
|
blank = new char[size+1];
|
||||||
memset(blank, ' ', uLong(size));
|
memset(blank, ' ', uLong(size));
|
||||||
blank[size] = '\0';
|
blank[size] = '\0';
|
||||||
|
|
||||||
for (int y=0; y < height+s; y++)
|
for (int y=0; y < getHeight()+s; y++)
|
||||||
{
|
{
|
||||||
gotoxy (xpos+xmin-1, ypos+ymin-1+y);
|
printPos (1, 1 + y);
|
||||||
print (blank);
|
print (blank);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete[] blank;
|
delete[] blank;
|
||||||
gotoxy (xpos+xmin+width-5, ypos+ymin-2);
|
printPos (getWidth() - 4, 0);
|
||||||
print (" "); // hide percentage
|
print (" "); // hide percentage
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,8 +54,8 @@ void FRadioButton::drawRadioButton()
|
||||||
if ( ! isVisible() )
|
if ( ! isVisible() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gotoxy (xpos+xmin-1, ypos+ymin-1);
|
printPos (1,1);
|
||||||
setColor (foregroundColor, backgroundColor);
|
setColor();
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -116,6 +116,21 @@ void FRect::setRect (int x, int y, int width, int height)
|
||||||
Y2 = short(y+height-1);
|
Y2 = short(y+height-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FRect::setCoordinates (const FPoint& p1, const FPoint& p2)
|
||||||
|
{
|
||||||
|
setCoordinates (p1.getX(), p1.getY(), p2.getX(), p2.getY());
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FRect::setCoordinates (int x1, int y1, int x2, int y2)
|
||||||
|
{
|
||||||
|
X1 = short(x1);
|
||||||
|
Y1 = short(y1);
|
||||||
|
X2 = short(x2);
|
||||||
|
Y2 = short(y2);
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FRect::move (int dx, int dy)
|
void FRect::move (int dx, int dy)
|
||||||
{
|
{
|
||||||
|
@ -174,6 +189,16 @@ FRect FRect::intersect (const FRect& r) const
|
||||||
return new_rect;
|
return new_rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
FRect& FRect::operator = (const FRect& r)
|
||||||
|
{
|
||||||
|
X1 = short(r.getX1());
|
||||||
|
Y1 = short(r.getY1());
|
||||||
|
X2 = short(r.getX2());
|
||||||
|
Y2 = short(r.getY2());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FRect operator + (const FRect& r, const FPoint& p)
|
FRect operator + (const FRect& r, const FPoint& p)
|
||||||
{
|
{
|
||||||
|
|
86
src/frect.h
86
src/frect.h
|
@ -37,37 +37,45 @@ class FRect
|
||||||
virtual ~FRect(); // destructor
|
virtual ~FRect(); // destructor
|
||||||
virtual const char* getClassName();
|
virtual const char* getClassName();
|
||||||
|
|
||||||
bool isNull() const;
|
bool isNull() const;
|
||||||
int getX1() const;
|
int getX1() const;
|
||||||
int getY1() const;
|
int getY1() const;
|
||||||
int getX2() const;
|
int getX2() const;
|
||||||
int getY2() const;
|
int getY2() const;
|
||||||
int getX() const;
|
int getX() const;
|
||||||
int getY() const;
|
int getY() const;
|
||||||
FPoint getPos() const;
|
FPoint getPos() const;
|
||||||
int getWidth() const;
|
int getWidth() const;
|
||||||
int getHeight() const;
|
int getHeight() const;
|
||||||
|
|
||||||
void setX1 (int);
|
short& x1_ref();
|
||||||
void setY1 (int);
|
short& y1_ref();
|
||||||
void setX2 (int);
|
short& x2_ref();
|
||||||
void setY2 (int);
|
short& y2_ref();
|
||||||
void setX (int);
|
void setX1 (int);
|
||||||
void setY (int);
|
void setY1 (int);
|
||||||
void setPos (int, int);
|
void setX2 (int);
|
||||||
void setPos (const FPoint&);
|
void setY2 (int);
|
||||||
void setWidth (int);
|
void setX (int);
|
||||||
void setHeight (int);
|
void setY (int);
|
||||||
void setRect (const FRect&);
|
void setPos (int, int);
|
||||||
void setRect (int, int, int, int);
|
void setPos (const FPoint&);
|
||||||
|
void setWidth (int);
|
||||||
|
void setHeight (int);
|
||||||
|
void setRect (const FRect&);
|
||||||
|
void setRect (int, int, int, int);
|
||||||
|
void setCoordinates (const FPoint&, const FPoint&);
|
||||||
|
void setCoordinates (int, int, int, int);
|
||||||
|
|
||||||
void move (int, int);
|
void move (int, int);
|
||||||
void move (const FPoint&);
|
void move (const FPoint&);
|
||||||
bool contains (int, int) const;
|
bool contains (int, int) const;
|
||||||
bool contains (const FPoint&) const;
|
bool contains (const FPoint&) const;
|
||||||
bool contains (const FRect&) const;
|
bool contains (const FRect&) const;
|
||||||
bool overlap (const FRect&) const;
|
bool overlap (const FRect&) const;
|
||||||
FRect intersect (const FRect&) const;
|
FRect intersect (const FRect&) const;
|
||||||
|
|
||||||
|
FRect& operator = (const FRect&);
|
||||||
|
|
||||||
friend FRect operator + (const FRect&, const FPoint&);
|
friend FRect operator + (const FRect&, const FPoint&);
|
||||||
friend FRect operator - (const FRect&, const FPoint&);
|
friend FRect operator - (const FRect&, const FPoint&);
|
||||||
|
@ -90,8 +98,8 @@ inline FRect::FRect()
|
||||||
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))
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -134,4 +142,20 @@ inline int FRect::getWidth() const
|
||||||
inline int FRect::getHeight() const
|
inline int FRect::getHeight() const
|
||||||
{ return Y2 - Y1 + 1; }
|
{ return Y2 - Y1 + 1; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline short& FRect::x1_ref()
|
||||||
|
{ return X1; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline short& FRect::y1_ref()
|
||||||
|
{ return Y1; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline short& FRect::x2_ref()
|
||||||
|
{ return X2; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline short& FRect::y2_ref()
|
||||||
|
{ return Y2; }
|
||||||
|
|
||||||
#endif // _FRECT_H
|
#endif // _FRECT_H
|
||||||
|
|
|
@ -31,8 +31,7 @@ FScrollbar::FScrollbar(FWidget* parent)
|
||||||
, max_color(getMaxColor())
|
, max_color(getMaxColor())
|
||||||
{
|
{
|
||||||
// The default scrollbar orientation is vertical
|
// The default scrollbar orientation is vertical
|
||||||
width = 1;
|
setGeometry(1, 1, 1, length, false);
|
||||||
height = length;
|
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,9 +71,9 @@ FScrollbar::~FScrollbar()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FScrollbar::init()
|
void FScrollbar::init()
|
||||||
{
|
{
|
||||||
setGeometry(1, 1, width, height);
|
|
||||||
ignore_padding = true;
|
|
||||||
unsetFocusable();
|
unsetFocusable();
|
||||||
|
ignorePadding();
|
||||||
|
setGeometry(1, 1, getWidth(), getHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -102,11 +101,11 @@ int FScrollbar::getClickedScrollType (int x, int y)
|
||||||
{
|
{
|
||||||
stype = FScrollbar::scrollPageBackward; // before slider
|
stype = FScrollbar::scrollPageBackward; // before slider
|
||||||
}
|
}
|
||||||
else if ( y > SliderPos+SliderLength+1 && y < height )
|
else if ( y > SliderPos+SliderLength+1 && y < getHeight() )
|
||||||
{
|
{
|
||||||
stype = FScrollbar::scrollPageForward; // after slider
|
stype = FScrollbar::scrollPageForward; // after slider
|
||||||
}
|
}
|
||||||
else if ( y == height )
|
else if ( y == getHeight() )
|
||||||
{
|
{
|
||||||
stype = FScrollbar::scrollStepForward; // increment button
|
stype = FScrollbar::scrollStepForward; // increment button
|
||||||
}
|
}
|
||||||
|
@ -125,11 +124,11 @@ int FScrollbar::getClickedScrollType (int x, int y)
|
||||||
{
|
{
|
||||||
stype = FScrollbar::scrollPageBackward; // before slider
|
stype = FScrollbar::scrollPageBackward; // before slider
|
||||||
}
|
}
|
||||||
else if ( x > SliderPos+SliderLength+2 && x < width-1 )
|
else if ( x > SliderPos+SliderLength+2 && x < getWidth()-1 )
|
||||||
{
|
{
|
||||||
stype = FScrollbar::scrollPageForward; // after slider
|
stype = FScrollbar::scrollPageForward; // after slider
|
||||||
}
|
}
|
||||||
else if ( x == width-1 || x == width )
|
else if ( x == getWidth()-1 || x == getWidth() )
|
||||||
{
|
{
|
||||||
stype = FScrollbar::scrollStepForward; // increment button
|
stype = FScrollbar::scrollStepForward; // increment button
|
||||||
}
|
}
|
||||||
|
@ -146,11 +145,11 @@ int FScrollbar::getClickedScrollType (int x, int y)
|
||||||
{
|
{
|
||||||
stype = FScrollbar::scrollPageBackward; // before slider
|
stype = FScrollbar::scrollPageBackward; // before slider
|
||||||
}
|
}
|
||||||
else if ( x > SliderPos+SliderLength+1 && x < width )
|
else if ( x > SliderPos+SliderLength+1 && x < getWidth() )
|
||||||
{
|
{
|
||||||
stype = FScrollbar::scrollPageForward; // after slider
|
stype = FScrollbar::scrollPageForward; // after slider
|
||||||
}
|
}
|
||||||
else if ( x == width )
|
else if ( x == getWidth() )
|
||||||
{
|
{
|
||||||
stype = FScrollbar::scrollStepForward; // increment button
|
stype = FScrollbar::scrollStepForward; // increment button
|
||||||
}
|
}
|
||||||
|
@ -169,7 +168,7 @@ void FScrollbar::processMiddleButton (int x, int y)
|
||||||
|
|
||||||
if ( bar_orientation == fc::vertical )
|
if ( bar_orientation == fc::vertical )
|
||||||
{
|
{
|
||||||
if ( y >1 && y < height )
|
if ( y >1 && y < getHeight() )
|
||||||
{
|
{
|
||||||
new_val = int( round ( float(max-min) * (y-2.0-(SliderLength/2))
|
new_val = int( round ( float(max-min) * (y-2.0-(SliderLength/2))
|
||||||
/ float(BarLength-SliderLength) ) );
|
/ float(BarLength-SliderLength) ) );
|
||||||
|
@ -181,7 +180,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 < getWidth()-nf )
|
||||||
{
|
{
|
||||||
new_val = int( round ( float(max-min) * (x-2.0-nf-(SliderLength/2))
|
new_val = int( round ( float(max-min) * (x-2.0-nf-(SliderLength/2))
|
||||||
/ float(BarLength-SliderLength) ) );
|
/ float(BarLength-SliderLength) ) );
|
||||||
|
@ -343,8 +342,8 @@ void FScrollbar::onMouseMove (FMouseEvent* ev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( mouse_x < 1 || mouse_x > width
|
if ( mouse_x < 1 || mouse_x > getWidth()
|
||||||
|| mouse_y < 1 || mouse_y > height )
|
|| mouse_y < 1 || mouse_y > getHeight() )
|
||||||
{
|
{
|
||||||
delOwnTimer();
|
delOwnTimer();
|
||||||
}
|
}
|
||||||
|
@ -514,17 +513,17 @@ void FScrollbar::calculateSliderValues()
|
||||||
void FScrollbar::setOrientation (int o)
|
void FScrollbar::setOrientation (int o)
|
||||||
{
|
{
|
||||||
int nf = 0;
|
int nf = 0;
|
||||||
length = (height > width) ? height : width;
|
length = (getHeight() > getWidth()) ? getHeight() : getWidth();
|
||||||
|
|
||||||
if ( o == fc::vertical && bar_orientation == fc::horizontal )
|
if ( o == fc::vertical && bar_orientation == fc::horizontal )
|
||||||
{
|
{
|
||||||
width = 1;
|
setWidth(1);
|
||||||
height = length;
|
setHeight(length);
|
||||||
}
|
}
|
||||||
else if ( o == fc::horizontal && bar_orientation == fc::vertical )
|
else if ( o == fc::horizontal && bar_orientation == fc::vertical )
|
||||||
{
|
{
|
||||||
height = 1;
|
setWidth(length);
|
||||||
width = length;
|
setHeight(1);
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
nf = 2;
|
nf = 2;
|
||||||
|
@ -543,17 +542,18 @@ void FScrollbar::setGeometry (int x, int y, int w, int h, bool adjust)
|
||||||
|
|
||||||
if ( bar_orientation == fc::vertical )
|
if ( bar_orientation == fc::vertical )
|
||||||
{
|
{
|
||||||
width = isNewFont() ? 2 : 1;
|
setWidth(isNewFont() ? 2 : 1);
|
||||||
height = length;
|
setHeight(length);
|
||||||
}
|
}
|
||||||
else // horizontal
|
else // horizontal
|
||||||
{
|
{
|
||||||
height = 1;
|
setWidth(length);
|
||||||
width = length;
|
setHeight(1);
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
nf = 2;
|
nf = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
SliderLength = BarLength = length-nf-2;
|
SliderLength = BarLength = length-nf-2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -571,7 +571,7 @@ void FScrollbar::drawBar()
|
||||||
|
|
||||||
for (z=1; z <= SliderPos; z++)
|
for (z=1; z <= SliderPos; z++)
|
||||||
{
|
{
|
||||||
gotoxy (xpos+xmin-1, ypos+ymin-1+z);
|
printPos (1, 1 + z);
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
print (fc::NF_border_line_left); // ⎸
|
print (fc::NF_border_line_left); // ⎸
|
||||||
|
@ -589,9 +589,11 @@ void FScrollbar::drawBar()
|
||||||
|
|
||||||
for (z=1; z <= SliderLength; z++)
|
for (z=1; z <= SliderLength; z++)
|
||||||
{
|
{
|
||||||
gotoxy (xpos+xmin-1, ypos+ymin-1+SliderPos+z);
|
printPos (1, 1 + SliderPos + z);
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
print (' ');
|
print (' ');
|
||||||
|
|
||||||
print (' ');
|
print (' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -602,7 +604,7 @@ void FScrollbar::drawBar()
|
||||||
|
|
||||||
for (z=SliderPos+SliderLength+1; z <= BarLength; z++)
|
for (z=SliderPos+SliderLength+1; z <= BarLength; z++)
|
||||||
{
|
{
|
||||||
gotoxy (xpos+xmin-1, ypos+ymin-1+z);
|
printPos (1, 1 + z);
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
print (fc::NF_border_line_left); // ⎸
|
print (fc::NF_border_line_left); // ⎸
|
||||||
|
@ -619,9 +621,9 @@ void FScrollbar::drawBar()
|
||||||
z = 0;
|
z = 0;
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
gotoxy (xpos+xmin+1+z, ypos+ymin-1);
|
printPos (3 + z, 1);
|
||||||
else
|
else
|
||||||
gotoxy (xpos+xmin+z, ypos+ymin-1);
|
printPos (2 + z, 1);
|
||||||
|
|
||||||
for (; z < SliderPos; z++)
|
for (; z < SliderPos; z++)
|
||||||
{
|
{
|
||||||
|
@ -676,13 +678,13 @@ void FScrollbar::drawButtons()
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
{
|
{
|
||||||
gotoxy (xpos+xmin-1, ypos+ymin-1);
|
printPos (1,1);
|
||||||
|
|
||||||
if ( bar_orientation == fc::vertical )
|
if ( bar_orientation == fc::vertical )
|
||||||
{
|
{
|
||||||
print (fc::NF_rev_up_arrow1);
|
print (fc::NF_rev_up_arrow1);
|
||||||
print (fc::NF_rev_up_arrow2);
|
print (fc::NF_rev_up_arrow2);
|
||||||
gotoxy (xpos+xmin-1, ypos+ymin+length-2);
|
printPos (1, length);
|
||||||
print (fc::NF_rev_down_arrow1);
|
print (fc::NF_rev_down_arrow1);
|
||||||
print (fc::NF_rev_down_arrow2);
|
print (fc::NF_rev_down_arrow2);
|
||||||
}
|
}
|
||||||
|
@ -690,14 +692,14 @@ void FScrollbar::drawButtons()
|
||||||
{
|
{
|
||||||
print (fc::NF_rev_left_arrow1);
|
print (fc::NF_rev_left_arrow1);
|
||||||
print (fc::NF_rev_left_arrow2);
|
print (fc::NF_rev_left_arrow2);
|
||||||
gotoxy (xpos+xmin+length-3, ypos+ymin-1);
|
printPos (length-1, 1);
|
||||||
print (fc::NF_rev_right_arrow1);
|
print (fc::NF_rev_right_arrow1);
|
||||||
print (fc::NF_rev_right_arrow2);
|
print (fc::NF_rev_right_arrow2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gotoxy (xpos+xmin-1, ypos+ymin-1);
|
printPos (1,1);
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
@ -709,7 +711,7 @@ void FScrollbar::drawButtons()
|
||||||
else
|
else
|
||||||
print (fc::BlackUpPointingTriangle); // ▲
|
print (fc::BlackUpPointingTriangle); // ▲
|
||||||
|
|
||||||
gotoxy (xpos+xmin-1, ypos+ymin+length-2);
|
printPos (1, length);
|
||||||
|
|
||||||
if ( isCygwinTerminal() )
|
if ( isCygwinTerminal() )
|
||||||
print ('v');
|
print ('v');
|
||||||
|
@ -719,9 +721,8 @@ void FScrollbar::drawButtons()
|
||||||
else // horizontal
|
else // horizontal
|
||||||
{
|
{
|
||||||
print (fc::BlackLeftPointingPointer); // ◄
|
print (fc::BlackLeftPointingPointer); // ◄
|
||||||
gotoxy (xpos+xmin+length-2, ypos+ymin-1);
|
printPos (length, 1);
|
||||||
print (fc::BlackRightPointingPointer); // ►
|
print (fc::BlackRightPointingPointer); // ►
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
|
|
|
@ -192,32 +192,30 @@ FStatusBar::~FStatusBar()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FStatusBar::init()
|
void FStatusBar::init()
|
||||||
{
|
{
|
||||||
xmin = ymin = 1;
|
FWidget* r = getRootWidget();
|
||||||
xpos = 1;
|
int w = r->getWidth();
|
||||||
ypos = getLineNumber();
|
int h = r->getHeight();
|
||||||
|
// initialize geometry values
|
||||||
|
setGeometry (1, h, w, 1, false);
|
||||||
createArea (vstatusbar);
|
createArea (vstatusbar);
|
||||||
vstatusbar->visible = true;
|
vstatusbar->visible = true;
|
||||||
ignore_padding = true;
|
ignorePadding();
|
||||||
mouse_down = false;
|
mouse_down = false;
|
||||||
|
|
||||||
// initialize geometry values
|
|
||||||
setGeometry (1, ypos, getColumnNumber(), 1, false);
|
|
||||||
setStatusBar(this);
|
setStatusBar(this);
|
||||||
|
|
||||||
if ( getRootWidget() )
|
if ( getRootWidget() )
|
||||||
getRootWidget()->setBottomPadding(1, true);
|
getRootWidget()->setBottomPadding(1, true);
|
||||||
|
|
||||||
foregroundColor = wc.statusbar_fg;
|
setForegroundColor (wc.statusbar_fg);
|
||||||
backgroundColor = wc.statusbar_bg;
|
setBackgroundColor (wc.statusbar_bg);
|
||||||
unsetFocusable();
|
unsetFocusable();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FStatusBar::draw()
|
void FStatusBar::draw()
|
||||||
{
|
{
|
||||||
xmin = ymin = 1;
|
|
||||||
height = 1;
|
|
||||||
xpos = 1;
|
|
||||||
drawKeys();
|
drawKeys();
|
||||||
drawMessage();
|
drawMessage();
|
||||||
}
|
}
|
||||||
|
@ -226,15 +224,12 @@ void FStatusBar::draw()
|
||||||
void FStatusBar::drawKeys()
|
void FStatusBar::drawKeys()
|
||||||
{
|
{
|
||||||
std::vector<FStatusKey*>::const_iterator iter, end;
|
std::vector<FStatusKey*>::const_iterator iter, end;
|
||||||
int screenWidth, lastLine;
|
int screenWidth;
|
||||||
|
|
||||||
if ( ! vstatusbar )
|
if ( ! vstatusbar )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
screenWidth = getColumnNumber();
|
screenWidth = getColumnNumber();
|
||||||
lastLine = getLineNumber();
|
|
||||||
width = screenWidth;
|
|
||||||
ypos = lastLine;
|
|
||||||
x = 1;
|
x = 1;
|
||||||
|
|
||||||
if ( keylist.empty() )
|
if ( keylist.empty() )
|
||||||
|
@ -244,7 +239,7 @@ void FStatusBar::drawKeys()
|
||||||
}
|
}
|
||||||
|
|
||||||
updateVTerm(false);
|
updateVTerm(false);
|
||||||
gotoxy (1, lastLine);
|
printPos (1, 1);
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
@ -535,7 +530,7 @@ void FStatusBar::onMouseMove (FMouseEvent* ev)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FStatusBar::hide()
|
void FStatusBar::hide()
|
||||||
{
|
{
|
||||||
int lastLine, screenWidth;
|
int screenWidth;
|
||||||
short fg, bg;
|
short fg, bg;
|
||||||
char* blank;
|
char* blank;
|
||||||
|
|
||||||
|
@ -543,27 +538,19 @@ void FStatusBar::hide()
|
||||||
fg = wc.term_fg;
|
fg = wc.term_fg;
|
||||||
bg = wc.term_bg;
|
bg = wc.term_bg;
|
||||||
setColor (fg, bg);
|
setColor (fg, bg);
|
||||||
lastLine = getLineNumber();
|
|
||||||
screenWidth = getColumnNumber();
|
screenWidth = getColumnNumber();
|
||||||
|
|
||||||
|
if ( screenWidth < 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
blank = new char[screenWidth+1];
|
blank = new char[screenWidth+1];
|
||||||
memset(blank, ' ', uLong(screenWidth));
|
memset(blank, ' ', uLong(screenWidth));
|
||||||
blank[screenWidth] = '\0';
|
blank[screenWidth] = '\0';
|
||||||
gotoxy (1, lastLine);
|
printPos (1, 1);
|
||||||
print (vstatusbar, blank);
|
print (vstatusbar, blank);
|
||||||
delete[] blank;
|
delete[] blank;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
void FStatusBar::setGeometry (int xx, int yy, int ww, int hh, bool adjust)
|
|
||||||
{
|
|
||||||
int old_width = width;
|
|
||||||
int old_height = height;
|
|
||||||
FWidget::setGeometry (xx, yy, ww, hh, adjust);
|
|
||||||
|
|
||||||
if ( vstatusbar && (width != old_width || height != old_height) )
|
|
||||||
resizeArea (vstatusbar);
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FStatusBar::hasActivatedKey()
|
bool FStatusBar::hasActivatedKey()
|
||||||
{
|
{
|
||||||
|
@ -588,7 +575,7 @@ bool FStatusBar::hasActivatedKey()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FStatusBar::drawMessage()
|
void FStatusBar::drawMessage()
|
||||||
{
|
{
|
||||||
int termWidth, lastLine, space_offset;
|
int termWidth, space_offset;
|
||||||
bool isLastActiveFocus, hasKeys;
|
bool isLastActiveFocus, hasKeys;
|
||||||
|
|
||||||
if ( ! (isVisible() && vstatusbar) )
|
if ( ! (isVisible() && vstatusbar) )
|
||||||
|
@ -599,7 +586,6 @@ void FStatusBar::drawMessage()
|
||||||
|
|
||||||
x = x_msg;
|
x = x_msg;
|
||||||
termWidth = getColumnNumber();
|
termWidth = getColumnNumber();
|
||||||
lastLine = getLineNumber();
|
|
||||||
space_offset = 1;
|
space_offset = 1;
|
||||||
hasKeys = bool(! keylist.empty());
|
hasKeys = bool(! keylist.empty());
|
||||||
|
|
||||||
|
@ -617,7 +603,7 @@ void FStatusBar::drawMessage()
|
||||||
|
|
||||||
updateVTerm(false);
|
updateVTerm(false);
|
||||||
setColor (wc.statusbar_fg, wc.statusbar_bg);
|
setColor (wc.statusbar_fg, wc.statusbar_bg);
|
||||||
gotoxy (x, lastLine);
|
printPos (x, 1);
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
@ -739,11 +725,7 @@ void FStatusBar::clear()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FStatusBar::adjustSize()
|
void FStatusBar::adjustSize()
|
||||||
{
|
{
|
||||||
xmin = ymin = 1;
|
setGeometry (1, getLineNumber(), getColumnNumber(), 1, false);
|
||||||
height = 1;
|
|
||||||
xpos = 1;
|
|
||||||
width = getColumnNumber();
|
|
||||||
ypos = getLineNumber();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -168,9 +168,6 @@ class FStatusBar : public FWindow
|
||||||
void onMouseUp (FMouseEvent*);
|
void onMouseUp (FMouseEvent*);
|
||||||
void onMouseMove (FMouseEvent*);
|
void onMouseMove (FMouseEvent*);
|
||||||
void hide();
|
void hide();
|
||||||
// make every setGeometry from FWidget available
|
|
||||||
using FWidget::setGeometry;
|
|
||||||
void setGeometry (int, int, int, int, bool = true);
|
|
||||||
|
|
||||||
uInt count() const;
|
uInt count() const;
|
||||||
FStatusKey* key (int) const;
|
FStatusKey* key (int) const;
|
||||||
|
|
|
@ -54,7 +54,7 @@ void FSwitch::drawCheckButton()
|
||||||
|
|
||||||
wchar_t on[6] = L" On ";
|
wchar_t on[6] = L" On ";
|
||||||
wchar_t off[6] = L" Off ";
|
wchar_t off[6] = L" Off ";
|
||||||
gotoxy (xpos+xmin-1+switch_offset_pos, ypos+ymin-1);
|
printPos (1 + switch_offset_pos, 1);
|
||||||
|
|
||||||
if ( checked )
|
if ( checked )
|
||||||
{
|
{
|
||||||
|
@ -98,8 +98,7 @@ void FSwitch::drawCheckButton()
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(false);
|
setReverse(false);
|
||||||
|
|
||||||
setCursorPos ( xpos + xmin + 1 + switch_offset_pos
|
setCursorPos (3 + switch_offset_pos, 1);
|
||||||
, ypos + ymin - 1 );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -141,8 +140,7 @@ void FSwitch::drawCheckButton()
|
||||||
if ( isMonochron() || getMaxColor() < 16 )
|
if ( isMonochron() || getMaxColor() < 16 )
|
||||||
setBold(false);
|
setBold(false);
|
||||||
|
|
||||||
setCursorPos ( xpos + xmin + 5 + switch_offset_pos
|
setCursorPos (7 + switch_offset_pos, 1);
|
||||||
, ypos + ymin - 1 );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2374,14 +2374,14 @@ void FTerm::restoreVTerm (int x, int y, int w, int h)
|
||||||
while ( iter != end )
|
while ( iter != end )
|
||||||
{
|
{
|
||||||
term_area* win = (*iter)->getVWin();
|
term_area* win = (*iter)->getVWin();
|
||||||
const FRect& geometry = (*iter)->getGeometryGlobalShadow();
|
const FRect& geometry = (*iter)->getTermGeometryWithShadow();
|
||||||
|
|
||||||
// window visible and contains current character
|
// window visible and contains current character
|
||||||
if ( win && win->visible && geometry.contains(tx+x+1, ty+y+1) )
|
if ( win && win->visible && geometry.contains(tx+x+1, ty+y+1) )
|
||||||
{
|
{
|
||||||
FOptiAttr::char_data* tmp;
|
FOptiAttr::char_data* tmp;
|
||||||
int win_x = (*iter)->getGlobalX() - 1;
|
int win_x = (*iter)->getTermX() - 1;
|
||||||
int win_y = (*iter)->getGlobalY() - 1;
|
int win_y = (*iter)->getTermY() - 1;
|
||||||
int line_len = win->width + win->right_shadow;
|
int line_len = win->width + win->right_shadow;
|
||||||
tmp = &win->text[(ty+y-win_y) * line_len + (tx+x-win_x)];
|
tmp = &win->text[(ty+y-win_y) * line_len + (tx+x-win_x)];
|
||||||
|
|
||||||
|
@ -2426,10 +2426,10 @@ void FTerm::restoreVTerm (int x, int y, int w, int h)
|
||||||
menubar = reinterpret_cast<FWidget*>(FWidget::menuBar());
|
menubar = reinterpret_cast<FWidget*>(FWidget::menuBar());
|
||||||
|
|
||||||
if ( vmenubar && menubar
|
if ( vmenubar && menubar
|
||||||
&& menubar->getGeometryGlobal().contains(x+tx+1, y+ty+1) )
|
&& menubar->getTermGeometry().contains(x+tx+1, y+ty+1) )
|
||||||
{
|
{
|
||||||
int bar_x = menubar->getGlobalX() - 1;
|
int bar_x = menubar->getTermX() - 1;
|
||||||
int bar_y = menubar->getGlobalY() - 1;
|
int bar_y = menubar->getTermY() - 1;
|
||||||
|
|
||||||
if ( vmenubar->visible )
|
if ( vmenubar->visible )
|
||||||
sc = &vmenubar->text[(y+ty-bar_y) * vmenubar->width + (x+tx-bar_x)];
|
sc = &vmenubar->text[(y+ty-bar_y) * vmenubar->width + (x+tx-bar_x)];
|
||||||
|
@ -2440,10 +2440,10 @@ void FTerm::restoreVTerm (int x, int y, int w, int h)
|
||||||
statusbar = reinterpret_cast<FWidget*>(FWidget::statusBar());
|
statusbar = reinterpret_cast<FWidget*>(FWidget::statusBar());
|
||||||
|
|
||||||
if ( vstatusbar && statusbar
|
if ( vstatusbar && statusbar
|
||||||
&& statusbar->getGeometryGlobal().contains(x+tx+1, y+ty+1) )
|
&& statusbar->getTermGeometry().contains(x+tx+1, y+ty+1) )
|
||||||
{
|
{
|
||||||
int bar_x = statusbar->getGlobalX() - 1;
|
int bar_x = statusbar->getTermX() - 1;
|
||||||
int bar_y = statusbar->getGlobalY() - 1;
|
int bar_y = statusbar->getTermY() - 1;
|
||||||
|
|
||||||
if ( vstatusbar->visible )
|
if ( vstatusbar->visible )
|
||||||
sc = &vstatusbar->text[(y+ty-bar_y) * vstatusbar->width + (x+tx-bar_x)];
|
sc = &vstatusbar->text[(y+ty-bar_y) * vstatusbar->width + (x+tx-bar_x)];
|
||||||
|
@ -2486,7 +2486,7 @@ FTerm::covered_state FTerm::isCovered (int x, int y, FTerm::term_area* area) con
|
||||||
while ( iter != end )
|
while ( iter != end )
|
||||||
{
|
{
|
||||||
term_area* win = (*iter)->getVWin();
|
term_area* win = (*iter)->getVWin();
|
||||||
const FRect& geometry = (*iter)->getGeometryGlobalShadow();
|
const FRect& geometry = (*iter)->getTermGeometryWithShadow();
|
||||||
|
|
||||||
if ( win && found
|
if ( win && found
|
||||||
&& (*iter)->isVisible()
|
&& (*iter)->isVisible()
|
||||||
|
@ -2494,8 +2494,8 @@ FTerm::covered_state FTerm::isCovered (int x, int y, FTerm::term_area* area) con
|
||||||
&& geometry.contains(x,y) )
|
&& geometry.contains(x,y) )
|
||||||
{
|
{
|
||||||
FOptiAttr::char_data* tmp;
|
FOptiAttr::char_data* tmp;
|
||||||
int win_x = (*iter)->getGlobalX() - 1;
|
int win_x = (*iter)->getTermX() - 1;
|
||||||
int win_y = (*iter)->getGlobalY() - 1;
|
int win_y = (*iter)->getTermY() - 1;
|
||||||
int line_len = win->width + win->right_shadow;
|
int line_len = win->width + win->right_shadow;
|
||||||
tmp = &win->text[(y-win_y-1) * line_len + (x-win_x-1)];
|
tmp = &win->text[(y-win_y-1) * line_len + (x-win_x-1)];
|
||||||
|
|
||||||
|
@ -2526,7 +2526,7 @@ FTerm::covered_state FTerm::isCovered (int x, int y, FTerm::term_area* area) con
|
||||||
menubar = 0;
|
menubar = 0;
|
||||||
|
|
||||||
if ( area != vmenubar && menubar
|
if ( area != vmenubar && menubar
|
||||||
&& menubar->getGeometryGlobal().contains(x,y) )
|
&& menubar->getTermGeometry().contains(x,y) )
|
||||||
{
|
{
|
||||||
is_covered = fully_covered;
|
is_covered = fully_covered;
|
||||||
}
|
}
|
||||||
|
@ -2540,7 +2540,7 @@ FTerm::covered_state FTerm::isCovered (int x, int y, FTerm::term_area* area) con
|
||||||
statusbar = 0;
|
statusbar = 0;
|
||||||
|
|
||||||
if ( area != vstatusbar && statusbar
|
if ( area != vstatusbar && statusbar
|
||||||
&& statusbar->getGeometryGlobal().contains(x,y) )
|
&& statusbar->getTermGeometry().contains(x,y) )
|
||||||
{
|
{
|
||||||
is_covered = fully_covered;
|
is_covered = fully_covered;
|
||||||
}
|
}
|
||||||
|
@ -2568,8 +2568,8 @@ void FTerm::updateVTerm (FTerm::term_area* area)
|
||||||
if ( ! area->visible )
|
if ( ! area->visible )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ax = area->widget->getGlobalX() - 1;
|
ax = area->widget->getTermX() - 1;
|
||||||
ay = area->widget->getGlobalY() - 1;
|
ay = area->widget->getTermY() - 1;
|
||||||
aw = area->width;
|
aw = area->width;
|
||||||
ah = area->height;
|
ah = area->height;
|
||||||
rsh = area->right_shadow;
|
rsh = area->right_shadow;
|
||||||
|
@ -2609,7 +2609,8 @@ void FTerm::updateVTerm (FTerm::term_area* area)
|
||||||
{
|
{
|
||||||
int gx, gy, line_len;
|
int gx, gy, line_len;
|
||||||
FTerm::covered_state is_covered;
|
FTerm::covered_state is_covered;
|
||||||
gx = ax + x; // global position
|
// global terminal positions
|
||||||
|
gx = ax + x;
|
||||||
gy = ay + y;
|
gy = ay + y;
|
||||||
|
|
||||||
if ( gx < 0 || gy < 0 )
|
if ( gx < 0 || gy < 0 )
|
||||||
|
@ -2761,8 +2762,8 @@ void FTerm::getArea (int x, int y, int w, int h, FTerm::term_area* area)
|
||||||
if ( ! area )
|
if ( ! area )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dx = x - area->widget->getGlobalX();
|
dx = x - area->widget->getTermX();
|
||||||
dy = y - area->widget->getGlobalY();
|
dy = y - area->widget->getTermY();
|
||||||
|
|
||||||
if ( x < 0 || y < 0 )
|
if ( x < 0 || y < 0 )
|
||||||
return;
|
return;
|
||||||
|
@ -3071,14 +3072,14 @@ FOptiAttr::char_data FTerm::getCharacter ( int char_type
|
||||||
if ( obj && *iter != obj && significant_char )
|
if ( obj && *iter != obj && significant_char )
|
||||||
{
|
{
|
||||||
term_area* win = (*iter)->getVWin();
|
term_area* win = (*iter)->getVWin();
|
||||||
const FRect& geometry = (*iter)->getGeometryGlobalShadow();
|
const FRect& geometry = (*iter)->getTermGeometryWithShadow();
|
||||||
|
|
||||||
// window visible and contains current character
|
// window visible and contains current character
|
||||||
if ( win && win->visible && geometry.contains(x+1,y+1) )
|
if ( win && win->visible && geometry.contains(x+1,y+1) )
|
||||||
{
|
{
|
||||||
FOptiAttr::char_data* tmp;
|
FOptiAttr::char_data* tmp;
|
||||||
int win_x = (*iter)->getGlobalX() - 1;
|
int win_x = (*iter)->getTermX() - 1;
|
||||||
int win_y = (*iter)->getGlobalY() - 1;
|
int win_y = (*iter)->getTermY() - 1;
|
||||||
int line_len = win->width + win->right_shadow;
|
int line_len = win->width + win->right_shadow;
|
||||||
tmp = &win->text[(y-win_y) * line_len + (x-win_x)];
|
tmp = &win->text[(y-win_y) * line_len + (x-win_x)];
|
||||||
|
|
||||||
|
@ -4107,6 +4108,7 @@ bool FTerm::hideCursor (bool on)
|
||||||
{
|
{
|
||||||
if ( vi )
|
if ( vi )
|
||||||
appendOutputBuffer (vi);
|
appendOutputBuffer (vi);
|
||||||
|
|
||||||
hiddenCursor = true; // global
|
hiddenCursor = true; // global
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -4118,6 +4120,7 @@ bool FTerm::hideCursor (bool on)
|
||||||
|
|
||||||
hiddenCursor = false;
|
hiddenCursor = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
flush_out();
|
flush_out();
|
||||||
|
|
||||||
if ( ! hiddenCursor && linux_terminal )
|
if ( ! hiddenCursor && linux_terminal )
|
||||||
|
@ -4135,6 +4138,8 @@ bool FTerm::isCursorInside()
|
||||||
|
|
||||||
int x = w->getCursorPos().getX();
|
int x = w->getCursorPos().getX();
|
||||||
int y = w->getCursorPos().getY();
|
int y = w->getCursorPos().getY();
|
||||||
|
x += w->getTermX() - 1;
|
||||||
|
y += w->getTermY() - 1;
|
||||||
|
|
||||||
if ( term->contains(x,y) )
|
if ( term->contains(x,y) )
|
||||||
return true;
|
return true;
|
||||||
|
@ -4573,8 +4578,8 @@ int FTerm::print (FTerm::term_area* area, FString& s)
|
||||||
nc.trans_shadow = next_attribute.trans_shadow;
|
nc.trans_shadow = next_attribute.trans_shadow;
|
||||||
nc.inherit_bg = next_attribute.inherit_bg;
|
nc.inherit_bg = next_attribute.inherit_bg;
|
||||||
|
|
||||||
int ax = x - area_widget->getGlobalX();
|
int ax = x - area_widget->getTermX();
|
||||||
int ay = y - area_widget->getGlobalY();
|
int ay = y - area_widget->getTermY();
|
||||||
|
|
||||||
if ( area
|
if ( area
|
||||||
&& ax >= 0 && ay >= 0
|
&& ax >= 0 && ay >= 0
|
||||||
|
@ -4619,11 +4624,11 @@ int FTerm::print (FTerm::term_area* area, FString& s)
|
||||||
|
|
||||||
rsh = area->right_shadow;
|
rsh = area->right_shadow;
|
||||||
bsh = area->bottom_shadow;
|
bsh = area->bottom_shadow;
|
||||||
const FRect& area_geometry = area_widget->getGeometryGlobal();
|
const FRect& area_geometry = area_widget->getTermGeometry();
|
||||||
|
|
||||||
if ( cursor->x_ref() > area_geometry.getX2()+rsh )
|
if ( cursor->x_ref() > area_geometry.getX2()+rsh )
|
||||||
{
|
{
|
||||||
cursor->x_ref() = short(area_widget->getGlobalX());
|
cursor->x_ref() = short(area_widget->getTermX());
|
||||||
cursor->y_ref()++;
|
cursor->y_ref()++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4701,8 +4706,8 @@ int FTerm::print (FTerm::term_area* area, register int c)
|
||||||
if ( ! area_widget )
|
if ( ! area_widget )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
ax = x - area_widget->getGlobalX();
|
ax = x - area_widget->getTermX();
|
||||||
ay = y - area_widget->getGlobalY();
|
ay = y - area_widget->getTermY();
|
||||||
|
|
||||||
if ( ax >= 0 && ay >= 0
|
if ( ax >= 0 && ay >= 0
|
||||||
&& ax < area->width + area->right_shadow
|
&& ax < area->width + area->right_shadow
|
||||||
|
@ -4744,11 +4749,11 @@ int FTerm::print (FTerm::term_area* area, register int c)
|
||||||
cursor->x_ref()++;
|
cursor->x_ref()++;
|
||||||
rsh = area->right_shadow;
|
rsh = area->right_shadow;
|
||||||
bsh = area->bottom_shadow;
|
bsh = area->bottom_shadow;
|
||||||
const FRect& area_geometry = area_widget->getGeometryGlobal();
|
const FRect& area_geometry = area_widget->getTermGeometry();
|
||||||
|
|
||||||
if ( cursor->x_ref() > area_geometry.getX2()+rsh )
|
if ( cursor->x_ref() > area_geometry.getX2()+rsh )
|
||||||
{
|
{
|
||||||
cursor->x_ref() = short(area_widget->getGlobalX());
|
cursor->x_ref() = short(area_widget->getTermX());
|
||||||
cursor->y_ref()++;
|
cursor->y_ref()++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
10
src/fterm.h
10
src/fterm.h
|
@ -410,6 +410,8 @@ class FTerm
|
||||||
static FString getAnswerbackMsg();
|
static FString getAnswerbackMsg();
|
||||||
static FString getSecDA();
|
static FString getSecDA();
|
||||||
|
|
||||||
|
static void printPosTerm (const FPoint&);
|
||||||
|
static void printPosTerm (register int, register int);
|
||||||
int printf (const wchar_t*, ...);
|
int printf (const wchar_t*, ...);
|
||||||
int printf (const char*, ...)
|
int printf (const char*, ...)
|
||||||
#if defined(__clang__)
|
#if defined(__clang__)
|
||||||
|
@ -656,5 +658,13 @@ inline bool FTerm::unsetRawMode()
|
||||||
inline bool FTerm::setCookedMode()
|
inline bool FTerm::setCookedMode()
|
||||||
{ return setRawMode(false); }
|
{ return setRawMode(false); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTerm::printPosTerm (const FPoint& pos)
|
||||||
|
{ printPosTerm (pos.getX(), pos.getY()); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTerm::printPosTerm (register int x, register int y)
|
||||||
|
{ cursor->setPoint(x,y); }
|
||||||
|
|
||||||
|
|
||||||
#endif // _FTERM_H
|
#endif // _FTERM_H
|
||||||
|
|
|
@ -37,8 +37,8 @@ void FTextView::init()
|
||||||
{
|
{
|
||||||
nf_offset = isNewFont() ? 1 : 0;
|
nf_offset = isNewFont() ? 1 : 0;
|
||||||
|
|
||||||
foregroundColor = wc.dialog_fg;
|
setForegroundColor (wc.dialog_fg);
|
||||||
backgroundColor = wc.dialog_bg;
|
setBackgroundColor (wc.dialog_bg);
|
||||||
|
|
||||||
VBar = new FScrollbar(fc::vertical, this);
|
VBar = new FScrollbar(fc::vertical, this);
|
||||||
VBar->setMinimum(0);
|
VBar->setMinimum(0);
|
||||||
|
@ -66,7 +66,7 @@ void FTextView::init()
|
||||||
void FTextView::draw()
|
void FTextView::draw()
|
||||||
{
|
{
|
||||||
updateVTerm(false);
|
updateVTerm(false);
|
||||||
setColor (foregroundColor, backgroundColor);
|
setColor();
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
@ -100,7 +100,7 @@ void FTextView::draw()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setCursorPos(1,1);
|
setCursorPos (getWidth(), getHeight());
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
flush_out();
|
flush_out();
|
||||||
}
|
}
|
||||||
|
@ -110,17 +110,17 @@ void FTextView::drawText()
|
||||||
{
|
{
|
||||||
uInt start, end;
|
uInt start, end;
|
||||||
|
|
||||||
if ( data.empty() || height < 4 || width < 5 )
|
if ( data.empty() || getHeight() < 4 || getWidth() < 5 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
start = 0;
|
start = 0;
|
||||||
end = uInt(height+nf_offset-2);
|
end = uInt(getHeight() + nf_offset - 2);
|
||||||
|
|
||||||
if ( end > getRows() )
|
if ( end > getRows() )
|
||||||
end = getRows();
|
end = getRows();
|
||||||
|
|
||||||
updateVTerm(false);
|
updateVTerm(false);
|
||||||
setColor (foregroundColor, backgroundColor);
|
setColor();
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
@ -130,9 +130,9 @@ void FTextView::drawText()
|
||||||
uInt i, len;
|
uInt i, len;
|
||||||
FString line;
|
FString line;
|
||||||
const wchar_t* line_str;
|
const wchar_t* line_str;
|
||||||
gotoxy (xpos+xmin, ypos+ymin-nf_offset+int(y));
|
printPos (2, 2 - nf_offset + int(y));
|
||||||
line = data[y+uInt(yoffset)].mid ( uInt(1 + xoffset)
|
line = data[y+uInt(yoffset)].mid ( uInt(1 + xoffset)
|
||||||
, uInt(width - nf_offset - 2) );
|
, uInt(getWidth() - nf_offset - 2) );
|
||||||
line_str = line.wc_str();
|
line_str = line.wc_str();
|
||||||
len = line.getLength();
|
len = line.getLength();
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ void FTextView::drawText()
|
||||||
print ('.');
|
print ('.');
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; i < uInt(width - nf_offset - 2); i++)
|
for (; i < uInt(getWidth() - nf_offset - 2); i++)
|
||||||
print (' ');
|
print (' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,25 +173,43 @@ void FTextView::processChanged()
|
||||||
void FTextView::adjustSize()
|
void FTextView::adjustSize()
|
||||||
{
|
{
|
||||||
FWidget::adjustSize();
|
FWidget::adjustSize();
|
||||||
|
int width = getWidth();
|
||||||
|
int height = getHeight();
|
||||||
|
int last_line = int(getRows());
|
||||||
|
int max_width = int(maxLineWidth);
|
||||||
|
|
||||||
VBar->setMaximum (int(getRows()) - height + 2 - nf_offset);
|
if ( xoffset > max_width - width - nf_offset - 1 )
|
||||||
VBar->setPageSize (int(getRows()), height - 2 + nf_offset);
|
xoffset = max_width - width - nf_offset - 1;
|
||||||
|
|
||||||
|
if ( xoffset < 0 )
|
||||||
|
xoffset = 0;
|
||||||
|
|
||||||
|
if ( yoffset > last_line - height - nf_offset + 2 )
|
||||||
|
yoffset = last_line - height - nf_offset + 2;
|
||||||
|
|
||||||
|
if ( yoffset < 0 )
|
||||||
|
yoffset = 0;
|
||||||
|
|
||||||
|
VBar->setMaximum (last_line - height + 2 - nf_offset);
|
||||||
|
VBar->setPageSize (last_line, height - 2 + nf_offset);
|
||||||
VBar->setX (width);
|
VBar->setX (width);
|
||||||
VBar->setHeight (height - 2 + nf_offset, false);
|
VBar->setHeight (height - 2 + nf_offset, false);
|
||||||
|
VBar->setValue (yoffset);
|
||||||
VBar->resize();
|
VBar->resize();
|
||||||
|
|
||||||
HBar->setMaximum (int(maxLineWidth) - width + nf_offset + 2);
|
HBar->setMaximum (max_width - width + nf_offset + 2);
|
||||||
HBar->setPageSize (int(maxLineWidth), width - nf_offset - 2);
|
HBar->setPageSize (max_width, width - nf_offset - 2);
|
||||||
HBar->setY (height);
|
HBar->setY (height);
|
||||||
HBar->setWidth (width - 2, false);
|
HBar->setWidth (width - 2, false);
|
||||||
|
HBar->setValue (xoffset);
|
||||||
HBar->resize();
|
HBar->resize();
|
||||||
|
|
||||||
if ( int(getRows()) < height + nf_offset - 1 )
|
if ( last_line < height + nf_offset - 1 )
|
||||||
VBar->hide();
|
VBar->hide();
|
||||||
else
|
else
|
||||||
VBar->setVisible();
|
VBar->setVisible();
|
||||||
|
|
||||||
if ( int(maxLineWidth) < width-nf_offset - 1 )
|
if ( max_width < width - nf_offset - 1 )
|
||||||
HBar->hide();
|
HBar->hide();
|
||||||
else
|
else
|
||||||
HBar->setVisible();
|
HBar->setVisible();
|
||||||
|
@ -222,14 +240,18 @@ void FTextView::hide()
|
||||||
|
|
||||||
setColor (fg, bg);
|
setColor (fg, bg);
|
||||||
n = isNewFont() ? 1 : 0;
|
n = isNewFont() ? 1 : 0;
|
||||||
size = width + n;
|
size = getWidth() + n;
|
||||||
|
|
||||||
|
if ( size < 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
blank = new char[size+1];
|
blank = new char[size+1];
|
||||||
memset(blank, ' ', uLong(size));
|
memset(blank, ' ', uLong(size));
|
||||||
blank[size] = '\0';
|
blank[size] = '\0';
|
||||||
|
|
||||||
for (int y=0; y < height; y++)
|
for (int y=0; y < getHeight(); y++)
|
||||||
{
|
{
|
||||||
gotoxy (xpos+xmin-1, ypos+ymin-1+y);
|
printPos (1, 1 + y);
|
||||||
print (blank);
|
print (blank);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,14 +275,14 @@ void FTextView::onKeyPress (FKeyEvent* ev)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_down:
|
case fc::Fkey_down:
|
||||||
if ( yoffset + height + nf_offset <= last_line + 1 )
|
if ( yoffset + getHeight() + nf_offset <= last_line + 1 )
|
||||||
yoffset++;
|
yoffset++;
|
||||||
|
|
||||||
ev->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_right:
|
case fc::Fkey_right:
|
||||||
if ( xoffset + width - nf_offset <= int(maxLineWidth) + 1 )
|
if ( xoffset + getWidth() - nf_offset <= int(maxLineWidth) + 1 )
|
||||||
xoffset++;
|
xoffset++;
|
||||||
|
|
||||||
ev->accept();
|
ev->accept();
|
||||||
|
@ -274,7 +296,7 @@ void FTextView::onKeyPress (FKeyEvent* ev)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_ppage:
|
case fc::Fkey_ppage:
|
||||||
yoffset -= height-2;
|
yoffset -= getHeight()-2;
|
||||||
|
|
||||||
if ( yoffset < 0 )
|
if ( yoffset < 0 )
|
||||||
yoffset = 0;
|
yoffset = 0;
|
||||||
|
@ -283,11 +305,11 @@ void FTextView::onKeyPress (FKeyEvent* ev)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_npage:
|
case fc::Fkey_npage:
|
||||||
if ( last_line >= height )
|
if ( last_line >= getHeight() )
|
||||||
yoffset += height-2;
|
yoffset += getHeight()-2;
|
||||||
|
|
||||||
if ( yoffset > last_line - height - nf_offset + 2 )
|
if ( yoffset > last_line - getHeight() - nf_offset + 2 )
|
||||||
yoffset = last_line - height - nf_offset + 2;
|
yoffset = last_line - getHeight() - nf_offset + 2;
|
||||||
|
|
||||||
if ( yoffset < 0 )
|
if ( yoffset < 0 )
|
||||||
yoffset = 0;
|
yoffset = 0;
|
||||||
|
@ -301,8 +323,8 @@ void FTextView::onKeyPress (FKeyEvent* ev)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_end:
|
case fc::Fkey_end:
|
||||||
if ( last_line >= height )
|
if ( last_line >= getHeight() )
|
||||||
yoffset = last_line - height - nf_offset + 2;
|
yoffset = last_line - getHeight() - nf_offset + 2;
|
||||||
|
|
||||||
ev->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
@ -373,7 +395,7 @@ void FTextView::onWheel (FWheelEvent* ev)
|
||||||
|
|
||||||
case fc::WheelDown:
|
case fc::WheelDown:
|
||||||
{
|
{
|
||||||
int yoffset_end = last_line - height - nf_offset + 2;
|
int yoffset_end = last_line - getHeight() - nf_offset + 2;
|
||||||
|
|
||||||
if ( yoffset_end < 0 )
|
if ( yoffset_end < 0 )
|
||||||
yoffset_end = 0;
|
yoffset_end = 0;
|
||||||
|
@ -436,7 +458,7 @@ void FTextView::cb_VBarChange (FWidget*, void*)
|
||||||
switch ( scrollType )
|
switch ( scrollType )
|
||||||
{
|
{
|
||||||
case FScrollbar::scrollPageBackward:
|
case FScrollbar::scrollPageBackward:
|
||||||
distance = height+nf_offset-2;
|
distance = getHeight() + nf_offset - 2;
|
||||||
// fall through
|
// fall through
|
||||||
case FScrollbar::scrollStepBackward:
|
case FScrollbar::scrollStepBackward:
|
||||||
yoffset -= distance;
|
yoffset -= distance;
|
||||||
|
@ -447,13 +469,13 @@ void FTextView::cb_VBarChange (FWidget*, void*)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FScrollbar::scrollPageForward:
|
case FScrollbar::scrollPageForward:
|
||||||
distance = height+nf_offset-2;
|
distance = getHeight() + nf_offset - 2;
|
||||||
// fall through
|
// fall through
|
||||||
case FScrollbar::scrollStepForward:
|
case FScrollbar::scrollStepForward:
|
||||||
yoffset += distance;
|
yoffset += distance;
|
||||||
|
|
||||||
if ( yoffset > last_line - height - nf_offset + 2 )
|
if ( yoffset > last_line - getHeight() - nf_offset + 2 )
|
||||||
yoffset = last_line - height - nf_offset + 2;
|
yoffset = last_line - getHeight() - nf_offset + 2;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -466,8 +488,8 @@ void FTextView::cb_VBarChange (FWidget*, void*)
|
||||||
|
|
||||||
yoffset = val;
|
yoffset = val;
|
||||||
|
|
||||||
if ( yoffset > last_line - height - nf_offset + 2 )
|
if ( yoffset > last_line - getHeight() - nf_offset + 2 )
|
||||||
yoffset = last_line - height - nf_offset + 2;
|
yoffset = last_line - getHeight() - nf_offset + 2;
|
||||||
|
|
||||||
if ( yoffset < 0 )
|
if ( yoffset < 0 )
|
||||||
yoffset = 0;
|
yoffset = 0;
|
||||||
|
@ -516,13 +538,13 @@ void FTextView::cb_HBarChange (FWidget*, void*)
|
||||||
{
|
{
|
||||||
int distance = 1;
|
int distance = 1;
|
||||||
int xoffset_before = xoffset;
|
int xoffset_before = xoffset;
|
||||||
int xoffset_end = int(maxLineWidth) - width + nf_offset + 4;
|
int xoffset_end = int(maxLineWidth) - getWidth() + nf_offset + 4;
|
||||||
int scrollType = HBar->getScrollType();
|
int scrollType = HBar->getScrollType();
|
||||||
|
|
||||||
switch ( scrollType )
|
switch ( scrollType )
|
||||||
{
|
{
|
||||||
case FScrollbar::scrollPageBackward:
|
case FScrollbar::scrollPageBackward:
|
||||||
distance = width - nf_offset - 4;
|
distance = getWidth() - nf_offset - 4;
|
||||||
// fall through
|
// fall through
|
||||||
case FScrollbar::scrollStepBackward:
|
case FScrollbar::scrollStepBackward:
|
||||||
xoffset -= distance;
|
xoffset -= distance;
|
||||||
|
@ -533,13 +555,13 @@ void FTextView::cb_HBarChange (FWidget*, void*)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FScrollbar::scrollPageForward:
|
case FScrollbar::scrollPageForward:
|
||||||
distance = width - nf_offset - 4;
|
distance = getWidth() - nf_offset - 4;
|
||||||
// fall through
|
// fall through
|
||||||
case FScrollbar::scrollStepForward:
|
case FScrollbar::scrollStepForward:
|
||||||
xoffset += distance;
|
xoffset += distance;
|
||||||
|
|
||||||
if ( xoffset > int(maxLineWidth) - width + nf_offset + 4 )
|
if ( xoffset > int(maxLineWidth) - getWidth() + nf_offset + 4 )
|
||||||
xoffset = int(maxLineWidth) - width + nf_offset + 4;
|
xoffset = int(maxLineWidth) - getWidth() + nf_offset + 4;
|
||||||
|
|
||||||
if ( xoffset < 0 )
|
if ( xoffset < 0 )
|
||||||
xoffset = 0;
|
xoffset = 0;
|
||||||
|
@ -555,8 +577,8 @@ void FTextView::cb_HBarChange (FWidget*, void*)
|
||||||
|
|
||||||
xoffset = val;
|
xoffset = val;
|
||||||
|
|
||||||
if ( xoffset > int(maxLineWidth) - width + nf_offset + 4 )
|
if ( xoffset > int(maxLineWidth) - getWidth() + nf_offset + 4 )
|
||||||
xoffset = int(maxLineWidth) - width + nf_offset + 4;
|
xoffset = int(maxLineWidth) - getWidth() + nf_offset + 4;
|
||||||
|
|
||||||
if ( xoffset < 0 )
|
if ( xoffset < 0 )
|
||||||
xoffset = 0;
|
xoffset = 0;
|
||||||
|
@ -612,6 +634,8 @@ void FTextView::cb_HBarChange (FWidget*, void*)
|
||||||
void FTextView::setGeometry (int x, int y, int w, int h, bool adjust)
|
void FTextView::setGeometry (int x, int y, int w, int h, bool adjust)
|
||||||
{
|
{
|
||||||
FWidget::setGeometry(x, y, w, h, adjust);
|
FWidget::setGeometry(x, y, w, h, adjust);
|
||||||
|
int width = getWidth();
|
||||||
|
int height = getHeight();
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
{
|
{
|
||||||
|
@ -623,6 +647,9 @@ void FTextView::setGeometry (int x, int y, int w, int h, bool adjust)
|
||||||
VBar->setGeometry (width, 2, 1, height-2);
|
VBar->setGeometry (width, 2, 1, height-2);
|
||||||
HBar->setGeometry (2, height, width-2, 1);
|
HBar->setGeometry (2, height, width-2, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VBar->resize();
|
||||||
|
HBar->resize();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -630,7 +657,7 @@ void FTextView::setPosition (int pos)
|
||||||
{
|
{
|
||||||
int last_line = int(getRows());
|
int last_line = int(getRows());
|
||||||
|
|
||||||
if ( pos < 0 || pos > last_line - height + 2 )
|
if ( pos < 0 || pos > last_line - getHeight() + 2 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
yoffset = pos;
|
yoffset = pos;
|
||||||
|
@ -728,10 +755,10 @@ void FTextView::insert (const FString& str, int pos)
|
||||||
{
|
{
|
||||||
maxLineWidth = len;
|
maxLineWidth = len;
|
||||||
|
|
||||||
if ( len > uInt(width-nf_offset-2) )
|
if ( len > uInt(getWidth() - nf_offset - 2) )
|
||||||
{
|
{
|
||||||
HBar->setMaximum (int(maxLineWidth) - width + nf_offset + 2);
|
HBar->setMaximum (int(maxLineWidth) - getWidth() + nf_offset + 2);
|
||||||
HBar->setPageSize (int(maxLineWidth), width - nf_offset - 2);
|
HBar->setPageSize (int(maxLineWidth), getWidth() - nf_offset - 2);
|
||||||
HBar->calculateSliderValues();
|
HBar->calculateSliderValues();
|
||||||
|
|
||||||
if ( ! HBar->isVisible() )
|
if ( ! HBar->isVisible() )
|
||||||
|
@ -741,14 +768,14 @@ void FTextView::insert (const FString& str, int pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
data.insert (iter + pos, text_split.begin(), text_split.end());
|
data.insert (iter + pos, text_split.begin(), text_split.end());
|
||||||
VBar->setMaximum (int(getRows()) - height + 2 - nf_offset);
|
VBar->setMaximum (int(getRows()) - getHeight() + 2 - nf_offset);
|
||||||
VBar->setPageSize (int(getRows()), height - 2 + nf_offset);
|
VBar->setPageSize (int(getRows()), getHeight() - 2 + nf_offset);
|
||||||
VBar->calculateSliderValues();
|
VBar->calculateSliderValues();
|
||||||
|
|
||||||
if ( ! VBar->isVisible() && int(getRows()) >= height + nf_offset - 1 )
|
if ( ! VBar->isVisible() && int(getRows()) >= getHeight() + nf_offset - 1 )
|
||||||
VBar->setVisible();
|
VBar->setVisible();
|
||||||
|
|
||||||
if ( VBar->isVisible() && int(getRows()) < height + nf_offset - 1 )
|
if ( VBar->isVisible() && int(getRows()) < getHeight() + nf_offset - 1 )
|
||||||
VBar->hide();
|
VBar->hide();
|
||||||
|
|
||||||
processChanged();
|
processChanged();
|
||||||
|
@ -795,15 +822,19 @@ void FTextView::clear()
|
||||||
HBar->hide();
|
HBar->hide();
|
||||||
|
|
||||||
// clear list from screen
|
// clear list from screen
|
||||||
setColor (foregroundColor, backgroundColor);
|
setColor();
|
||||||
size = width - 2;
|
size = getWidth() - 2;
|
||||||
|
|
||||||
|
if ( size < 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
blank = new char[size+1];
|
blank = new char[size+1];
|
||||||
memset(blank, ' ', uLong(size));
|
memset(blank, ' ', uLong(size));
|
||||||
blank[size] = '\0';
|
blank[size] = '\0';
|
||||||
|
|
||||||
for (int y=0; y < height+nf_offset-2; y++)
|
for (int y=0; y < getHeight() + nf_offset - 2; y++)
|
||||||
{
|
{
|
||||||
gotoxy (xpos+xmin, ypos+ymin-nf_offset+y);
|
printPos (2, 2 - nf_offset + y);
|
||||||
print (blank);
|
print (blank);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,19 +85,19 @@ void FToggleButton::init()
|
||||||
|
|
||||||
if ( hasFocus() )
|
if ( hasFocus() )
|
||||||
{
|
{
|
||||||
foregroundColor = wc.toggle_button_active_focus_fg;
|
setForegroundColor (wc.toggle_button_active_focus_fg);
|
||||||
backgroundColor = wc.toggle_button_active_focus_bg;
|
setBackgroundColor (wc.toggle_button_active_focus_bg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foregroundColor = wc.toggle_button_active_fg;
|
setForegroundColor (wc.toggle_button_active_fg);
|
||||||
backgroundColor = wc.toggle_button_active_bg;
|
setBackgroundColor (wc.toggle_button_active_bg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // inactive
|
else // inactive
|
||||||
{
|
{
|
||||||
foregroundColor = wc.label_inactive_fg;
|
setForegroundColor (wc.label_inactive_fg);
|
||||||
backgroundColor = wc.label_inactive_bg;
|
setBackgroundColor (wc.label_inactive_bg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ void FToggleButton::draw()
|
||||||
// set the cursor to the button
|
// set the cursor to the button
|
||||||
if ( isRadioButton() || isCheckboxButton() )
|
if ( isRadioButton() || isCheckboxButton() )
|
||||||
{
|
{
|
||||||
setCursorPos (xpos+xmin, ypos+ymin-1);
|
setCursorPos (2, 1);
|
||||||
|
|
||||||
if ( isCursorInside() && hasFocus() )
|
if ( isCursorInside() && hasFocus() )
|
||||||
{
|
{
|
||||||
|
@ -232,7 +232,7 @@ void FToggleButton::drawLabel()
|
||||||
if ( hotkeypos != -1 )
|
if ( hotkeypos != -1 )
|
||||||
length--;
|
length--;
|
||||||
|
|
||||||
gotoxy (xpos+xmin-1+label_offset_pos, ypos+ymin-1);
|
printPos (1 + label_offset_pos, 1);
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
@ -381,11 +381,15 @@ void FToggleButton::hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
setColor (fg, bg);
|
setColor (fg, bg);
|
||||||
size = width;
|
size = getWidth();
|
||||||
|
|
||||||
|
if ( size < 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
blank = new char[size+1];
|
blank = new char[size+1];
|
||||||
memset(blank, ' ', uLong(size));
|
memset(blank, ' ', uLong(size));
|
||||||
blank[size] = '\0';
|
blank[size] = '\0';
|
||||||
gotoxy (xpos+xmin-1, ypos+ymin-1);
|
printPos (1, 1);
|
||||||
print (blank);
|
print (blank);
|
||||||
delete[] blank;
|
delete[] blank;
|
||||||
}
|
}
|
||||||
|
@ -424,21 +428,21 @@ bool FToggleButton::setEnable (bool on)
|
||||||
|
|
||||||
if ( hasFocus() )
|
if ( hasFocus() )
|
||||||
{
|
{
|
||||||
foregroundColor = wc.toggle_button_active_focus_fg;
|
setForegroundColor (wc.toggle_button_active_focus_fg);
|
||||||
backgroundColor = wc.toggle_button_active_focus_bg;
|
setBackgroundColor (wc.toggle_button_active_focus_bg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foregroundColor = wc.toggle_button_active_fg;
|
setForegroundColor (wc.toggle_button_active_fg);
|
||||||
backgroundColor = wc.toggle_button_active_bg;
|
setBackgroundColor (wc.toggle_button_active_bg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flags &= ~fc::active;
|
flags &= ~fc::active;
|
||||||
delAccelerator();
|
delAccelerator();
|
||||||
foregroundColor = wc.toggle_button_inactive_fg;
|
setForegroundColor (wc.toggle_button_inactive_fg);
|
||||||
backgroundColor = wc.toggle_button_inactive_bg;
|
setBackgroundColor (wc.toggle_button_inactive_bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
return on;
|
return on;
|
||||||
|
@ -458,8 +462,8 @@ bool FToggleButton::setFocus (bool on)
|
||||||
if ( isRadioButton() )
|
if ( isRadioButton() )
|
||||||
focus_inside_group = false;
|
focus_inside_group = false;
|
||||||
|
|
||||||
foregroundColor = wc.toggle_button_active_focus_fg;
|
setForegroundColor (wc.toggle_button_active_focus_fg);
|
||||||
backgroundColor = wc.toggle_button_active_focus_bg;
|
setBackgroundColor (wc.toggle_button_active_focus_bg);
|
||||||
|
|
||||||
if ( isCursorInside() && (isRadioButton() || isCheckboxButton()) )
|
if ( isCursorInside() && (isRadioButton() || isCheckboxButton()) )
|
||||||
showCursor();
|
showCursor();
|
||||||
|
@ -480,8 +484,8 @@ bool FToggleButton::setFocus (bool on)
|
||||||
|
|
||||||
if ( isEnabled() )
|
if ( isEnabled() )
|
||||||
{
|
{
|
||||||
foregroundColor = wc.toggle_button_active_fg;
|
setForegroundColor (wc.toggle_button_active_fg);
|
||||||
backgroundColor = wc.toggle_button_active_bg;
|
setBackgroundColor (wc.toggle_button_active_bg);
|
||||||
hideCursor();
|
hideCursor();
|
||||||
|
|
||||||
if ( statusBar() )
|
if ( statusBar() )
|
||||||
|
@ -525,7 +529,7 @@ void FToggleButton::onMouseUp (FMouseEvent* ev)
|
||||||
if ( ev->getButton() != fc::LeftButton )
|
if ( ev->getButton() != fc::LeftButton )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( getGeometryGlobal().contains(ev->getGlobalPos()) )
|
if ( getTermGeometry().contains(ev->getTermPos()) )
|
||||||
{
|
{
|
||||||
if ( isRadioButton() )
|
if ( isRadioButton() )
|
||||||
{
|
{
|
||||||
|
|
806
src/fwidget.cpp
806
src/fwidget.cpp
File diff suppressed because it is too large
Load Diff
314
src/fwidget.h
314
src/fwidget.h
|
@ -107,7 +107,7 @@ class FWidget : public FObject, public FTerm
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<callback_data> CallbackObjects;
|
typedef std::vector<callback_data> CallbackObjects;
|
||||||
CallbackObjects callbackObjects;
|
CallbackObjects callback_objects;
|
||||||
|
|
||||||
struct member_callback_data
|
struct member_callback_data
|
||||||
{
|
{
|
||||||
|
@ -118,7 +118,7 @@ class FWidget : public FObject, public FTerm
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<member_callback_data> MemberCallbackObjects;
|
typedef std::vector<member_callback_data> MemberCallbackObjects;
|
||||||
MemberCallbackObjects memberCallbackObjects;
|
MemberCallbackObjects member_callback_objects;
|
||||||
|
|
||||||
struct accelerator
|
struct accelerator
|
||||||
{
|
{
|
||||||
|
@ -217,6 +217,44 @@ class FWidget : public FObject, public FTerm
|
||||||
} wc;
|
} wc;
|
||||||
// widget_colors wc;
|
// widget_colors wc;
|
||||||
|
|
||||||
|
int flags;
|
||||||
|
static uInt modal_dialogs;
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool enable;
|
||||||
|
bool visible;
|
||||||
|
bool shown;
|
||||||
|
bool focus;
|
||||||
|
bool focusable;
|
||||||
|
bool visibleCursor;
|
||||||
|
FPoint widgetCursorPosition;
|
||||||
|
|
||||||
|
struct widget_size_hints
|
||||||
|
{
|
||||||
|
widget_size_hints()
|
||||||
|
: min_width (INT_MIN)
|
||||||
|
, min_height (INT_MIN)
|
||||||
|
, max_width (INT_MAX)
|
||||||
|
, max_height (INT_MAX)
|
||||||
|
{ }
|
||||||
|
~widget_size_hints()
|
||||||
|
{ }
|
||||||
|
void setMinimum (int w, int h)
|
||||||
|
{
|
||||||
|
min_width = w;
|
||||||
|
min_height = h;
|
||||||
|
}
|
||||||
|
void setMaximum (int w, int h)
|
||||||
|
{
|
||||||
|
max_width = w;
|
||||||
|
max_height = h;
|
||||||
|
}
|
||||||
|
int min_width;
|
||||||
|
int min_height;
|
||||||
|
int max_width;
|
||||||
|
int max_height;
|
||||||
|
} size_hints;
|
||||||
|
|
||||||
struct dbl_line_mask
|
struct dbl_line_mask
|
||||||
{
|
{
|
||||||
dbl_line_mask() : top(), right(), bottom(), left()
|
dbl_line_mask() : top(), right(), bottom(), left()
|
||||||
|
@ -229,52 +267,45 @@ class FWidget : public FObject, public FTerm
|
||||||
std::vector<bool> left;
|
std::vector<bool> left;
|
||||||
} double_flatline_mask;
|
} double_flatline_mask;
|
||||||
|
|
||||||
int xpos;
|
struct widget_padding
|
||||||
int ypos;
|
{
|
||||||
int width;
|
widget_padding() : top(0), left(0), bottom(0), right(0)
|
||||||
int height;
|
{ }
|
||||||
int xmin;
|
~widget_padding()
|
||||||
int ymin;
|
{ }
|
||||||
int xmax;
|
int top;
|
||||||
int ymax;
|
int left;
|
||||||
int top_padding;
|
int bottom;
|
||||||
int left_padding;
|
int right;
|
||||||
int bottom_padding;
|
} padding;
|
||||||
int right_padding;
|
|
||||||
int client_xmin;
|
|
||||||
int client_ymin;
|
|
||||||
int client_xmax;
|
|
||||||
int client_ymax;
|
|
||||||
FPoint shadow;
|
|
||||||
FRect adjustWidgetSizeShadow;
|
|
||||||
FRect adjustWidgetSizeGlobalShadow;
|
|
||||||
bool ignore_padding;
|
|
||||||
bool window_object;
|
|
||||||
bool dialog_object;
|
|
||||||
bool menu_object;
|
|
||||||
int flags;
|
|
||||||
short foregroundColor;
|
|
||||||
short backgroundColor;
|
|
||||||
static uInt modal_dialogs;
|
|
||||||
|
|
||||||
private:
|
bool ignore_padding;
|
||||||
bool enable;
|
|
||||||
bool visible;
|
// widget size
|
||||||
bool shown;
|
FRect wsize;
|
||||||
bool focus;
|
FRect adjust_wsize;
|
||||||
bool focusable;
|
FRect adjust_wsize_term;
|
||||||
bool visibleCursor;
|
FRect adjust_wsize_shadow;
|
||||||
FPoint widgetCursorPosition;
|
FRect adjust_wsize_term_shadow;
|
||||||
FRect widgetSize;
|
// widget offset
|
||||||
FRect adjustWidgetSize;
|
FRect offset;
|
||||||
FRect adjustWidgetSizeGlobal;
|
// offset of the widget client area
|
||||||
FString statusbar_message;
|
FRect client_offset;
|
||||||
|
// widget shadow size (on the right and bottom side)
|
||||||
|
FPoint wshadow;
|
||||||
|
|
||||||
|
// default widget foreground and background color
|
||||||
|
short foreground_color;
|
||||||
|
short background_color;
|
||||||
|
|
||||||
|
term_area* print_area;
|
||||||
|
FString statusbar_message;
|
||||||
|
|
||||||
static FStatusBar* statusbar;
|
static FStatusBar* statusbar;
|
||||||
static FMenuBar* menubar;
|
static FMenuBar* menubar;
|
||||||
static FWidget* show_root_widget;
|
static FWidget* show_root_widget;
|
||||||
static FWidget* redraw_root_widget;
|
static FWidget* redraw_root_widget;
|
||||||
term_area* print_area;
|
|
||||||
friend class FTerm;
|
friend class FTerm;
|
||||||
friend class FApplication;
|
friend class FApplication;
|
||||||
friend class FToggleButton;
|
friend class FToggleButton;
|
||||||
|
@ -335,9 +366,9 @@ class FWidget : public FObject, public FTerm
|
||||||
int numOfFocusableChildren();
|
int numOfFocusableChildren();
|
||||||
FWidget* getParentWidget() const;
|
FWidget* getParentWidget() const;
|
||||||
bool isRootWidget() const;
|
bool isRootWidget() const;
|
||||||
bool isWindow() const;
|
bool isWindowWidget() const;
|
||||||
bool isDialog() const;
|
bool isDialogWidget() const;
|
||||||
bool isMenu() const;
|
bool isMenuWidget() const;
|
||||||
virtual bool close();
|
virtual bool close();
|
||||||
|
|
||||||
static FStatusBar* statusBar();
|
static FStatusBar* statusBar();
|
||||||
|
@ -401,9 +432,9 @@ class FWidget : public FObject, public FTerm
|
||||||
int getX() const;
|
int getX() const;
|
||||||
int getY() const;
|
int getY() const;
|
||||||
const FPoint getPos() const;
|
const FPoint getPos() const;
|
||||||
int getGlobalX() const;
|
int getTermX() const;
|
||||||
int getGlobalY() const;
|
int getTermY() const;
|
||||||
const FPoint getGlobalPos() const;
|
const FPoint getTermPos() const;
|
||||||
int getWidth() const;
|
int getWidth() const;
|
||||||
int getHeight() const;
|
int getHeight() const;
|
||||||
int getTopPadding() const;
|
int getTopPadding() const;
|
||||||
|
@ -413,15 +444,16 @@ class FWidget : public FObject, public FTerm
|
||||||
int getClientWidth() const;
|
int getClientWidth() const;
|
||||||
int getClientHeight() const;
|
int getClientHeight() const;
|
||||||
int getMaxWidth() const;
|
int getMaxWidth() const;
|
||||||
int getMinHeight() const;
|
int getMaxHeight() const;
|
||||||
const FPoint& getShadow() const;
|
const FPoint& getShadow() const;
|
||||||
const FRect& getGeometry() const;
|
const FRect& getGeometry() const;
|
||||||
const FRect& getGeometryShadow() const;
|
const FRect& getGeometryWithShadow();
|
||||||
const FRect& getGeometryGlobal() const;
|
const FRect& getTermGeometry();
|
||||||
const FRect& getGeometryGlobalShadow() const;
|
const FRect& getTermGeometryWithShadow();
|
||||||
FPoint globalToLocalPos (const FPoint&);
|
FPoint termToWidgetPos (const FPoint&);
|
||||||
void setForegroundColor (short);
|
void setForegroundColor (short);
|
||||||
void setBackgroundColor (short);
|
void setBackgroundColor (short);
|
||||||
|
void setColor();
|
||||||
void setColor (short, short);
|
void setColor (short, short);
|
||||||
void setX (int, bool = true);
|
void setX (int, bool = true);
|
||||||
void setY (int, bool = true);
|
void setY (int, bool = true);
|
||||||
|
@ -429,14 +461,22 @@ class FWidget : public FObject, public FTerm
|
||||||
virtual void setPos (int, int, bool = true);
|
virtual void setPos (int, int, bool = true);
|
||||||
void setWidth (int, bool = true);
|
void setWidth (int, bool = true);
|
||||||
void setHeight (int, bool = true);
|
void setHeight (int, bool = true);
|
||||||
|
void setSize (int, int, bool = true);
|
||||||
void setTopPadding (int, bool = true);
|
void setTopPadding (int, bool = true);
|
||||||
void setLeftPadding (int, bool = true);
|
void setLeftPadding (int, bool = true);
|
||||||
void setBottomPadding (int, bool = true);
|
void setBottomPadding (int, bool = true);
|
||||||
void setRightPadding (int, bool = true);
|
void setRightPadding (int, bool = true);
|
||||||
void getTermGeometry();
|
void setParentOffset();
|
||||||
void setTermGeometry (int, int);
|
void setTermOffset();
|
||||||
|
void setTermOffsetWithPadding();
|
||||||
|
void getTermSize();
|
||||||
|
void setTermSize (int, int);
|
||||||
virtual void setGeometry (const FRect&, bool = true);
|
virtual void setGeometry (const FRect&, bool = true);
|
||||||
virtual void setGeometry (int, int, int, int, bool = true);
|
virtual void setGeometry (int, int, int, int, bool = true);
|
||||||
|
void setShadowSize (int, int);
|
||||||
|
void setMinimumSize (int, int);
|
||||||
|
void setMaximumSize (int, int);
|
||||||
|
void setFixedSize (int, int);
|
||||||
virtual void move (const FPoint&);
|
virtual void move (const FPoint&);
|
||||||
virtual void move (int, int);
|
virtual void move (int, int);
|
||||||
int getFlags() const;
|
int getFlags() const;
|
||||||
|
@ -447,8 +487,8 @@ class FWidget : public FObject, public FTerm
|
||||||
bool setCursorPos (register int, register int);
|
bool setCursorPos (register int, register int);
|
||||||
void unsetCursorPos();
|
void unsetCursorPos();
|
||||||
|
|
||||||
static void gotoxy (const FPoint&);
|
void printPos (const FPoint&);
|
||||||
static void gotoxy (register int, register int);
|
void printPos (register int, register int);
|
||||||
|
|
||||||
static void setNormal();
|
static void setNormal();
|
||||||
|
|
||||||
|
@ -541,6 +581,7 @@ class FWidget : public FObject, public FTerm
|
||||||
void setDoubleFlatLine (int, int, bool = true);
|
void setDoubleFlatLine (int, int, bool = true);
|
||||||
void unsetDoubleFlatLine (int, int);
|
void unsetDoubleFlatLine (int, int);
|
||||||
std::vector<bool>& doubleFlatLine_ref (int);
|
std::vector<bool>& doubleFlatLine_ref (int);
|
||||||
|
virtual void drawBorder (int, int, int, int);
|
||||||
virtual void drawBorder();
|
virtual void drawBorder();
|
||||||
|
|
||||||
static void quit();
|
static void quit();
|
||||||
|
@ -602,16 +643,16 @@ inline bool FWidget::isShown() const
|
||||||
{ return shown; }
|
{ return shown; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FWidget::isWindow() const
|
inline bool FWidget::isWindowWidget() const
|
||||||
{ return window_object; }
|
{ return ((flags & fc::window_widget) != 0); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FWidget::isDialog() const
|
inline bool FWidget::isDialogWidget() const
|
||||||
{ return dialog_object; }
|
{ return ((flags & fc::dialog_widget) != 0); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FWidget::isMenu() const
|
inline bool FWidget::isMenuWidget() const
|
||||||
{ return menu_object; }
|
{ return ((flags & fc::menu_widget) != 0); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FWidget::isEnabled() const
|
inline bool FWidget::isEnabled() const
|
||||||
|
@ -671,41 +712,41 @@ inline void FWidget::unsetFocusable()
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline short FWidget::getForegroundColor() const
|
inline short FWidget::getForegroundColor() const
|
||||||
{ return foregroundColor; }
|
{ return foreground_color; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline short FWidget::getBackgroundColor() const
|
inline short FWidget::getBackgroundColor() const
|
||||||
{ return backgroundColor; }
|
{ return background_color; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FWidget::getX() const
|
inline int FWidget::getX() const // x-position relative to the widget
|
||||||
{ return xpos; }
|
{ return adjust_wsize.getX(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FWidget::getY() const
|
inline int FWidget::getY() const // y-position relative to the widget
|
||||||
{ return ypos; }
|
{ return adjust_wsize.getY(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const FPoint FWidget::getPos() const
|
inline const FPoint FWidget::getPos() const // position relative to the widget
|
||||||
{ return adjustWidgetSize.getPos(); }
|
{ return adjust_wsize.getPos(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FWidget::getGlobalX() const
|
inline int FWidget::getTermX() const // x-position on terminal
|
||||||
{ return xpos+xmin-1; }
|
{ return offset.getX1() + adjust_wsize.getX(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FWidget::getGlobalY() const
|
inline int FWidget::getTermY() const // y-position on terminal
|
||||||
{ return ypos+ymin-1; }
|
{ return offset.getY1() + adjust_wsize.getY(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const FPoint FWidget::getGlobalPos() const
|
inline const FPoint FWidget::getTermPos() const // position on terminal
|
||||||
{ return FPoint(xpos+xmin-1, ypos+ymin-1); }
|
{ return FPoint(getTermX(), getTermY()); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FPoint FWidget::globalToLocalPos (const FPoint& gPos)
|
inline FPoint FWidget::termToWidgetPos (const FPoint& tPos)
|
||||||
{
|
{
|
||||||
return FPoint ( gPos.getX() - xpos - xmin + 2
|
return FPoint ( tPos.getX() + 1 - offset.getX1() - adjust_wsize.getX()
|
||||||
, gPos.getY() - ypos - ymin + 2 );
|
, tPos.getY() + 1 - offset.getY1() - adjust_wsize.getY() );
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -713,7 +754,7 @@ inline void FWidget::setForegroundColor (short color)
|
||||||
{
|
{
|
||||||
// valid colors -1..254
|
// valid colors -1..254
|
||||||
if ( color == fc::Default || color >> 8 == 0 )
|
if ( color == fc::Default || color >> 8 == 0 )
|
||||||
foregroundColor = color;
|
foreground_color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -721,7 +762,7 @@ inline void FWidget::setBackgroundColor (short color)
|
||||||
{
|
{
|
||||||
// valid colors -1..254
|
// valid colors -1..254
|
||||||
if ( color == fc::Default || color >> 8 == 0 )
|
if ( color == fc::Default || color >> 8 == 0 )
|
||||||
backgroundColor = color;
|
background_color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -730,63 +771,90 @@ inline void FWidget::setPos (const FPoint& p, bool adjust)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FWidget::getWidth() const
|
inline int FWidget::getWidth() const
|
||||||
{ return width; }
|
{ return adjust_wsize.getWidth(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FWidget::getHeight() const
|
inline int FWidget::getHeight() const
|
||||||
{ return height; }
|
{ return adjust_wsize.getHeight(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FWidget::getTopPadding() const
|
inline int FWidget::getTopPadding() const
|
||||||
{ return top_padding; }
|
{ return padding.top; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FWidget::getLeftPadding() const
|
inline int FWidget::getLeftPadding() const
|
||||||
{ return left_padding; }
|
{ return padding.left; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FWidget::getBottomPadding() const
|
inline int FWidget::getBottomPadding() const
|
||||||
{ return bottom_padding; }
|
{ return padding.bottom; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FWidget::getRightPadding() const
|
inline int FWidget::getRightPadding() const
|
||||||
{ return right_padding; }
|
{ return padding.right; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FWidget::getClientWidth() const
|
inline int FWidget::getClientWidth() const
|
||||||
{ return client_xmax-client_xmin+1; }
|
{ return client_offset.getWidth(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FWidget::getClientHeight() const
|
inline int FWidget::getClientHeight() const
|
||||||
{ return client_ymax-client_ymin+1; }
|
{ return client_offset.getHeight(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FWidget::getMaxWidth() const
|
inline int FWidget::getMaxWidth() const
|
||||||
{ return xmax-xmin+1; }
|
{ return offset.getWidth(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FWidget::getMinHeight() const
|
inline int FWidget::getMaxHeight() const
|
||||||
{ return ymax-ymin+1; }
|
{ return offset.getHeight(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const FPoint& FWidget::getShadow() const
|
inline const FPoint& FWidget::getShadow() const
|
||||||
{ return shadow; }
|
{ return wshadow; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const FRect& FWidget::getGeometry() const
|
inline const FRect& FWidget::getGeometry() const
|
||||||
{ return adjustWidgetSize; }
|
{ return adjust_wsize; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const FRect& FWidget::getGeometryShadow() const
|
inline const FRect& FWidget::getGeometryWithShadow()
|
||||||
{ return adjustWidgetSizeShadow; }
|
{
|
||||||
|
adjust_wsize_shadow.setCoordinates
|
||||||
|
(
|
||||||
|
adjust_wsize.x1_ref(),
|
||||||
|
adjust_wsize.y1_ref(),
|
||||||
|
adjust_wsize.x2_ref() + wshadow.x_ref(),
|
||||||
|
adjust_wsize.y2_ref() + wshadow.y_ref()
|
||||||
|
);
|
||||||
|
return adjust_wsize_shadow;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const FRect& FWidget::getGeometryGlobal() const
|
inline const FRect& FWidget::getTermGeometry()
|
||||||
{ return adjustWidgetSizeGlobal; }
|
{
|
||||||
|
adjust_wsize_term.setCoordinates
|
||||||
|
(
|
||||||
|
adjust_wsize.x1_ref() + offset.x1_ref(),
|
||||||
|
adjust_wsize.y1_ref() + offset.y1_ref(),
|
||||||
|
adjust_wsize.x2_ref() + offset.x1_ref(),
|
||||||
|
adjust_wsize.y2_ref() + offset.y1_ref()
|
||||||
|
);
|
||||||
|
return adjust_wsize_term;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const FRect& FWidget::getGeometryGlobalShadow() const
|
inline const FRect& FWidget::getTermGeometryWithShadow()
|
||||||
{ return adjustWidgetSizeGlobalShadow; }
|
{
|
||||||
|
adjust_wsize_term_shadow.setCoordinates
|
||||||
|
(
|
||||||
|
adjust_wsize.x1_ref() + offset.x1_ref(),
|
||||||
|
adjust_wsize.y1_ref() + offset.y1_ref(),
|
||||||
|
adjust_wsize.x2_ref() + offset.x1_ref() + wshadow.x_ref(),
|
||||||
|
adjust_wsize.y2_ref() + offset.y1_ref() + wshadow.y_ref()
|
||||||
|
);
|
||||||
|
return adjust_wsize_term_shadow;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FWidget::setGeometry (const FRect& box, bool adjust)
|
inline void FWidget::setGeometry (const FRect& box, bool adjust)
|
||||||
|
@ -798,6 +866,25 @@ inline void FWidget::setGeometry (const FRect& box, bool adjust)
|
||||||
, adjust );
|
, adjust );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FWidget::setShadowSize (int right, int bottom)
|
||||||
|
{ wshadow.setPoint (right, bottom); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FWidget::setMinimumSize (int min_width, int min_height)
|
||||||
|
{ size_hints.setMinimum (min_width, min_height); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FWidget::setMaximumSize (int max_width, int max_height)
|
||||||
|
{ size_hints.setMaximum (max_width, max_height); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FWidget::setFixedSize (int width, int height)
|
||||||
|
{
|
||||||
|
size_hints.setMinimum (width, height);
|
||||||
|
size_hints.setMaximum (width, height);
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FWidget::move (const FPoint& pos)
|
inline void FWidget::move (const FPoint& pos)
|
||||||
{ move( pos.getX(), pos.getY() ); }
|
{ move( pos.getX(), pos.getY() ); }
|
||||||
|
@ -819,12 +906,15 @@ inline void FWidget::unsetCursorPos()
|
||||||
{ widgetCursorPosition.setPoint(-1,-1); }
|
{ widgetCursorPosition.setPoint(-1,-1); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FWidget::gotoxy (const FPoint& pos)
|
inline void FWidget::printPos (const FPoint& pos)
|
||||||
{ gotoxy (pos.getX(), pos.getY()); }
|
{ printPos (pos.getX(), pos.getY()); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FWidget::gotoxy (register int x, register int y)
|
inline void FWidget::printPos (register int x, register int y)
|
||||||
{ cursor->setPoint(x,y); }
|
{
|
||||||
|
cursor->setPoint ( offset.getX1() + adjust_wsize.getX() - 1 + x,
|
||||||
|
offset.getY1() + adjust_wsize.getY() - 1 + y );
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FWidget::setNormal()
|
inline void FWidget::setNormal()
|
||||||
|
@ -1107,13 +1197,17 @@ inline bool FWidget::isInheritBackground()
|
||||||
{ return next_attribute.inherit_bg; }
|
{ return next_attribute.inherit_bg; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FWidget::unsetDoubleFlatLine(int side)
|
inline void FWidget::unsetDoubleFlatLine (int side)
|
||||||
{ setDoubleFlatLine(side, false); }
|
{ setDoubleFlatLine(side, false); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FWidget::unsetDoubleFlatLine(int side, int pos)
|
inline void FWidget::unsetDoubleFlatLine (int side, int pos)
|
||||||
{ setDoubleFlatLine(side, pos, false); }
|
{ setDoubleFlatLine(side, pos, false); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FWidget::drawBorder()
|
||||||
|
{ drawBorder (1, getWidth(), 1, getHeight()); }
|
||||||
|
|
||||||
|
|
||||||
// NewFont elements
|
// NewFont elements
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -21,10 +21,8 @@ FWindow::FWindow(FWidget* parent)
|
||||||
, zoomed(false)
|
, zoomed(false)
|
||||||
, win_focus_widget(0)
|
, win_focus_widget(0)
|
||||||
, normalGeometry()
|
, normalGeometry()
|
||||||
, maxGeometry()
|
|
||||||
, minGeometry()
|
|
||||||
{
|
{
|
||||||
window_object = true;
|
setWindowWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -79,6 +77,15 @@ void FWindow::onWindowRaised (FEvent*)
|
||||||
void FWindow::onWindowLowered (FEvent*)
|
void FWindow::onWindowLowered (FEvent*)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FWindow::adjustSize()
|
||||||
|
{
|
||||||
|
FWidget::adjustSize();
|
||||||
|
|
||||||
|
if ( zoomed )
|
||||||
|
setGeometry (1, 1, getMaxWidth(), getMaxHeight(), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// public methods of FWindow
|
// public methods of FWindow
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -106,31 +113,31 @@ void FWindow::hide()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FWindow::setWidth (int w, bool adjust)
|
void FWindow::setWidth (int w, bool adjust)
|
||||||
{
|
{
|
||||||
int old_width = width;
|
int old_width = getWidth();
|
||||||
FWidget::setWidth (w, adjust);
|
FWidget::setWidth (w, adjust);
|
||||||
|
|
||||||
if ( vwin && width != old_width )
|
if ( vwin && getWidth() != old_width )
|
||||||
resizeArea (vwin);
|
resizeArea (vwin);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FWindow::setHeight (int h, bool adjust)
|
void FWindow::setHeight (int h, bool adjust)
|
||||||
{
|
{
|
||||||
int old_height = height;
|
int old_height = getHeight();
|
||||||
FWidget::setHeight (h, adjust);
|
FWidget::setHeight (h, adjust);
|
||||||
|
|
||||||
if ( vwin && height != old_height )
|
if ( vwin && getHeight() != old_height )
|
||||||
resizeArea (vwin);
|
resizeArea (vwin);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FWindow::setGeometry (int x, int y, int w, int h, bool adjust)
|
void FWindow::setGeometry (int x, int y, int w, int h, bool adjust)
|
||||||
{
|
{
|
||||||
int old_width = width;
|
int old_width = getWidth();
|
||||||
int old_height = height;
|
int old_height = getHeight();
|
||||||
FWidget::setGeometry (x, y, w, h, adjust);
|
FWidget::setGeometry (x, y, w, h, adjust);
|
||||||
|
|
||||||
if ( vwin && (width != old_width || height != old_height) )
|
if ( vwin && (getWidth() != old_width || getHeight() != old_height) )
|
||||||
resizeArea (vwin);
|
resizeArea (vwin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,10 +145,10 @@ void FWindow::setGeometry (int x, int y, int w, int h, bool adjust)
|
||||||
FWindow* FWindow::getWindowWidgetAt (int x, int y)
|
FWindow* FWindow::getWindowWidgetAt (int x, int y)
|
||||||
{
|
{
|
||||||
// returns the window object to the corresponding coordinates
|
// returns the window object to the corresponding coordinates
|
||||||
if ( statusBar() && statusBar()->getGeometryGlobal().contains(x,y) )
|
if ( statusBar() && statusBar()->getTermGeometry().contains(x,y) )
|
||||||
return statusBar();
|
return statusBar();
|
||||||
|
|
||||||
if ( menuBar() && menuBar()->getGeometryGlobal().contains(x,y) )
|
if ( menuBar() && menuBar()->getTermGeometry().contains(x,y) )
|
||||||
return menuBar();
|
return menuBar();
|
||||||
|
|
||||||
if ( window_list && ! window_list->empty() )
|
if ( window_list && ! window_list->empty() )
|
||||||
|
@ -158,7 +165,7 @@ FWindow* FWindow::getWindowWidgetAt (int x, int y)
|
||||||
FWindow* w = static_cast<FWindow*>(*iter);
|
FWindow* w = static_cast<FWindow*>(*iter);
|
||||||
|
|
||||||
if ( ! w->isHiddenWindow()
|
if ( ! w->isHiddenWindow()
|
||||||
&& w->getGeometryGlobal().contains(x,y) )
|
&& w->getTermGeometry().contains(x,y) )
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -205,13 +212,13 @@ FWindow* FWindow::getWindowWidget (FWidget* obj)
|
||||||
// returns the window object to the given widget obj
|
// returns the window object to the given widget obj
|
||||||
FWidget* p_obj = obj->getParentWidget();
|
FWidget* p_obj = obj->getParentWidget();
|
||||||
|
|
||||||
while ( ! obj->isWindow() && p_obj )
|
while ( ! obj->isWindowWidget() && p_obj )
|
||||||
{
|
{
|
||||||
obj = p_obj;
|
obj = p_obj;
|
||||||
p_obj = p_obj->getParentWidget();
|
p_obj = p_obj->getParentWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( obj->isWindow() )
|
if ( obj->isWindowWidget() )
|
||||||
return static_cast<FWindow*>(obj);
|
return static_cast<FWindow*>(obj);
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -230,7 +237,7 @@ int FWindow::getWindowLayer (FWidget* obj)
|
||||||
if ( window_list->empty() )
|
if ( window_list->empty() )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if ( ! obj->isWindow() )
|
if ( ! obj->isWindowWidget() )
|
||||||
{
|
{
|
||||||
if ( (window = getWindowWidget(obj)) == 0 )
|
if ( (window = getWindowWidget(obj)) == 0 )
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -301,14 +308,14 @@ bool FWindow::raiseWindow (FWidget* obj)
|
||||||
if ( window_list->empty() )
|
if ( window_list->empty() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( ! obj->isWindow() )
|
if ( ! obj->isWindowWidget() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( window_list->back() == obj )
|
if ( window_list->back() == obj )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( (window_list->back()->getFlags() & fc::modal) != 0
|
if ( (window_list->back()->getFlags() & fc::modal) != 0
|
||||||
&& ! obj->isMenu() )
|
&& ! obj->isMenuWidget() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
iter = window_list->begin();
|
iter = window_list->begin();
|
||||||
|
@ -342,7 +349,7 @@ bool FWindow::lowerWindow (FWidget* obj)
|
||||||
if ( window_list->empty() )
|
if ( window_list->empty() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( ! obj->isWindow() )
|
if ( ! obj->isWindowWidget() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( window_list->front() == obj )
|
if ( window_list->front() == obj )
|
||||||
|
@ -376,9 +383,9 @@ bool FWindow::zoomWindow()
|
||||||
if ( zoomed )
|
if ( zoomed )
|
||||||
{
|
{
|
||||||
zoomed = false;
|
zoomed = false;
|
||||||
FRect currentGeometry = getGeometryShadow();
|
FRect oldGeometry = getTermGeometryWithShadow();
|
||||||
setGeometry (normalGeometry);
|
setGeometry (normalGeometry);
|
||||||
restoreVTerm (currentGeometry);
|
restoreVTerm (oldGeometry);
|
||||||
redraw();
|
redraw();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -386,13 +393,35 @@ bool FWindow::zoomWindow()
|
||||||
zoomed = true;
|
zoomed = true;
|
||||||
// save the current geometry
|
// save the current geometry
|
||||||
normalGeometry = getGeometry();
|
normalGeometry = getGeometry();
|
||||||
setGeometry (1, 1, getMaxWidth(), getMinHeight());
|
FRect oldGeometry = getTermGeometryWithShadow();
|
||||||
|
setGeometry (1, 1, getMaxWidth(), getMaxHeight());
|
||||||
|
restoreVTerm (oldGeometry);
|
||||||
redraw();
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
return zoomed;
|
return zoomed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
bool FWindow::setWindowWidget (bool on)
|
||||||
|
{
|
||||||
|
if ( isWindowWidget() == on )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if ( on )
|
||||||
|
{
|
||||||
|
flags |= fc::window_widget;
|
||||||
|
setTermOffset();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
flags &= ~fc::window_widget;
|
||||||
|
setParentOffset();
|
||||||
|
}
|
||||||
|
|
||||||
|
return on;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FWindow* FWindow::getActiveWindow()
|
FWindow* FWindow::getActiveWindow()
|
||||||
{
|
{
|
||||||
|
@ -500,7 +529,7 @@ void FWindow::switchToPrevWindow()
|
||||||
{
|
{
|
||||||
focus_widget->setFocus();
|
focus_widget->setFocus();
|
||||||
|
|
||||||
if ( ! focus_widget->isWindow() )
|
if ( ! focus_widget->isWindowWidget() )
|
||||||
focus_widget->redraw();
|
focus_widget->redraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,8 +48,6 @@ class FWindow : public FWidget
|
||||||
bool zoomed;
|
bool zoomed;
|
||||||
FWidget* win_focus_widget;
|
FWidget* win_focus_widget;
|
||||||
FRect normalGeometry;
|
FRect normalGeometry;
|
||||||
FRect maxGeometry;
|
|
||||||
FRect minGeometry;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static FWindow* previous_widget;
|
static FWindow* previous_widget;
|
||||||
|
@ -65,6 +63,7 @@ class FWindow : public FWidget
|
||||||
virtual void onWindowInactive (FEvent*);
|
virtual void onWindowInactive (FEvent*);
|
||||||
virtual void onWindowRaised (FEvent*);
|
virtual void onWindowRaised (FEvent*);
|
||||||
virtual void onWindowLowered (FEvent*);
|
virtual void onWindowLowered (FEvent*);
|
||||||
|
virtual void adjustSize();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit FWindow (FWidget* = 0); // constructor
|
explicit FWindow (FWidget* = 0); // constructor
|
||||||
|
@ -91,6 +90,9 @@ class FWindow : public FWidget
|
||||||
bool lowerWindow ();
|
bool lowerWindow ();
|
||||||
bool zoomWindow ();
|
bool zoomWindow ();
|
||||||
bool isZoomed() const;
|
bool isZoomed() const;
|
||||||
|
bool setWindowWidget (bool);
|
||||||
|
bool setWindowWidget();
|
||||||
|
bool unsetWindowWidget();
|
||||||
static FWindow* getActiveWindow();
|
static FWindow* getActiveWindow();
|
||||||
static void setActiveWindow (FWindow*);
|
static void setActiveWindow (FWindow*);
|
||||||
FWidget* getWindowFocusWidget() const;
|
FWidget* getWindowFocusWidget() const;
|
||||||
|
@ -127,6 +129,14 @@ inline bool FWindow::lowerWindow()
|
||||||
inline bool FWindow::isZoomed() const
|
inline bool FWindow::isZoomed() const
|
||||||
{ return zoomed; }
|
{ return zoomed; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FWindow::setWindowWidget()
|
||||||
|
{ return setWindowWidget(true); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FWindow::unsetWindowWidget()
|
||||||
|
{ return setWindowWidget(false); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FWindow::activateWindow()
|
inline bool FWindow::activateWindow()
|
||||||
{ return activateWindow(true); }
|
{ return activateWindow(true); }
|
||||||
|
|
|
@ -250,13 +250,11 @@ Calc::Calc (FWidget* parent)
|
||||||
btn->setNoUnderline();
|
btn->setNoUnderline();
|
||||||
btn->setText(button_text[key]);
|
btn->setText(button_text[key]);
|
||||||
btn->setDoubleFlatLine(fc::top);
|
btn->setDoubleFlatLine(fc::top);
|
||||||
|
btn->setDoubleFlatLine(fc::bottom);
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
btn->unsetClickAnimation();
|
btn->unsetClickAnimation();
|
||||||
|
|
||||||
if ( key <= Three )
|
|
||||||
btn->setDoubleFlatLine(fc::bottom);
|
|
||||||
|
|
||||||
btn->addCallback
|
btn->addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
|
@ -318,7 +316,7 @@ void Calc::drawDispay()
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(false);
|
setReverse(false);
|
||||||
|
|
||||||
gotoxy (xpos+xmin+1, ypos+ymin+1);
|
printPos (3,3);
|
||||||
print(display);
|
print(display);
|
||||||
print(L' ');
|
print(L' ');
|
||||||
setColor(wc.dialog_fg, wc.dialog_bg);
|
setColor(wc.dialog_fg, wc.dialog_bg);
|
||||||
|
@ -329,15 +327,15 @@ void Calc::drawDispay()
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
{
|
{
|
||||||
FString bottom_line(33, wchar_t(fc::NF_border_line_bottom));
|
FString bottom_line(33, wchar_t(fc::NF_border_line_bottom));
|
||||||
gotoxy (xpos+xmin+1, ypos+ymin);
|
printPos (3,2);
|
||||||
print(bottom_line);
|
print (bottom_line);
|
||||||
gotoxy (xpos+xmin+0, ypos+ymin+1);
|
printPos (2,3);
|
||||||
print (wchar_t(fc::NF_rev_border_line_right));
|
print (wchar_t(fc::NF_rev_border_line_right));
|
||||||
gotoxy (xpos+xmin+34, ypos+ymin+1);
|
printPos (36,3);
|
||||||
print (wchar_t(fc::NF_border_line_left));
|
print (wchar_t(fc::NF_border_line_left));
|
||||||
FString top_bottom_line_5(5, wchar_t(fc::NF_border_line_up_and_down));
|
FString top_bottom_line_5(5, wchar_t(fc::NF_border_line_up_and_down));
|
||||||
FString top_line_2(2, wchar_t(fc::NF_border_line_upper));
|
FString top_line_2(2, wchar_t(fc::NF_border_line_upper));
|
||||||
gotoxy (xpos+xmin+1, ypos+ymin+2);
|
printPos (3,4);
|
||||||
print ( top_bottom_line_5 + top_line_2
|
print ( top_bottom_line_5 + top_line_2
|
||||||
+ top_bottom_line_5 + top_line_2
|
+ top_bottom_line_5 + top_line_2
|
||||||
+ top_bottom_line_5 + top_line_2
|
+ top_bottom_line_5 + top_line_2
|
||||||
|
@ -349,7 +347,7 @@ void Calc::drawDispay()
|
||||||
FString separator = FString(wchar_t(fc::BoxDrawingsVerticalAndRight))
|
FString separator = FString(wchar_t(fc::BoxDrawingsVerticalAndRight))
|
||||||
+ FString(35, wchar_t(fc::BoxDrawingsHorizontal))
|
+ FString(35, wchar_t(fc::BoxDrawingsHorizontal))
|
||||||
+ FString(wchar_t(fc::BoxDrawingsVerticalAndLeft));
|
+ FString(wchar_t(fc::BoxDrawingsVerticalAndLeft));
|
||||||
gotoxy (xpos+xmin-1, ypos+ymin+2);
|
printPos (1,4);
|
||||||
print(separator);
|
print(separator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -415,8 +413,8 @@ bool Calc::isOperatorKey(int key)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Calc::setDisplay (lDouble d)
|
void Calc::setDisplay (lDouble d)
|
||||||
{
|
{
|
||||||
char buffer[32];
|
char buffer[33];
|
||||||
snprintf (buffer, sizeof(buffer), "%31.11Lg", d);
|
snprintf (buffer, sizeof(buffer), "%32.11Lg", d);
|
||||||
input = buffer;
|
input = buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ void keyboard::draw()
|
||||||
setNormal();
|
setNormal();
|
||||||
setColor(fc::Default, fc::Default);
|
setColor(fc::Default, fc::Default);
|
||||||
clearArea();
|
clearArea();
|
||||||
gotoxy (1,1);
|
printPosTerm (1,1);
|
||||||
print ("---------------\n");
|
print ("---------------\n");
|
||||||
print ("Press Q to quit\n");
|
print ("Press Q to quit\n");
|
||||||
print ("---------------\n");
|
print ("---------------\n");
|
||||||
|
|
|
@ -52,8 +52,8 @@ void Mandelbrot::draw()
|
||||||
y_max = 1.05;
|
y_max = 1.05;
|
||||||
max_iter = 99;
|
max_iter = 99;
|
||||||
|
|
||||||
xoffset = xpos+xmin;
|
xoffset = 2;
|
||||||
yoffset = ypos+ymin;
|
yoffset = 2;
|
||||||
Cols = getClientWidth();
|
Cols = getClientWidth();
|
||||||
Lines = getClientHeight();
|
Lines = getClientHeight();
|
||||||
current_line = 1;
|
current_line = 1;
|
||||||
|
@ -63,7 +63,7 @@ void Mandelbrot::draw()
|
||||||
|
|
||||||
for (y0=y_min; y0 < y_max && current_line <= Lines; y0+=dY)
|
for (y0=y_min; y0 < y_max && current_line <= Lines; y0+=dY)
|
||||||
{
|
{
|
||||||
gotoxy (xoffset, yoffset+current_line);
|
printPos (xoffset, yoffset+current_line);
|
||||||
|
|
||||||
for (x0=x_min; x0 < x_max; x0+=dX)
|
for (x0=x_min; x0 < x_max; x0+=dX)
|
||||||
{
|
{
|
||||||
|
|
|
@ -218,7 +218,7 @@ void AttribDemo::printAltCharset()
|
||||||
if ( ! isMonochron() )
|
if ( ! isMonochron() )
|
||||||
setColor (wc.label_fg, wc.label_bg);
|
setColor (wc.label_fg, wc.label_bg);
|
||||||
|
|
||||||
gotoxy (xpos + xmin - 1, ypos + ymin - 1);
|
printPos (1,1);
|
||||||
print("alternate charset: ");
|
print("alternate charset: ");
|
||||||
|
|
||||||
if ( parent->bgcolor == fc::Default )
|
if ( parent->bgcolor == fc::Default )
|
||||||
|
@ -249,8 +249,7 @@ void AttribDemo::draw()
|
||||||
|
|
||||||
for (int y=0; y < getParentWidget()->getHeight()-7; y++)
|
for (int y=0; y < getParentWidget()->getHeight()-7; y++)
|
||||||
{
|
{
|
||||||
gotoxy ( xpos + xmin - 1,
|
printPos (1, 2+y);
|
||||||
ypos + ymin + y );
|
|
||||||
|
|
||||||
if ( ! isMonochron() )
|
if ( ! isMonochron() )
|
||||||
setColor (wc.label_fg, wc.label_bg);
|
setColor (wc.label_fg, wc.label_bg);
|
||||||
|
@ -354,7 +353,7 @@ void AttribDemo::draw()
|
||||||
if ( ! isMonochron() )
|
if ( ! isMonochron() )
|
||||||
setColor(wc.label_fg, wc.label_bg);
|
setColor(wc.label_fg, wc.label_bg);
|
||||||
|
|
||||||
gotoxy (xpos + xmin - 1, ypos + ymin + 13);
|
printPos (1, 15);
|
||||||
short bg = static_cast<AttribDlg*>(getParent())->bgcolor;
|
short bg = static_cast<AttribDlg*>(getParent())->bgcolor;
|
||||||
print (" Background color:");
|
print (" Background color:");
|
||||||
|
|
||||||
|
@ -363,7 +362,7 @@ void AttribDemo::draw()
|
||||||
else
|
else
|
||||||
printf ( " %d", bg);
|
printf ( " %d", bg);
|
||||||
|
|
||||||
gotoxy (xpos + xmin + 14, ypos + ymin + 15);
|
printPos (16, 17);
|
||||||
print ("Change background color ->");
|
print ("Change background color ->");
|
||||||
updateVTerm(true);
|
updateVTerm(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ void timer::draw()
|
||||||
setNormal();
|
setNormal();
|
||||||
setColor (fc::Default, fc::Default);
|
setColor (fc::Default, fc::Default);
|
||||||
clearArea();
|
clearArea();
|
||||||
gotoxy (1,1);
|
printPosTerm (1,1);
|
||||||
print ("---------------\n");
|
print ("---------------\n");
|
||||||
print ("Press Q to quit\n");
|
print ("Press Q to quit\n");
|
||||||
print ("---------------\n");
|
print ("---------------\n");
|
||||||
|
|
|
@ -78,7 +78,7 @@ void Transparent::draw()
|
||||||
|
|
||||||
for (int n=1; n <= getClientHeight(); n++)
|
for (int n=1; n <= getClientHeight(); n++)
|
||||||
{
|
{
|
||||||
gotoxy(xpos+xmin, ypos+ymin+n);
|
printPos (2, 2+n);
|
||||||
print(line);
|
print(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,10 +192,10 @@ void MainWindow::draw()
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
||||||
setColor(foregroundColor, backgroundColor);
|
setColor();
|
||||||
gotoxy(xpos+xmin, ypos+ymin+2);
|
printPos (2,4);
|
||||||
print(line1);
|
print(line1);
|
||||||
gotoxy(xpos+xmin, ypos+ymin+3);
|
printPos (2,5);
|
||||||
print(line2);
|
print(line2);
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
|
|
|
@ -68,7 +68,7 @@ ProgressDialog::ProgressDialog (FWidget* parent)
|
||||||
|
|
||||||
progressBar = new FProgressbar(this);
|
progressBar = new FProgressbar(this);
|
||||||
progressBar->setGeometry(2, 3, 34, 1, false);
|
progressBar->setGeometry(2, 3, 34, 1, false);
|
||||||
//progressBar->setPercentage(78);<
|
//progressBar->setPercentage(78);
|
||||||
|
|
||||||
reset->addCallback
|
reset->addCallback
|
||||||
(
|
(
|
||||||
|
@ -211,8 +211,8 @@ void TextWindow::append (const FString& str)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void TextWindow::adjustSize()
|
void TextWindow::adjustSize()
|
||||||
{
|
{
|
||||||
scrollText->setGeometry (1, 2, getWidth(), getHeight()-1);
|
|
||||||
FDialog::adjustSize();
|
FDialog::adjustSize();
|
||||||
|
scrollText->setGeometry (1, 2, getWidth(), getHeight()-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -888,7 +888,7 @@ int main (int argc, char* argv[])
|
||||||
app.setXTermTitle (title);
|
app.setXTermTitle (title);
|
||||||
|
|
||||||
//app.setEncoding("VT100");
|
//app.setEncoding("VT100");
|
||||||
//app.setTermGeometry(94,30);
|
//app.setTermSize(94,30);
|
||||||
//app.setNewFont();
|
//app.setNewFont();
|
||||||
|
|
||||||
MyDialog d(&app);
|
MyDialog d(&app);
|
||||||
|
|
|
@ -239,6 +239,7 @@ void Window::cb_createWindows (FWidget*, void*)
|
||||||
x = dx + 5 + (n%3)*25 + int(n/3)*3;
|
x = dx + 5 + (n%3)*25 + int(n/3)*3;
|
||||||
y = dy + 11 + int(n/3)*3;
|
y = dy + 11 + int(n/3)*3;
|
||||||
win->setGeometry (x, y, 20, 8);
|
win->setGeometry (x, y, 20, 8);
|
||||||
|
win->setMinimumSize (20, 8);
|
||||||
win->setResizeable();
|
win->setResizeable();
|
||||||
win->show();
|
win->show();
|
||||||
|
|
||||||
|
@ -305,7 +306,7 @@ void Window::cb_next (FWidget*, void*)
|
||||||
} while ( ! next->isEnabled()
|
} while ( ! next->isEnabled()
|
||||||
|| ! next->acceptFocus()
|
|| ! next->acceptFocus()
|
||||||
|| ! next->isVisible()
|
|| ! next->isVisible()
|
||||||
|| ! next->isWindow() );
|
|| ! next->isWindowWidget() );
|
||||||
|
|
||||||
activateWindow(next);
|
activateWindow(next);
|
||||||
break;
|
break;
|
||||||
|
@ -328,7 +329,7 @@ void Window::cb_previous (FWidget*, void*)
|
||||||
{
|
{
|
||||||
--iter;
|
--iter;
|
||||||
|
|
||||||
if ( (*iter)->isDialog()
|
if ( (*iter)->isDialogWidget()
|
||||||
&& static_cast<FWindow*>(*iter)->isActiveWindow() )
|
&& static_cast<FWindow*>(*iter)->isActiveWindow() )
|
||||||
{
|
{
|
||||||
FDialog* prev;
|
FDialog* prev;
|
||||||
|
@ -345,7 +346,7 @@ void Window::cb_previous (FWidget*, void*)
|
||||||
} while ( ! prev->isEnabled()
|
} while ( ! prev->isEnabled()
|
||||||
|| ! prev->acceptFocus()
|
|| ! prev->acceptFocus()
|
||||||
|| ! prev->isVisible()
|
|| ! prev->isVisible()
|
||||||
|| ! prev->isWindow() );
|
|| ! prev->isWindowWidget() );
|
||||||
|
|
||||||
activateWindow(prev);
|
activateWindow(prev);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue