2015-09-25 21:37:19 +02:00
|
|
|
// File: flabel.cpp
|
|
|
|
// Provides: class FLabel
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
#include "fapp.h"
|
|
|
|
#include "flabel.h"
|
|
|
|
#include "fstatusbar.h"
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FLabel
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
// constructors and destructor
|
|
|
|
//----------------------------------------------------------------------
|
2015-09-22 04:18:20 +02:00
|
|
|
FLabel::FLabel(FWidget* parent)
|
|
|
|
: FWidget(parent)
|
|
|
|
, multiline_text()
|
|
|
|
, multiline(false)
|
|
|
|
, text()
|
|
|
|
, alignment(fc::alignLeft)
|
|
|
|
, emphasis_color(wc.label_emphasis_fg)
|
|
|
|
, ellipsis_color(wc.label_ellipsis_fg)
|
2016-01-17 02:57:08 +01:00
|
|
|
, emphasis(false)
|
2015-09-22 04:18:20 +02:00
|
|
|
, reverse_mode(false)
|
|
|
|
, accel_widget(0)
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2015-09-22 04:18:20 +02:00
|
|
|
init();
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2015-09-22 04:18:20 +02:00
|
|
|
FLabel::FLabel (const FString& txt, FWidget* parent)
|
|
|
|
: FWidget(parent)
|
|
|
|
, multiline_text()
|
|
|
|
, multiline(false)
|
|
|
|
, text(txt)
|
|
|
|
, alignment(fc::alignLeft)
|
|
|
|
, emphasis_color(wc.label_emphasis_fg)
|
|
|
|
, ellipsis_color(wc.label_ellipsis_fg)
|
2016-01-17 02:57:08 +01:00
|
|
|
, emphasis(false)
|
2015-09-22 04:18:20 +02:00
|
|
|
, reverse_mode(false)
|
|
|
|
, accel_widget(0)
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2015-09-22 04:18:20 +02:00
|
|
|
init();
|
2015-05-23 13:35:12 +02:00
|
|
|
setText(txt);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
FLabel::~FLabel() // destructor
|
|
|
|
{
|
2015-11-12 01:33:16 +01:00
|
|
|
delAccelerator();
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
// public methods of FLabel
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FLabel::setAccelWidget (FWidget* widget)
|
|
|
|
{
|
|
|
|
if ( widget )
|
|
|
|
accel_widget = widget;
|
|
|
|
|
|
|
|
accel_widget->addCallback
|
|
|
|
(
|
|
|
|
"destroy",
|
|
|
|
_METHOD_CALLBACK (this, &FLabel::cb_accel_widget_destroyed)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FLabel::setAlignment (uInt align)
|
|
|
|
{
|
2016-12-18 23:34:11 +01:00
|
|
|
if ( align != fc::alignLeft
|
|
|
|
&& align != fc::alignCenter
|
|
|
|
&& align != fc::alignRight )
|
2016-11-02 00:37:58 +01:00
|
|
|
alignment = fc::alignLeft;
|
|
|
|
else
|
|
|
|
alignment = align;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
bool FLabel::setEmphasis (bool on)
|
|
|
|
{
|
|
|
|
if ( emphasis != on )
|
|
|
|
emphasis = on;
|
|
|
|
|
|
|
|
return on;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
bool FLabel::setReverseMode (bool on)
|
|
|
|
{
|
|
|
|
if ( reverse_mode != on )
|
|
|
|
reverse_mode = on;
|
|
|
|
|
|
|
|
return on;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
bool FLabel::setEnable (bool on)
|
|
|
|
{
|
|
|
|
FWidget::setEnable(on);
|
|
|
|
|
|
|
|
if ( on )
|
|
|
|
{
|
|
|
|
flags |= fc::active;
|
|
|
|
setHotkeyAccelerator();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
flags &= ~fc::active;
|
|
|
|
delAccelerator();
|
|
|
|
}
|
|
|
|
|
|
|
|
return on;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FLabel::setNumber (long num)
|
|
|
|
{
|
|
|
|
setText(FString().setNumber(num));
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FLabel::setText (const FString& txt)
|
|
|
|
{
|
|
|
|
text = txt;
|
|
|
|
multiline_text = text.split("\r\n");
|
|
|
|
|
|
|
|
if ( int(multiline_text.size()) > 1 )
|
|
|
|
multiline = true;
|
|
|
|
else
|
|
|
|
multiline = false;
|
|
|
|
|
|
|
|
if ( isEnabled() )
|
|
|
|
{
|
|
|
|
delAccelerator();
|
|
|
|
setHotkeyAccelerator();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FLabel::hide()
|
|
|
|
{
|
|
|
|
short fg, bg;
|
|
|
|
int size;
|
|
|
|
char* blank;
|
|
|
|
FWidget* parent_widget = getParentWidget();
|
|
|
|
|
|
|
|
FWidget::hide();
|
|
|
|
|
|
|
|
if ( parent_widget )
|
|
|
|
{
|
|
|
|
fg = parent_widget->getForegroundColor();
|
|
|
|
bg = parent_widget->getBackgroundColor();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
fg = wc.dialog_fg;
|
|
|
|
bg = wc.dialog_bg;
|
|
|
|
}
|
|
|
|
|
|
|
|
setColor (fg, bg);
|
|
|
|
size = getWidth();
|
|
|
|
|
|
|
|
if ( size < 0 )
|
|
|
|
return;
|
|
|
|
|
|
|
|
blank = new char[size+1];
|
|
|
|
std::memset(blank, ' ', uLong(size));
|
|
|
|
blank[getWidth()] = '\0';
|
|
|
|
setPrintPos (1,1);
|
|
|
|
print (blank);
|
|
|
|
delete[] blank;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FLabel::onMouseDown (FMouseEvent* ev)
|
|
|
|
{
|
|
|
|
if ( ev->getButton() != fc::LeftButton )
|
|
|
|
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);
|
|
|
|
accel_widget->setFocus();
|
|
|
|
|
|
|
|
if ( focused_widget )
|
|
|
|
focused_widget->redraw();
|
|
|
|
|
|
|
|
accel_widget->redraw();
|
|
|
|
|
|
|
|
if ( getStatusBar() )
|
|
|
|
{
|
|
|
|
accel_widget->getStatusBar()->drawMessage();
|
|
|
|
updateTerminal();
|
|
|
|
flush_out();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FLabel::onAccel (FAccelEvent* ev)
|
|
|
|
{
|
|
|
|
if ( ! (isEnabled() && accel_widget) )
|
|
|
|
return;
|
|
|
|
|
|
|
|
if ( ! accel_widget->hasFocus() )
|
|
|
|
{
|
|
|
|
FWidget* focused_widget = static_cast<FWidget*>(ev->focusedWidget());
|
|
|
|
FFocusEvent out (fc::FocusOut_Event);
|
|
|
|
FApplication::queueEvent(focused_widget, &out);
|
|
|
|
accel_widget->setFocus();
|
|
|
|
|
|
|
|
if ( focused_widget )
|
|
|
|
focused_widget->redraw();
|
|
|
|
|
|
|
|
accel_widget->redraw();
|
|
|
|
|
|
|
|
if ( getStatusBar() )
|
|
|
|
{
|
|
|
|
accel_widget->getStatusBar()->drawMessage();
|
|
|
|
updateTerminal();
|
|
|
|
flush_out();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ev->accept();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FLabel::cb_accel_widget_destroyed (FWidget*, void*)
|
|
|
|
{
|
|
|
|
accel_widget = 0;
|
|
|
|
delAccelerator();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
// private methods of FLabel
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FLabel::init()
|
|
|
|
{
|
2016-08-21 21:27:44 +02:00
|
|
|
FWidget* parent_widget = getParentWidget();
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
if ( isEnabled() )
|
2016-01-24 14:53:09 +01:00
|
|
|
flags |= fc::active;
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
unsetFocusable();
|
2016-08-21 21:27:44 +02:00
|
|
|
|
|
|
|
if ( parent_widget )
|
|
|
|
{
|
2016-09-25 23:53:48 +02:00
|
|
|
setForegroundColor (parent_widget->getForegroundColor());
|
|
|
|
setBackgroundColor (parent_widget->getBackgroundColor());
|
2016-08-21 21:27:44 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-09-25 23:53:48 +02:00
|
|
|
setForegroundColor (wc.dialog_fg);
|
|
|
|
setBackgroundColor (wc.dialog_bg);
|
2016-08-21 21:27:44 +02:00
|
|
|
}
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
uChar FLabel::getHotkey()
|
|
|
|
{
|
|
|
|
uInt length;
|
|
|
|
|
|
|
|
if ( text.isEmpty() )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
length = text.getLength();
|
|
|
|
|
|
|
|
for (uInt i=0; i < length; i++)
|
2015-09-30 22:39:02 +02:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if ( (i+1 < length) && (text[i] == '&') )
|
|
|
|
return uChar(text[++i]);
|
|
|
|
}
|
|
|
|
catch (const std::out_of_range&)
|
|
|
|
{
|
|
|
|
return 0;;
|
|
|
|
}
|
|
|
|
}
|
2016-07-09 00:01:59 +02:00
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-07-18 21:31:26 +02:00
|
|
|
//----------------------------------------------------------------------
|
2015-07-18 21:36:57 +02:00
|
|
|
int FLabel::getHotkeyPos (wchar_t*& src, wchar_t*& dest, uInt length)
|
2015-07-18 21:31:26 +02:00
|
|
|
{
|
|
|
|
// find hotkey position in string
|
|
|
|
// + generate a new string without the '&'-sign
|
|
|
|
int hotkeypos = -1;
|
|
|
|
wchar_t* txt = src;
|
|
|
|
|
|
|
|
for (uInt i=0; i < length; i++)
|
|
|
|
{
|
|
|
|
if ( (i < length) && (txt[i] == L'&') && (hotkeypos == -1) )
|
|
|
|
{
|
|
|
|
hotkeypos = int(i);
|
|
|
|
i++;
|
|
|
|
src++;
|
|
|
|
}
|
2016-07-09 00:01:59 +02:00
|
|
|
|
2015-07-18 21:31:26 +02:00
|
|
|
*dest++ = *src++;
|
|
|
|
}
|
2016-07-09 00:01:59 +02:00
|
|
|
|
2015-07-18 21:31:26 +02:00
|
|
|
return hotkeypos;
|
|
|
|
}
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FLabel::setHotkeyAccelerator()
|
|
|
|
{
|
|
|
|
int hotkey = getHotkey();
|
2016-07-09 00:01:59 +02:00
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
if ( hotkey )
|
|
|
|
{
|
2016-10-06 23:15:09 +02:00
|
|
|
if ( std::isalpha(hotkey) || std::isdigit(hotkey) )
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2016-10-06 23:15:09 +02:00
|
|
|
addAccelerator (std::tolower(hotkey));
|
|
|
|
addAccelerator (std::toupper(hotkey));
|
2015-05-23 13:35:12 +02:00
|
|
|
// Meta + hotkey
|
2016-10-06 23:15:09 +02:00
|
|
|
addAccelerator (fc::Fmkey_meta + std::tolower(hotkey));
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
|
|
|
else
|
2015-11-12 01:33:16 +01:00
|
|
|
addAccelerator (getHotkey());
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
|
|
|
else
|
2015-11-12 01:33:16 +01:00
|
|
|
delAccelerator();
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2015-07-18 21:31:26 +02:00
|
|
|
int FLabel::getXOffset(int length)
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2015-07-18 21:31:26 +02:00
|
|
|
switch ( alignment )
|
|
|
|
{
|
|
|
|
case fc::alignLeft:
|
|
|
|
return 0;
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2015-07-18 21:31:26 +02:00
|
|
|
case fc::alignCenter:
|
2016-09-25 23:53:48 +02:00
|
|
|
if ( length < getWidth() )
|
|
|
|
return int((getWidth() - length) / 2);
|
2015-07-18 21:31:26 +02:00
|
|
|
else
|
|
|
|
return 0;
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2015-07-18 21:31:26 +02:00
|
|
|
case fc::alignRight:
|
2016-09-25 23:53:48 +02:00
|
|
|
if ( length < getWidth() )
|
|
|
|
return getWidth() - length;
|
2015-07-18 21:31:26 +02:00
|
|
|
else
|
|
|
|
return 0;
|
2015-09-20 05:44:50 +02:00
|
|
|
|
|
|
|
default:
|
|
|
|
return 0;
|
2015-07-18 21:31:26 +02:00
|
|
|
}
|
|
|
|
}
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2015-07-18 21:31:26 +02:00
|
|
|
//----------------------------------------------------------------------
|
2015-09-22 04:18:20 +02:00
|
|
|
void FLabel::printLine ( wchar_t*& line
|
|
|
|
, uInt length
|
|
|
|
, int hotkeypos
|
|
|
|
, int xoffset )
|
2015-07-18 21:31:26 +02:00
|
|
|
{
|
|
|
|
int to_char;
|
|
|
|
bool isActive, isNoUnderline;
|
2016-01-24 14:53:09 +01:00
|
|
|
isActive = ((flags & fc::active) != 0);
|
|
|
|
isNoUnderline = ((flags & fc::no_underline) != 0);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
for (int x=0; x < xoffset; x++)
|
|
|
|
print (' ');
|
|
|
|
|
2016-09-25 23:53:48 +02:00
|
|
|
if ( length <= uInt(getWidth()) )
|
2015-05-23 13:35:12 +02:00
|
|
|
to_char = int(length);
|
|
|
|
else
|
2016-09-25 23:53:48 +02:00
|
|
|
to_char = getWidth() - 2;
|
2015-05-26 23:15:49 +02:00
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
if ( hasReverseMode() )
|
|
|
|
setReverse(true);
|
|
|
|
|
|
|
|
for (int z=0; z < to_char; z++)
|
|
|
|
{
|
2016-10-06 23:15:09 +02:00
|
|
|
if ( ! std::iswprint(wint_t(line[z])) )
|
2015-10-17 21:05:49 +02:00
|
|
|
{
|
2016-12-18 23:34:11 +01:00
|
|
|
if ( ! isNewFont() && ( int(line[z]) < fc::NF_rev_left_arrow2
|
|
|
|
|| int(line[z]) > fc::NF_check_mark ) )
|
2015-10-17 21:05:49 +02:00
|
|
|
{
|
|
|
|
line[z] = L' ';
|
|
|
|
}
|
|
|
|
}
|
2015-05-23 13:35:12 +02:00
|
|
|
if ( (z == hotkeypos) && isActive )
|
|
|
|
{
|
|
|
|
setColor (wc.label_hotkey_fg, wc.label_hotkey_bg);
|
2016-07-09 00:01:59 +02:00
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
if ( ! isNoUnderline )
|
|
|
|
setUnderline();
|
2016-07-09 00:01:59 +02:00
|
|
|
|
2015-07-18 21:31:26 +02:00
|
|
|
print ( line[z] );
|
2016-07-09 00:01:59 +02:00
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
if ( ! isNoUnderline )
|
|
|
|
unsetUnderline();
|
2016-07-09 00:01:59 +02:00
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
if ( hasEmphasis() )
|
2016-09-25 23:53:48 +02:00
|
|
|
setColor (emphasis_color, getBackgroundColor());
|
2015-05-23 13:35:12 +02:00
|
|
|
else
|
2016-09-25 23:53:48 +02:00
|
|
|
setColor();
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
|
|
|
else
|
2015-07-18 21:31:26 +02:00
|
|
|
print ( line[z] );
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
|
|
|
|
2016-09-25 23:53:48 +02:00
|
|
|
if ( length > uInt(getWidth()) )
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2016-09-25 23:53:48 +02:00
|
|
|
setColor (ellipsis_color, getBackgroundColor());
|
2015-05-23 13:35:12 +02:00
|
|
|
print ("..");
|
2016-09-25 23:53:48 +02:00
|
|
|
setColor();
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
2015-07-18 21:31:26 +02:00
|
|
|
else
|
|
|
|
{
|
2016-09-25 23:53:48 +02:00
|
|
|
for (int x=xoffset+to_char; x < getWidth(); x++)
|
2015-07-18 21:31:26 +02:00
|
|
|
print (' ');
|
|
|
|
}
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
if ( hasReverseMode() )
|
|
|
|
setReverse(false);
|
2015-07-18 21:31:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FLabel::draw()
|
|
|
|
{
|
|
|
|
wchar_t* src;
|
|
|
|
wchar_t* dest;
|
|
|
|
wchar_t* LabelText;
|
|
|
|
uInt length;
|
|
|
|
int hotkeypos, xoffset;
|
2015-05-26 23:15:49 +02:00
|
|
|
|
2015-07-18 21:31:26 +02:00
|
|
|
if ( text.isNull() || text.isEmpty() )
|
|
|
|
return;
|
|
|
|
|
2015-10-11 21:56:16 +02:00
|
|
|
if ( isMonochron() )
|
|
|
|
{
|
|
|
|
setReverse(true);
|
|
|
|
if ( hasEmphasis() )
|
|
|
|
setBold(true);
|
|
|
|
}
|
|
|
|
|
2015-07-18 21:31:26 +02:00
|
|
|
if ( hasEmphasis() )
|
2016-09-25 23:53:48 +02:00
|
|
|
setColor (emphasis_color, getBackgroundColor());
|
2015-07-18 21:31:26 +02:00
|
|
|
else
|
2016-09-25 23:53:48 +02:00
|
|
|
setColor();
|
2015-07-18 21:31:26 +02:00
|
|
|
|
|
|
|
hotkeypos = -1;
|
|
|
|
|
2016-10-06 23:15:09 +02:00
|
|
|
if ( multiline && getHeight() >= 2 )
|
2015-07-18 21:31:26 +02:00
|
|
|
{
|
|
|
|
uInt y = 0;
|
|
|
|
uInt text_lines = uInt(multiline_text.size());
|
|
|
|
bool hotkey_printed = false;
|
|
|
|
|
2016-09-25 23:53:48 +02:00
|
|
|
while ( y < text_lines && y < uInt(getHeight()) )
|
2015-07-18 21:31:26 +02:00
|
|
|
{
|
|
|
|
length = multiline_text[y].getLength();
|
2015-10-17 19:40:43 +02:00
|
|
|
LabelText = new wchar_t[length+1]();
|
2015-09-30 22:39:02 +02:00
|
|
|
src = const_cast<wchar_t*>(multiline_text[y].wc_str());
|
|
|
|
dest = const_cast<wchar_t*>(LabelText);
|
2015-07-18 21:31:26 +02:00
|
|
|
|
|
|
|
if ( ! hotkey_printed )
|
|
|
|
hotkeypos = getHotkeyPos(src, dest, length);
|
|
|
|
else
|
2016-10-06 23:15:09 +02:00
|
|
|
std::wcsncpy(dest, src, length);
|
2015-07-18 21:31:26 +02:00
|
|
|
|
2016-10-11 04:57:36 +02:00
|
|
|
setPrintPos (1, 1+int(y));
|
2015-07-18 21:31:26 +02:00
|
|
|
|
|
|
|
if ( hotkeypos != -1 )
|
|
|
|
{
|
|
|
|
xoffset = getXOffset (int(length-1));
|
|
|
|
printLine (LabelText, length-1, hotkeypos, xoffset);
|
|
|
|
hotkey_printed = true;
|
|
|
|
hotkeypos = -1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
xoffset = getXOffset (int(length));
|
|
|
|
printLine (LabelText, length, -1, xoffset);
|
|
|
|
}
|
2016-07-09 00:01:59 +02:00
|
|
|
|
2015-07-18 21:31:26 +02:00
|
|
|
y++;
|
|
|
|
delete[] LabelText;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
length = text.getLength();
|
2015-10-17 19:40:43 +02:00
|
|
|
LabelText = new wchar_t[length+1]();
|
2015-07-18 21:31:26 +02:00
|
|
|
src = const_cast<wchar_t*>(text.wc_str());
|
|
|
|
dest = const_cast<wchar_t*>(LabelText);
|
|
|
|
hotkeypos = getHotkeyPos (src, dest, length);
|
|
|
|
|
|
|
|
if ( hotkeypos != -1 )
|
|
|
|
length--;
|
|
|
|
|
2016-10-11 04:57:36 +02:00
|
|
|
setPrintPos (1,1);
|
2015-07-18 21:31:26 +02:00
|
|
|
xoffset = getXOffset (int(length));
|
|
|
|
printLine (LabelText, length, hotkeypos, xoffset);
|
|
|
|
delete[] LabelText;
|
|
|
|
}
|
2016-07-09 00:01:59 +02:00
|
|
|
|
2015-10-11 21:56:16 +02:00
|
|
|
if ( isMonochron() )
|
|
|
|
{
|
|
|
|
setReverse(false);
|
2016-07-09 00:01:59 +02:00
|
|
|
|
2015-10-11 21:56:16 +02:00
|
|
|
if ( hasEmphasis() )
|
|
|
|
setBold(false);
|
|
|
|
}
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|