FLabel now transmits the Click events to the parent widget
This commit is contained in:
parent
9475f34499
commit
7369ed1a10
|
@ -1,3 +1,6 @@
|
|||
2016-09-26 Markus Gans <guru.mail@muenster.de>
|
||||
* FLabel now transmits the Click events to the parent widget
|
||||
|
||||
2016-09-25 Markus Gans <guru.mail@muenster.de>
|
||||
* Splitting gotoxy in printPos (local position)
|
||||
and printPosTerm (global terminal position)
|
||||
|
|
18
src/fapp.cpp
18
src/fapp.cpp
|
@ -48,7 +48,7 @@ FApplication::FApplication (int& _argc, char**& _argv)
|
|||
, dblclick_interval(500000) // 500 ms
|
||||
, time_keypressed()
|
||||
, time_mousepressed()
|
||||
, newMousePosition()
|
||||
, new_mouse_position()
|
||||
{
|
||||
assert ( ! rootObj
|
||||
&& "FApplication: There should be only one application object" );
|
||||
|
@ -844,7 +844,7 @@ void FApplication::getX11ButtonState (int button)
|
|||
{
|
||||
case button1_pressed:
|
||||
case button1_pressed_move:
|
||||
if ( *mouse == newMousePosition
|
||||
if ( *mouse == new_mouse_position
|
||||
&& x11_button_state == all_buttons_released
|
||||
&& ! isKeyTimeout(&time_mousepressed, dblclick_interval) )
|
||||
{
|
||||
|
@ -938,7 +938,7 @@ bool FApplication::parseX11Mouse()
|
|||
|
||||
x = uChar(x11_mouse[1] - 0x20);
|
||||
y = uChar(x11_mouse[2] - 0x20);
|
||||
newMousePosition.setPoint(x,y);
|
||||
new_mouse_position.setPoint(x,y);
|
||||
// fill bit field with 0
|
||||
memset(&b_state, 0x00, sizeof(b_state));
|
||||
|
||||
|
@ -1031,7 +1031,7 @@ bool FApplication::parseSGRMouse()
|
|||
y = uChar(10 * y + (*p - '0'));
|
||||
}
|
||||
|
||||
newMousePosition.setPoint(x,y);
|
||||
new_mouse_position.setPoint(x,y);
|
||||
// fill bit field with 0
|
||||
memset(&b_state, 0x00, sizeof(b_state));
|
||||
|
||||
|
@ -1057,7 +1057,7 @@ bool FApplication::parseSGRMouse()
|
|||
{
|
||||
case button1:
|
||||
case button1_move:
|
||||
if ( *mouse == newMousePosition
|
||||
if ( *mouse == new_mouse_position
|
||||
&& (((x11_button_state & 0x80) >> 2) + 'M') == released
|
||||
&& ! isKeyTimeout(&time_mousepressed, dblclick_interval) )
|
||||
{
|
||||
|
@ -1126,7 +1126,7 @@ bool FApplication::parseSGRMouse()
|
|||
}
|
||||
}
|
||||
|
||||
if ( *mouse == newMousePosition
|
||||
if ( *mouse == new_mouse_position
|
||||
&& b_state.wheel_up != Pressed
|
||||
&& b_state.wheel_down != Pressed
|
||||
&& x11_button_state == uChar(((*p & 0x20) << 2) + button) )
|
||||
|
@ -1228,7 +1228,7 @@ bool FApplication::parseUrxvtMouse()
|
|||
if ( y > term->getHeight() )
|
||||
y = uChar(term->getHeight());
|
||||
|
||||
newMousePosition.setPoint(x,y);
|
||||
new_mouse_position.setPoint(x,y);
|
||||
// fill bit field with 0
|
||||
memset(&b_state, 0x00, sizeof(b_state));
|
||||
|
||||
|
@ -1250,7 +1250,7 @@ bool FApplication::parseUrxvtMouse()
|
|||
|
||||
getX11ButtonState (button & button_mask);
|
||||
|
||||
if ( *mouse == newMousePosition
|
||||
if ( *mouse == new_mouse_position
|
||||
&& b_state.wheel_up != Pressed
|
||||
&& b_state.wheel_down != Pressed
|
||||
&& x11_button_state == uChar(button) )
|
||||
|
@ -1398,10 +1398,12 @@ void FApplication::processMouseEvent()
|
|||
|| b_state.wheel_up == Pressed
|
||||
|| b_state.wheel_down == Pressed ) )
|
||||
{
|
||||
// determine the window object on the current click position
|
||||
FWidget* window = FWindow::getWindowWidgetAt (*mouse);
|
||||
|
||||
if ( window )
|
||||
{
|
||||
// determine the widget at the current click position
|
||||
FWidget* child = childWidgetAt (window, *mouse);
|
||||
clicked_widget = (child != 0) ? child : window;
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ class FApplication : public FWidget
|
|||
long dblclick_interval;
|
||||
struct timeval time_keypressed;
|
||||
struct timeval time_mousepressed;
|
||||
FPoint newMousePosition;
|
||||
FPoint new_mouse_position;
|
||||
static FWidget* main_widget;
|
||||
static FWidget* active_window;
|
||||
static FWidget* focus_widget;
|
||||
|
|
|
@ -57,6 +57,10 @@ static uInt character[][fc::NUM_OF_ENCODINGS] =
|
|||
{0x25bc, '.', 0x1f, 'v'}, // ▼ - BlackDownPointingTriangle
|
||||
{0x25ba, '+', 0x10, '>'}, // ► - BlackRightPointingPointer
|
||||
{0x25c4, ',', 0x11, '<'}, // ◄ - BlackLeftPointingPointer
|
||||
{0x25E2,'\\', '\\','\\'}, // ◢ - BlackLowerLightTriangle
|
||||
{0x25E3, '/', '/', '/'}, // ◣ - BlackLowerLeftTriangle
|
||||
{0x25E4,'\\', '\\','\\'}, // ◤ - BlackUpperLeftTriangle
|
||||
{0x25E5, '/', '/', '/'}, // ◥ - BlackUpperRightTriangle
|
||||
{0x1ab4, 0, 0xb4, 0}, // ⊐ - NF_rev_left_arrow2
|
||||
{0x1ab5, 0, 0xb5, 0}, // ► - NF_rev_right_arrow2
|
||||
{0x1ab7, 0, 0xb7, 0}, // ) - NF_radio_button3
|
||||
|
|
|
@ -18,8 +18,8 @@ FDialog::FDialog(FWidget* parent)
|
|||
, result_code(FDialog::Reject)
|
||||
, zoom_button_pressed(false)
|
||||
, zoom_button_active(false)
|
||||
, TitleBarClickPos()
|
||||
, oldGeometry()
|
||||
, titlebar_click_pos()
|
||||
, old_geometry()
|
||||
, dialog_menu()
|
||||
, dgl_menuitem()
|
||||
, zoom_item()
|
||||
|
@ -35,8 +35,8 @@ FDialog::FDialog (const FString& txt, FWidget* parent)
|
|||
, result_code(FDialog::Reject)
|
||||
, zoom_button_pressed(false)
|
||||
, zoom_button_active(false)
|
||||
, TitleBarClickPos()
|
||||
, oldGeometry()
|
||||
, titlebar_click_pos()
|
||||
, old_geometry()
|
||||
, dialog_menu()
|
||||
, dgl_menuitem()
|
||||
, zoom_item()
|
||||
|
@ -622,9 +622,9 @@ void FDialog::onMouseDown (FMouseEvent* ev)
|
|||
|
||||
// click on titlebar or window: raise + activate
|
||||
if ( mouse_x >= 4 && mouse_x <= getWidth()-zoom_btn && mouse_y == 1 )
|
||||
TitleBarClickPos.setPoint (ev->getTermX(), ev->getTermY());
|
||||
titlebar_click_pos.setPoint (ev->getTermX(), ev->getTermY());
|
||||
else
|
||||
TitleBarClickPos.setPoint (0,0);
|
||||
titlebar_click_pos.setPoint (0,0);
|
||||
|
||||
has_raised = raiseWindow();
|
||||
|
||||
|
@ -679,8 +679,8 @@ void FDialog::onMouseDown (FMouseEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void FDialog::onMouseUp (FMouseEvent* ev)
|
||||
{
|
||||
int titlebar_x = TitleBarClickPos.getX();
|
||||
int titlebar_y = TitleBarClickPos.getY();
|
||||
int titlebar_x = titlebar_click_pos.getX();
|
||||
int titlebar_y = titlebar_click_pos.getY();
|
||||
int zoom_btn;
|
||||
|
||||
if ( (flags & fc::resizeable) == 0 )
|
||||
|
@ -695,15 +695,15 @@ void FDialog::onMouseUp (FMouseEvent* ev)
|
|||
int mouse_x = ev->getX();
|
||||
int mouse_y = ev->getY();
|
||||
|
||||
if ( ! TitleBarClickPos.isNull()
|
||||
if ( ! titlebar_click_pos.isNull()
|
||||
&& titlebar_x > getTermX() + 3
|
||||
&& titlebar_x < getTermX() + getWidth()
|
||||
&& titlebar_y == getTermY() )
|
||||
{
|
||||
FPoint currentPos(getGeometry().getX(), getGeometry().getY());
|
||||
FPoint deltaPos = ev->getTermPos() - TitleBarClickPos;
|
||||
FPoint deltaPos = ev->getTermPos() - titlebar_click_pos;
|
||||
move (currentPos + deltaPos);
|
||||
TitleBarClickPos = ev->getTermPos();
|
||||
titlebar_click_pos = ev->getTermPos();
|
||||
}
|
||||
|
||||
// click on titlebar menu button
|
||||
|
@ -750,12 +750,12 @@ void FDialog::onMouseMove (FMouseEvent* ev)
|
|||
int mouse_x = ev->getX();
|
||||
int mouse_y = ev->getY();
|
||||
|
||||
if ( ! TitleBarClickPos.isNull() )
|
||||
if ( ! titlebar_click_pos.isNull() )
|
||||
{
|
||||
FPoint currentPos(getGeometry().getX(), getGeometry().getY());
|
||||
FPoint deltaPos = ev->getTermPos() - TitleBarClickPos;
|
||||
FPoint deltaPos = ev->getTermPos() - titlebar_click_pos;
|
||||
move (currentPos + deltaPos);
|
||||
TitleBarClickPos = ev->getTermPos();
|
||||
titlebar_click_pos = ev->getTermPos();
|
||||
}
|
||||
|
||||
if ( dialog_menu->isVisible() && dialog_menu->isShown() )
|
||||
|
@ -1018,13 +1018,13 @@ void FDialog::move (int x, int y)
|
|||
const FPoint& shadow = getShadow();
|
||||
rsw = shadow.getX(); // right shadow width;
|
||||
bsh = shadow.getY(); // bottom shadow height
|
||||
oldGeometry = getGeometryWithShadow();
|
||||
old_geometry = getGeometryWithShadow();
|
||||
|
||||
FWidget::move(x,y);
|
||||
setPos(x, y, false);
|
||||
putArea (getTermPos(), vwin);updateTerminal();
|
||||
|
||||
if ( getGeometry().overlap(oldGeometry) )
|
||||
if ( getGeometry().overlap(old_geometry) )
|
||||
{
|
||||
// dx > 0 : move left
|
||||
// dx = 0 : move vertical
|
||||
|
|
|
@ -54,8 +54,8 @@ class FDialog : public FWindow
|
|||
int result_code;
|
||||
bool zoom_button_pressed;
|
||||
bool zoom_button_active;
|
||||
FPoint TitleBarClickPos;
|
||||
FRect oldGeometry; // required by move()
|
||||
FPoint titlebar_click_pos;
|
||||
FRect old_geometry; // required by move()
|
||||
FMenu* dialog_menu;
|
||||
FMenuItem* dgl_menuitem;
|
||||
FMenuItem* zoom_item;
|
||||
|
|
10
src/fenum.h
10
src/fenum.h
|
@ -166,6 +166,10 @@ class fc
|
|||
LowerHalfBlock = 0x2584, // ▄
|
||||
LeftHalfBlock = 0x258c, // ▌
|
||||
RightHalfBlock = 0x2590, // ▐
|
||||
BlackLowerLightTriangle = 0x25E2, // ◢
|
||||
BlackLowerLeftTriangle = 0x25E3, // ◣
|
||||
BlackUpperLeftTriangle = 0x25E4, // ◤
|
||||
BlackUpperRightTriangle = 0x25E5, // ◥
|
||||
NF_rev_left_arrow2 = 0x1ab4, // ⊐
|
||||
NF_rev_right_arrow2 = 0x1ab5, // ►
|
||||
NF_radio_button3 = 0x1ab7, // )
|
||||
|
@ -906,7 +910,7 @@ class fc
|
|||
};
|
||||
|
||||
// xterm cursor style
|
||||
enum xterm_cursor_style
|
||||
enum xtermCursorStyle
|
||||
{
|
||||
blinking_block = 0,
|
||||
blinking_block_default = 1,
|
||||
|
@ -918,7 +922,7 @@ class fc
|
|||
};
|
||||
|
||||
// linux console and framebuffer cursor style
|
||||
enum console_cursor_style
|
||||
enum consoleCursorStyle
|
||||
{
|
||||
default_cursor = 0,
|
||||
invisible_cursor = 1,
|
||||
|
@ -930,7 +934,7 @@ class fc
|
|||
};
|
||||
|
||||
// KDE konsole cursor style
|
||||
enum kde_konsole_CursorShape
|
||||
enum kdeKonsoleCursorShape
|
||||
{
|
||||
BlockCursor = 0,
|
||||
IBeamCursor = 1,
|
||||
|
|
|
@ -375,10 +375,24 @@ void FLabel::onMouseDown (FMouseEvent* ev)
|
|||
return;
|
||||
|
||||
if ( ! (isEnabled() && accel_widget) )
|
||||
{
|
||||
// send click to the parent widget
|
||||
if ( FWidget* parent = getParentWidget() )
|
||||
{
|
||||
int b = ev->getButton();
|
||||
const FPoint& tp = ev->getTermPos();
|
||||
const FPoint& p = parent->termToWidgetPos(tp);
|
||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseDown_Event, p, tp, b);
|
||||
FApplication::sendEvent (parent, _ev);
|
||||
delete _ev;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! accel_widget->hasFocus() )
|
||||
{
|
||||
// focus the accelerator widget
|
||||
FWidget* focused_widget = getFocusWidget();
|
||||
FFocusEvent out (fc::FocusOut_Event);
|
||||
FApplication::queueEvent(focused_widget, &out);
|
||||
|
|
|
@ -17,9 +17,9 @@ FLineEdit::FLineEdit(FWidget* parent)
|
|||
, text("")
|
||||
, label_text("")
|
||||
, label(new FLabel("", parent))
|
||||
, dragScroll(FLineEdit::noScroll)
|
||||
, scrollTimer(false)
|
||||
, scrollRepeat(100)
|
||||
, drag_scroll(FLineEdit::noScroll)
|
||||
, scroll_timer(false)
|
||||
, scroll_repeat(100)
|
||||
, insert_mode(true)
|
||||
, cursor_pos(0)
|
||||
, text_offset(0)
|
||||
|
@ -34,9 +34,9 @@ FLineEdit::FLineEdit (const FString& txt, FWidget* parent)
|
|||
, text(txt)
|
||||
, label_text("")
|
||||
, label(new FLabel("", parent))
|
||||
, dragScroll(FLineEdit::noScroll)
|
||||
, scrollTimer(false)
|
||||
, scrollRepeat(100)
|
||||
, drag_scroll(FLineEdit::noScroll)
|
||||
, scroll_timer(false)
|
||||
, scroll_repeat(100)
|
||||
, insert_mode(true)
|
||||
, cursor_pos(0)
|
||||
, text_offset(0)
|
||||
|
@ -612,11 +612,11 @@ void FLineEdit::onMouseDown (FMouseEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void FLineEdit::onMouseUp (FMouseEvent*)
|
||||
{
|
||||
if ( dragScroll != FLineEdit::noScroll )
|
||||
if ( drag_scroll != FLineEdit::noScroll )
|
||||
{
|
||||
delOwnTimer();
|
||||
dragScroll = FLineEdit::noScroll;
|
||||
scrollTimer = false;
|
||||
drag_scroll = FLineEdit::noScroll;
|
||||
scroll_timer = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -647,41 +647,41 @@ void FLineEdit::onMouseMove (FMouseEvent* ev)
|
|||
if ( mouse_x < 2 )
|
||||
{
|
||||
// drag left
|
||||
if ( ! scrollTimer && text_offset > 0 )
|
||||
if ( ! scroll_timer && text_offset > 0 )
|
||||
{
|
||||
scrollTimer = true;
|
||||
addTimer(scrollRepeat);
|
||||
dragScroll = FLineEdit::scrollLeft;
|
||||
scroll_timer = true;
|
||||
addTimer(scroll_repeat);
|
||||
drag_scroll = FLineEdit::scrollLeft;
|
||||
}
|
||||
|
||||
if ( text_offset == 0 )
|
||||
{
|
||||
delOwnTimer();
|
||||
dragScroll = FLineEdit::noScroll;
|
||||
drag_scroll = FLineEdit::noScroll;
|
||||
}
|
||||
}
|
||||
else if ( mouse_x >= getWidth() )
|
||||
{
|
||||
// drag right
|
||||
if ( ! scrollTimer && text_offset <= len-getWidth()+1 )
|
||||
if ( ! scroll_timer && text_offset <= len-getWidth()+1 )
|
||||
{
|
||||
scrollTimer = true;
|
||||
addTimer(scrollRepeat);
|
||||
dragScroll = FLineEdit::scrollRight;
|
||||
scroll_timer = true;
|
||||
addTimer(scroll_repeat);
|
||||
drag_scroll = FLineEdit::scrollRight;
|
||||
}
|
||||
|
||||
if ( text_offset == len-getWidth()+2 )
|
||||
{
|
||||
delOwnTimer();
|
||||
dragScroll = FLineEdit::noScroll;
|
||||
drag_scroll = FLineEdit::noScroll;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// no dragging
|
||||
delOwnTimer();
|
||||
scrollTimer = false;
|
||||
dragScroll = FLineEdit::noScroll;
|
||||
scroll_timer = false;
|
||||
drag_scroll = FLineEdit::noScroll;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -690,7 +690,7 @@ void FLineEdit::onTimer (FTimerEvent*)
|
|||
{
|
||||
int len = int(text.getLength());
|
||||
|
||||
switch ( dragScroll )
|
||||
switch ( drag_scroll )
|
||||
{
|
||||
case FLineEdit::noScroll:
|
||||
return;
|
||||
|
@ -698,7 +698,7 @@ void FLineEdit::onTimer (FTimerEvent*)
|
|||
case FLineEdit::scrollLeft:
|
||||
if ( text_offset == 0)
|
||||
{
|
||||
dragScroll = FLineEdit::noScroll;
|
||||
drag_scroll = FLineEdit::noScroll;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -717,7 +717,7 @@ void FLineEdit::onTimer (FTimerEvent*)
|
|||
case FLineEdit::scrollRight:
|
||||
if ( text_offset == len-getWidth()+2 )
|
||||
{
|
||||
dragScroll = FLineEdit::noScroll;
|
||||
drag_scroll = FLineEdit::noScroll;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,15 +40,17 @@ class FLineEdit : public FWidget
|
|||
FString text;
|
||||
FString label_text;
|
||||
FLabel* label;
|
||||
enum drag_scroll
|
||||
|
||||
enum dragScroll
|
||||
{
|
||||
noScroll = 0,
|
||||
scrollLeft = 1,
|
||||
scrollRight = 2
|
||||
};
|
||||
int dragScroll;
|
||||
bool scrollTimer;
|
||||
int scrollRepeat;
|
||||
|
||||
dragScroll drag_scroll;
|
||||
bool scroll_timer;
|
||||
int scroll_repeat;
|
||||
bool insert_mode;
|
||||
int cursor_pos;
|
||||
int text_offset;
|
||||
|
|
318
src/flistbox.cpp
318
src/flistbox.cpp
|
@ -55,16 +55,16 @@ FListBoxItem::~FListBoxItem()
|
|||
FListBox::FListBox(FWidget* parent)
|
||||
: FWidget(parent)
|
||||
, data()
|
||||
, VBar(0)
|
||||
, HBar(0)
|
||||
, vbar(0)
|
||||
, hbar(0)
|
||||
, text()
|
||||
, inc_search()
|
||||
, multiSelect(false)
|
||||
, mouseSelect(false)
|
||||
, dragScroll(FListBox::noScroll)
|
||||
, scrollTimer(false)
|
||||
, scrollRepeat(100)
|
||||
, scrollDistance(1)
|
||||
, multi_select(false)
|
||||
, mouse_select(false)
|
||||
, drag_scroll(FListBox::noScroll)
|
||||
, scroll_timer(false)
|
||||
, scroll_repeat(100)
|
||||
, scroll_distance(1)
|
||||
, current(0)
|
||||
, last_current(-1)
|
||||
, secect_from_item(-1)
|
||||
|
@ -72,7 +72,7 @@ FListBox::FListBox(FWidget* parent)
|
|||
, yoffset(0)
|
||||
, last_yoffset(-1)
|
||||
, nf_offset(0)
|
||||
, maxLineWidth(0)
|
||||
, max_line_width(0)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
@ -81,8 +81,8 @@ FListBox::FListBox(FWidget* parent)
|
|||
FListBox::~FListBox() // destructor
|
||||
{
|
||||
delOwnTimer();
|
||||
delete VBar;
|
||||
delete HBar;
|
||||
delete vbar;
|
||||
delete hbar;
|
||||
}
|
||||
|
||||
|
||||
|
@ -101,25 +101,25 @@ void FListBox::init()
|
|||
setForegroundColor (wc.dialog_fg);
|
||||
setBackgroundColor (wc.dialog_bg);
|
||||
|
||||
VBar = new FScrollbar(fc::vertical, this);
|
||||
VBar->setMinimum(0);
|
||||
VBar->setValue(0);
|
||||
VBar->hide();
|
||||
vbar = new FScrollbar(fc::vertical, this);
|
||||
vbar->setMinimum(0);
|
||||
vbar->setValue(0);
|
||||
vbar->hide();
|
||||
|
||||
HBar = new FScrollbar(fc::horizontal, this);
|
||||
HBar->setMinimum(0);
|
||||
HBar->setValue(0);
|
||||
HBar->hide();
|
||||
hbar = new FScrollbar(fc::horizontal, this);
|
||||
hbar->setMinimum(0);
|
||||
hbar->setValue(0);
|
||||
hbar->hide();
|
||||
|
||||
setGeometry (1, 1, 5, 4, false); // initialize geometry values
|
||||
|
||||
VBar->addCallback
|
||||
vbar->addCallback
|
||||
(
|
||||
"change-value",
|
||||
_METHOD_CALLBACK (this, &FListBox::cb_VBarChange)
|
||||
);
|
||||
|
||||
HBar->addCallback
|
||||
hbar->addCallback
|
||||
(
|
||||
"change-value",
|
||||
_METHOD_CALLBACK (this, &FListBox::cb_HBarChange)
|
||||
|
@ -145,7 +145,7 @@ void FListBox::draw()
|
|||
else
|
||||
drawBorder();
|
||||
|
||||
if ( isNewFont() && ! VBar->isVisible() )
|
||||
if ( isNewFont() && ! vbar->isVisible() )
|
||||
{
|
||||
setColor();
|
||||
|
||||
|
@ -163,11 +163,11 @@ void FListBox::draw()
|
|||
|
||||
updateVTerm(true);
|
||||
|
||||
if ( VBar->isVisible() )
|
||||
VBar->redraw();
|
||||
if ( vbar->isVisible() )
|
||||
vbar->redraw();
|
||||
|
||||
if ( HBar->isVisible() )
|
||||
HBar->redraw();
|
||||
if ( hbar->isVisible() )
|
||||
hbar->redraw();
|
||||
|
||||
drawList();
|
||||
isFocus = ((flags & fc::focus) != 0);
|
||||
|
@ -521,27 +521,27 @@ void FListBox::adjustSize()
|
|||
FWidget::adjustSize();
|
||||
|
||||
element_count = int(count());
|
||||
VBar->setMaximum(element_count - getHeight() + 2);
|
||||
VBar->setPageSize(element_count, getHeight() - 2);
|
||||
VBar->setX(getWidth());
|
||||
VBar->setHeight (getHeight()-2, false);
|
||||
VBar->resize();
|
||||
vbar->setMaximum(element_count - getHeight() + 2);
|
||||
vbar->setPageSize(element_count, getHeight() - 2);
|
||||
vbar->setX(getWidth());
|
||||
vbar->setHeight (getHeight()-2, false);
|
||||
vbar->resize();
|
||||
|
||||
HBar->setMaximum(maxLineWidth - getWidth() + nf_offset + 4);
|
||||
HBar->setPageSize(maxLineWidth, getWidth() - nf_offset - 4);
|
||||
HBar->setY(getHeight());
|
||||
HBar->setWidth (getWidth()-2, false);
|
||||
HBar->resize();
|
||||
hbar->setMaximum(max_line_width - getWidth() + nf_offset + 4);
|
||||
hbar->setPageSize(max_line_width, getWidth() - nf_offset - 4);
|
||||
hbar->setY(getHeight());
|
||||
hbar->setWidth (getWidth()-2, false);
|
||||
hbar->resize();
|
||||
|
||||
if ( element_count < getHeight() - 1 )
|
||||
VBar->hide();
|
||||
vbar->hide();
|
||||
else
|
||||
VBar->setVisible();
|
||||
vbar->setVisible();
|
||||
|
||||
if ( maxLineWidth < getWidth() - nf_offset - 3 )
|
||||
HBar->hide();
|
||||
if ( max_line_width < getWidth() - nf_offset - 3 )
|
||||
hbar->hide();
|
||||
else
|
||||
HBar->setVisible();
|
||||
hbar->setVisible();
|
||||
}
|
||||
|
||||
// public methods of FListBox
|
||||
|
@ -565,7 +565,7 @@ void FListBox::setCurrentItem(int index)
|
|||
xoffset = 0;
|
||||
yoffset = 0;
|
||||
adjustSize();
|
||||
VBar->setValue(yoffset);
|
||||
vbar->setValue(yoffset);
|
||||
|
||||
if ( isVisible() )
|
||||
redraw();
|
||||
|
@ -622,18 +622,18 @@ void FListBox::showInsideBrackets ( int index
|
|||
{
|
||||
int len = int(data[uInt(index-1)].getText().getLength() + 2);
|
||||
|
||||
if ( len > maxLineWidth )
|
||||
if ( len > max_line_width )
|
||||
{
|
||||
maxLineWidth = len;
|
||||
max_line_width = len;
|
||||
|
||||
if ( len >= getWidth() - nf_offset - 3 )
|
||||
{
|
||||
HBar->setMaximum(maxLineWidth - getWidth() + nf_offset + 4);
|
||||
HBar->setPageSize(maxLineWidth, getWidth() - nf_offset - 4);
|
||||
HBar->setValue (xoffset);
|
||||
hbar->setMaximum(max_line_width - getWidth() + nf_offset + 4);
|
||||
hbar->setPageSize(max_line_width, getWidth() - nf_offset - 4);
|
||||
hbar->setValue (xoffset);
|
||||
|
||||
if ( ! HBar->isVisible() )
|
||||
HBar->setVisible();
|
||||
if ( ! hbar->isVisible() )
|
||||
hbar->setVisible();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -646,13 +646,13 @@ void FListBox::setGeometry (int x, int y, int w, int h, bool adjust)
|
|||
|
||||
if ( isNewFont() )
|
||||
{
|
||||
VBar->setGeometry (getWidth(), 2, 2, getHeight()-2);
|
||||
HBar->setGeometry (1, getHeight(), getWidth()-2, 1);
|
||||
vbar->setGeometry (getWidth(), 2, 2, getHeight()-2);
|
||||
hbar->setGeometry (1, getHeight(), getWidth()-2, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
VBar->setGeometry (getWidth(), 2, 1, getHeight()-2);
|
||||
HBar->setGeometry (2, getHeight(), getWidth()-2, 1);
|
||||
vbar->setGeometry (getWidth(), 2, 1, getHeight()-2);
|
||||
hbar->setGeometry (2, getHeight(), getWidth()-2, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -755,8 +755,8 @@ void FListBox::onKeyPress (FKeyEvent* ev)
|
|||
case fc::Fkey_right:
|
||||
xoffset++;
|
||||
|
||||
if ( xoffset > maxLineWidth - getWidth() + nf_offset + 4 )
|
||||
xoffset = maxLineWidth - getWidth() + nf_offset + 4;
|
||||
if ( xoffset > max_line_width - getWidth() + nf_offset + 4 )
|
||||
xoffset = max_line_width - getWidth() + nf_offset + 4;
|
||||
|
||||
if ( xoffset < 0 )
|
||||
xoffset = 0;
|
||||
|
@ -979,15 +979,15 @@ void FListBox::onKeyPress (FKeyEvent* ev)
|
|||
if ( isVisible() )
|
||||
drawList();
|
||||
|
||||
VBar->setValue (yoffset);
|
||||
vbar->setValue (yoffset);
|
||||
|
||||
if ( VBar->isVisible() && yoffset_before != yoffset )
|
||||
VBar->drawBar();
|
||||
if ( vbar->isVisible() && yoffset_before != yoffset )
|
||||
vbar->drawBar();
|
||||
|
||||
HBar->setValue (xoffset);
|
||||
hbar->setValue (xoffset);
|
||||
|
||||
if ( HBar->isVisible() && xoffset_before != xoffset )
|
||||
HBar->drawBar();
|
||||
if ( hbar->isVisible() && xoffset_before != xoffset )
|
||||
hbar->drawBar();
|
||||
|
||||
updateTerminal();
|
||||
flush_out();
|
||||
|
@ -1041,12 +1041,12 @@ void FListBox::onMouseDown (FMouseEvent* ev)
|
|||
{
|
||||
if ( isSelected(current) )
|
||||
{
|
||||
mouseSelect = false;
|
||||
mouse_select = false;
|
||||
unselectItem(current);
|
||||
}
|
||||
else
|
||||
{
|
||||
mouseSelect = true;
|
||||
mouse_select = true;
|
||||
selectItem(current);
|
||||
}
|
||||
|
||||
|
@ -1058,10 +1058,10 @@ void FListBox::onMouseDown (FMouseEvent* ev)
|
|||
if ( isVisible() )
|
||||
drawList();
|
||||
|
||||
VBar->setValue (yoffset);
|
||||
vbar->setValue (yoffset);
|
||||
|
||||
if ( VBar->isVisible() && yoffset_before != yoffset )
|
||||
VBar->drawBar();
|
||||
if ( vbar->isVisible() && yoffset_before != yoffset )
|
||||
vbar->drawBar();
|
||||
|
||||
updateTerminal();
|
||||
flush_out();
|
||||
|
@ -1071,12 +1071,12 @@ void FListBox::onMouseDown (FMouseEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void FListBox::onMouseUp (FMouseEvent* ev)
|
||||
{
|
||||
if ( dragScroll != FListBox::noScroll )
|
||||
if ( drag_scroll != FListBox::noScroll )
|
||||
{
|
||||
delOwnTimer();
|
||||
dragScroll = FListBox::noScroll;
|
||||
scrollDistance = 1;
|
||||
scrollTimer = false;
|
||||
drag_scroll = FListBox::noScroll;
|
||||
scroll_distance = 1;
|
||||
scroll_timer = false;
|
||||
}
|
||||
|
||||
if ( ev->getButton() == fc::LeftButton )
|
||||
|
@ -1143,7 +1143,7 @@ void FListBox::onMouseMove (FMouseEvent* ev)
|
|||
}
|
||||
for (int i=from; i <= to; i++)
|
||||
{
|
||||
if ( mouseSelect )
|
||||
if ( mouse_select )
|
||||
{
|
||||
selectItem(i);
|
||||
processSelect();
|
||||
|
@ -1161,10 +1161,10 @@ void FListBox::onMouseMove (FMouseEvent* ev)
|
|||
if ( isVisible() )
|
||||
drawList();
|
||||
|
||||
VBar->setValue (yoffset);
|
||||
vbar->setValue (yoffset);
|
||||
|
||||
if ( VBar->isVisible() && yoffset_before != yoffset )
|
||||
VBar->drawBar();
|
||||
if ( vbar->isVisible() && yoffset_before != yoffset )
|
||||
vbar->drawBar();
|
||||
|
||||
updateTerminal();
|
||||
flush_out();
|
||||
|
@ -1174,56 +1174,58 @@ void FListBox::onMouseMove (FMouseEvent* ev)
|
|||
if ( mouse_y < 2 )
|
||||
{
|
||||
// drag up
|
||||
if ( dragScroll != FListBox::noScroll && scrollDistance < getHeight()-2 )
|
||||
scrollDistance++;
|
||||
if ( drag_scroll != FListBox::noScroll
|
||||
&& scroll_distance < getHeight()-2 )
|
||||
scroll_distance++;
|
||||
|
||||
if ( ! scrollTimer && current > 1 )
|
||||
if ( ! scroll_timer && current > 1 )
|
||||
{
|
||||
scrollTimer = true;
|
||||
addTimer(scrollRepeat);
|
||||
scroll_timer = true;
|
||||
addTimer(scroll_repeat);
|
||||
|
||||
if ( ev->getButton() == fc::RightButton )
|
||||
dragScroll = FListBox::scrollUpSelect;
|
||||
drag_scroll = FListBox::scrollUpSelect;
|
||||
else
|
||||
dragScroll = FListBox::scrollUp;
|
||||
drag_scroll = FListBox::scrollUp;
|
||||
}
|
||||
|
||||
if ( current == 1 )
|
||||
{
|
||||
delOwnTimer();
|
||||
dragScroll = FListBox::noScroll;
|
||||
drag_scroll = FListBox::noScroll;
|
||||
}
|
||||
}
|
||||
else if ( mouse_y >= getHeight() )
|
||||
{
|
||||
// drag down
|
||||
if ( dragScroll != FListBox::noScroll && scrollDistance < getHeight()-2 )
|
||||
scrollDistance++;
|
||||
if ( drag_scroll != FListBox::noScroll
|
||||
&& scroll_distance < getHeight()-2 )
|
||||
scroll_distance++;
|
||||
|
||||
if ( ! scrollTimer && current < int(count()) )
|
||||
if ( ! scroll_timer && current < int(count()) )
|
||||
{
|
||||
scrollTimer = true;
|
||||
addTimer(scrollRepeat);
|
||||
scroll_timer = true;
|
||||
addTimer(scroll_repeat);
|
||||
|
||||
if ( ev->getButton() == fc::RightButton )
|
||||
dragScroll = FListBox::scrollDownSelect;
|
||||
drag_scroll = FListBox::scrollDownSelect;
|
||||
else
|
||||
dragScroll = FListBox::scrollDown;
|
||||
drag_scroll = FListBox::scrollDown;
|
||||
}
|
||||
|
||||
if ( current == int(count()) )
|
||||
{
|
||||
delOwnTimer();
|
||||
dragScroll = FListBox::noScroll;
|
||||
drag_scroll = FListBox::noScroll;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// no dragging
|
||||
delOwnTimer();
|
||||
scrollTimer = false;
|
||||
scrollDistance = 1;
|
||||
dragScroll = FListBox::noScroll;
|
||||
scroll_timer = false;
|
||||
scroll_distance = 1;
|
||||
drag_scroll = FListBox::noScroll;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1255,7 +1257,7 @@ void FListBox::onTimer (FTimerEvent*)
|
|||
int current_before = current;
|
||||
int yoffset_before = yoffset;
|
||||
|
||||
switch ( dragScroll )
|
||||
switch ( drag_scroll )
|
||||
{
|
||||
case FListBox::noScroll:
|
||||
return;
|
||||
|
@ -1264,17 +1266,17 @@ void FListBox::onTimer (FTimerEvent*)
|
|||
case FListBox::scrollUpSelect:
|
||||
if ( current_before == 1)
|
||||
{
|
||||
dragScroll = FListBox::noScroll;
|
||||
drag_scroll = FListBox::noScroll;
|
||||
return;
|
||||
}
|
||||
|
||||
current -= scrollDistance;
|
||||
current -= scroll_distance;
|
||||
|
||||
if ( current < 1 )
|
||||
current=1;
|
||||
|
||||
if ( current <= yoffset )
|
||||
yoffset -= scrollDistance;
|
||||
yoffset -= scroll_distance;
|
||||
|
||||
if ( yoffset < 0 )
|
||||
yoffset=0;
|
||||
|
@ -1284,17 +1286,17 @@ void FListBox::onTimer (FTimerEvent*)
|
|||
case FListBox::scrollDownSelect:
|
||||
if ( current_before == element_count )
|
||||
{
|
||||
dragScroll = FListBox::noScroll;
|
||||
drag_scroll = FListBox::noScroll;
|
||||
return;
|
||||
}
|
||||
|
||||
current += scrollDistance;
|
||||
current += scroll_distance;
|
||||
|
||||
if ( current > element_count )
|
||||
current = element_count;
|
||||
|
||||
if ( current - yoffset >= getHeight() - 1 )
|
||||
yoffset += scrollDistance;
|
||||
yoffset += scroll_distance;
|
||||
|
||||
if ( yoffset > element_count - getHeight() + 2 )
|
||||
yoffset = element_count - getHeight() + 2;
|
||||
|
@ -1304,8 +1306,8 @@ void FListBox::onTimer (FTimerEvent*)
|
|||
}
|
||||
|
||||
// handle multiple selections
|
||||
if ( dragScroll == FListBox::scrollUpSelect
|
||||
|| dragScroll == FListBox::scrollDownSelect )
|
||||
if ( drag_scroll == FListBox::scrollUpSelect
|
||||
|| drag_scroll == FListBox::scrollDownSelect )
|
||||
{
|
||||
if ( isMultiSelection() && current_before != current )
|
||||
{
|
||||
|
@ -1324,7 +1326,7 @@ void FListBox::onTimer (FTimerEvent*)
|
|||
|
||||
for (int i=from; i <= to; i++)
|
||||
{
|
||||
if ( mouseSelect )
|
||||
if ( mouse_select )
|
||||
{
|
||||
selectItem(i);
|
||||
processSelect();
|
||||
|
@ -1343,10 +1345,10 @@ void FListBox::onTimer (FTimerEvent*)
|
|||
if ( isVisible() )
|
||||
drawList();
|
||||
|
||||
VBar->setValue (yoffset);
|
||||
vbar->setValue (yoffset);
|
||||
|
||||
if ( VBar->isVisible() && yoffset_before != yoffset )
|
||||
VBar->drawBar();
|
||||
if ( vbar->isVisible() && yoffset_before != yoffset )
|
||||
vbar->drawBar();
|
||||
|
||||
updateTerminal();
|
||||
flush_out();
|
||||
|
@ -1366,12 +1368,12 @@ void FListBox::onWheel (FWheelEvent* ev)
|
|||
|
||||
wheel = ev->getWheel();
|
||||
|
||||
if ( dragScroll != FListBox::noScroll )
|
||||
if ( drag_scroll != FListBox::noScroll )
|
||||
{
|
||||
delOwnTimer();
|
||||
scrollTimer = false;
|
||||
scrollDistance = 1;
|
||||
dragScroll = FListBox::noScroll;
|
||||
scroll_timer = false;
|
||||
scroll_distance = 1;
|
||||
drag_scroll = FListBox::noScroll;
|
||||
}
|
||||
|
||||
switch ( wheel )
|
||||
|
@ -1431,10 +1433,10 @@ void FListBox::onWheel (FWheelEvent* ev)
|
|||
if ( isVisible() )
|
||||
drawList();
|
||||
|
||||
VBar->setValue (yoffset);
|
||||
vbar->setValue (yoffset);
|
||||
|
||||
if ( VBar->isVisible() && yoffset_before != yoffset )
|
||||
VBar->drawBar();
|
||||
if ( vbar->isVisible() && yoffset_before != yoffset )
|
||||
vbar->drawBar();
|
||||
|
||||
updateTerminal();
|
||||
flush_out();
|
||||
|
@ -1468,7 +1470,7 @@ void FListBox::cb_VBarChange (FWidget*, void*)
|
|||
int distance = 1;
|
||||
int element_count = int(count());
|
||||
int yoffset_before = yoffset;
|
||||
int scrollType = VBar->getScrollType();
|
||||
int scrollType = vbar->getScrollType();
|
||||
|
||||
switch ( scrollType )
|
||||
{
|
||||
|
@ -1508,7 +1510,7 @@ void FListBox::cb_VBarChange (FWidget*, void*)
|
|||
|
||||
case FScrollbar::scrollJump:
|
||||
{
|
||||
int val = VBar->getValue();
|
||||
int val = vbar->getValue();
|
||||
|
||||
if ( yoffset == val )
|
||||
break;
|
||||
|
@ -1557,10 +1559,10 @@ void FListBox::cb_VBarChange (FWidget*, void*)
|
|||
if ( scrollType >= FScrollbar::scrollStepBackward
|
||||
&& scrollType <= FScrollbar::scrollPageForward )
|
||||
{
|
||||
VBar->setValue (yoffset);
|
||||
vbar->setValue (yoffset);
|
||||
|
||||
if ( VBar->isVisible() && yoffset_before != yoffset )
|
||||
VBar->drawBar();
|
||||
if ( vbar->isVisible() && yoffset_before != yoffset )
|
||||
vbar->drawBar();
|
||||
|
||||
updateTerminal();
|
||||
flush_out();
|
||||
|
@ -1572,8 +1574,8 @@ void FListBox::cb_HBarChange (FWidget*, void*)
|
|||
{
|
||||
int distance = 1;
|
||||
int xoffset_before = xoffset;
|
||||
int xoffset_end = maxLineWidth - getWidth() + nf_offset + 4;
|
||||
int scrollType = HBar->getScrollType();
|
||||
int xoffset_end = max_line_width - getWidth() + nf_offset + 4;
|
||||
int scrollType = hbar->getScrollType();
|
||||
|
||||
switch ( scrollType )
|
||||
{
|
||||
|
@ -1593,8 +1595,8 @@ void FListBox::cb_HBarChange (FWidget*, void*)
|
|||
case FScrollbar::scrollStepForward:
|
||||
xoffset += distance;
|
||||
|
||||
if ( xoffset > maxLineWidth - getWidth() + nf_offset + 4 )
|
||||
xoffset = maxLineWidth - getWidth() + nf_offset + 4;
|
||||
if ( xoffset > max_line_width - getWidth() + nf_offset + 4 )
|
||||
xoffset = max_line_width - getWidth() + nf_offset + 4;
|
||||
|
||||
if ( xoffset < 0 )
|
||||
xoffset = 0;
|
||||
|
@ -1603,15 +1605,15 @@ void FListBox::cb_HBarChange (FWidget*, void*)
|
|||
|
||||
case FScrollbar::scrollJump:
|
||||
{
|
||||
int val = HBar->getValue();
|
||||
int val = hbar->getValue();
|
||||
|
||||
if ( xoffset == val )
|
||||
break;
|
||||
|
||||
xoffset = val;
|
||||
|
||||
if ( xoffset > maxLineWidth - getWidth() + nf_offset + 4 )
|
||||
xoffset = maxLineWidth - getWidth() + nf_offset + 4;
|
||||
if ( xoffset > max_line_width - getWidth() + nf_offset + 4 )
|
||||
xoffset = max_line_width - getWidth() + nf_offset + 4;
|
||||
|
||||
if ( xoffset < 0 )
|
||||
xoffset = 0;
|
||||
|
@ -1655,10 +1657,10 @@ void FListBox::cb_HBarChange (FWidget*, void*)
|
|||
if ( scrollType >= FScrollbar::scrollStepBackward
|
||||
&& scrollType <= FScrollbar::scrollWheelDown )
|
||||
{
|
||||
HBar->setValue (xoffset);
|
||||
hbar->setValue (xoffset);
|
||||
|
||||
if ( HBar->isVisible() && xoffset_before != xoffset )
|
||||
HBar->drawBar();
|
||||
if ( hbar->isVisible() && xoffset_before != xoffset )
|
||||
hbar->drawBar();
|
||||
|
||||
updateTerminal();
|
||||
flush_out();
|
||||
|
@ -1677,18 +1679,18 @@ void FListBox::insert ( FString item
|
|||
if ( b )
|
||||
len += 2;
|
||||
|
||||
if ( len > maxLineWidth )
|
||||
if ( len > max_line_width )
|
||||
{
|
||||
maxLineWidth = len;
|
||||
max_line_width = len;
|
||||
|
||||
if ( len >= getWidth() - nf_offset - 3 )
|
||||
{
|
||||
HBar->setMaximum(maxLineWidth - getWidth() + nf_offset + 4);
|
||||
HBar->setPageSize(maxLineWidth, getWidth() - nf_offset - 4);
|
||||
HBar->calculateSliderValues();
|
||||
hbar->setMaximum(max_line_width - getWidth() + nf_offset + 4);
|
||||
hbar->setPageSize(max_line_width, getWidth() - nf_offset - 4);
|
||||
hbar->calculateSliderValues();
|
||||
|
||||
if ( ! HBar->isVisible() )
|
||||
HBar->setVisible();
|
||||
if ( ! hbar->isVisible() )
|
||||
hbar->setVisible();
|
||||
}
|
||||
}
|
||||
FListBoxItem listItem (item);
|
||||
|
@ -1697,12 +1699,12 @@ void FListBox::insert ( FString item
|
|||
data.push_back (listItem);
|
||||
|
||||
element_count = int(count());
|
||||
VBar->setMaximum(element_count - getHeight() + 2);
|
||||
VBar->setPageSize(element_count, getHeight() - 2);
|
||||
VBar->calculateSliderValues();
|
||||
vbar->setMaximum(element_count - getHeight() + 2);
|
||||
vbar->setPageSize(element_count, getHeight() - 2);
|
||||
vbar->calculateSliderValues();
|
||||
|
||||
if ( ! VBar->isVisible() && element_count >= getHeight() - 1 )
|
||||
VBar->setVisible();
|
||||
if ( ! vbar->isVisible() && element_count >= getHeight() - 1 )
|
||||
vbar->setVisible();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -1723,27 +1725,27 @@ void FListBox::remove (int item)
|
|||
|
||||
data.erase (data.begin() + item - 1);
|
||||
element_count = int(count());
|
||||
maxLineWidth = 0;
|
||||
max_line_width = 0;
|
||||
|
||||
for (int i=0; i < element_count; i++)
|
||||
{
|
||||
int len = int(data[uInt(i)].getText().getLength());
|
||||
|
||||
if ( len > maxLineWidth )
|
||||
maxLineWidth = len;
|
||||
if ( len > max_line_width )
|
||||
max_line_width = len;
|
||||
}
|
||||
|
||||
HBar->setMaximum(maxLineWidth - getWidth() + nf_offset + 4);
|
||||
HBar->setPageSize(maxLineWidth, getWidth() - nf_offset - 4);
|
||||
hbar->setMaximum(max_line_width - getWidth() + nf_offset + 4);
|
||||
hbar->setPageSize(max_line_width, getWidth() - nf_offset - 4);
|
||||
|
||||
if ( HBar->isVisible() && maxLineWidth < getWidth() - nf_offset - 3 )
|
||||
HBar->hide();
|
||||
if ( hbar->isVisible() && max_line_width < getWidth() - nf_offset - 3 )
|
||||
hbar->hide();
|
||||
|
||||
VBar->setMaximum(element_count - getHeight() + 2);
|
||||
VBar->setPageSize(element_count, getHeight() - 2);
|
||||
vbar->setMaximum(element_count - getHeight() + 2);
|
||||
vbar->setPageSize(element_count, getHeight() - 2);
|
||||
|
||||
if ( VBar->isVisible() && element_count < getHeight() - 1 )
|
||||
VBar->hide();
|
||||
if ( vbar->isVisible() && element_count < getHeight() - 1 )
|
||||
vbar->hide();
|
||||
|
||||
if ( current >= item && current > 1 )
|
||||
current--;
|
||||
|
@ -1769,17 +1771,17 @@ void FListBox::clear()
|
|||
current = 0;
|
||||
xoffset = 0;
|
||||
yoffset = 0;
|
||||
maxLineWidth = 0;
|
||||
max_line_width = 0;
|
||||
last_current = -1;
|
||||
last_yoffset = -1;
|
||||
|
||||
VBar->setMinimum(0);
|
||||
VBar->setValue(0);
|
||||
VBar->hide();
|
||||
vbar->setMinimum(0);
|
||||
vbar->setValue(0);
|
||||
vbar->hide();
|
||||
|
||||
HBar->setMinimum(0);
|
||||
HBar->setValue(0);
|
||||
HBar->hide();
|
||||
hbar->setMinimum(0);
|
||||
hbar->setValue(0);
|
||||
hbar->hide();
|
||||
|
||||
// clear list from screen
|
||||
setColor (wc.list_fg, wc.list_bg);
|
||||
|
|
|
@ -90,7 +90,7 @@ inline void FListBoxItem::setText (const char* txt)
|
|||
class FListBox : public FWidget
|
||||
{
|
||||
private:
|
||||
enum drag_scroll
|
||||
enum dragScroll
|
||||
{
|
||||
noScroll = 0,
|
||||
scrollUp = 1,
|
||||
|
@ -98,17 +98,18 @@ class FListBox : public FWidget
|
|||
scrollUpSelect = 3,
|
||||
scrollDownSelect = 4
|
||||
};
|
||||
|
||||
std::vector<FListBoxItem> data;
|
||||
FScrollbar* VBar;
|
||||
FScrollbar* HBar;
|
||||
FScrollbar* vbar;
|
||||
FScrollbar* hbar;
|
||||
FString text;
|
||||
FString inc_search;
|
||||
bool multiSelect;
|
||||
bool mouseSelect;
|
||||
int dragScroll;
|
||||
bool scrollTimer;
|
||||
int scrollRepeat;
|
||||
int scrollDistance;
|
||||
bool multi_select;
|
||||
bool mouse_select;
|
||||
dragScroll drag_scroll;
|
||||
bool scroll_timer;
|
||||
int scroll_repeat;
|
||||
int scroll_distance;
|
||||
int current;
|
||||
int last_current;
|
||||
int secect_from_item;
|
||||
|
@ -116,7 +117,7 @@ class FListBox : public FWidget
|
|||
int yoffset;
|
||||
int last_yoffset;
|
||||
int nf_offset;
|
||||
int maxLineWidth;
|
||||
int max_line_width;
|
||||
|
||||
private:
|
||||
FListBox (const FListBox&);
|
||||
|
@ -232,7 +233,7 @@ inline bool FListBox::hasBrackets(int index) const
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FListBox::setMultiSelection (bool on)
|
||||
{ multiSelect = on; }
|
||||
{ multi_select = on; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FListBox::setMultiSelection()
|
||||
|
@ -244,7 +245,7 @@ inline void FListBox::unsetMultiSelection()
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FListBox::isMultiSelection() const
|
||||
{ return multiSelect; }
|
||||
{ return multi_select; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FListBox::setEnable()
|
||||
|
|
102
src/fmenu.cpp
102
src/fmenu.cpp
|
@ -17,7 +17,7 @@ FMenu::FMenu(FWidget* parent)
|
|||
, item(0)
|
||||
, super_menu(0)
|
||||
, open_sub_menu(0)
|
||||
, maxItemWidth(0)
|
||||
, max_item_width(0)
|
||||
, mouse_down(false)
|
||||
, has_checkable_items(false)
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ FMenu::FMenu (FString& txt, FWidget* parent)
|
|||
, item(0)
|
||||
, super_menu(0)
|
||||
, open_sub_menu(0)
|
||||
, maxItemWidth(0)
|
||||
, max_item_width(0)
|
||||
, mouse_down(false)
|
||||
, has_checkable_items(false)
|
||||
{
|
||||
|
@ -44,7 +44,7 @@ FMenu::FMenu (const std::string& txt, FWidget* parent)
|
|||
, item(0)
|
||||
, super_menu(0)
|
||||
, open_sub_menu(0)
|
||||
, maxItemWidth(0)
|
||||
, max_item_width(0)
|
||||
, mouse_down(false)
|
||||
, has_checkable_items(false)
|
||||
{
|
||||
|
@ -58,7 +58,7 @@ FMenu::FMenu (const char* txt, FWidget* parent)
|
|||
, item(0)
|
||||
, super_menu(0)
|
||||
, open_sub_menu(0)
|
||||
, maxItemWidth(0)
|
||||
, max_item_width(0)
|
||||
, mouse_down(false)
|
||||
, has_checkable_items(false)
|
||||
{
|
||||
|
@ -124,30 +124,30 @@ void FMenu::init(FWidget* parent)
|
|||
FMenuBar* mbar = dynamic_cast<FMenuBar*>(parent);
|
||||
|
||||
if ( mbar )
|
||||
mbar->menu_dimension();
|
||||
mbar->calculateDimensions();
|
||||
}
|
||||
else if ( isMenu(parent) )
|
||||
{
|
||||
FMenu* smenu = dynamic_cast<FMenu*>(parent);
|
||||
|
||||
if ( smenu )
|
||||
smenu->menu_dimension();
|
||||
smenu->calculateDimensions();
|
||||
}
|
||||
|
||||
setSuperMenu(parent);
|
||||
}
|
||||
|
||||
menu_dimension();
|
||||
calculateDimensions();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMenu::menu_dimension()
|
||||
void FMenu::calculateDimensions()
|
||||
{
|
||||
int item_X, item_Y, adjust_X;
|
||||
std::vector<FMenuItem*>::const_iterator iter, end;
|
||||
iter = itemlist.begin();
|
||||
end = itemlist.end();
|
||||
maxItemWidth = 10; // minimum width
|
||||
iter = item_list.begin();
|
||||
end = item_list.end();
|
||||
max_item_width = 10; // minimum width
|
||||
|
||||
// find the maximum item width
|
||||
while ( iter != end )
|
||||
|
@ -169,8 +169,8 @@ void FMenu::menu_dimension()
|
|||
if ( has_checkable_items )
|
||||
item_width++;
|
||||
|
||||
if ( item_width > maxItemWidth )
|
||||
maxItemWidth = item_width;
|
||||
if ( item_width > max_item_width )
|
||||
max_item_width = item_width;
|
||||
|
||||
++iter;
|
||||
}
|
||||
|
@ -178,20 +178,20 @@ void FMenu::menu_dimension()
|
|||
adjust_X = adjustX(getX());
|
||||
|
||||
// set widget geometry
|
||||
setGeometry (adjust_X, getY(), int(maxItemWidth + 2), int(count() + 2));
|
||||
setGeometry (adjust_X, getY(), int(max_item_width + 2), int(count() + 2));
|
||||
|
||||
// set geometry of all items
|
||||
iter = itemlist.begin();
|
||||
iter = item_list.begin();
|
||||
item_X = 1;
|
||||
item_Y = 1;
|
||||
|
||||
while ( iter != end )
|
||||
{
|
||||
(*iter)->setGeometry (item_X, item_Y, int(maxItemWidth), 1);
|
||||
(*iter)->setGeometry (item_X, item_Y, int(max_item_width), 1);
|
||||
|
||||
if ( (*iter)->hasMenu() )
|
||||
{
|
||||
int menu_X = getTermX() + int(maxItemWidth) + 1;
|
||||
int menu_X = getTermX() + int(max_item_width) + 1;
|
||||
int menu_Y = (*iter)->getTermY() - 2;
|
||||
// set sub-menu position
|
||||
(*iter)->getMenu()->setPos (menu_X, menu_Y, false);
|
||||
|
@ -206,8 +206,8 @@ void FMenu::menu_dimension()
|
|||
void FMenu::adjustItems()
|
||||
{
|
||||
std::vector<FMenuItem*>::const_iterator end, iter;
|
||||
iter = itemlist.begin();
|
||||
end = itemlist.end();
|
||||
iter = item_list.begin();
|
||||
end = item_list.end();
|
||||
|
||||
while ( iter != end )
|
||||
{
|
||||
|
@ -216,7 +216,7 @@ void FMenu::adjustItems()
|
|||
int menu_X, menu_Y;
|
||||
FMenu* menu = (*iter)->getMenu();
|
||||
|
||||
menu_X = getTermX() + int(maxItemWidth) + 1;
|
||||
menu_X = getTermX() + int(max_item_width) + 1;
|
||||
menu_X = menu->adjustX(menu_X);
|
||||
menu_Y = (*iter)->getTermY() - 2;
|
||||
|
||||
|
@ -236,9 +236,9 @@ void FMenu::adjustItems()
|
|||
int FMenu::adjustX (int x_pos)
|
||||
{
|
||||
// Is menu outside on the right of the screen?
|
||||
if ( x_pos+int(maxItemWidth) >= getColumnNumber()-1 )
|
||||
if ( x_pos+int(max_item_width) >= getColumnNumber()-1 )
|
||||
{
|
||||
x_pos = getColumnNumber() - int(maxItemWidth + 1);
|
||||
x_pos = getColumnNumber() - int(max_item_width + 1);
|
||||
// Menu to large for the screen
|
||||
if ( x_pos < 1 )
|
||||
x_pos = 1;
|
||||
|
@ -396,8 +396,8 @@ FMenu* FMenu::superMenuAt (int x, int y)
|
|||
bool FMenu::selectNextItem()
|
||||
{
|
||||
std::vector<FMenuItem*>::const_iterator iter, end;
|
||||
iter = itemlist.begin();
|
||||
end = itemlist.end();
|
||||
iter = item_list.begin();
|
||||
end = item_list.end();
|
||||
|
||||
while ( iter != end )
|
||||
{
|
||||
|
@ -410,8 +410,8 @@ bool FMenu::selectNextItem()
|
|||
do
|
||||
{
|
||||
++next_element;
|
||||
if ( next_element == itemlist.end() )
|
||||
next_element = itemlist.begin();
|
||||
if ( next_element == item_list.end() )
|
||||
next_element = item_list.begin();
|
||||
next = static_cast<FMenuItem*>(*next_element);
|
||||
}
|
||||
while ( ! next->isEnabled()
|
||||
|
@ -446,8 +446,8 @@ bool FMenu::selectNextItem()
|
|||
bool FMenu::selectPrevItem()
|
||||
{
|
||||
std::vector<FMenuItem*>::const_iterator iter, begin;
|
||||
iter = itemlist.end();
|
||||
begin = itemlist.begin();
|
||||
iter = item_list.end();
|
||||
begin = item_list.begin();
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -461,8 +461,8 @@ bool FMenu::selectPrevItem()
|
|||
|
||||
do
|
||||
{
|
||||
if ( prev_element == itemlist.begin() )
|
||||
prev_element = itemlist.end();
|
||||
if ( prev_element == item_list.begin() )
|
||||
prev_element = item_list.end();
|
||||
--prev_element;
|
||||
prev = static_cast<FMenuItem*>(*prev_element);
|
||||
}
|
||||
|
@ -506,8 +506,8 @@ void FMenu::keypressMenuBar (FKeyEvent*& ev)
|
|||
bool FMenu::hotkeyMenu (FKeyEvent*& ev)
|
||||
{
|
||||
std::vector<FMenuItem*>::const_iterator iter, end;
|
||||
iter = itemlist.begin();
|
||||
end = itemlist.end();
|
||||
iter = item_list.begin();
|
||||
end = item_list.end();
|
||||
|
||||
while ( iter != end )
|
||||
{
|
||||
|
@ -695,8 +695,8 @@ void FMenu::drawItems()
|
|||
std::vector<FMenuItem*>::const_iterator iter, end;
|
||||
int c = 0;
|
||||
int y = 0;
|
||||
iter = itemlist.begin();
|
||||
end = itemlist.end();
|
||||
iter = item_list.begin();
|
||||
end = item_list.end();
|
||||
|
||||
if ( has_checkable_items )
|
||||
c = 1;
|
||||
|
@ -851,33 +851,33 @@ void FMenu::drawItems()
|
|||
|
||||
if ( has_menu )
|
||||
{
|
||||
int len = int(maxItemWidth) - (to_char + c + 3);
|
||||
int len = int(max_item_width) - (to_char + c + 3);
|
||||
|
||||
if ( len > 0 )
|
||||
{
|
||||
print (FString(len, wchar_t(' ')));
|
||||
// BlackRightPointingPointer ►
|
||||
print (wchar_t(fc::BlackRightPointingPointer));
|
||||
to_char = int(maxItemWidth) - (c + 2);
|
||||
to_char = int(max_item_width) - (c + 2);
|
||||
}
|
||||
}
|
||||
else if ( accel_key )
|
||||
{
|
||||
FString accel_name (getKeyName(accel_key));
|
||||
int accel_len = int(accel_name.getLength());
|
||||
int len = int(maxItemWidth) - (to_char + accel_len + c + 2);
|
||||
int len = int(max_item_width) - (to_char + accel_len + c + 2);
|
||||
|
||||
if ( len > 0 )
|
||||
{
|
||||
FString spaces (len, wchar_t(' '));
|
||||
print (spaces + accel_name);
|
||||
to_char = int(maxItemWidth) - (c + 2);
|
||||
to_char = int(max_item_width) - (c + 2);
|
||||
}
|
||||
}
|
||||
|
||||
if ( is_selected )
|
||||
{
|
||||
for (uInt i=uInt(to_char+c); i < maxItemWidth-1; i++)
|
||||
for (uInt i=uInt(to_char+c); i < max_item_width - 1; i++)
|
||||
print (' ');
|
||||
}
|
||||
|
||||
|
@ -1105,15 +1105,15 @@ void FMenu::onMouseDown (FMouseEvent* ev)
|
|||
|
||||
mouse_down = true;
|
||||
|
||||
if ( ! itemlist.empty() )
|
||||
if ( ! item_list.empty() )
|
||||
{
|
||||
std::vector<FMenuItem*>::const_iterator iter, end;
|
||||
FMenu* show_sub_menu = 0;
|
||||
bool focus_changed = false;
|
||||
FPoint mouse_pos;
|
||||
|
||||
iter = itemlist.begin();
|
||||
end = itemlist.end();
|
||||
iter = item_list.begin();
|
||||
end = item_list.end();
|
||||
mouse_pos = ev->getPos();
|
||||
mouse_pos -= FPoint(getRightPadding(),getTopPadding());
|
||||
|
||||
|
@ -1213,12 +1213,12 @@ void FMenu::onMouseUp (FMouseEvent* ev)
|
|||
{
|
||||
mouse_down = false;
|
||||
|
||||
if ( ! itemlist.empty() )
|
||||
if ( ! item_list.empty() )
|
||||
{
|
||||
std::vector<FMenuItem*>::const_iterator iter, end;
|
||||
FPoint mouse_pos;
|
||||
iter = itemlist.begin();
|
||||
end = itemlist.end();
|
||||
iter = item_list.begin();
|
||||
end = item_list.end();
|
||||
mouse_pos = ev->getPos();
|
||||
mouse_pos -= FPoint(getRightPadding(),getTopPadding());
|
||||
|
||||
|
@ -1292,7 +1292,7 @@ void FMenu::onMouseMove (FMouseEvent* ev)
|
|||
if ( ! isActiveWindow() )
|
||||
setActiveWindow(this);
|
||||
|
||||
if ( mouse_down && ! itemlist.empty() )
|
||||
if ( mouse_down && ! item_list.empty() )
|
||||
{
|
||||
std::vector<FMenuItem*>::const_iterator iter, end;
|
||||
FMenu* smenu = 0;
|
||||
|
@ -1305,8 +1305,8 @@ void FMenu::onMouseMove (FMouseEvent* ev)
|
|||
FMenu* show_sub_menu = 0;
|
||||
FPoint mouse_pos;
|
||||
|
||||
iter = itemlist.begin();
|
||||
end = itemlist.end();
|
||||
iter = item_list.begin();
|
||||
end = item_list.end();
|
||||
mouse_pos = ev->getPos();
|
||||
mouse_pos -= FPoint(getRightPadding(),getTopPadding());
|
||||
|
||||
|
@ -1572,11 +1572,11 @@ void FMenu::cb_menuitem_toggled (FWidget* widget, void*)
|
|||
if ( ! menuitem->isChecked() )
|
||||
return;
|
||||
|
||||
if ( itemlist.empty() )
|
||||
if ( item_list.empty() )
|
||||
return;
|
||||
|
||||
iter = itemlist.begin();
|
||||
end = itemlist.end();
|
||||
iter = item_list.begin();
|
||||
end = item_list.end();
|
||||
|
||||
while ( iter != end )
|
||||
{
|
||||
|
|
|
@ -49,7 +49,7 @@ class FMenu : public FWindow, public FMenuList
|
|||
FMenuItem* item;
|
||||
FWidget* super_menu;
|
||||
FMenu* open_sub_menu;
|
||||
uInt maxItemWidth;
|
||||
uInt max_item_width;
|
||||
bool mouse_down;
|
||||
bool has_checkable_items;
|
||||
|
||||
|
@ -57,7 +57,7 @@ class FMenu : public FWindow, public FMenuList
|
|||
FMenu (const FMenu&);
|
||||
FMenu& operator = (const FMenu&);
|
||||
void init(FWidget*);
|
||||
void menu_dimension();
|
||||
void calculateDimensions();
|
||||
void adjustItems();
|
||||
int adjustX(int);
|
||||
bool isWindowsMenu (FWidget*) const;
|
||||
|
|
|
@ -61,13 +61,13 @@ void FMenuBar::init()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMenuBar::menu_dimension()
|
||||
void FMenuBar::calculateDimensions()
|
||||
{
|
||||
int item_X = 1;
|
||||
int item_Y = 1;
|
||||
std::vector<FMenuItem*>::const_iterator end, iter;
|
||||
iter = itemlist.begin();
|
||||
end = itemlist.end();
|
||||
iter = item_list.begin();
|
||||
end = item_list.end();
|
||||
|
||||
// find the maximum item width
|
||||
while ( iter != end )
|
||||
|
@ -98,8 +98,8 @@ bool FMenuBar::isMenu (FMenuItem* mi) const
|
|||
bool FMenuBar::selectNextItem()
|
||||
{
|
||||
std::vector<FMenuItem*>::const_iterator iter, end;
|
||||
iter = itemlist.begin();
|
||||
end = itemlist.end();
|
||||
iter = item_list.begin();
|
||||
end = item_list.end();
|
||||
|
||||
while ( iter != end )
|
||||
{
|
||||
|
@ -113,8 +113,8 @@ bool FMenuBar::selectNextItem()
|
|||
{
|
||||
++next_element;
|
||||
|
||||
if ( next_element == itemlist.end() )
|
||||
next_element = itemlist.begin();
|
||||
if ( next_element == item_list.end() )
|
||||
next_element = item_list.begin();
|
||||
|
||||
next = static_cast<FMenuItem*>(*next_element);
|
||||
} while ( ! next->isEnabled()
|
||||
|
@ -161,8 +161,8 @@ bool FMenuBar::selectNextItem()
|
|||
bool FMenuBar::selectPrevItem()
|
||||
{
|
||||
std::vector<FMenuItem*>::const_iterator iter, begin;
|
||||
iter = itemlist.end();
|
||||
begin = itemlist.begin();
|
||||
iter = item_list.end();
|
||||
begin = item_list.begin();
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -176,8 +176,8 @@ bool FMenuBar::selectPrevItem()
|
|||
|
||||
do
|
||||
{
|
||||
if ( prev_element == itemlist.begin() )
|
||||
prev_element = itemlist.end();
|
||||
if ( prev_element == item_list.begin() )
|
||||
prev_element = item_list.end();
|
||||
|
||||
--prev_element;
|
||||
prev = static_cast<FMenuItem*>(*prev_element);
|
||||
|
@ -225,8 +225,8 @@ bool FMenuBar::selectPrevItem()
|
|||
bool FMenuBar::hotkeyMenu (FKeyEvent*& ev)
|
||||
{
|
||||
std::vector<FMenuItem*>::const_iterator iter, end;
|
||||
iter = itemlist.begin();
|
||||
end = itemlist.end();
|
||||
iter = item_list.begin();
|
||||
end = item_list.end();
|
||||
|
||||
while ( iter != end )
|
||||
{
|
||||
|
@ -322,7 +322,7 @@ void FMenuBar::drawItems()
|
|||
int x = 1;
|
||||
screenWidth = getColumnNumber();
|
||||
|
||||
if ( itemlist.empty() )
|
||||
if ( item_list.empty() )
|
||||
return;
|
||||
|
||||
updateVTerm(false);
|
||||
|
@ -331,8 +331,8 @@ void FMenuBar::drawItems()
|
|||
if ( isMonochron() )
|
||||
setReverse(true);
|
||||
|
||||
iter = itemlist.begin();
|
||||
end = itemlist.end();
|
||||
iter = item_list.begin();
|
||||
end = item_list.end();
|
||||
|
||||
while ( iter != end )
|
||||
{
|
||||
|
@ -476,8 +476,8 @@ void FMenuBar::adjustItems()
|
|||
int item_X = 1;
|
||||
int item_Y = 1;
|
||||
std::vector<FMenuItem*>::const_iterator end, iter;
|
||||
iter = itemlist.begin();
|
||||
end = itemlist.end();
|
||||
iter = item_list.begin();
|
||||
end = item_list.end();
|
||||
|
||||
while ( iter != end )
|
||||
{
|
||||
|
@ -592,7 +592,7 @@ void FMenuBar::onMouseDown (FMouseEvent* ev)
|
|||
{
|
||||
mouse_down = false;
|
||||
|
||||
if ( ! itemlist.empty() && hasSelectedItem() )
|
||||
if ( ! item_list.empty() && hasSelectedItem() )
|
||||
leaveMenuBar();
|
||||
else
|
||||
return;
|
||||
|
@ -611,14 +611,14 @@ void FMenuBar::onMouseDown (FMouseEvent* ev)
|
|||
if ( ! isActiveWindow() )
|
||||
setActiveWindow(this);
|
||||
|
||||
if ( ! itemlist.empty() )
|
||||
if ( ! item_list.empty() )
|
||||
{
|
||||
std::vector<FMenuItem*>::const_iterator iter, end;
|
||||
int mouse_x, mouse_y;
|
||||
bool focus_changed = false;
|
||||
|
||||
iter = itemlist.begin();
|
||||
end = itemlist.end();
|
||||
iter = item_list.begin();
|
||||
end = item_list.end();
|
||||
mouse_x = ev->getX();
|
||||
mouse_y = ev->getY();
|
||||
|
||||
|
@ -696,12 +696,12 @@ void FMenuBar::onMouseUp (FMouseEvent* ev)
|
|||
{
|
||||
mouse_down = false;
|
||||
|
||||
if ( ! itemlist.empty() )
|
||||
if ( ! item_list.empty() )
|
||||
{
|
||||
int mouse_x, mouse_y;
|
||||
std::vector<FMenuItem*>::const_iterator iter, end;
|
||||
iter = itemlist.begin();
|
||||
end = itemlist.end();
|
||||
iter = item_list.begin();
|
||||
end = item_list.end();
|
||||
mouse_x = ev->getX();
|
||||
mouse_y = ev->getY();
|
||||
|
||||
|
@ -784,14 +784,14 @@ void FMenuBar::onMouseMove (FMouseEvent* ev)
|
|||
if ( ! isActiveWindow() )
|
||||
setActiveWindow(this);
|
||||
|
||||
if ( mouse_down && ! itemlist.empty() )
|
||||
if ( mouse_down && ! item_list.empty() )
|
||||
{
|
||||
std::vector<FMenuItem*>::const_iterator iter, end;
|
||||
int mouse_x, mouse_y;
|
||||
bool mouse_over_menubar = false;
|
||||
bool focus_changed = false;
|
||||
iter = itemlist.begin();
|
||||
end = itemlist.end();
|
||||
iter = item_list.begin();
|
||||
end = item_list.end();
|
||||
mouse_x = ev->getX();
|
||||
mouse_y = ev->getY();
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ class FMenuBar : public FWindow, public FMenuList
|
|||
FMenuBar (const FMenuBar&);
|
||||
FMenuBar& operator = (const FMenuBar&);
|
||||
void init();
|
||||
void menu_dimension();
|
||||
void calculateDimensions();
|
||||
bool isMenu (FMenuItem*) const;
|
||||
bool selectNextItem();
|
||||
bool selectPrevItem();
|
||||
|
|
|
@ -196,7 +196,7 @@ void FMenuItem::init (FWidget* parent)
|
|||
|
||||
if ( menubar_ptr )
|
||||
{
|
||||
menubar_ptr->menu_dimension();
|
||||
menubar_ptr->calculateDimensions();
|
||||
|
||||
if ( hotkey ) // Meta + hotkey
|
||||
menubar_ptr->addAccelerator (fc::Fmkey_meta + tolower(hotkey), this);
|
||||
|
@ -213,7 +213,7 @@ void FMenuItem::init (FWidget* parent)
|
|||
FMenu* menu_ptr = dynamic_cast<FMenu*>(parent);
|
||||
|
||||
if ( menu_ptr )
|
||||
menu_ptr->menu_dimension();
|
||||
menu_ptr->calculateDimensions();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -307,7 +307,7 @@ void FMenuItem::createDialogList (FMenu* winmenu)
|
|||
}
|
||||
}
|
||||
|
||||
winmenu->menu_dimension();
|
||||
winmenu->calculateDimensions();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -393,7 +393,7 @@ void FMenuItem::addAccelerator (int key, FWidget* obj)
|
|||
FMenu* menu_ptr = dynamic_cast<FMenu*>(super_menu);
|
||||
|
||||
if ( menu_ptr )
|
||||
menu_ptr->menu_dimension();
|
||||
menu_ptr->calculateDimensions();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -426,7 +426,7 @@ void FMenuItem::delAccelerator (FWidget* obj)
|
|||
FMenu* menu_ptr = dynamic_cast<FMenu*>(super_menu);
|
||||
|
||||
if ( menu_ptr )
|
||||
menu_ptr->menu_dimension();
|
||||
menu_ptr->calculateDimensions();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -673,7 +673,7 @@ void FMenuItem::onAccel (FAccelEvent* ev)
|
|||
mbar->getSelectedItem()->unsetSelected();
|
||||
|
||||
setSelected();
|
||||
mbar->selectedItem = this;
|
||||
mbar->selected_item = this;
|
||||
openMenu();
|
||||
|
||||
focused_widget = static_cast<FWidget*>(ev->focusedWidget());
|
||||
|
@ -699,7 +699,7 @@ void FMenuItem::onAccel (FAccelEvent* ev)
|
|||
else
|
||||
{
|
||||
unsetSelected();
|
||||
mbar->selectedItem = 0;
|
||||
mbar->selected_item = 0;
|
||||
mbar->redraw();
|
||||
processClicked();
|
||||
mbar->drop_down = false;
|
||||
|
|
|
@ -10,23 +10,23 @@
|
|||
// constructor and destructor
|
||||
//----------------------------------------------------------------------
|
||||
FMenuList::FMenuList()
|
||||
: selectedItem()
|
||||
, itemlist()
|
||||
: selected_item()
|
||||
, item_list()
|
||||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FMenuList::~FMenuList() // destructor
|
||||
{
|
||||
// delete all items
|
||||
if ( ! itemlist.empty() )
|
||||
if ( ! item_list.empty() )
|
||||
{
|
||||
std::vector<FMenuItem*>::iterator iter;
|
||||
iter = itemlist.begin();
|
||||
iter = item_list.begin();
|
||||
|
||||
while ( iter != itemlist.end() )
|
||||
while ( iter != item_list.end() )
|
||||
{
|
||||
(*iter)->setSuperMenu(0);
|
||||
iter = itemlist.erase(iter);
|
||||
iter = item_list.erase(iter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,10 +37,10 @@ FMenuList::~FMenuList() // destructor
|
|||
void FMenuList::selectFirstItem()
|
||||
{
|
||||
std::vector<FMenuItem*>::const_iterator iter, end;
|
||||
iter = itemlist.begin();
|
||||
end = itemlist.end();
|
||||
iter = item_list.begin();
|
||||
end = item_list.end();
|
||||
|
||||
if ( itemlist.empty() )
|
||||
if ( item_list.empty() )
|
||||
return;
|
||||
|
||||
if ( hasSelectedItem() )
|
||||
|
@ -72,7 +72,7 @@ void FMenuList::unselectItem()
|
|||
//----------------------------------------------------------------------
|
||||
void FMenuList::insert (FMenuItem* i)
|
||||
{
|
||||
itemlist.push_back(i);
|
||||
item_list.push_back(i);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -80,16 +80,16 @@ void FMenuList::remove (FMenuItem* i)
|
|||
{
|
||||
std::vector<FMenuItem*>::iterator iter;
|
||||
|
||||
if ( itemlist.empty() )
|
||||
if ( item_list.empty() )
|
||||
return;
|
||||
|
||||
iter = itemlist.begin();
|
||||
iter = item_list.begin();
|
||||
|
||||
while ( iter != itemlist.end() )
|
||||
while ( iter != item_list.end() )
|
||||
{
|
||||
if ( (*iter) == i )
|
||||
{
|
||||
iter = itemlist.erase(iter);
|
||||
iter = item_list.erase(iter);
|
||||
i->setSuperMenu(0);
|
||||
break;
|
||||
}
|
||||
|
@ -104,11 +104,11 @@ void FMenuList::remove (int pos)
|
|||
if ( int(count()) < pos )
|
||||
return;
|
||||
|
||||
itemlist.erase (itemlist.begin()+pos-1);
|
||||
item_list.erase (item_list.begin() + pos - 1);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMenuList::clear()
|
||||
{
|
||||
itemlist.clear();
|
||||
item_list.clear();
|
||||
}
|
||||
|
|
|
@ -33,8 +33,8 @@
|
|||
class FMenuList
|
||||
{
|
||||
protected:
|
||||
FMenuItem* selectedItem;
|
||||
std::vector<FMenuItem*> itemlist;
|
||||
FMenuItem* selected_item;
|
||||
std::vector<FMenuItem*> item_list;
|
||||
|
||||
private:
|
||||
FMenuList (const FMenuList&);
|
||||
|
@ -71,34 +71,34 @@ inline const char* FMenuList::getClassName() const
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
inline uInt FMenuList::count() const
|
||||
{ return uInt(itemlist.size()); }
|
||||
{ return uInt(item_list.size()); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FMenuItem* FMenuList::item (int index) const
|
||||
{ return (index > 0) ? itemlist[uInt(index-1)] : 0; }
|
||||
{ return (index > 0) ? item_list[uInt(index-1)] : 0; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FMenuList::enableItem (int index)
|
||||
{ itemlist[uInt(index-1)]->setEnable(); }
|
||||
{ item_list[uInt(index-1)]->setEnable(); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FMenuList::disableItem (int index)
|
||||
{ itemlist[uInt(index-1)]->unsetEnable(); }
|
||||
{ item_list[uInt(index-1)]->unsetEnable(); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FMenuList::isSelected(int index) const
|
||||
{ return (index > 0) ? itemlist[uInt(index-1)]->isSelected() : false; }
|
||||
{ return (index > 0) ? item_list[uInt(index-1)]->isSelected() : false; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FMenuItem* FMenuList::getSelectedItem() const
|
||||
{ return selectedItem; }
|
||||
{ return selected_item; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FMenuList::setSelectedItem (FMenuItem* menuitem)
|
||||
{ selectedItem = menuitem; }
|
||||
{ selected_item = menuitem; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FMenuList::hasSelectedItem() const
|
||||
{ return selectedItem; }
|
||||
{ return selected_item; }
|
||||
|
||||
#endif // _FMENULIST_H
|
||||
|
|
|
@ -30,10 +30,10 @@ FMessageBox::FMessageBox(FWidget* parent)
|
|||
, text()
|
||||
, text_components(0)
|
||||
, text_split()
|
||||
, maxLineWidth(0)
|
||||
, max_line_width(0)
|
||||
, center_text(false)
|
||||
, emphasis_color(wc.dialog_emphasis_fg)
|
||||
, numButtons(0)
|
||||
, num_buttons(0)
|
||||
, text_num_lines(0)
|
||||
, button_digit()
|
||||
, button()
|
||||
|
@ -49,10 +49,10 @@ FMessageBox::FMessageBox (const FMessageBox& mbox)
|
|||
, text(mbox.text)
|
||||
, text_components(mbox.text_components)
|
||||
, text_split(mbox.text_split)
|
||||
, maxLineWidth(mbox.maxLineWidth)
|
||||
, max_line_width(mbox.max_line_width)
|
||||
, center_text(mbox.center_text)
|
||||
, emphasis_color(mbox.emphasis_color)
|
||||
, numButtons(mbox.numButtons)
|
||||
, num_buttons(mbox.num_buttons)
|
||||
, text_num_lines(mbox.text_num_lines)
|
||||
, button_digit()
|
||||
, button()
|
||||
|
@ -75,10 +75,10 @@ FMessageBox::FMessageBox ( const FString& caption
|
|||
, text(message)
|
||||
, text_components(0)
|
||||
, text_split()
|
||||
, maxLineWidth(0)
|
||||
, max_line_width(0)
|
||||
, center_text(false)
|
||||
, emphasis_color(wc.dialog_emphasis_fg)
|
||||
, numButtons(0)
|
||||
, num_buttons(0)
|
||||
, text_num_lines(0)
|
||||
, button_digit()
|
||||
, button()
|
||||
|
@ -90,7 +90,7 @@ FMessageBox::FMessageBox ( const FString& caption
|
|||
//----------------------------------------------------------------------
|
||||
FMessageBox::~FMessageBox() // destructor
|
||||
{
|
||||
for (uInt n=0; n < numButtons; n++)
|
||||
for (uInt n=0; n < num_buttons; n++)
|
||||
delete button[n];
|
||||
|
||||
delete button_digit[2];
|
||||
|
@ -103,7 +103,7 @@ FMessageBox::~FMessageBox() // destructor
|
|||
//----------------------------------------------------------------------
|
||||
void FMessageBox::init(int button0, int button1, int button2)
|
||||
{
|
||||
msg_dimension();
|
||||
calculateDimensions();
|
||||
|
||||
if ( (button2 && ! button1) || (button1 && ! button0) )
|
||||
{
|
||||
|
@ -114,11 +114,11 @@ void FMessageBox::init(int button0, int button1, int button2)
|
|||
button0 = FMessageBox::Ok;
|
||||
|
||||
if ( button1 == 0 && button2 == 0 )
|
||||
numButtons = 1;
|
||||
num_buttons = 1;
|
||||
else if ( button2 == 0 )
|
||||
numButtons = 2;
|
||||
num_buttons = 2;
|
||||
else
|
||||
numButtons = 3;
|
||||
num_buttons = 3;
|
||||
|
||||
button_digit[0] = new int(button0);
|
||||
button_digit[1] = new int(button1);
|
||||
|
@ -186,7 +186,7 @@ void FMessageBox::init(int button0, int button1, int button2)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMessageBox::msg_dimension()
|
||||
void FMessageBox::calculateDimensions()
|
||||
{
|
||||
int x, y, w, h;
|
||||
int headline_height = 0;
|
||||
|
@ -194,7 +194,7 @@ void FMessageBox::msg_dimension()
|
|||
text_split = text.split("\n");
|
||||
text_num_lines = uInt(text_split.size());
|
||||
text_components = &text_split[0];
|
||||
maxLineWidth = 0;
|
||||
max_line_width = 0;
|
||||
|
||||
if ( ! headline_text.isNull() )
|
||||
headline_height = 2;
|
||||
|
@ -203,12 +203,12 @@ void FMessageBox::msg_dimension()
|
|||
{
|
||||
uInt len = text_components[i].getLength();
|
||||
|
||||
if ( len > maxLineWidth )
|
||||
maxLineWidth = len;
|
||||
if ( len > max_line_width )
|
||||
max_line_width = len;
|
||||
}
|
||||
|
||||
h = int(text_num_lines) + 8 + headline_height;
|
||||
w = int(maxLineWidth + 4);
|
||||
w = int(max_line_width + 4);
|
||||
|
||||
if ( w < 20 )
|
||||
w = 20;
|
||||
|
@ -231,7 +231,7 @@ void FMessageBox::draw()
|
|||
|
||||
int head_offset = 0;
|
||||
int center_x = 0;
|
||||
int msg_x = int((getWidth() - int(maxLineWidth)) / 2); // center the whole block
|
||||
int msg_x = int((getWidth() - int(max_line_width)) / 2); // center the whole block
|
||||
updateVTerm(false);
|
||||
|
||||
if ( isMonochron() )
|
||||
|
@ -243,7 +243,7 @@ void FMessageBox::draw()
|
|||
uInt headline_length = headline_text.getLength();
|
||||
|
||||
if ( center_text ) // center one line
|
||||
center_x = int((maxLineWidth - headline_length) / 2);
|
||||
center_x = int((max_line_width - headline_length) / 2);
|
||||
|
||||
printPos (1 + msg_x + center_x, 4);
|
||||
print (headline_text);
|
||||
|
@ -257,7 +257,7 @@ void FMessageBox::draw()
|
|||
uInt line_length = text_components[i].getLength();
|
||||
|
||||
if ( center_text ) // center one line
|
||||
center_x = int((maxLineWidth - line_length) / 2);
|
||||
center_x = int((max_line_width - line_length) / 2);
|
||||
|
||||
printPos (1 + msg_x + center_x, 4 + head_offset + i);
|
||||
print(text_components[i]);
|
||||
|
@ -274,7 +274,7 @@ void FMessageBox::resizeButtons()
|
|||
{
|
||||
uInt len[3], max_size;
|
||||
|
||||
for (uInt n=0; n < numButtons; n++)
|
||||
for (uInt n=0; n < num_buttons; n++)
|
||||
{
|
||||
len[n] = button[n]->getText().getLength();
|
||||
|
||||
|
@ -282,21 +282,21 @@ void FMessageBox::resizeButtons()
|
|||
len[n]--;
|
||||
}
|
||||
|
||||
if ( numButtons == 1 )
|
||||
if ( num_buttons == 1 )
|
||||
max_size = len[0];
|
||||
else
|
||||
{
|
||||
assert ( numButtons > 1 );
|
||||
assert ( num_buttons > 1 );
|
||||
max_size = std::max(len[0], len[1]);
|
||||
|
||||
if ( numButtons == 3 )
|
||||
if ( num_buttons == 3 )
|
||||
max_size = std::max(max_size, len[2]);
|
||||
}
|
||||
|
||||
if ( max_size < 7 )
|
||||
max_size = 7;
|
||||
|
||||
for (uInt n=0; n < numButtons; n++)
|
||||
for (uInt n=0; n < num_buttons; n++)
|
||||
button[n]->setWidth(int(max_size + 3), false);
|
||||
}
|
||||
|
||||
|
@ -306,9 +306,9 @@ void FMessageBox::adjustButtons()
|
|||
int btn_width=0;
|
||||
int gap = 4;
|
||||
|
||||
for (uInt n=0; n < numButtons; n++)
|
||||
for (uInt n=0; n < num_buttons; n++)
|
||||
{
|
||||
if ( n == numButtons-1 )
|
||||
if ( n == num_buttons-1 )
|
||||
btn_width += button[n]->getWidth();
|
||||
else
|
||||
btn_width += button[n]->getWidth() + gap;
|
||||
|
@ -325,7 +325,7 @@ void FMessageBox::adjustButtons()
|
|||
|
||||
int btn_x = int((getWidth()-btn_width) / 2);
|
||||
|
||||
for (uInt n=0; n < numButtons; n++)
|
||||
for (uInt n=0; n < num_buttons; n++)
|
||||
{
|
||||
if ( n == 0 )
|
||||
button[n]->setX(btn_x);
|
||||
|
@ -378,7 +378,7 @@ FMessageBox& FMessageBox::operator = (const FMessageBox& mbox)
|
|||
return *this;
|
||||
else
|
||||
{
|
||||
for (uInt n=0; n < numButtons; n++)
|
||||
for (uInt n=0; n < num_buttons; n++)
|
||||
delete button[n];
|
||||
|
||||
delete button_digit[2];
|
||||
|
@ -392,10 +392,10 @@ FMessageBox& FMessageBox::operator = (const FMessageBox& mbox)
|
|||
text = mbox.text;
|
||||
text_components = mbox.text_components;
|
||||
text_split = mbox.text_split;
|
||||
maxLineWidth = mbox.maxLineWidth;
|
||||
max_line_width = mbox.max_line_width;
|
||||
center_text = mbox.center_text;
|
||||
emphasis_color = mbox.emphasis_color;
|
||||
numButtons = mbox.numButtons;
|
||||
num_buttons = mbox.num_buttons;
|
||||
text_num_lines = mbox.text_num_lines;
|
||||
|
||||
setTitlebarText (mbox.getTitlebarText());
|
||||
|
@ -414,13 +414,13 @@ void FMessageBox::setHeadline (const FString& headline)
|
|||
headline_text = headline;
|
||||
setHeight(getHeight() + 2, true);
|
||||
|
||||
for (uInt n=0; n < numButtons; n++)
|
||||
for (uInt n=0; n < num_buttons; n++)
|
||||
button[n]->setY(getHeight()-4, false);
|
||||
|
||||
uInt len = headline_text.getLength();
|
||||
|
||||
if ( len > maxLineWidth )
|
||||
maxLineWidth = len;
|
||||
if ( len > max_line_width )
|
||||
max_line_width = len;
|
||||
|
||||
if ( vwin && getHeight() != old_height )
|
||||
resizeArea (vwin);
|
||||
|
@ -444,7 +444,7 @@ void FMessageBox::setHeadline (const char* headline)
|
|||
void FMessageBox::setText (const FString& txt)
|
||||
{
|
||||
text = txt;
|
||||
msg_dimension();
|
||||
calculateDimensions();
|
||||
button[0]->setY(getHeight()-4, false);
|
||||
|
||||
if ( *button_digit[1] != 0 )
|
||||
|
|
|
@ -67,10 +67,10 @@ class FMessageBox : public FDialog
|
|||
FString text;
|
||||
FString* text_components;
|
||||
std::vector<FString> text_split;
|
||||
uInt maxLineWidth;
|
||||
uInt max_line_width;
|
||||
bool center_text;
|
||||
short emphasis_color;
|
||||
uInt numButtons;
|
||||
uInt num_buttons;
|
||||
uInt text_num_lines;
|
||||
int* button_digit[3];
|
||||
FButton* button[3];
|
||||
|
@ -80,7 +80,7 @@ class FMessageBox : public FDialog
|
|||
|
||||
private:
|
||||
void init(int, int, int);
|
||||
void msg_dimension();
|
||||
void calculateDimensions();
|
||||
virtual void draw();
|
||||
void resizeButtons();
|
||||
void adjustButtons();
|
||||
|
|
|
@ -15,14 +15,14 @@ FObject::TimerList* FObject::timer_list = 0;
|
|||
// constructors and destructor
|
||||
//----------------------------------------------------------------------
|
||||
FObject::FObject (FObject* parent)
|
||||
: parentObj(parent)
|
||||
: parent_obj(parent)
|
||||
, children_list()
|
||||
, has_parent(false)
|
||||
{
|
||||
children_list.clear(); // no children yet
|
||||
|
||||
if ( parentObj ) // add object to parent
|
||||
parentObj->addChild(this);
|
||||
if ( parent_obj ) // add object to parent
|
||||
parent_obj->addChild(this);
|
||||
|
||||
if ( parent == 0 )
|
||||
{
|
||||
|
@ -36,10 +36,10 @@ FObject::FObject (FObject* parent)
|
|||
//----------------------------------------------------------------------
|
||||
FObject::~FObject() // destructor
|
||||
{
|
||||
if ( parentObj )
|
||||
parentObj->delChild(this);
|
||||
if ( parent_obj )
|
||||
parent_obj->delChild(this);
|
||||
|
||||
parentObj = 0;
|
||||
parent_obj = 0;
|
||||
delOwnTimer(); // delete all timers of this object
|
||||
|
||||
if ( ! has_parent && timer_list )
|
||||
|
@ -70,10 +70,13 @@ FObject::~FObject() // destructor
|
|||
//----------------------------------------------------------------------
|
||||
void FObject::addChild (FObject* obj)
|
||||
{
|
||||
if ( obj->parentObj )
|
||||
obj->parentObj->delChild(obj);
|
||||
if ( ! obj )
|
||||
return;
|
||||
|
||||
obj->parentObj = this;
|
||||
if ( obj->parent_obj )
|
||||
obj->parent_obj->delChild(obj);
|
||||
|
||||
obj->parent_obj = this;
|
||||
|
||||
children_list.push_back(obj);
|
||||
}
|
||||
|
@ -81,6 +84,9 @@ void FObject::addChild (FObject* obj)
|
|||
//----------------------------------------------------------------------
|
||||
void FObject::delChild (FObject* obj)
|
||||
{
|
||||
if ( ! obj )
|
||||
return;
|
||||
|
||||
if ( ! children_list.empty() )
|
||||
{
|
||||
obj->removeParent();
|
||||
|
|
|
@ -57,11 +57,12 @@ class FObject
|
|||
timeval timeout;
|
||||
FObject* object;
|
||||
};
|
||||
|
||||
typedef std::vector<timer_data> TimerList;
|
||||
static TimerList* timer_list;
|
||||
|
||||
private:
|
||||
FObject* parentObj;
|
||||
FObject* parent_obj;
|
||||
object_list children_list;
|
||||
bool has_parent;
|
||||
static bool modify_timer;
|
||||
|
@ -103,7 +104,7 @@ inline const char* FObject::getClassName() const
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
inline FObject* FObject::getParent() const
|
||||
{ return parentObj; }
|
||||
{ return parent_obj; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FObject::hasParent() const
|
||||
|
@ -111,7 +112,7 @@ inline bool FObject::hasParent() const
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FObject::removeParent()
|
||||
{ parentObj = 0; }
|
||||
{ parent_obj = 0; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FObject::object_list FObject::getChildren() const
|
||||
|
|
|
@ -63,7 +63,7 @@ void FOptiMove::calculateCharDuration()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
int FOptiMove::cap_duration (char*& cap, int affcnt)
|
||||
int FOptiMove::capDuration (char*& cap, int affcnt)
|
||||
{
|
||||
// calculate the duration in milliseconds of a given operation
|
||||
// cap - the term capability
|
||||
|
@ -111,7 +111,7 @@ void FOptiMove::set_cursor_home (char*& cap)
|
|||
if ( cap )
|
||||
{
|
||||
F_cursor_home.cap = cap;
|
||||
F_cursor_home.duration = cap_duration(cap, 0);
|
||||
F_cursor_home.duration = capDuration (cap, 0);
|
||||
F_cursor_home.length = int(strlen(cap));
|
||||
}
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ void FOptiMove::set_cursor_to_ll (char*& cap)
|
|||
if ( cap )
|
||||
{
|
||||
F_cursor_to_ll.cap = cap;
|
||||
F_cursor_to_ll.duration = cap_duration(cap, 0);
|
||||
F_cursor_to_ll.duration = capDuration (cap, 0);
|
||||
F_cursor_to_ll.length = int(strlen(cap));
|
||||
}
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ void FOptiMove::set_carriage_return (char*& cap)
|
|||
if ( cap )
|
||||
{
|
||||
F_carriage_return.cap = cap;
|
||||
F_carriage_return.duration = cap_duration(cap, 0);
|
||||
F_carriage_return.duration = capDuration (cap, 0);
|
||||
F_carriage_return.length = int(strlen(cap));
|
||||
}
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ void FOptiMove::set_tabular (char*& cap)
|
|||
if ( cap )
|
||||
{
|
||||
F_tab.cap = cap;
|
||||
F_tab.duration = cap_duration(cap, 0);
|
||||
F_tab.duration = capDuration (cap, 0);
|
||||
F_tab.length = int(strlen(cap));
|
||||
}
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ void FOptiMove::set_back_tab (char*& cap)
|
|||
if ( cap )
|
||||
{
|
||||
F_back_tab.cap = cap;
|
||||
F_back_tab.duration = cap_duration(cap, 0);
|
||||
F_back_tab.duration = capDuration (cap, 0);
|
||||
F_back_tab.length = int(strlen(cap));
|
||||
}
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ void FOptiMove::set_cursor_up (char*& cap)
|
|||
if ( cap )
|
||||
{
|
||||
F_cursor_up.cap = cap;
|
||||
F_cursor_up.duration = cap_duration(cap, 0);
|
||||
F_cursor_up.duration = capDuration (cap, 0);
|
||||
F_cursor_up.length = int(strlen(cap));
|
||||
}
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ void FOptiMove::set_cursor_down (char*& cap)
|
|||
if ( cap )
|
||||
{
|
||||
F_cursor_down.cap = cap;
|
||||
F_cursor_down.duration = cap_duration(cap, 0);
|
||||
F_cursor_down.duration = capDuration (cap, 0);
|
||||
F_cursor_down.length = int(strlen(cap));
|
||||
}
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ void FOptiMove::set_cursor_left (char*& cap)
|
|||
if ( cap )
|
||||
{
|
||||
F_cursor_left.cap = cap;
|
||||
F_cursor_left.duration = cap_duration(cap, 0);
|
||||
F_cursor_left.duration = capDuration (cap, 0);
|
||||
F_cursor_left.length = int(strlen(cap));
|
||||
}
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ void FOptiMove::set_cursor_right (char*& cap)
|
|||
if ( cap )
|
||||
{
|
||||
F_cursor_right.cap = cap;
|
||||
F_cursor_right.duration = cap_duration(cap, 0);
|
||||
F_cursor_right.duration = capDuration (cap, 0);
|
||||
F_cursor_right.length = int(strlen(cap));
|
||||
}
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ void FOptiMove::set_cursor_address (char*& cap)
|
|||
{
|
||||
char* temp = tgoto(cap, 23, 23);
|
||||
F_cursor_address.cap = cap;
|
||||
F_cursor_address.duration = cap_duration(temp, 1);
|
||||
F_cursor_address.duration = capDuration (temp, 1);
|
||||
F_cursor_address.length = int(strlen(cap));
|
||||
}
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ void FOptiMove::set_column_address (char*& cap)
|
|||
{
|
||||
char* temp = tparm(cap, 23);
|
||||
F_column_address.cap = cap;
|
||||
F_column_address.duration = cap_duration(temp, 1);
|
||||
F_column_address.duration = capDuration (temp, 1);
|
||||
F_column_address.length = int(strlen(cap));
|
||||
}
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ void FOptiMove::set_row_address (char*& cap)
|
|||
{
|
||||
char* temp = tparm(cap, 23);
|
||||
F_row_address.cap = cap;
|
||||
F_row_address.duration = cap_duration(temp, 1);
|
||||
F_row_address.duration = capDuration (temp, 1);
|
||||
F_row_address.length = int(strlen(cap));
|
||||
}
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ void FOptiMove::set_parm_up_cursor (char*& cap)
|
|||
{
|
||||
char* temp = tparm(cap, 23);
|
||||
F_parm_up_cursor.cap = cap;
|
||||
F_parm_up_cursor.duration = cap_duration(temp, 1);
|
||||
F_parm_up_cursor.duration = capDuration (temp, 1);
|
||||
F_parm_up_cursor.length = int(strlen(cap));
|
||||
}
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ void FOptiMove::set_parm_down_cursor (char*& cap)
|
|||
{
|
||||
char* temp = tparm(cap, 23);
|
||||
F_parm_down_cursor.cap = cap;
|
||||
F_parm_down_cursor.duration = cap_duration(temp, 1);
|
||||
F_parm_down_cursor.duration = capDuration (temp, 1);
|
||||
F_parm_down_cursor.length = int(strlen(cap));
|
||||
}
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ void FOptiMove::set_parm_left_cursor (char*& cap)
|
|||
{
|
||||
char* temp = tparm(cap, 23);
|
||||
F_parm_left_cursor.cap = cap;
|
||||
F_parm_left_cursor.duration = cap_duration(temp, 1);
|
||||
F_parm_left_cursor.duration = capDuration (temp, 1);
|
||||
F_parm_left_cursor.length = int(strlen(cap));
|
||||
}
|
||||
}
|
||||
|
@ -283,7 +283,7 @@ void FOptiMove::set_parm_right_cursor (char*& cap)
|
|||
{
|
||||
char* temp = tparm(cap, 23);
|
||||
F_parm_right_cursor.cap = cap;
|
||||
F_parm_right_cursor.duration = cap_duration(temp, 1);
|
||||
F_parm_right_cursor.duration = capDuration (temp, 1);
|
||||
F_parm_right_cursor.length = int(strlen(cap));
|
||||
}
|
||||
}
|
||||
|
@ -314,7 +314,7 @@ void FOptiMove::setTermSize (int w, int h)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
int FOptiMove::repeated_append (capability& o, int count, char* dst)
|
||||
int FOptiMove::repeatedAppend (capability& o, int count, char* dst)
|
||||
{
|
||||
register size_t src_len;
|
||||
register size_t dst_len;
|
||||
|
@ -346,7 +346,7 @@ int FOptiMove::repeated_append (capability& o, int count, char* dst)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
int FOptiMove::relative_move ( char*& move
|
||||
int FOptiMove::relativeMove ( char*& move
|
||||
, int from_x, int from_y
|
||||
, int to_x, int to_y )
|
||||
{
|
||||
|
@ -386,7 +386,7 @@ int FOptiMove::relative_move ( char*& move
|
|||
if ( move )
|
||||
move[0] = '\0';
|
||||
|
||||
vtime = repeated_append (F_cursor_down, num, move);
|
||||
vtime = repeatedAppend (F_cursor_down, num, move);
|
||||
}
|
||||
}
|
||||
else // to_y < from_y
|
||||
|
@ -406,7 +406,7 @@ int FOptiMove::relative_move ( char*& move
|
|||
if ( move )
|
||||
move[0] = '\0';
|
||||
|
||||
vtime = repeated_append (F_cursor_up, num, move);
|
||||
vtime = repeatedAppend (F_cursor_up, num, move);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -457,7 +457,7 @@ int FOptiMove::relative_move ( char*& move
|
|||
if ( tab_pos > to_x )
|
||||
break;
|
||||
|
||||
htime_r += repeated_append (F_tab, 1, str);
|
||||
htime_r += repeatedAppend (F_tab, 1, str);
|
||||
|
||||
if ( htime_r >= LONG_DURATION )
|
||||
break;
|
||||
|
@ -468,7 +468,7 @@ int FOptiMove::relative_move ( char*& move
|
|||
num = to_x - pos;
|
||||
}
|
||||
|
||||
htime_r += repeated_append (F_cursor_right, num, str);
|
||||
htime_r += repeatedAppend (F_cursor_right, num, str);
|
||||
|
||||
if ( htime_r < htime )
|
||||
{
|
||||
|
@ -507,7 +507,7 @@ int FOptiMove::relative_move ( char*& move
|
|||
if ( tab_pos < to_x )
|
||||
break;
|
||||
|
||||
htime_l += repeated_append (F_back_tab, 1, str);
|
||||
htime_l += repeatedAppend (F_back_tab, 1, str);
|
||||
|
||||
if ( htime_l >= LONG_DURATION )
|
||||
break;
|
||||
|
@ -518,7 +518,7 @@ int FOptiMove::relative_move ( char*& move
|
|||
num = pos - to_x;
|
||||
}
|
||||
|
||||
htime_l += repeated_append (F_cursor_left, num, str);
|
||||
htime_l += repeatedAppend (F_cursor_left, num, str);
|
||||
|
||||
if ( htime_l < htime )
|
||||
{
|
||||
|
@ -592,7 +592,7 @@ char* FOptiMove::cursor_move (int xold, int yold, int xnew, int ynew)
|
|||
// Method 1: local movement
|
||||
if ( xold >= 0 && yold >= 0 )
|
||||
{
|
||||
new_time = relative_move (null_ptr, xold, yold, xnew, ynew);
|
||||
new_time = relativeMove (null_ptr, xold, yold, xnew, ynew);
|
||||
|
||||
if ( new_time < LONG_DURATION && new_time < move_time )
|
||||
{
|
||||
|
@ -604,7 +604,7 @@ char* FOptiMove::cursor_move (int xold, int yold, int xnew, int ynew)
|
|||
// Method 2: carriage-return + local movement
|
||||
if ( yold >= 0 && F_carriage_return.cap )
|
||||
{
|
||||
new_time = relative_move (null_ptr, 0, yold, xnew, ynew);
|
||||
new_time = relativeMove (null_ptr, 0, yold, xnew, ynew);
|
||||
|
||||
if ( new_time < LONG_DURATION
|
||||
&& F_carriage_return.duration + new_time < move_time )
|
||||
|
@ -617,7 +617,7 @@ char* FOptiMove::cursor_move (int xold, int yold, int xnew, int ynew)
|
|||
// Method 3: home-cursor + local movement
|
||||
if ( F_cursor_home.cap )
|
||||
{
|
||||
new_time = relative_move (null_ptr, 0, 0, xnew, ynew);
|
||||
new_time = relativeMove (null_ptr, 0, 0, xnew, ynew);
|
||||
|
||||
if ( new_time < LONG_DURATION
|
||||
&& F_cursor_home.duration + new_time < move_time )
|
||||
|
@ -630,7 +630,7 @@ char* FOptiMove::cursor_move (int xold, int yold, int xnew, int ynew)
|
|||
// Method 4: home-down + local movement
|
||||
if ( F_cursor_to_ll.cap )
|
||||
{
|
||||
new_time = relative_move (null_ptr, 0, screen_height-1, xnew, ynew);
|
||||
new_time = relativeMove (null_ptr, 0, screen_height-1, xnew, ynew);
|
||||
|
||||
if ( new_time < LONG_DURATION
|
||||
&& F_cursor_to_ll.duration + new_time < move_time )
|
||||
|
@ -646,7 +646,7 @@ char* FOptiMove::cursor_move (int xold, int yold, int xnew, int ynew)
|
|||
&& yold > 0
|
||||
&& F_cursor_left.cap )
|
||||
{
|
||||
new_time = relative_move (null_ptr, screen_width-1, yold-1, xnew, ynew);
|
||||
new_time = relativeMove (null_ptr, screen_width-1, yold-1, xnew, ynew);
|
||||
|
||||
if ( new_time < LONG_DURATION
|
||||
&& F_carriage_return.cap
|
||||
|
@ -664,7 +664,7 @@ char* FOptiMove::cursor_move (int xold, int yold, int xnew, int ynew)
|
|||
switch ( method )
|
||||
{
|
||||
case 1:
|
||||
relative_move (move_ptr, xold, yold, xnew, ynew);
|
||||
relativeMove (move_ptr, xold, yold, xnew, ynew);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
@ -672,20 +672,20 @@ char* FOptiMove::cursor_move (int xold, int yold, int xnew, int ynew)
|
|||
{
|
||||
strncpy (move_ptr, F_carriage_return.cap, sizeof(move_buf) - 1);
|
||||
move_ptr += F_carriage_return.length;
|
||||
relative_move (move_ptr, 0, yold, xnew, ynew);
|
||||
relativeMove (move_ptr, 0, yold, xnew, ynew);
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
strncpy (move_ptr, F_cursor_home.cap, sizeof(move_buf) - 1);
|
||||
move_ptr += F_cursor_home.length;
|
||||
relative_move (move_ptr, 0, 0, xnew, ynew);
|
||||
relativeMove (move_ptr, 0, 0, xnew, ynew);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
strncpy (move_ptr, F_cursor_to_ll.cap, sizeof(move_buf) - 1);
|
||||
move_ptr += F_cursor_to_ll.length;
|
||||
relative_move (move_ptr, 0, screen_height-1, xnew, ynew);
|
||||
relativeMove (move_ptr, 0, screen_height-1, xnew, ynew);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
|
@ -700,7 +700,7 @@ char* FOptiMove::cursor_move (int xold, int yold, int xnew, int ynew)
|
|||
, F_cursor_left.cap
|
||||
, sizeof(move_buf) - strlen(move_ptr) - 1 );
|
||||
move_ptr += strlen(move_buf);
|
||||
relative_move (move_ptr, screen_width-1, yold-1, xnew, ynew);
|
||||
relativeMove (move_ptr, screen_width-1, yold-1, xnew, ynew);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -78,9 +78,9 @@ class FOptiMove
|
|||
|
||||
private:
|
||||
void calculateCharDuration();
|
||||
int cap_duration (char*&, int);
|
||||
int repeated_append (capability&, int, char*);
|
||||
int relative_move (char*&, int, int, int, int);
|
||||
int capDuration (char*&, int);
|
||||
int repeatedAppend (capability&, int, char*);
|
||||
int relativeMove (char*&, int, int, int, int);
|
||||
bool isTwoDirectionMove (int, int, int, int);
|
||||
bool isWideMove (int, int, int, int);
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
FProgressbar::FProgressbar(FWidget* parent)
|
||||
: FWidget(parent)
|
||||
, percentage(-1)
|
||||
, BarLength(getWidth())
|
||||
, bar_length(getWidth())
|
||||
{
|
||||
unsetFocusable();
|
||||
setShadow();
|
||||
|
@ -52,7 +52,7 @@ void FProgressbar::drawPercentage()
|
|||
void FProgressbar::drawBar()
|
||||
{
|
||||
int i = 1;
|
||||
float length = float(BarLength*percentage)/100;
|
||||
float length = float(bar_length * percentage) / 100;
|
||||
printPos (1,1);
|
||||
|
||||
if ( isMonochron() )
|
||||
|
@ -110,7 +110,7 @@ void FProgressbar::drawBar()
|
|||
if ( isMonochron() )
|
||||
setReverse(true);
|
||||
|
||||
if ( trunc(length) >= 1 && trunc(length) < BarLength )
|
||||
if ( trunc(length) >= 1 && trunc(length) < bar_length )
|
||||
{
|
||||
if ( round(length) > trunc(length)
|
||||
|| isCygwinTerminal()
|
||||
|
@ -138,12 +138,12 @@ void FProgressbar::drawBar()
|
|||
|
||||
if ( getMaxColor() < 16 )
|
||||
{
|
||||
for (; i < BarLength; i++)
|
||||
for (; i < bar_length; i++)
|
||||
print (fc::MediumShade); // ▒
|
||||
}
|
||||
else
|
||||
{
|
||||
for (; i < BarLength; i++)
|
||||
for (; i < bar_length; i++)
|
||||
print (' ');
|
||||
}
|
||||
|
||||
|
@ -260,7 +260,7 @@ void FProgressbar::reset()
|
|||
void FProgressbar::setGeometry (int x, int y, int w, int h, bool adjust)
|
||||
{
|
||||
FWidget::setGeometry (x, y, w, h, adjust);
|
||||
BarLength = w;
|
||||
bar_length = w;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -37,7 +37,7 @@ class FProgressbar : public FWidget
|
|||
{
|
||||
private:
|
||||
int percentage;
|
||||
int BarLength;
|
||||
int bar_length;
|
||||
|
||||
private:
|
||||
void drawPercentage();
|
||||
|
|
|
@ -11,16 +11,16 @@
|
|||
//----------------------------------------------------------------------
|
||||
FScrollbar::FScrollbar(FWidget* parent)
|
||||
: FWidget(parent)
|
||||
, scrollType(FScrollbar::noScroll)
|
||||
, thresholdReached(false)
|
||||
, thresholdTime(500)
|
||||
, repeatTime(10)
|
||||
, SliderClickPos(-1)
|
||||
, SliderClickStopPos(-1)
|
||||
, currentSliderPos(-1)
|
||||
, SliderPos(0)
|
||||
, SliderLength(18) // = BarLength
|
||||
, BarLength(18) // = length - 2
|
||||
, scroll_type(FScrollbar::noScroll)
|
||||
, threshold_reached(false)
|
||||
, threshold_time(500)
|
||||
, repeat_time(10)
|
||||
, slider_click_pos(-1)
|
||||
, slider_click_stop_pos(-1)
|
||||
, current_slider_pos(-1)
|
||||
, slider_pos(0)
|
||||
, slider_length(18) // = bar_length
|
||||
, bar_length(18) // = length - 2
|
||||
, val(0)
|
||||
, min(0)
|
||||
, max(99)
|
||||
|
@ -38,16 +38,16 @@ FScrollbar::FScrollbar(FWidget* parent)
|
|||
//----------------------------------------------------------------------
|
||||
FScrollbar::FScrollbar(int o, FWidget* parent)
|
||||
: FWidget(parent)
|
||||
, scrollType(FScrollbar::noScroll)
|
||||
, thresholdReached(false)
|
||||
, thresholdTime(500)
|
||||
, repeatTime(10)
|
||||
, SliderClickPos(-1)
|
||||
, SliderClickStopPos(-1)
|
||||
, currentSliderPos(-1)
|
||||
, SliderPos(0)
|
||||
, SliderLength(18) // = BarLength
|
||||
, BarLength(18) // = length - 2
|
||||
, scroll_type(FScrollbar::noScroll)
|
||||
, threshold_reached(false)
|
||||
, threshold_time(500)
|
||||
, repeat_time(10)
|
||||
, slider_click_pos(-1)
|
||||
, slider_click_stop_pos(-1)
|
||||
, current_slider_pos(-1)
|
||||
, slider_pos(0)
|
||||
, slider_length(18) // = bar_length
|
||||
, bar_length(18) // = length - 2
|
||||
, val(0)
|
||||
, min(0)
|
||||
, max(99)
|
||||
|
@ -81,15 +81,15 @@ void FScrollbar::draw()
|
|||
{
|
||||
updateVTerm(false);
|
||||
drawButtons();
|
||||
currentSliderPos = -1;
|
||||
current_slider_pos = -1;
|
||||
drawBar();
|
||||
updateVTerm(true);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
int FScrollbar::getClickedScrollType (int x, int y)
|
||||
FScrollbar::sType FScrollbar::getClickedScrollType (int x, int y)
|
||||
{
|
||||
int stype;
|
||||
FScrollbar::sType stype;
|
||||
|
||||
if ( bar_orientation == fc::vertical )
|
||||
{
|
||||
|
@ -97,11 +97,11 @@ int FScrollbar::getClickedScrollType (int x, int y)
|
|||
{
|
||||
stype = FScrollbar::scrollStepBackward; // decrement button
|
||||
}
|
||||
else if ( y >1 && y <= SliderPos+1 )
|
||||
else if ( y >1 && y <= slider_pos+1 )
|
||||
{
|
||||
stype = FScrollbar::scrollPageBackward; // before slider
|
||||
}
|
||||
else if ( y > SliderPos+SliderLength+1 && y < getHeight() )
|
||||
else if ( y > slider_pos+slider_length+1 && y < getHeight() )
|
||||
{
|
||||
stype = FScrollbar::scrollPageForward; // after slider
|
||||
}
|
||||
|
@ -120,11 +120,11 @@ int FScrollbar::getClickedScrollType (int x, int y)
|
|||
{
|
||||
stype = FScrollbar::scrollStepBackward; // decrement button
|
||||
}
|
||||
else if ( x >2 && x <= SliderPos+2 )
|
||||
else if ( x >2 && x <= slider_pos+2 )
|
||||
{
|
||||
stype = FScrollbar::scrollPageBackward; // before slider
|
||||
}
|
||||
else if ( x > SliderPos+SliderLength+2 && x < getWidth()-1 )
|
||||
else if ( x > slider_pos+slider_length+2 && x < getWidth()-1 )
|
||||
{
|
||||
stype = FScrollbar::scrollPageForward; // after slider
|
||||
}
|
||||
|
@ -141,11 +141,11 @@ int FScrollbar::getClickedScrollType (int x, int y)
|
|||
{
|
||||
stype = FScrollbar::scrollStepBackward; // decrement button
|
||||
}
|
||||
else if ( x >1 && x <= SliderPos+1 )
|
||||
else if ( x >1 && x <= slider_pos+1 )
|
||||
{
|
||||
stype = FScrollbar::scrollPageBackward; // before slider
|
||||
}
|
||||
else if ( x > SliderPos+SliderLength+1 && x < getWidth() )
|
||||
else if ( x > slider_pos+slider_length+1 && x < getWidth() )
|
||||
{
|
||||
stype = FScrollbar::scrollPageForward; // after slider
|
||||
}
|
||||
|
@ -170,8 +170,8 @@ void FScrollbar::processMiddleButton (int x, int y)
|
|||
{
|
||||
if ( y >1 && y < getHeight() )
|
||||
{
|
||||
new_val = int( round ( float(max-min) * (y-2.0-(SliderLength/2))
|
||||
/ float(BarLength-SliderLength) ) );
|
||||
new_val = int( round ( float(max - min) * (y - 2.0 - (slider_length/2))
|
||||
/ float(bar_length - slider_length) ) );
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
@ -182,8 +182,8 @@ void FScrollbar::processMiddleButton (int x, int y)
|
|||
|
||||
if ( x > 1+nf && x < getWidth()-nf )
|
||||
{
|
||||
new_val = int( round ( float(max-min) * (x-2.0-nf-(SliderLength/2))
|
||||
/ float(BarLength-SliderLength) ) );
|
||||
new_val = int( round ( float(max - min) * (x - 2.0 - nf - (slider_length/2))
|
||||
/ float(bar_length - slider_length) ) );
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
@ -194,7 +194,7 @@ void FScrollbar::processMiddleButton (int x, int y)
|
|||
setValue(new_val);
|
||||
drawBar();
|
||||
updateTerminal();
|
||||
scrollType = FScrollbar::scrollJump;
|
||||
scroll_type = FScrollbar::scrollJump;
|
||||
processScroll();
|
||||
}
|
||||
}
|
||||
|
@ -230,50 +230,50 @@ void FScrollbar::onMouseDown (FMouseEvent* ev)
|
|||
}
|
||||
|
||||
// process LeftButton
|
||||
scrollType = getClickedScrollType(mouse_x, mouse_y);
|
||||
scroll_type = getClickedScrollType(mouse_x, mouse_y);
|
||||
|
||||
if ( bar_orientation == fc::vertical )
|
||||
{
|
||||
if ( mouse_y > SliderPos+1 && mouse_y <= SliderPos+SliderLength+1 )
|
||||
SliderClickPos = mouse_y; // on slider
|
||||
if ( mouse_y > slider_pos+1 && mouse_y <= slider_pos+slider_length+1 )
|
||||
slider_click_pos = mouse_y; // on slider
|
||||
}
|
||||
else // horizontal
|
||||
{
|
||||
if ( isNewFont() )
|
||||
{
|
||||
if ( mouse_x > SliderPos+2 && mouse_x <= SliderPos+SliderLength+2 )
|
||||
SliderClickPos = mouse_x; // on slider
|
||||
if ( mouse_x > slider_pos+2 && mouse_x <= slider_pos+slider_length+2 )
|
||||
slider_click_pos = mouse_x; // on slider
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( mouse_x > SliderPos+1 && mouse_x <= SliderPos+SliderLength+1 )
|
||||
SliderClickPos = mouse_x; // on slider
|
||||
if ( mouse_x > slider_pos+1 && mouse_x <= slider_pos+slider_length+1 )
|
||||
slider_click_pos = mouse_x; // on slider
|
||||
}
|
||||
}
|
||||
|
||||
if ( SliderClickPos > 0 )
|
||||
scrollType = FScrollbar::scrollJump;
|
||||
if ( slider_click_pos > 0 )
|
||||
scroll_type = FScrollbar::scrollJump;
|
||||
|
||||
if ( scrollType == FScrollbar::scrollPageBackward
|
||||
|| scrollType == FScrollbar::scrollPageForward )
|
||||
if ( scroll_type == FScrollbar::scrollPageBackward
|
||||
|| scroll_type == FScrollbar::scrollPageForward )
|
||||
{
|
||||
if ( bar_orientation == fc::vertical )
|
||||
SliderClickStopPos = mouse_y - 2;
|
||||
slider_click_stop_pos = mouse_y - 2;
|
||||
else
|
||||
if ( isNewFont() )
|
||||
SliderClickStopPos = mouse_x - 3;
|
||||
slider_click_stop_pos = mouse_x - 3;
|
||||
else
|
||||
SliderClickStopPos = mouse_x - 2;
|
||||
slider_click_stop_pos = mouse_x - 2;
|
||||
}
|
||||
else
|
||||
SliderClickStopPos = -1;
|
||||
slider_click_stop_pos = -1;
|
||||
|
||||
if ( scrollType >= FScrollbar::scrollStepBackward
|
||||
&& scrollType <= FScrollbar::scrollPageForward )
|
||||
if ( scroll_type >= FScrollbar::scrollStepBackward
|
||||
&& scroll_type <= FScrollbar::scrollPageForward )
|
||||
{
|
||||
processScroll();
|
||||
thresholdReached = false;
|
||||
addTimer(thresholdTime);
|
||||
threshold_reached = false;
|
||||
addTimer(threshold_time);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -284,19 +284,19 @@ void FScrollbar::onMouseUp (FMouseEvent* ev)
|
|||
&& ev->getButton() != fc::MiddleButton )
|
||||
return;
|
||||
|
||||
SliderClickPos = -1;
|
||||
slider_click_pos = -1;
|
||||
|
||||
if ( scrollType != FScrollbar::noScroll )
|
||||
if ( scroll_type != FScrollbar::noScroll )
|
||||
{
|
||||
delOwnTimer();
|
||||
scrollType = FScrollbar::noScroll;
|
||||
scroll_type = FScrollbar::noScroll;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FScrollbar::onMouseMove (FMouseEvent* ev)
|
||||
{
|
||||
int mouse_x, mouse_y, newScrollType;
|
||||
int mouse_x, mouse_y, new_scroll_type;
|
||||
|
||||
if ( ev->getButton() != fc::LeftButton
|
||||
&& ev->getButton() != fc::MiddleButton )
|
||||
|
@ -312,25 +312,25 @@ void FScrollbar::onMouseMove (FMouseEvent* ev)
|
|||
}
|
||||
|
||||
// process LeftButton
|
||||
newScrollType = getClickedScrollType(mouse_x, mouse_y);
|
||||
new_scroll_type = getClickedScrollType(mouse_x, mouse_y);
|
||||
|
||||
if ( scrollType == FScrollbar::scrollJump )
|
||||
if ( scroll_type == FScrollbar::scrollJump )
|
||||
{
|
||||
int new_val;
|
||||
|
||||
if ( bar_orientation == fc::vertical )
|
||||
{
|
||||
int dy = mouse_y - SliderClickPos;
|
||||
SliderClickPos = mouse_y;
|
||||
new_val = int( round ( float((max-min) * (SliderPos + dy))
|
||||
/ float(BarLength-SliderLength) ) );
|
||||
int dy = mouse_y - slider_click_pos;
|
||||
slider_click_pos = mouse_y;
|
||||
new_val = int( round ( float((max - min) * (slider_pos + dy))
|
||||
/ float(bar_length - slider_length) ) );
|
||||
}
|
||||
else // horizontal
|
||||
{
|
||||
int dx = mouse_x - SliderClickPos;
|
||||
SliderClickPos = mouse_x;
|
||||
new_val = int( round ( float((max-min) * (SliderPos + dx))
|
||||
/ float(BarLength-SliderLength) ) );
|
||||
int dx = mouse_x - slider_click_pos;
|
||||
slider_click_pos = mouse_x;
|
||||
new_val = int( round ( float((max - min) * (slider_pos + dx))
|
||||
/ float(bar_length - slider_length) ) );
|
||||
}
|
||||
|
||||
if ( new_val != val )
|
||||
|
@ -347,12 +347,12 @@ void FScrollbar::onMouseMove (FMouseEvent* ev)
|
|||
{
|
||||
delOwnTimer();
|
||||
}
|
||||
else if ( scrollType != FScrollbar::scrollJump )
|
||||
else if ( scroll_type != FScrollbar::scrollJump )
|
||||
{
|
||||
addTimer(repeatTime);
|
||||
addTimer(repeat_time);
|
||||
}
|
||||
|
||||
if ( scrollType != newScrollType )
|
||||
if ( scroll_type != new_scroll_type )
|
||||
{
|
||||
delOwnTimer();
|
||||
}
|
||||
|
@ -363,16 +363,16 @@ void FScrollbar::onWheel (FWheelEvent* ev)
|
|||
{
|
||||
int wheel = ev->getWheel();
|
||||
|
||||
if ( scrollType != FScrollbar::noScroll )
|
||||
if ( scroll_type != FScrollbar::noScroll )
|
||||
{
|
||||
delOwnTimer();
|
||||
scrollType = FScrollbar::noScroll;
|
||||
scroll_type = FScrollbar::noScroll;
|
||||
}
|
||||
|
||||
if ( wheel == fc::WheelUp )
|
||||
scrollType = FScrollbar::scrollWheelUp;
|
||||
scroll_type = FScrollbar::scrollWheelUp;
|
||||
else if ( wheel == fc::WheelDown )
|
||||
scrollType = FScrollbar::scrollWheelDown;
|
||||
scroll_type = FScrollbar::scrollWheelDown;
|
||||
|
||||
processScroll();
|
||||
}
|
||||
|
@ -380,20 +380,20 @@ void FScrollbar::onWheel (FWheelEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void FScrollbar::onTimer (FTimerEvent*)
|
||||
{
|
||||
if ( scrollType == FScrollbar::noScroll )
|
||||
if ( scroll_type == FScrollbar::noScroll )
|
||||
return;
|
||||
|
||||
if ( ! thresholdReached )
|
||||
if ( ! threshold_reached )
|
||||
{
|
||||
thresholdReached = true;
|
||||
threshold_reached = true;
|
||||
delOwnTimer();
|
||||
addTimer(repeatTime);
|
||||
addTimer(repeat_time);
|
||||
}
|
||||
|
||||
if ( ( scrollType == scrollPageBackward
|
||||
&& SliderPos < SliderClickStopPos )
|
||||
|| ( scrollType == scrollPageForward
|
||||
&& SliderPos+SliderLength > SliderClickStopPos ) )
|
||||
if ( ( scroll_type == FScrollbar::scrollPageBackward
|
||||
&& slider_pos < slider_click_stop_pos )
|
||||
|| ( scroll_type == FScrollbar::scrollPageForward
|
||||
&& slider_pos+slider_length > slider_click_stop_pos ) )
|
||||
{
|
||||
delOwnTimer();
|
||||
return;
|
||||
|
@ -477,36 +477,36 @@ void FScrollbar::setPageSize (int document_size, int page_size)
|
|||
void FScrollbar::calculateSliderValues()
|
||||
{
|
||||
if ( isNewFont() && bar_orientation == fc::horizontal )
|
||||
BarLength = length - 4;
|
||||
bar_length = length - 4;
|
||||
else
|
||||
BarLength = length - 2;
|
||||
bar_length = length - 2;
|
||||
|
||||
SliderLength = int(float(BarLength) / steps);
|
||||
slider_length = int(float(bar_length) / steps);
|
||||
|
||||
if ( SliderLength < 1 )
|
||||
SliderLength = 1;
|
||||
else if ( SliderLength > BarLength )
|
||||
SliderLength = BarLength;
|
||||
if ( slider_length < 1 )
|
||||
slider_length = 1;
|
||||
else if ( slider_length > bar_length )
|
||||
slider_length = bar_length;
|
||||
|
||||
if ( val == min )
|
||||
{
|
||||
SliderPos = 0;
|
||||
slider_pos = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if ( val == max )
|
||||
{
|
||||
SliderPos = BarLength - SliderLength;
|
||||
slider_pos = bar_length - slider_length;
|
||||
return;
|
||||
}
|
||||
|
||||
SliderPos = int( round ( float((BarLength-SliderLength) * val)
|
||||
slider_pos = int( round ( float((bar_length - slider_length) * val)
|
||||
/ float(max - min) ) );
|
||||
|
||||
if ( SliderPos < 0 )
|
||||
SliderPos = 0;
|
||||
else if ( SliderPos > BarLength - SliderLength )
|
||||
SliderPos = BarLength - SliderLength;
|
||||
if ( slider_pos < 0 )
|
||||
slider_pos = 0;
|
||||
else if ( slider_pos > bar_length - slider_length )
|
||||
slider_pos = bar_length - slider_length;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -528,7 +528,7 @@ void FScrollbar::setOrientation (int o)
|
|||
if ( isNewFont() )
|
||||
nf = 2;
|
||||
}
|
||||
SliderLength = BarLength = length-nf-2;
|
||||
slider_length = bar_length = length-nf-2;
|
||||
bar_orientation = o;
|
||||
}
|
||||
|
||||
|
@ -554,13 +554,13 @@ void FScrollbar::setGeometry (int x, int y, int w, int h, bool adjust)
|
|||
nf = 2;
|
||||
}
|
||||
|
||||
SliderLength = BarLength = length-nf-2;
|
||||
slider_length = bar_length = length-nf-2;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FScrollbar::drawBar()
|
||||
{
|
||||
if (SliderPos != currentSliderPos)
|
||||
if ( slider_pos != current_slider_pos )
|
||||
{
|
||||
int z;
|
||||
updateVTerm(false);
|
||||
|
@ -569,7 +569,7 @@ void FScrollbar::drawBar()
|
|||
{
|
||||
setColor (wc.scrollbar_fg, wc.scrollbar_bg);
|
||||
|
||||
for (z=1; z <= SliderPos; z++)
|
||||
for (z=1; z <= slider_pos; z++)
|
||||
{
|
||||
printPos (1, 1 + z);
|
||||
|
||||
|
@ -587,9 +587,9 @@ void FScrollbar::drawBar()
|
|||
if ( isMonochron() )
|
||||
setReverse(false);
|
||||
|
||||
for (z=1; z <= SliderLength; z++)
|
||||
for (z=1; z <= slider_length; z++)
|
||||
{
|
||||
printPos (1, 1 + SliderPos + z);
|
||||
printPos (1, 1 + slider_pos + z);
|
||||
|
||||
if ( isNewFont() )
|
||||
print (' ');
|
||||
|
@ -602,7 +602,7 @@ void FScrollbar::drawBar()
|
|||
|
||||
setColor (wc.scrollbar_fg, wc.scrollbar_bg);
|
||||
|
||||
for (z=SliderPos+SliderLength+1; z <= BarLength; z++)
|
||||
for (z=slider_pos+slider_length+1; z <= bar_length; z++)
|
||||
{
|
||||
printPos (1, 1 + z);
|
||||
|
||||
|
@ -625,7 +625,7 @@ void FScrollbar::drawBar()
|
|||
else
|
||||
printPos (2 + z, 1);
|
||||
|
||||
for (; z < SliderPos; z++)
|
||||
for (; z < slider_pos; z++)
|
||||
{
|
||||
if ( isNewFont() )
|
||||
print (fc::NF_border_line_upper); // ¯
|
||||
|
@ -642,16 +642,16 @@ void FScrollbar::drawBar()
|
|||
|
||||
z = 0;
|
||||
|
||||
for (; z < SliderLength; z++)
|
||||
for (; z < slider_length; z++)
|
||||
print (' ');
|
||||
|
||||
if ( isMonochron() )
|
||||
setReverse(true);
|
||||
|
||||
setColor (wc.scrollbar_fg, wc.scrollbar_bg);
|
||||
z = SliderPos + SliderLength + 1;
|
||||
z = slider_pos + slider_length + 1;
|
||||
|
||||
for (; z <= BarLength; z++)
|
||||
for (; z <= bar_length; z++)
|
||||
{
|
||||
if ( isNewFont() )
|
||||
print (fc::NF_border_line_upper); // ¯
|
||||
|
@ -662,7 +662,7 @@ void FScrollbar::drawBar()
|
|||
}
|
||||
}
|
||||
|
||||
currentSliderPos = SliderPos;
|
||||
current_slider_pos = slider_pos;
|
||||
|
||||
if ( isMonochron() )
|
||||
setReverse(false);
|
||||
|
|
|
@ -35,28 +35,8 @@
|
|||
|
||||
class FScrollbar : public FWidget
|
||||
{
|
||||
private:
|
||||
int scrollType;
|
||||
bool thresholdReached;
|
||||
int thresholdTime;
|
||||
int repeatTime;
|
||||
int SliderClickPos;
|
||||
int SliderClickStopPos;
|
||||
int currentSliderPos;
|
||||
int SliderPos;
|
||||
int SliderLength;
|
||||
int BarLength;
|
||||
int val;
|
||||
int min;
|
||||
int max;
|
||||
float steps;
|
||||
int pageSize;
|
||||
int length;
|
||||
int bar_orientation;
|
||||
int max_color;
|
||||
|
||||
public:
|
||||
enum scroll_type
|
||||
enum sType
|
||||
{
|
||||
noScroll = 0,
|
||||
scrollJump = 1,
|
||||
|
@ -68,13 +48,33 @@ class FScrollbar : public FWidget
|
|||
scrollWheelDown = 7
|
||||
};
|
||||
|
||||
private:
|
||||
sType scroll_type;
|
||||
bool threshold_reached;
|
||||
int threshold_time;
|
||||
int repeat_time;
|
||||
int slider_click_pos;
|
||||
int slider_click_stop_pos;
|
||||
int current_slider_pos;
|
||||
int slider_pos;
|
||||
int slider_length;
|
||||
int bar_length;
|
||||
int val;
|
||||
int min;
|
||||
int max;
|
||||
float steps;
|
||||
int pageSize;
|
||||
int length;
|
||||
int bar_orientation;
|
||||
int max_color;
|
||||
|
||||
private:
|
||||
FScrollbar (const FScrollbar&);
|
||||
FScrollbar& operator = (const FScrollbar&);
|
||||
|
||||
void init();
|
||||
void draw();
|
||||
int getClickedScrollType (int, int);
|
||||
sType getClickedScrollType (int, int);
|
||||
void processMiddleButton (int, int);
|
||||
void processScroll();
|
||||
|
||||
|
@ -106,7 +106,7 @@ class FScrollbar : public FWidget
|
|||
void setGeometry (int, int, int, int, bool = true);
|
||||
void drawButtons();
|
||||
void drawBar();
|
||||
int getScrollType() const;
|
||||
sType getScrollType() const;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
|
@ -121,7 +121,7 @@ inline int FScrollbar::getValue() const
|
|||
{ return val; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline int FScrollbar::getScrollType() const
|
||||
{ return scrollType; }
|
||||
inline FScrollbar::sType FScrollbar::getScrollType() const
|
||||
{ return scroll_type; }
|
||||
|
||||
#endif // _FSCROLLBAR_H
|
||||
|
|
125
src/fterm.cpp
125
src/fterm.cpp
|
@ -34,7 +34,7 @@ uInt FTerm::baudrate;
|
|||
uInt FTerm::tabstop;
|
||||
uInt FTerm::attr_without_color;
|
||||
bool FTerm::resize_term;
|
||||
bool FTerm::hiddenCursor;
|
||||
bool FTerm::hidden_cursor;
|
||||
bool FTerm::mouse_support;
|
||||
bool FTerm::raw_mode;
|
||||
bool FTerm::input_data_pending;
|
||||
|
@ -93,8 +93,8 @@ char FTerm::exit_message[8192] = "";
|
|||
fc::encoding FTerm::Encoding;
|
||||
const FString* FTerm::xterm_font = 0;
|
||||
const FString* FTerm::xterm_title = 0;
|
||||
const FString* FTerm::AnswerBack = 0;
|
||||
const FString* FTerm::Sec_DA = 0;
|
||||
const FString* FTerm::answer_back = 0;
|
||||
const FString* FTerm::sec_da = 0;
|
||||
FOptiMove* FTerm::opti_move = 0;
|
||||
FOptiAttr* FTerm::opti_attr = 0;
|
||||
FTerm::modifier_key FTerm::mod_key;
|
||||
|
@ -109,10 +109,9 @@ std::map<std::string,fc::encoding>* \
|
|||
FTerm::encoding_set = 0;
|
||||
FOptiAttr::char_data FTerm::term_attribute;
|
||||
FOptiAttr::char_data FTerm::next_attribute;
|
||||
console_font_op FTerm::screenFont;
|
||||
unimapdesc FTerm::screenUnicodeMap;
|
||||
fc::console_cursor_style \
|
||||
FTerm::consoleCursorStyle;
|
||||
console_font_op FTerm::screen_font;
|
||||
unimapdesc FTerm::screen_unicode_map;
|
||||
fc::consoleCursorStyle FTerm::console_cursor_style;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -373,10 +372,10 @@ int FTerm::getScreenFont()
|
|||
|
||||
if ( ret == 0 )
|
||||
{
|
||||
screenFont.width = font.width;
|
||||
screenFont.height = font.height;
|
||||
screenFont.charcount = font.charcount;
|
||||
screenFont.data = font.data;
|
||||
screen_font.width = font.width;
|
||||
screen_font.height = font.height;
|
||||
screen_font.charcount = font.charcount;
|
||||
screen_font.data = font.data;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
|
@ -484,8 +483,8 @@ int FTerm::getUnicodeMap()
|
|||
|
||||
if ( ret == 0 )
|
||||
{
|
||||
screenUnicodeMap.entry_ct = unimap.entry_ct;
|
||||
screenUnicodeMap.entries = unimap.entries;
|
||||
screen_unicode_map.entry_ct = unimap.entry_ct;
|
||||
screen_unicode_map.entries = unimap.entries;
|
||||
}
|
||||
else
|
||||
return -1;
|
||||
|
@ -734,8 +733,8 @@ void FTerm::getModifierKey()
|
|||
void FTerm::init_console()
|
||||
{
|
||||
fd_tty = -1;
|
||||
screenUnicodeMap.entries = 0;
|
||||
screenFont.data = 0;
|
||||
screen_unicode_map.entries = 0;
|
||||
screen_font.data = 0;
|
||||
|
||||
if ( openConsole() == 0 )
|
||||
{
|
||||
|
@ -785,15 +784,15 @@ uInt FTerm::getBaudRate (const struct termios* termios_p)
|
|||
//----------------------------------------------------------------------
|
||||
void FTerm::init_consoleCharMap()
|
||||
{
|
||||
if ( screenUnicodeMap.entry_ct != 0 )
|
||||
if ( screen_unicode_map.entry_ct != 0 )
|
||||
{
|
||||
for (int i=0; i <= lastCharItem; i++ )
|
||||
{
|
||||
bool found = false;
|
||||
|
||||
for (uInt n=0; n < screenUnicodeMap.entry_ct; n++)
|
||||
for (uInt n=0; n < screen_unicode_map.entry_ct; n++)
|
||||
{
|
||||
if ( character[i][fc::UTF8] == screenUnicodeMap.entries[n].unicode )
|
||||
if ( character[i][fc::UTF8] == screen_unicode_map.entries[n].unicode )
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
|
@ -928,9 +927,9 @@ char* FTerm::parseAnswerbackMsg (char*& current_termtype)
|
|||
char* new_termtype = current_termtype;
|
||||
|
||||
// send ENQ and read the answerback message
|
||||
AnswerBack = new FString(getAnswerbackMsg());
|
||||
answer_back = new FString(getAnswerbackMsg());
|
||||
|
||||
if ( AnswerBack && *AnswerBack == FString("PuTTY") )
|
||||
if ( answer_back && *answer_back == FString("PuTTY") )
|
||||
{
|
||||
putty_terminal = true;
|
||||
|
||||
|
@ -960,36 +959,36 @@ char* FTerm::parseSecDA (char*& current_termtype)
|
|||
return new_termtype;
|
||||
|
||||
// secondary device attributes (SEC_DA) <- decTerminalID string
|
||||
Sec_DA = new FString(getSecDA());
|
||||
sec_da = new FString(getSecDA());
|
||||
|
||||
if ( Sec_DA && Sec_DA->getLength() > 5 )
|
||||
if ( sec_da && sec_da->getLength() > 5 )
|
||||
{
|
||||
uLong num_components;
|
||||
|
||||
// remove the first 3 bytes ("\033[>")
|
||||
FString temp = Sec_DA->right(Sec_DA->getLength() - 3);
|
||||
FString temp = sec_da->right(sec_da->getLength() - 3);
|
||||
// remove the last byte ("c")
|
||||
temp.remove(temp.getLength()-1, 1);
|
||||
// split into components
|
||||
std::vector<FString> Sec_DA_split = temp.split(';');
|
||||
std::vector<FString> sec_da_split = temp.split(';');
|
||||
|
||||
num_components = Sec_DA_split.size();
|
||||
num_components = sec_da_split.size();
|
||||
|
||||
if ( num_components == 3 )
|
||||
sec_da_supported = true;
|
||||
|
||||
if ( num_components >= 2 )
|
||||
{
|
||||
FString* Sec_DA_components = &Sec_DA_split[0];
|
||||
FString* sec_da_components = &sec_da_split[0];
|
||||
|
||||
if ( ! Sec_DA_components[0].isEmpty() )
|
||||
if ( ! sec_da_components[0].isEmpty() )
|
||||
{
|
||||
int terminal_id_type, terminal_id_version;
|
||||
|
||||
// Read the terminal type
|
||||
try
|
||||
{
|
||||
terminal_id_type = Sec_DA_components[0].toInt();
|
||||
terminal_id_type = sec_da_components[0].toInt();
|
||||
}
|
||||
catch (const std::exception&)
|
||||
{
|
||||
|
@ -999,8 +998,8 @@ char* FTerm::parseSecDA (char*& current_termtype)
|
|||
// Read the terminal (firmware) version
|
||||
try
|
||||
{
|
||||
if ( Sec_DA_components[1] )
|
||||
terminal_id_version = Sec_DA_components[1].toInt();
|
||||
if ( sec_da_components[1] )
|
||||
terminal_id_version = sec_da_components[1].toInt();
|
||||
else
|
||||
terminal_id_version = -1;
|
||||
}
|
||||
|
@ -1672,7 +1671,7 @@ void FTerm::init()
|
|||
NewFont = \
|
||||
VGAFont = \
|
||||
ascii_console = \
|
||||
hiddenCursor = \
|
||||
hidden_cursor = \
|
||||
mouse_support = \
|
||||
force_vt100 = \
|
||||
tera_terminal = \
|
||||
|
@ -2114,11 +2113,11 @@ void FTerm::finish()
|
|||
setOldFont();
|
||||
else
|
||||
{
|
||||
if ( screenFont.data != 0 )
|
||||
delete[] screenFont.data;
|
||||
if ( screen_font.data != 0 )
|
||||
delete[] screen_font.data;
|
||||
|
||||
if ( screenUnicodeMap.entries != 0 )
|
||||
delete[] screenUnicodeMap.entries;
|
||||
if ( screen_unicode_map.entries != 0 )
|
||||
delete[] screen_unicode_map.entries;
|
||||
}
|
||||
|
||||
if ( encoding_set )
|
||||
|
@ -2130,11 +2129,11 @@ void FTerm::finish()
|
|||
if ( output_buffer )
|
||||
delete output_buffer;
|
||||
|
||||
if ( Sec_DA )
|
||||
delete Sec_DA;
|
||||
if ( sec_da )
|
||||
delete sec_da;
|
||||
|
||||
if ( AnswerBack )
|
||||
delete AnswerBack;
|
||||
if ( answer_back )
|
||||
delete answer_back;
|
||||
|
||||
if ( xterm_title )
|
||||
delete xterm_title;
|
||||
|
@ -3295,23 +3294,23 @@ bool FTerm::setOldFont()
|
|||
{
|
||||
if ( isConsole() )
|
||||
{
|
||||
if ( screenFont.data )
|
||||
if ( screen_font.data )
|
||||
{
|
||||
int ret = setScreenFont ( screenFont.data
|
||||
, screenFont.charcount
|
||||
, screenFont.width
|
||||
, screenFont.height
|
||||
int ret = setScreenFont ( screen_font.data
|
||||
, screen_font.charcount
|
||||
, screen_font.width
|
||||
, screen_font.height
|
||||
, true );
|
||||
delete[] screenFont.data;
|
||||
delete[] screen_font.data;
|
||||
|
||||
if ( ret == 0 )
|
||||
retval = true;
|
||||
}
|
||||
|
||||
if ( screenUnicodeMap.entries )
|
||||
if ( screen_unicode_map.entries )
|
||||
{
|
||||
setUnicodeMap (&screenUnicodeMap);
|
||||
delete[] screenUnicodeMap.entries;
|
||||
setUnicodeMap (&screen_unicode_map);
|
||||
delete[] screen_unicode_map.entries;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3325,14 +3324,14 @@ bool FTerm::setOldFont()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTerm::setConsoleCursor (fc::console_cursor_style style)
|
||||
void FTerm::setConsoleCursor (fc::consoleCursorStyle style)
|
||||
{
|
||||
// Set cursor style in linux console
|
||||
if ( linux_terminal )
|
||||
{
|
||||
consoleCursorStyle = style;
|
||||
console_cursor_style = style;
|
||||
|
||||
if ( hiddenCursor )
|
||||
if ( hidden_cursor )
|
||||
return;
|
||||
|
||||
putstringf (CSI "?%dc", style);
|
||||
|
@ -3583,7 +3582,7 @@ void FTerm::updateTerminal (bool on)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTerm::setKDECursor (fc::kde_konsole_CursorShape style)
|
||||
void FTerm::setKDECursor (fc::kdeKonsoleCursorShape style)
|
||||
{
|
||||
// Set cursor style in KDE konsole
|
||||
if ( kde_konsole )
|
||||
|
@ -3658,7 +3657,7 @@ FString FTerm::getXTermTitle()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTerm::setXTermCursorStyle (fc::xterm_cursor_style style)
|
||||
void FTerm::setXTermCursorStyle (fc::xtermCursorStyle style)
|
||||
{
|
||||
// Set the xterm cursor style
|
||||
if ( (xterm || mintty_terminal) && ! (gnome_terminal || kde_konsole) )
|
||||
|
@ -4097,8 +4096,8 @@ bool FTerm::hideCursor (bool on)
|
|||
{
|
||||
char *vi, *vs, *ve;
|
||||
|
||||
if ( on == hiddenCursor )
|
||||
return hiddenCursor;
|
||||
if ( on == hidden_cursor )
|
||||
return hidden_cursor;
|
||||
|
||||
vi = tcap[t_cursor_invisible].string;
|
||||
vs = tcap[t_cursor_visible].string;
|
||||
|
@ -4109,7 +4108,7 @@ bool FTerm::hideCursor (bool on)
|
|||
if ( vi )
|
||||
appendOutputBuffer (vi);
|
||||
|
||||
hiddenCursor = true; // global
|
||||
hidden_cursor = true; // global
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4118,15 +4117,15 @@ bool FTerm::hideCursor (bool on)
|
|||
else if ( vs )
|
||||
appendOutputBuffer (vs);
|
||||
|
||||
hiddenCursor = false;
|
||||
hidden_cursor = false;
|
||||
}
|
||||
|
||||
flush_out();
|
||||
|
||||
if ( ! hiddenCursor && linux_terminal )
|
||||
setConsoleCursor (consoleCursorStyle);
|
||||
if ( ! hidden_cursor && linux_terminal )
|
||||
setConsoleCursor (console_cursor_style);
|
||||
|
||||
return hiddenCursor;
|
||||
return hidden_cursor;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -4334,7 +4333,7 @@ FString FTerm::getAnswerbackMsg()
|
|||
//----------------------------------------------------------------------
|
||||
FString FTerm::getSecDA()
|
||||
{
|
||||
FString sec_da = "";
|
||||
FString sec_da_str = "";
|
||||
|
||||
if ( raw_mode )
|
||||
{
|
||||
|
@ -4365,12 +4364,12 @@ FString FTerm::getSecDA()
|
|||
if ( n > 0 )
|
||||
{
|
||||
temp[n] = '\0';
|
||||
sec_da = temp;
|
||||
sec_da_str = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sec_da;
|
||||
return sec_da_str;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
20
src/fterm.h
20
src/fterm.h
|
@ -104,7 +104,7 @@ class FTerm
|
|||
static std::map <uChar,uChar>* vt100_alt_char;
|
||||
static std::map <std::string,fc::encoding>* encoding_set;
|
||||
|
||||
static bool hiddenCursor;
|
||||
static bool hidden_cursor;
|
||||
static bool mouse_support;
|
||||
static bool raw_mode;
|
||||
static bool input_data_pending;
|
||||
|
@ -168,16 +168,16 @@ class FTerm
|
|||
static FOptiAttr::char_data term_attribute;
|
||||
static FOptiAttr::char_data next_attribute;
|
||||
|
||||
static fc::console_cursor_style consoleCursorStyle;
|
||||
static struct console_font_op screenFont;
|
||||
static struct unimapdesc screenUnicodeMap;
|
||||
static fc::consoleCursorStyle console_cursor_style;
|
||||
static struct console_font_op screen_font;
|
||||
static struct unimapdesc screen_unicode_map;
|
||||
|
||||
static FOptiMove* opti_move;
|
||||
static FOptiAttr* opti_attr;
|
||||
static const FString* xterm_font;
|
||||
static const FString* xterm_title;
|
||||
static const FString* AnswerBack;
|
||||
static const FString* Sec_DA;
|
||||
static const FString* answer_back;
|
||||
static const FString* sec_da;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -336,7 +336,7 @@ class FTerm
|
|||
static bool isNewFont();
|
||||
static bool setOldFont();
|
||||
static bool setCursorOptimisation (bool);
|
||||
static void setConsoleCursor (fc::console_cursor_style);
|
||||
static void setConsoleCursor (fc::consoleCursorStyle);
|
||||
static void getTermSize();
|
||||
static void setTermSize (int, int);
|
||||
void createVTerm();
|
||||
|
@ -344,10 +344,10 @@ class FTerm
|
|||
static void putVTerm();
|
||||
static void updateTerminal();
|
||||
static void updateTerminal (bool);
|
||||
static void setKDECursor (fc::kde_konsole_CursorShape);
|
||||
static void setKDECursor (fc::kdeKonsoleCursorShape);
|
||||
static FString getXTermFont();
|
||||
static FString getXTermTitle();
|
||||
static void setXTermCursorStyle (fc::xterm_cursor_style);
|
||||
static void setXTermCursorStyle (fc::xtermCursorStyle);
|
||||
static void setXTermTitle (const FString&);
|
||||
static void setXTermForeground (const FString&);
|
||||
static void setXTermBackground (const FString&);
|
||||
|
@ -553,7 +553,7 @@ inline bool FTerm::isNewFont()
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FTerm::isHiddenCursor()
|
||||
{ return hiddenCursor; }
|
||||
{ return hidden_cursor; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FTerm::isMonochron()
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
FTextView::FTextView(FWidget* parent)
|
||||
: FWidget(parent)
|
||||
, data()
|
||||
, VBar(0)
|
||||
, HBar(0)
|
||||
, vbar(0)
|
||||
, hbar(0)
|
||||
, xoffset(0)
|
||||
, yoffset(0)
|
||||
, nf_offset(0)
|
||||
|
@ -27,8 +27,8 @@ FTextView::FTextView(FWidget* parent)
|
|||
//----------------------------------------------------------------------
|
||||
FTextView::~FTextView() // destructor
|
||||
{
|
||||
delete VBar;
|
||||
delete HBar;
|
||||
delete vbar;
|
||||
delete hbar;
|
||||
}
|
||||
|
||||
// private methods of FTextView
|
||||
|
@ -40,22 +40,22 @@ void FTextView::init()
|
|||
setForegroundColor (wc.dialog_fg);
|
||||
setBackgroundColor (wc.dialog_bg);
|
||||
|
||||
VBar = new FScrollbar(fc::vertical, this);
|
||||
VBar->setMinimum(0);
|
||||
VBar->setValue(0);
|
||||
VBar->hide();
|
||||
vbar = new FScrollbar(fc::vertical, this);
|
||||
vbar->setMinimum(0);
|
||||
vbar->setValue(0);
|
||||
vbar->hide();
|
||||
|
||||
HBar = new FScrollbar(fc::horizontal, this);
|
||||
HBar->setMinimum(0);
|
||||
HBar->setValue(0);
|
||||
HBar->hide();
|
||||
hbar = new FScrollbar(fc::horizontal, this);
|
||||
hbar->setMinimum(0);
|
||||
hbar->setValue(0);
|
||||
hbar->hide();
|
||||
|
||||
VBar->addCallback
|
||||
vbar->addCallback
|
||||
(
|
||||
"change-value",
|
||||
_METHOD_CALLBACK (this, &FTextView::cb_VBarChange)
|
||||
);
|
||||
HBar->addCallback
|
||||
hbar->addCallback
|
||||
(
|
||||
"change-value",
|
||||
_METHOD_CALLBACK (this, &FTextView::cb_HBarChange)
|
||||
|
@ -77,11 +77,11 @@ void FTextView::draw()
|
|||
if ( isMonochron() )
|
||||
setReverse(false);
|
||||
|
||||
if ( VBar->isVisible() )
|
||||
VBar->redraw();
|
||||
if ( vbar->isVisible() )
|
||||
vbar->redraw();
|
||||
|
||||
if ( HBar->isVisible() )
|
||||
HBar->redraw();
|
||||
if ( hbar->isVisible() )
|
||||
hbar->redraw();
|
||||
|
||||
updateVTerm(true);
|
||||
drawText();
|
||||
|
@ -190,29 +190,29 @@ void FTextView::adjustSize()
|
|||
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->setHeight (height - 2 + nf_offset, false);
|
||||
VBar->setValue (yoffset);
|
||||
VBar->resize();
|
||||
vbar->setMaximum (last_line - height + 2 - nf_offset);
|
||||
vbar->setPageSize (last_line, height - 2 + nf_offset);
|
||||
vbar->setX (width);
|
||||
vbar->setHeight (height - 2 + nf_offset, false);
|
||||
vbar->setValue (yoffset);
|
||||
vbar->resize();
|
||||
|
||||
HBar->setMaximum (max_width - width + nf_offset + 2);
|
||||
HBar->setPageSize (max_width, width - nf_offset - 2);
|
||||
HBar->setY (height);
|
||||
HBar->setWidth (width - 2, false);
|
||||
HBar->setValue (xoffset);
|
||||
HBar->resize();
|
||||
hbar->setMaximum (max_width - width + nf_offset + 2);
|
||||
hbar->setPageSize (max_width, width - nf_offset - 2);
|
||||
hbar->setY (height);
|
||||
hbar->setWidth (width - 2, false);
|
||||
hbar->setValue (xoffset);
|
||||
hbar->resize();
|
||||
|
||||
if ( last_line < height + nf_offset - 1 )
|
||||
VBar->hide();
|
||||
vbar->hide();
|
||||
else
|
||||
VBar->setVisible();
|
||||
vbar->setVisible();
|
||||
|
||||
if ( max_width < width - nf_offset - 1 )
|
||||
HBar->hide();
|
||||
hbar->hide();
|
||||
else
|
||||
HBar->setVisible();
|
||||
hbar->setVisible();
|
||||
}
|
||||
|
||||
|
||||
|
@ -338,15 +338,15 @@ void FTextView::onKeyPress (FKeyEvent* ev)
|
|||
if ( isVisible() )
|
||||
drawText();
|
||||
|
||||
VBar->setValue (yoffset);
|
||||
vbar->setValue (yoffset);
|
||||
|
||||
if ( VBar->isVisible() )
|
||||
VBar->drawBar();
|
||||
if ( vbar->isVisible() )
|
||||
vbar->drawBar();
|
||||
|
||||
HBar->setValue (xoffset);
|
||||
hbar->setValue (xoffset);
|
||||
|
||||
if ( HBar->isVisible() )
|
||||
HBar->drawBar();
|
||||
if ( hbar->isVisible() )
|
||||
hbar->drawBar();
|
||||
|
||||
updateTerminal();
|
||||
flush_out();
|
||||
|
@ -417,15 +417,15 @@ void FTextView::onWheel (FWheelEvent* ev)
|
|||
if ( isVisible() )
|
||||
drawText();
|
||||
|
||||
VBar->setValue (yoffset);
|
||||
vbar->setValue (yoffset);
|
||||
|
||||
if ( VBar->isVisible() )
|
||||
VBar->drawBar();
|
||||
if ( vbar->isVisible() )
|
||||
vbar->drawBar();
|
||||
|
||||
HBar->setValue (xoffset);
|
||||
hbar->setValue (xoffset);
|
||||
|
||||
if ( HBar->isVisible() )
|
||||
HBar->drawBar();
|
||||
if ( hbar->isVisible() )
|
||||
hbar->drawBar();
|
||||
|
||||
updateTerminal();
|
||||
}
|
||||
|
@ -450,10 +450,11 @@ void FTextView::onFocusOut (FFocusEvent*)
|
|||
//----------------------------------------------------------------------
|
||||
void FTextView::cb_VBarChange (FWidget*, void*)
|
||||
{
|
||||
FScrollbar::sType scrollType;
|
||||
int distance = 1;
|
||||
int last_line = int(getRows());
|
||||
int yoffset_before = yoffset;
|
||||
int scrollType = VBar->getScrollType();
|
||||
scrollType = vbar->getScrollType();
|
||||
|
||||
switch ( scrollType )
|
||||
{
|
||||
|
@ -481,7 +482,7 @@ void FTextView::cb_VBarChange (FWidget*, void*)
|
|||
|
||||
case FScrollbar::scrollJump:
|
||||
{
|
||||
int val = VBar->getValue();
|
||||
int val = vbar->getValue();
|
||||
|
||||
if ( yoffset == val )
|
||||
break;
|
||||
|
@ -524,10 +525,10 @@ void FTextView::cb_VBarChange (FWidget*, void*)
|
|||
if ( scrollType >= FScrollbar::scrollStepBackward
|
||||
&& scrollType <= FScrollbar::scrollPageForward )
|
||||
{
|
||||
VBar->setValue (yoffset);
|
||||
vbar->setValue (yoffset);
|
||||
|
||||
if ( VBar->isVisible() && yoffset_before != yoffset )
|
||||
VBar->drawBar();
|
||||
if ( vbar->isVisible() && yoffset_before != yoffset )
|
||||
vbar->drawBar();
|
||||
|
||||
updateTerminal();
|
||||
}
|
||||
|
@ -539,7 +540,7 @@ void FTextView::cb_HBarChange (FWidget*, void*)
|
|||
int distance = 1;
|
||||
int xoffset_before = xoffset;
|
||||
int xoffset_end = int(maxLineWidth) - getWidth() + nf_offset + 4;
|
||||
int scrollType = HBar->getScrollType();
|
||||
int scrollType = hbar->getScrollType();
|
||||
|
||||
switch ( scrollType )
|
||||
{
|
||||
|
@ -570,7 +571,7 @@ void FTextView::cb_HBarChange (FWidget*, void*)
|
|||
|
||||
case FScrollbar::scrollJump:
|
||||
{
|
||||
int val = HBar->getValue();
|
||||
int val = hbar->getValue();
|
||||
|
||||
if ( xoffset == val )
|
||||
break;
|
||||
|
@ -621,10 +622,10 @@ void FTextView::cb_HBarChange (FWidget*, void*)
|
|||
if ( scrollType >= FScrollbar::scrollStepBackward
|
||||
&& scrollType <= FScrollbar::scrollWheelDown )
|
||||
{
|
||||
HBar->setValue (xoffset);
|
||||
hbar->setValue (xoffset);
|
||||
|
||||
if ( HBar->isVisible() && xoffset_before != xoffset )
|
||||
HBar->drawBar();
|
||||
if ( hbar->isVisible() && xoffset_before != xoffset )
|
||||
hbar->drawBar();
|
||||
|
||||
updateTerminal();
|
||||
}
|
||||
|
@ -639,17 +640,17 @@ void FTextView::setGeometry (int x, int y, int w, int h, bool adjust)
|
|||
|
||||
if ( isNewFont() )
|
||||
{
|
||||
VBar->setGeometry (width, 1, 2, height-1);
|
||||
HBar->setGeometry (1, height, width-2, 1);
|
||||
vbar->setGeometry (width, 1, 2, height-1);
|
||||
hbar->setGeometry (1, height, width-2, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
VBar->setGeometry (width, 2, 1, height-2);
|
||||
HBar->setGeometry (2, height, width-2, 1);
|
||||
vbar->setGeometry (width, 2, 1, height-2);
|
||||
hbar->setGeometry (2, height, width-2, 1);
|
||||
}
|
||||
|
||||
VBar->resize();
|
||||
HBar->resize();
|
||||
vbar->resize();
|
||||
hbar->resize();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -665,10 +666,10 @@ void FTextView::setPosition (int pos)
|
|||
if ( isVisible() )
|
||||
drawText();
|
||||
|
||||
VBar->setValue (yoffset);
|
||||
vbar->setValue (yoffset);
|
||||
|
||||
if ( VBar->isVisible() )
|
||||
VBar->drawBar();
|
||||
if ( vbar->isVisible() )
|
||||
vbar->drawBar();
|
||||
|
||||
flush_out();
|
||||
}
|
||||
|
@ -757,26 +758,26 @@ void FTextView::insert (const FString& str, int pos)
|
|||
|
||||
if ( len > uInt(getWidth() - nf_offset - 2) )
|
||||
{
|
||||
HBar->setMaximum (int(maxLineWidth) - getWidth() + nf_offset + 2);
|
||||
HBar->setPageSize (int(maxLineWidth), getWidth() - nf_offset - 2);
|
||||
HBar->calculateSliderValues();
|
||||
hbar->setMaximum (int(maxLineWidth) - getWidth() + nf_offset + 2);
|
||||
hbar->setPageSize (int(maxLineWidth), getWidth() - nf_offset - 2);
|
||||
hbar->calculateSliderValues();
|
||||
|
||||
if ( ! HBar->isVisible() )
|
||||
HBar->setVisible();
|
||||
if ( ! hbar->isVisible() )
|
||||
hbar->setVisible();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data.insert (iter + pos, text_split.begin(), text_split.end());
|
||||
VBar->setMaximum (int(getRows()) - getHeight() + 2 - nf_offset);
|
||||
VBar->setPageSize (int(getRows()), getHeight() - 2 + nf_offset);
|
||||
VBar->calculateSliderValues();
|
||||
vbar->setMaximum (int(getRows()) - getHeight() + 2 - nf_offset);
|
||||
vbar->setPageSize (int(getRows()), getHeight() - 2 + nf_offset);
|
||||
vbar->calculateSliderValues();
|
||||
|
||||
if ( ! VBar->isVisible() && int(getRows()) >= getHeight() + nf_offset - 1 )
|
||||
VBar->setVisible();
|
||||
if ( ! vbar->isVisible() && int(getRows()) >= getHeight() + nf_offset - 1 )
|
||||
vbar->setVisible();
|
||||
|
||||
if ( VBar->isVisible() && int(getRows()) < getHeight() + nf_offset - 1 )
|
||||
VBar->hide();
|
||||
if ( vbar->isVisible() && int(getRows()) < getHeight() + nf_offset - 1 )
|
||||
vbar->hide();
|
||||
|
||||
processChanged();
|
||||
}
|
||||
|
@ -813,13 +814,13 @@ void FTextView::clear()
|
|||
yoffset = 0;
|
||||
maxLineWidth = 0;
|
||||
|
||||
VBar->setMinimum(0);
|
||||
VBar->setValue(0);
|
||||
VBar->hide();
|
||||
vbar->setMinimum(0);
|
||||
vbar->setValue(0);
|
||||
vbar->hide();
|
||||
|
||||
HBar->setMinimum(0);
|
||||
HBar->setValue(0);
|
||||
HBar->hide();
|
||||
hbar->setMinimum(0);
|
||||
hbar->setValue(0);
|
||||
hbar->hide();
|
||||
|
||||
// clear list from screen
|
||||
setColor();
|
||||
|
|
|
@ -42,8 +42,8 @@ class FTextView : public FWidget
|
|||
private:
|
||||
typedef std::vector<FString> stringLines;
|
||||
stringLines data;
|
||||
FScrollbar* VBar;
|
||||
FScrollbar* HBar;
|
||||
FScrollbar* vbar;
|
||||
FScrollbar* hbar;
|
||||
int xoffset;
|
||||
int yoffset;
|
||||
int nf_offset;
|
||||
|
|
|
@ -39,8 +39,8 @@ FWidget::FWidget (FWidget* parent)
|
|||
, shown(false)
|
||||
, focus(false)
|
||||
, focusable(true)
|
||||
, visibleCursor(false)
|
||||
, widgetCursorPosition(-1,-1)
|
||||
, visible_cursor(false)
|
||||
, widget_cursor_position(-1,-1)
|
||||
, size_hints()
|
||||
, double_flatline_mask()
|
||||
, padding()
|
||||
|
@ -1929,7 +1929,7 @@ void FWidget::move (int x, int y)
|
|||
//----------------------------------------------------------------------
|
||||
bool FWidget::setCursor()
|
||||
{
|
||||
FPoint* wcursor = &widgetCursorPosition;
|
||||
FPoint* wcursor = &widget_cursor_position;
|
||||
|
||||
if ( isCursorInside() )
|
||||
{
|
||||
|
@ -1944,7 +1944,7 @@ bool FWidget::setCursor()
|
|||
//----------------------------------------------------------------------
|
||||
bool FWidget::setCursorPos (register int x, register int y)
|
||||
{
|
||||
widgetCursorPosition.setPoint(x,y);
|
||||
widget_cursor_position.setPoint(x,y);
|
||||
|
||||
if ( isCursorInside() )
|
||||
return true;
|
||||
|
|
|
@ -226,8 +226,8 @@ class FWidget : public FObject, public FTerm
|
|||
bool shown;
|
||||
bool focus;
|
||||
bool focusable;
|
||||
bool visibleCursor;
|
||||
FPoint widgetCursorPosition;
|
||||
bool visible_cursor;
|
||||
FPoint widget_cursor_position;
|
||||
|
||||
struct widget_size_hints
|
||||
{
|
||||
|
@ -660,7 +660,7 @@ inline bool FWidget::isEnabled() const
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FWidget::setVisibleCursor (bool on)
|
||||
{ return visibleCursor = (on) ? true : false; }
|
||||
{ return visible_cursor = (on) ? true : false; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FWidget::setVisibleCursor()
|
||||
|
@ -672,7 +672,7 @@ inline bool FWidget::unsetVisibleCursor()
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FWidget::hasVisibleCursor() const
|
||||
{ return visibleCursor; }
|
||||
{ return visible_cursor; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FWidget::setFocus()
|
||||
|
@ -895,7 +895,7 @@ inline int FWidget::getFlags() const
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
inline FPoint FWidget::getCursorPos()
|
||||
{ return widgetCursorPosition; }
|
||||
{ return widget_cursor_position; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FWidget::setCursorPos (const FPoint& pos)
|
||||
|
@ -903,7 +903,7 @@ inline bool FWidget::setCursorPos (const FPoint& pos)
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FWidget::unsetCursorPos()
|
||||
{ widgetCursorPosition.setPoint(-1,-1); }
|
||||
{ widget_cursor_position.setPoint(-1,-1); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FWidget::printPos (const FPoint& pos)
|
||||
|
|
|
@ -10,6 +10,55 @@
|
|||
#include "fstatusbar.h"
|
||||
#include "fstring.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class smallWindow
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
|
||||
class smallWindow : public FDialog
|
||||
{
|
||||
private:
|
||||
FLabel* label;
|
||||
|
||||
private:
|
||||
smallWindow (const smallWindow&); // Disabled copy constructor
|
||||
smallWindow& operator = (const smallWindow&); // and operator '='
|
||||
void adjustSize();
|
||||
|
||||
public:
|
||||
explicit smallWindow (FWidget* = 0); // constructor
|
||||
~smallWindow(); // destructor
|
||||
|
||||
void append (const FString&);
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
smallWindow::smallWindow (FWidget* parent)
|
||||
: FDialog(parent)
|
||||
, label()
|
||||
{
|
||||
FString label_text = "resize \n"
|
||||
"corner \u25E2";
|
||||
label = new FLabel (label_text, this);
|
||||
label->setAlignment (fc::alignRight);
|
||||
label->setForegroundColor (fc::DarkGray);
|
||||
label->setGeometry (13, 4, 8, 2);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
smallWindow::~smallWindow()
|
||||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void smallWindow::adjustSize()
|
||||
{
|
||||
FDialog::adjustSize();
|
||||
label->setGeometry (1, getClientHeight() - 1, getClientWidth(), 2);
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class Window
|
||||
|
@ -231,7 +280,7 @@ void Window::cb_createWindows (FWidget*, void*)
|
|||
{
|
||||
int x, y, n;
|
||||
win_data* win_dat = *iter;
|
||||
FDialog* win = new FDialog(this);
|
||||
FDialog* win = new smallWindow(this);
|
||||
win_dat->dgl = win;
|
||||
win_dat->is_open = true;
|
||||
win->setText(*(win_dat)->title);
|
||||
|
|
Loading…
Reference in New Issue