Refactoring FMenu::drawItems

This commit is contained in:
Markus Gans 2017-12-19 02:06:27 +01:00
parent ec57ec6f74
commit ef5970b09c
20 changed files with 455 additions and 393 deletions

View File

@ -1,3 +1,6 @@
2017-12-19 Markus Gans <guru.mail@muenster.de>
* Refactoring FMenu::drawItems
2017-12-17 Markus Gans <guru.mail@muenster.de>
* The Final Cut now also compiles under Solaris

View File

@ -162,7 +162,7 @@ class FFileDialog : public FDialog
// Method
void init();
inline bool pattern_match (const char* const, char*&);
inline bool pattern_match (const char* const, char[]);
void clear();
int numOfDirs();
void sortDir();

View File

@ -138,10 +138,10 @@ class FLabel : public FWidget
// Methods
void init();
uChar getHotkey();
int getHotkeyPos (wchar_t*&, wchar_t*&, uInt);
int getHotkeyPos (wchar_t[], wchar_t[], uInt);
void setHotkeyAccelerator();
int getAlignOffset (int);
void printLine (wchar_t*&, uInt, int, int = 0);
void printLine (wchar_t[], uInt, int, int = 0);
void draw();
// Data Members

View File

@ -134,6 +134,14 @@ class FMenu : public FWindow, public FMenuList
uChar : 2; // padding bits
} mouseStates;
typedef struct
{
wchar_t* text;
int length;
int hotkeypos;
bool no_underline;
} menuText;
// Constants
static const bool SELECT_ITEM = true;
@ -156,7 +164,7 @@ class FMenu : public FWindow, public FMenuList
bool isRadioMenuItem (FWidget*) const;
bool isSubMenu() const;
bool isMouseOverMenu (const FPoint&);
bool isMouseOverSubmenu (const FPoint&);
bool isMouseOverSubMenu (const FPoint&);
bool isMouseOverSuperMenu (const FPoint&);
bool isMouseOverMenuBar (const FPoint&);
@ -185,10 +193,18 @@ class FMenu : public FWindow, public FMenuList
bool selectPrevItem();
void keypressMenuBar (FKeyEvent*&);
bool hotkeyMenu (FKeyEvent*&);
int getHotkeyPos (wchar_t*&, wchar_t*&, uInt);
int getHotkeyPos (wchar_t[], wchar_t[], uInt);
void draw();
void drawItems();
void drawSeparator(int);
void drawMenuLine (FMenuItem*, int);
void drawCheckMarkPrefix (FMenuItem*);
void drawMenuText (menuText&);
void drawSubMenuIndicator (int&);
void drawAcceleratorKey (int&, int);
void drawTrailingSpaces (int);
void setLineAttributes (FMenuItem*, int);
void setCursorToHotkeyPosition (FMenuItem*, int);
void processActivate();
// Friend classes

View File

@ -114,7 +114,7 @@ class FMenuBar : public FWindow, public FMenuList
bool selectNextItem();
bool selectPrevItem();
bool hotkeyMenu (FKeyEvent*&);
int getHotkeyPos (wchar_t*&, wchar_t*&, uInt);
int getHotkeyPos (wchar_t[], wchar_t[], uInt);
void draw();
void drawItems();
void adjustItems();

View File

@ -126,41 +126,41 @@ class FOptiAttr
void setNoColorVideo (int);
void setDefaultColorSupport();
void setCygwinTerminal();
void set_enter_bold_mode (char*&);
void set_exit_bold_mode (char*&);
void set_enter_dim_mode (char*&);
void set_exit_dim_mode (char*&);
void set_enter_italics_mode (char*&);
void set_exit_italics_mode (char*&);
void set_enter_underline_mode (char*&);
void set_exit_underline_mode (char*&);
void set_enter_blink_mode (char*&);
void set_exit_blink_mode (char*&);
void set_enter_reverse_mode (char*&);
void set_exit_reverse_mode (char*&);
void set_enter_secure_mode (char*&);
void set_exit_secure_mode (char*&);
void set_enter_protected_mode (char*&);
void set_exit_protected_mode (char*&);
void set_enter_crossed_out_mode (char*&);
void set_exit_crossed_out_mode (char*&);
void set_enter_dbl_underline_mode (char*&);
void set_exit_dbl_underline_mode (char*&);
void set_enter_standout_mode (char*&);
void set_exit_standout_mode (char*&);
void set_set_attributes (char*&);
void set_exit_attribute_mode (char*&);
void set_enter_alt_charset_mode (char*&);
void set_exit_alt_charset_mode (char*&);
void set_enter_pc_charset_mode (char*&);
void set_exit_pc_charset_mode (char*&);
void set_a_foreground_color (char*&);
void set_a_background_color (char*&);
void set_foreground_color (char*&);
void set_background_color (char*&);
void set_term_color_pair (char*&);
void set_orig_pair (char*&);
void set_orig_orig_colors (char*&);
void set_enter_bold_mode (char[]);
void set_exit_bold_mode (char[]);
void set_enter_dim_mode (char[]);
void set_exit_dim_mode (char[]);
void set_enter_italics_mode (char[]);
void set_exit_italics_mode (char[]);
void set_enter_underline_mode (char[]);
void set_exit_underline_mode (char[]);
void set_enter_blink_mode (char[]);
void set_exit_blink_mode (char[]);
void set_enter_reverse_mode (char[]);
void set_exit_reverse_mode (char[]);
void set_enter_secure_mode (char[]);
void set_exit_secure_mode (char[]);
void set_enter_protected_mode (char[]);
void set_exit_protected_mode (char[]);
void set_enter_crossed_out_mode (char[]);
void set_exit_crossed_out_mode (char[]);
void set_enter_dbl_underline_mode (char[]);
void set_exit_dbl_underline_mode (char[]);
void set_enter_standout_mode (char[]);
void set_exit_standout_mode (char[]);
void set_set_attributes (char[]);
void set_exit_attribute_mode (char[]);
void set_enter_alt_charset_mode (char[]);
void set_exit_alt_charset_mode (char[]);
void set_enter_pc_charset_mode (char[]);
void set_exit_pc_charset_mode (char[]);
void set_a_foreground_color (char[]);
void set_a_background_color (char[]);
void set_foreground_color (char[]);
void set_background_color (char[]);
void set_term_color_pair (char[]);
void set_orig_pair (char[]);
void set_orig_orig_colors (char[]);
// Inquiry
static bool isNormal (char_data*&);
@ -273,13 +273,13 @@ class FOptiAttr
void change_color (char_data*&, char_data*&);
void resetAttribute (char_data*&);
void reset (char_data*&);
bool caused_reset_attributes (char*&, uChar = all_tests);
bool caused_reset_attributes (char[], uChar = all_tests);
void detectSwitchOn (char_data*&, char_data*&);
void detectSwitchOff (char_data*&, char_data*&);
bool switchOn();
bool switchOff();
bool append_sequence (char*&);
bool replace_sequence (char*&);
bool append_sequence (char[]);
bool replace_sequence (char[]);
// Data Members
capability F_enter_bold_mode;

View File

@ -84,26 +84,26 @@ class FOptiMove
void setBaudRate (int);
void setTabStop (int);
void setTermSize (int, int);
int set_cursor_home (char*&);
int set_cursor_to_ll (char*&);
int set_carriage_return (char*&);
int set_tabular (char*&);
int set_back_tab (char*&);
int set_cursor_up (char*&);
int set_cursor_down (char*&);
int set_cursor_left (char*&);
int set_cursor_right (char*&);
int set_cursor_address (char*&);
int set_column_address (char*&);
int set_row_address (char*&);
int set_parm_up_cursor (char*&);
int set_parm_down_cursor (char*&);
int set_parm_left_cursor (char*&);
int set_parm_right_cursor (char*&);
int set_erase_chars (char*&);
int set_repeat_char (char*&);
int set_clr_bol (char*&);
int set_clr_eol (char*&);
int set_cursor_home (char[]);
int set_cursor_to_ll (char[]);
int set_carriage_return (char[]);
int set_tabular (char[]);
int set_back_tab (char[]);
int set_cursor_up (char[]);
int set_cursor_down (char[]);
int set_cursor_left (char[]);
int set_cursor_right (char[]);
int set_cursor_address (char[]);
int set_column_address (char[]);
int set_row_address (char[]);
int set_parm_up_cursor (char[]);
int set_parm_down_cursor (char[]);
int set_parm_left_cursor (char[]);
int set_parm_right_cursor (char[]);
int set_erase_chars (char[]);
int set_repeat_char (char[]);
int set_clr_bol (char[]);
int set_clr_eol (char[]);
void set_auto_left_margin (const bool&);
void set_eat_newline_glitch (const bool&);
@ -131,10 +131,10 @@ class FOptiMove
// Methods
void calculateCharDuration();
int capDuration (char*&, int);
int capDuration (char[], int);
int capDurationToLength (int);
int repeatedAppend (const capability&, int, char*);
int relativeMove (char*&, int, int, int, int);
int relativeMove (char[], int, int, int, int);
bool isWideMove (int, int, int, int);
bool isMethod0Faster (int&, int, int);
bool isMethod1Faster (int&, int, int, int, int);

View File

@ -484,9 +484,9 @@ class FTerm
static void detectTerminal();
static void termtypeAnalysis();
static char* init_256colorTerminal();
static char* determineMaxColor (char*&);
static char* parseAnswerbackMsg (char*&);
static char* parseSecDA (char*&);
static char* determineMaxColor (char[]);
static char* parseAnswerbackMsg (char[]);
static char* parseSecDA (char[]);
static void oscPrefix();
static void oscPostfix();
static void init_alt_charset();

View File

@ -384,7 +384,7 @@ class FVTerm : public FTerm
static bool clearTerm (int = ' ');
static bool canClearToEOL (uInt, uInt);
static bool canClearLeadingWS (uInt&, uInt);
static bool canClearTailingWS (uInt&, uInt);
static bool canClearTrailingWS (uInt&, uInt);
static bool skipUnchangedCharacters (uInt&, uInt, uInt);
static void printRange (uInt, uInt, uInt, bool);
static exit_state eraseCharacters (uInt&, uInt, uInt, bool);
@ -402,13 +402,13 @@ class FVTerm : public FTerm
static void appendAttributes (char_data*&);
static int appendLowerRight (char_data*&);
static void appendOutputBuffer (const std::string&);
static void appendOutputBuffer (const char*&);
static void appendOutputBuffer (const char[]);
#if defined(__sun) && defined(__SVR4)
static int appendOutputBuffer (char);
#endif
#else
static int appendOutputBuffer (int);
#endif
// Data Members
static std::queue<int>* output_buffer;

View File

@ -1868,7 +1868,7 @@ void FApplication::closeOpenMenu()
FMenu* menu = static_cast<FMenu*>(open_menu);
const FPoint& mouse_position = getMousePos();
if ( menu && menu->containsMenuStructure(mouse_position) )
if ( menu->containsMenuStructure(mouse_position) )
return;
bool is_window_menu;

View File

@ -614,7 +614,7 @@ void FFileDialog::init()
//----------------------------------------------------------------------
inline bool FFileDialog::pattern_match ( const char* const pattern
, char*& fname )
, char fname[] )
{
char search[128] = {};

View File

@ -419,7 +419,7 @@ uChar FLabel::getHotkey()
}
//----------------------------------------------------------------------
int FLabel::getHotkeyPos (wchar_t*& src, wchar_t*& dest, uInt length)
int FLabel::getHotkeyPos (wchar_t src[], wchar_t dest[], uInt length)
{
// find hotkey position in string
// + generate a new string without the '&'-sign
@ -487,7 +487,7 @@ int FLabel::getAlignOffset (int length)
}
//----------------------------------------------------------------------
void FLabel::printLine ( wchar_t*& line
void FLabel::printLine ( wchar_t line[]
, uInt length
, int hotkeypos
, int align_offset )
@ -549,7 +549,7 @@ void FLabel::printLine ( wchar_t*& line
else if ( align_offset + to_char < getWidth() )
{
int len = getWidth() - align_offset - to_char;
print (FString(len, ' ')); // tailing spaces
print (FString(len, ' ')); // trailing spaces
}
if ( hasReverseMode() )
@ -559,8 +559,6 @@ void FLabel::printLine ( wchar_t*& line
//----------------------------------------------------------------------
void FLabel::draw()
{
wchar_t* src;
wchar_t* dest;
wchar_t* LabelText;
uInt length;
int hotkeypos, align_offset;
@ -600,8 +598,8 @@ void FLabel::draw()
return;
}
src = const_cast<wchar_t*>(multiline_text[y].wc_str());
dest = const_cast<wchar_t*>(LabelText);
wchar_t* src = const_cast<wchar_t*>(multiline_text[y].wc_str());
wchar_t* dest = const_cast<wchar_t*>(LabelText);
if ( ! hotkey_printed )
hotkeypos = getHotkeyPos(src, dest, length);
@ -641,9 +639,7 @@ void FLabel::draw()
return;
}
src = const_cast<wchar_t*>(text.wc_str());
dest = const_cast<wchar_t*>(LabelText);
hotkeypos = getHotkeyPos (src, dest, length);
hotkeypos = getHotkeyPos (text.wc_str(), LabelText, length);
if ( hotkeypos != -1 )
length--;

View File

@ -1591,7 +1591,7 @@ inline void FListBox::keyLeft()
//----------------------------------------------------------------------
inline void FListBox::keyRight()
{
static const int padding_space = 2; // 1 leading space + 1 tailing space
static const int padding_space = 2; // 1 leading space + 1 trailing space
int xoffset_end = max_line_width - getClientWidth() + padding_space;
xoffset++;
@ -1976,7 +1976,7 @@ void FListBox::cb_VBarChange (FWidget*, data_ptr)
//----------------------------------------------------------------------
void FListBox::cb_HBarChange (FWidget*, data_ptr)
{
static const int padding_space = 2; // 1 leading space + 1 tailing space
static const int padding_space = 2; // 1 leading space + 1 trailing space
FScrollbar::sType scrollType;
int distance = 1
, pagesize = 4

View File

@ -610,7 +610,7 @@ FObject::FObjectIterator FListView::insert ( FListViewItem* item
(*header_iter).width = len;
}
line_width += (*header_iter).width + padding_space; // width + tailing space
line_width += (*header_iter).width + padding_space; // width + trailing space
column_idx++;
++header_iter;
}
@ -1385,7 +1385,7 @@ void FListView::draw()
void FListView::drawColumnLabels()
{
static const int leading_space = 1;
static const int tailing_space = 1;
static const int trailing_space = 1;
static const int ellipsis_length = 2;
std::vector<char_data>::const_iterator first, last;
headerItems::const_iterator iter;
@ -1427,12 +1427,12 @@ void FListView::drawColumnLabels()
headerline << txt;
if ( txt_length < uInt(column_width) )
headerline << ' '; // tailing space
headerline << ' '; // trailing space
if ( txt_length + tailing_space < uInt(column_width) )
if ( txt_length + trailing_space < uInt(column_width) )
{
setColor();
const FString line ( uInt(column_width) - tailing_space - txt_length
const FString line ( uInt(column_width) - trailing_space - txt_length
, wchar_t(fc::BoxDrawingsHorizontal) );
headerline << line; // horizontal line
}
@ -1608,7 +1608,7 @@ void FListView::drawListLine ( const FListViewItem* item
if ( align_offset + txt_length <= uInt(width) )
{
// Insert text and tailing space
// Insert text and trailing space
line += text.left(width);
line += FString ( leading_space + width
- int(align_offset + txt_length), L' ');

View File

@ -364,7 +364,7 @@ void FMenu::onMouseMove (FMouseEvent* ev)
return;
state.mouse_over_menu = isMouseOverMenu (ev->getTermPos());
state.mouse_over_submenu = isMouseOverSubmenu (ev->getTermPos());
state.mouse_over_submenu = isMouseOverSubMenu (ev->getTermPos());
state.mouse_over_supermenu = isMouseOverSuperMenu (ev->getTermPos());
state.mouse_over_menubar = isMouseOverMenuBar (ev->getTermPos());
@ -488,7 +488,7 @@ bool FMenu::isMouseOverMenu (const FPoint& termpos)
}
//----------------------------------------------------------------------
bool FMenu::isMouseOverSubmenu (const FPoint& termpos)
bool FMenu::isMouseOverSubMenu (const FPoint& termpos)
{
if ( opened_sub_menu )
{
@ -1294,7 +1294,7 @@ bool FMenu::hotkeyMenu (FKeyEvent*& ev)
}
//----------------------------------------------------------------------
int FMenu::getHotkeyPos (wchar_t*& src, wchar_t*& dest, uInt length)
int FMenu::getHotkeyPos (wchar_t src[], wchar_t dest[], uInt length)
{
// find hotkey position in string
// + generate a new string without the '&'-sign
@ -1338,218 +1338,16 @@ void FMenu::draw()
void FMenu::drawItems()
{
std::vector<FMenuItem*>::const_iterator iter, last;
int c = 0;
int y = 0;
iter = item_list.begin();
last = item_list.end();
if ( has_checkable_items )
c = 1;
while ( iter != last )
{
if ( (*iter)->isSeparator() )
{
drawSeparator(y);
}
else
{
wchar_t* src;
wchar_t* dest;
wchar_t* item_text;
FString txt;
uInt txt_length;
int hotkeypos, to_char;
int accel_key = (*iter)->accel_key;
bool has_menu = (*iter)->hasMenu()
, is_enabled = (*iter)->isEnabled()
, is_checked = (*iter)->isChecked()
, is_checkable = (*iter)->checkable
, is_radio_btn = (*iter)->radio_button
, is_selected = (*iter)->isSelected()
, is_noUnderline = (((*iter)->getFlags() & fc::no_underline) != 0);
if ( is_enabled )
{
if ( is_selected )
{
setForegroundColor (wc.menu_active_focus_fg);
setBackgroundColor (wc.menu_active_focus_bg);
if ( isMonochron() )
setReverse(false);
}
else
{
setForegroundColor (wc.menu_active_fg);
setBackgroundColor (wc.menu_active_bg);
if ( isMonochron() )
setReverse(true);
}
}
else
{
setForegroundColor (wc.menu_inactive_fg);
setBackgroundColor (wc.menu_inactive_bg);
if ( isMonochron() )
setReverse(true);
}
setPrintPos (2, 2 + y);
setColor();
if ( has_checkable_items )
{
if ( is_checkable )
{
if ( is_checked )
{
if ( is_radio_btn )
{
if ( isNewFont() )
print (fc::NF_Bullet); // NF_Bullet ●
else
print (fc::Bullet); // Bullet ●
}
else
{
if ( isNewFont() )
print (fc::NF_check_mark); // NF_check_mark ✓
else
print (fc::SquareRoot); // SquareRoot √
}
}
else
{
setColor (wc.menu_inactive_fg, getBackgroundColor());
if ( getEncoding() == fc::ASCII )
print ('-');
else
print (fc::SmallBullet); // ·
setColor();
}
}
else
print (' ');
}
print (' ');
txt = (*iter)->getText();
txt_length = uInt(txt.getLength());
try
{
item_text = new wchar_t[txt_length + 1]();
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
return;
}
src = const_cast<wchar_t*>(txt.wc_str());
dest = const_cast<wchar_t*>(item_text);
to_char = int(txt_length);
hotkeypos = getHotkeyPos (src, dest, txt_length);
if ( hotkeypos == -1 )
{
// set cursor to the first character
if ( is_selected )
{
if ( is_checkable )
(*iter)->setCursorPos (3, 1);
else
(*iter)->setCursorPos (2, 1);
}
}
else
{
if ( is_selected )
{
// set cursor to the hotkey position
if ( is_checkable )
(*iter)->setCursorPos (3 + hotkeypos, 1);
else
(*iter)->setCursorPos (2 + hotkeypos, 1);
}
txt_length--;
to_char--;
}
for (int z = 0; z < to_char; z++)
{
if ( ! std::iswprint(wint_t(item_text[z])) )
{
if ( ! isNewFont()
&& ( int(item_text[z]) < fc::NF_rev_left_arrow2
|| int(item_text[z]) > fc::NF_check_mark )
&& ! charEncodable(uInt(item_text[z])) )
{
item_text[z] = L' ';
}
}
if ( (z == hotkeypos) && is_enabled && ! is_selected )
{
setColor (wc.menu_hotkey_fg, wc.menu_hotkey_bg);
if ( ! is_noUnderline )
setUnderline();
print (item_text[z]);
if ( ! is_noUnderline )
unsetUnderline();
setColor();
}
else
print (item_text[z]);
}
if ( has_menu )
{
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(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(max_item_width) - (to_char + accel_len + c + 2);
if ( len > 0 )
{
FString spaces (len, wchar_t(' '));
print (spaces + accel_name);
to_char = int(max_item_width) - (c + 2);
}
}
if ( is_selected )
{
for (uInt i = uInt(to_char + c); i < max_item_width - 1; i++)
print (' ');
}
if ( isMonochron() && is_enabled && is_selected )
setReverse(true);
delete[] item_text;
}
drawMenuLine (*iter, y);
++iter;
y++;
@ -1584,6 +1382,260 @@ inline void FMenu::drawSeparator(int y)
setReverse(false);
}
//----------------------------------------------------------------------
void FMenu::drawMenuLine (FMenuItem* menuitem, int y)
{
FString txt = menuitem->getText();
menuText txtdata;
uInt txt_length = uInt(txt.getLength());
int hotkeypos;
int to_char = int(txt_length);
int accel_key = menuitem->accel_key;
bool is_enabled = menuitem->isEnabled();
bool is_selected = menuitem->isSelected();
// Set screen position and attributes
setLineAttributes (menuitem, y);
// Draw check mark prefix for checkable items
drawCheckMarkPrefix (menuitem);
// Print leading blank space
print (' ');
try
{
txtdata.text = new wchar_t[txt_length + 1]();
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
return;
}
hotkeypos = getHotkeyPos(txt.wc_str(), txtdata.text, txt_length);
if ( hotkeypos != -1 )
to_char--;
txtdata.length = to_char;
txtdata.no_underline = ((menuitem->getFlags() & fc::no_underline) != 0);
setCursorToHotkeyPosition (menuitem, hotkeypos);
if ( ! is_enabled || is_selected )
txtdata.hotkeypos = -1;
else
txtdata.hotkeypos = hotkeypos;
drawMenuText (txtdata);
if ( menuitem->hasMenu() )
drawSubMenuIndicator (to_char);
else if ( accel_key )
drawAcceleratorKey (to_char, accel_key);
// Draw the trailing spaces of the selected line
if ( is_selected )
drawTrailingSpaces (to_char);
if ( isMonochron() && is_enabled && is_selected )
setReverse(true);
delete[] txtdata.text;
}
//----------------------------------------------------------------------
void FMenu::drawCheckMarkPrefix (FMenuItem* menuitem)
{
bool is_checked = menuitem->isChecked();
bool is_checkable = menuitem->checkable;
bool is_radio_btn = menuitem->radio_button;
if ( ! has_checkable_items )
return;
if ( is_checkable )
{
if ( is_checked )
{
if ( is_radio_btn )
{
if ( isNewFont() )
print (fc::NF_Bullet); // NF_Bullet ●
else
print (fc::Bullet); // Bullet ●
}
else
{
if ( isNewFont() )
print (fc::NF_check_mark); // NF_check_mark ✓
else
print (fc::SquareRoot); // SquareRoot √
}
}
else
{
setColor (wc.menu_inactive_fg, getBackgroundColor());
if ( getEncoding() == fc::ASCII )
print ('-');
else
print (fc::SmallBullet); // ·
setColor();
}
}
else
print (' ');
}
//----------------------------------------------------------------------
void FMenu::drawMenuText (menuText& data)
{
// Print menu text
for (int z = 0; z < data.length; z++)
{
if ( ! std::iswprint(wint_t(data.text[z])) )
{
if ( ! isNewFont()
&& ( int(data.text[z]) < fc::NF_rev_left_arrow2
|| int(data.text[z]) > fc::NF_check_mark )
&& ! charEncodable(uInt(data.text[z])) )
{
data.text[z] = L' ';
}
}
if ( z == data.hotkeypos )
{
setColor (wc.menu_hotkey_fg, wc.menu_hotkey_bg);
if ( ! data.no_underline )
setUnderline();
print (data.text[z]);
if ( ! data.no_underline )
unsetUnderline();
setColor();
}
else
print (data.text[z]);
}
}
//----------------------------------------------------------------------
void FMenu::drawSubMenuIndicator (int& startpos)
{
int c = ( has_checkable_items ) ? 1 : 0;
int len = int(max_item_width) - (startpos + c + 3);
if ( len > 0 )
{
// Print filling blank spaces
print (FString(len, wchar_t(' ')));
// Print BlackRightPointingPointer ►
print (wchar_t(fc::BlackRightPointingPointer));
startpos = int(max_item_width) - (c + 2);
}
}
//----------------------------------------------------------------------
void FMenu::drawAcceleratorKey (int& startpos, int accel_key)
{
FString accel_name (getKeyName(accel_key));
int c = ( has_checkable_items ) ? 1 : 0;
int accel_len = int(accel_name.getLength());
int len = int(max_item_width) - (startpos + accel_len + c + 2);
if ( len > 0 )
{
// Print filling blank spaces + accelerator key name
FString spaces (len, wchar_t(' '));
print (spaces + accel_name);
startpos = int(max_item_width) - (c + 2);
}
}
//----------------------------------------------------------------------
void FMenu::drawTrailingSpaces (int startpos)
{
int c = ( has_checkable_items ) ? 1 : 0;
// Print trailing blank space
for (uInt i = uInt(startpos + c); i < max_item_width - 1; i++)
print (' ');
}
//----------------------------------------------------------------------
void FMenu::setLineAttributes (FMenuItem* menuitem, int y)
{
bool is_enabled = menuitem->isEnabled();
bool is_selected = menuitem->isSelected();
if ( is_enabled )
{
if ( is_selected )
{
setForegroundColor (wc.menu_active_focus_fg);
setBackgroundColor (wc.menu_active_focus_bg);
if ( isMonochron() )
setReverse(false);
}
else
{
setForegroundColor (wc.menu_active_fg);
setBackgroundColor (wc.menu_active_bg);
if ( isMonochron() )
setReverse(true);
}
}
else
{
setForegroundColor (wc.menu_inactive_fg);
setBackgroundColor (wc.menu_inactive_bg);
if ( isMonochron() )
setReverse(true);
}
setPrintPos (2, 2 + y);
setColor();
}
//----------------------------------------------------------------------
void FMenu::setCursorToHotkeyPosition (FMenuItem* menuitem, int hotkeypos)
{
bool is_checkable = menuitem->checkable;
bool is_selected = menuitem->isSelected();
if ( hotkeypos == -1 )
{
// set cursor to the first character
if ( is_selected )
{
if ( is_checkable )
menuitem->setCursorPos (3, 1);
else
menuitem->setCursorPos (2, 1);
}
}
else
{
if ( is_selected )
{
// set cursor to the hotkey position
if ( is_checkable )
menuitem->setCursorPos (3 + hotkeypos, 1);
else
menuitem->setCursorPos (2 + hotkeypos, 1);
}
}
}
//----------------------------------------------------------------------
void FMenu::processActivate()
{

View File

@ -744,7 +744,7 @@ bool FMenuBar::hotkeyMenu (FKeyEvent*& ev)
}
//----------------------------------------------------------------------
int FMenuBar::getHotkeyPos (wchar_t*& src, wchar_t*& dest, uInt length)
int FMenuBar::getHotkeyPos (wchar_t src[], wchar_t dest[], uInt length)
{
// find hotkey position in string
// + generate a new string without the '&'-sign
@ -793,17 +793,15 @@ void FMenuBar::drawItems()
while ( iter != last )
{
wchar_t* src;
wchar_t* dest;
wchar_t* item_text;
FString txt;
uInt txt_length;
int hotkeypos
, startpos
, to_char;
, startpos
, to_char;
bool is_active
, is_selected
, is_noUnderline;
, is_selected
, is_noUnderline;
startpos = x + 1;
is_active = (*iter)->isEnabled();
@ -853,15 +851,12 @@ void FMenuBar::drawItems()
return;
}
src = const_cast<wchar_t*>(txt.wc_str());
dest = const_cast<wchar_t*>(item_text);
if ( x - 1 <= screenWidth )
to_char = int(txt_length);
else
to_char = int(txt_length) - (screenWidth - x - 1);
hotkeypos = getHotkeyPos (src, dest, txt_length);
hotkeypos = getHotkeyPos (txt.wc_str(), item_text, txt_length);
if ( hotkeypos != -1 )
{

View File

@ -86,7 +86,7 @@ FOptiAttr::~FOptiAttr() // destructor
// public methods of FOptiAttr
//----------------------------------------------------------------------
void FOptiAttr::set_enter_bold_mode (char*& cap)
void FOptiAttr::set_enter_bold_mode (char cap[])
{
if ( cap )
{
@ -96,7 +96,7 @@ void FOptiAttr::set_enter_bold_mode (char*& cap)
}
//----------------------------------------------------------------------
void FOptiAttr::set_exit_bold_mode (char*& cap)
void FOptiAttr::set_exit_bold_mode (char cap[])
{
if ( cap )
{
@ -106,7 +106,7 @@ void FOptiAttr::set_exit_bold_mode (char*& cap)
}
//----------------------------------------------------------------------
void FOptiAttr::set_enter_dim_mode (char*& cap)
void FOptiAttr::set_enter_dim_mode (char cap[])
{
if ( cap )
{
@ -116,7 +116,7 @@ void FOptiAttr::set_enter_dim_mode (char*& cap)
}
//----------------------------------------------------------------------
void FOptiAttr::set_exit_dim_mode (char*& cap)
void FOptiAttr::set_exit_dim_mode (char cap[])
{
if ( cap )
{
@ -126,7 +126,7 @@ void FOptiAttr::set_exit_dim_mode (char*& cap)
}
//----------------------------------------------------------------------
void FOptiAttr::set_enter_italics_mode (char*& cap)
void FOptiAttr::set_enter_italics_mode (char cap[])
{
if ( cap )
{
@ -136,7 +136,7 @@ void FOptiAttr::set_enter_italics_mode (char*& cap)
}
//----------------------------------------------------------------------
void FOptiAttr::set_exit_italics_mode (char*& cap)
void FOptiAttr::set_exit_italics_mode (char cap[])
{
if ( cap )
{
@ -146,7 +146,7 @@ void FOptiAttr::set_exit_italics_mode (char*& cap)
}
//----------------------------------------------------------------------
void FOptiAttr::set_enter_underline_mode (char*& cap)
void FOptiAttr::set_enter_underline_mode (char cap[])
{
if ( cap )
{
@ -156,7 +156,7 @@ void FOptiAttr::set_enter_underline_mode (char*& cap)
}
//----------------------------------------------------------------------
void FOptiAttr::set_exit_underline_mode (char*& cap)
void FOptiAttr::set_exit_underline_mode (char cap[])
{
if ( cap )
{
@ -166,7 +166,7 @@ void FOptiAttr::set_exit_underline_mode (char*& cap)
}
//----------------------------------------------------------------------
void FOptiAttr::set_enter_blink_mode (char*& cap)
void FOptiAttr::set_enter_blink_mode (char cap[])
{
if ( cap )
{
@ -176,7 +176,7 @@ void FOptiAttr::set_enter_blink_mode (char*& cap)
}
//----------------------------------------------------------------------
void FOptiAttr::set_exit_blink_mode (char*& cap)
void FOptiAttr::set_exit_blink_mode (char cap[])
{
if ( cap )
{
@ -186,7 +186,7 @@ void FOptiAttr::set_exit_blink_mode (char*& cap)
}
//----------------------------------------------------------------------
void FOptiAttr::set_enter_reverse_mode (char*& cap)
void FOptiAttr::set_enter_reverse_mode (char cap[])
{
if ( cap )
{
@ -196,7 +196,7 @@ void FOptiAttr::set_enter_reverse_mode (char*& cap)
}
//----------------------------------------------------------------------
void FOptiAttr::set_exit_reverse_mode (char*& cap)
void FOptiAttr::set_exit_reverse_mode (char cap[])
{
if ( cap )
{
@ -206,7 +206,7 @@ void FOptiAttr::set_exit_reverse_mode (char*& cap)
}
//----------------------------------------------------------------------
void FOptiAttr::set_enter_secure_mode (char*& cap)
void FOptiAttr::set_enter_secure_mode (char cap[])
{
if ( cap )
{
@ -216,7 +216,7 @@ void FOptiAttr::set_enter_secure_mode (char*& cap)
}
//----------------------------------------------------------------------
void FOptiAttr::set_exit_secure_mode (char*& cap)
void FOptiAttr::set_exit_secure_mode (char cap[])
{
if ( cap )
{
@ -226,7 +226,7 @@ void FOptiAttr::set_exit_secure_mode (char*& cap)
}
//----------------------------------------------------------------------
void FOptiAttr::set_enter_protected_mode (char*& cap)
void FOptiAttr::set_enter_protected_mode (char cap[])
{
if ( cap )
{
@ -236,7 +236,7 @@ void FOptiAttr::set_enter_protected_mode (char*& cap)
}
//----------------------------------------------------------------------
void FOptiAttr::set_exit_protected_mode (char*& cap)
void FOptiAttr::set_exit_protected_mode (char cap[])
{
if ( cap )
{
@ -246,7 +246,7 @@ void FOptiAttr::set_exit_protected_mode (char*& cap)
}
//----------------------------------------------------------------------
void FOptiAttr::set_enter_crossed_out_mode (char*& cap)
void FOptiAttr::set_enter_crossed_out_mode (char cap[])
{
if ( cap )
{
@ -256,7 +256,7 @@ void FOptiAttr::set_enter_crossed_out_mode (char*& cap)
}
//----------------------------------------------------------------------
void FOptiAttr::set_exit_crossed_out_mode (char*& cap)
void FOptiAttr::set_exit_crossed_out_mode (char cap[])
{
if ( cap )
{
@ -266,7 +266,7 @@ void FOptiAttr::set_exit_crossed_out_mode (char*& cap)
}
//----------------------------------------------------------------------
void FOptiAttr::set_enter_dbl_underline_mode (char*& cap)
void FOptiAttr::set_enter_dbl_underline_mode (char cap[])
{
if ( cap )
{
@ -276,7 +276,7 @@ void FOptiAttr::set_enter_dbl_underline_mode (char*& cap)
}
//----------------------------------------------------------------------
void FOptiAttr::set_exit_dbl_underline_mode (char*& cap)
void FOptiAttr::set_exit_dbl_underline_mode (char cap[])
{
if ( cap )
{
@ -286,7 +286,7 @@ void FOptiAttr::set_exit_dbl_underline_mode (char*& cap)
}
//----------------------------------------------------------------------
void FOptiAttr::set_enter_standout_mode (char*& cap)
void FOptiAttr::set_enter_standout_mode (char cap[])
{
if ( cap )
{
@ -296,7 +296,7 @@ void FOptiAttr::set_enter_standout_mode (char*& cap)
}
//----------------------------------------------------------------------
void FOptiAttr::set_exit_standout_mode (char*& cap)
void FOptiAttr::set_exit_standout_mode (char cap[])
{
if ( cap )
{
@ -306,7 +306,7 @@ void FOptiAttr::set_exit_standout_mode (char*& cap)
}
//----------------------------------------------------------------------
void FOptiAttr::set_set_attributes (char*& cap)
void FOptiAttr::set_set_attributes (char cap[])
{
if ( cap )
{
@ -316,7 +316,7 @@ void FOptiAttr::set_set_attributes (char*& cap)
}
//----------------------------------------------------------------------
void FOptiAttr::set_exit_attribute_mode (char*& cap)
void FOptiAttr::set_exit_attribute_mode (char cap[])
{
if ( cap )
{
@ -326,7 +326,7 @@ void FOptiAttr::set_exit_attribute_mode (char*& cap)
}
//----------------------------------------------------------------------
void FOptiAttr::set_enter_alt_charset_mode (char*& cap)
void FOptiAttr::set_enter_alt_charset_mode (char cap[])
{
if ( cap )
{
@ -336,7 +336,7 @@ void FOptiAttr::set_enter_alt_charset_mode (char*& cap)
}
//----------------------------------------------------------------------
void FOptiAttr::set_exit_alt_charset_mode (char*& cap)
void FOptiAttr::set_exit_alt_charset_mode (char cap[])
{
if ( cap )
{
@ -346,7 +346,7 @@ void FOptiAttr::set_exit_alt_charset_mode (char*& cap)
}
//----------------------------------------------------------------------
void FOptiAttr::set_enter_pc_charset_mode (char*& cap)
void FOptiAttr::set_enter_pc_charset_mode (char cap[])
{
if ( cap )
{
@ -356,7 +356,7 @@ void FOptiAttr::set_enter_pc_charset_mode (char*& cap)
}
//----------------------------------------------------------------------
void FOptiAttr::set_exit_pc_charset_mode (char*& cap)
void FOptiAttr::set_exit_pc_charset_mode (char cap[])
{
if ( cap )
{
@ -366,7 +366,7 @@ void FOptiAttr::set_exit_pc_charset_mode (char*& cap)
}
//----------------------------------------------------------------------
void FOptiAttr::set_a_foreground_color (char*& cap)
void FOptiAttr::set_a_foreground_color (char cap[])
{
if ( cap )
{
@ -376,7 +376,7 @@ void FOptiAttr::set_a_foreground_color (char*& cap)
}
//----------------------------------------------------------------------
void FOptiAttr::set_a_background_color (char*& cap)
void FOptiAttr::set_a_background_color (char cap[])
{
if ( cap )
{
@ -386,7 +386,7 @@ void FOptiAttr::set_a_background_color (char*& cap)
}
//----------------------------------------------------------------------
void FOptiAttr::set_foreground_color (char*& cap)
void FOptiAttr::set_foreground_color (char cap[])
{
if ( cap )
{
@ -396,7 +396,7 @@ void FOptiAttr::set_foreground_color (char*& cap)
}
//----------------------------------------------------------------------
void FOptiAttr::set_background_color (char*& cap)
void FOptiAttr::set_background_color (char cap[])
{
if ( cap )
{
@ -406,7 +406,7 @@ void FOptiAttr::set_background_color (char*& cap)
}
//----------------------------------------------------------------------
void FOptiAttr::set_term_color_pair (char*& cap)
void FOptiAttr::set_term_color_pair (char cap[])
{
if ( cap )
{
@ -416,7 +416,7 @@ void FOptiAttr::set_term_color_pair (char*& cap)
}
//----------------------------------------------------------------------
void FOptiAttr::set_orig_pair (char*& cap)
void FOptiAttr::set_orig_pair (char cap[])
{
if ( cap )
{
@ -426,7 +426,7 @@ void FOptiAttr::set_orig_pair (char*& cap)
}
//----------------------------------------------------------------------
void FOptiAttr::set_orig_orig_colors (char*& cap)
void FOptiAttr::set_orig_orig_colors (char cap[])
{
if ( cap )
{
@ -1407,7 +1407,7 @@ inline void FOptiAttr::reset (char_data*& attr)
}
//----------------------------------------------------------------------
bool FOptiAttr::caused_reset_attributes (char*& cap, uChar test)
bool FOptiAttr::caused_reset_attributes (char cap[], uChar test)
{
// test if "cap" reset all attributes
char* ue = F_exit_underline_mode.cap;
@ -1492,7 +1492,7 @@ inline bool FOptiAttr::switchOff()
}
//----------------------------------------------------------------------
inline bool FOptiAttr::append_sequence (char*& seq)
inline bool FOptiAttr::append_sequence (char seq[])
{
if ( seq )
{
@ -1504,7 +1504,7 @@ inline bool FOptiAttr::append_sequence (char*& seq)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::replace_sequence (char*& seq)
inline bool FOptiAttr::replace_sequence (char seq[])
{
if ( seq )
{

View File

@ -97,7 +97,7 @@ void FOptiMove::setTermSize (int w, int h)
}
//----------------------------------------------------------------------
int FOptiMove::set_cursor_home (char*& cap)
int FOptiMove::set_cursor_home (char cap[])
{
if ( cap )
{
@ -116,7 +116,7 @@ int FOptiMove::set_cursor_home (char*& cap)
}
//----------------------------------------------------------------------
int FOptiMove::set_cursor_to_ll (char*& cap)
int FOptiMove::set_cursor_to_ll (char cap[])
{
if ( cap )
{
@ -135,7 +135,7 @@ int FOptiMove::set_cursor_to_ll (char*& cap)
}
//----------------------------------------------------------------------
int FOptiMove::set_carriage_return (char*& cap)
int FOptiMove::set_carriage_return (char cap[])
{
if ( cap )
{
@ -154,7 +154,7 @@ int FOptiMove::set_carriage_return (char*& cap)
}
//----------------------------------------------------------------------
int FOptiMove::set_tabular (char*& cap)
int FOptiMove::set_tabular (char cap[])
{
if ( cap )
{
@ -173,7 +173,7 @@ int FOptiMove::set_tabular (char*& cap)
}
//----------------------------------------------------------------------
int FOptiMove::set_back_tab (char*& cap)
int FOptiMove::set_back_tab (char cap[])
{
if ( cap )
{
@ -192,7 +192,7 @@ int FOptiMove::set_back_tab (char*& cap)
}
//----------------------------------------------------------------------
int FOptiMove::set_cursor_up (char*& cap)
int FOptiMove::set_cursor_up (char cap[])
{
if ( cap )
{
@ -211,7 +211,7 @@ int FOptiMove::set_cursor_up (char*& cap)
}
//----------------------------------------------------------------------
int FOptiMove::set_cursor_down (char*& cap)
int FOptiMove::set_cursor_down (char cap[])
{
if ( cap )
{
@ -230,7 +230,7 @@ int FOptiMove::set_cursor_down (char*& cap)
}
//----------------------------------------------------------------------
int FOptiMove::set_cursor_left (char*& cap)
int FOptiMove::set_cursor_left (char cap[])
{
if ( cap )
{
@ -249,7 +249,7 @@ int FOptiMove::set_cursor_left (char*& cap)
}
//----------------------------------------------------------------------
int FOptiMove::set_cursor_right (char*& cap)
int FOptiMove::set_cursor_right (char cap[])
{
if ( cap )
{
@ -268,7 +268,7 @@ int FOptiMove::set_cursor_right (char*& cap)
}
//----------------------------------------------------------------------
int FOptiMove::set_cursor_address (char*& cap)
int FOptiMove::set_cursor_address (char cap[])
{
if ( cap )
{
@ -288,7 +288,7 @@ int FOptiMove::set_cursor_address (char*& cap)
}
//----------------------------------------------------------------------
int FOptiMove::set_column_address (char*& cap)
int FOptiMove::set_column_address (char cap[])
{
if ( cap )
{
@ -308,7 +308,7 @@ int FOptiMove::set_column_address (char*& cap)
}
//----------------------------------------------------------------------
int FOptiMove::set_row_address (char*& cap)
int FOptiMove::set_row_address (char cap[])
{
if ( cap )
{
@ -328,7 +328,7 @@ int FOptiMove::set_row_address (char*& cap)
}
//----------------------------------------------------------------------
int FOptiMove::set_parm_up_cursor (char*& cap)
int FOptiMove::set_parm_up_cursor (char cap[])
{
if ( cap )
{
@ -348,7 +348,7 @@ int FOptiMove::set_parm_up_cursor (char*& cap)
}
//----------------------------------------------------------------------
int FOptiMove::set_parm_down_cursor (char*& cap)
int FOptiMove::set_parm_down_cursor (char cap[])
{
if ( cap )
{
@ -368,7 +368,7 @@ int FOptiMove::set_parm_down_cursor (char*& cap)
}
//----------------------------------------------------------------------
int FOptiMove::set_parm_left_cursor (char*& cap)
int FOptiMove::set_parm_left_cursor (char cap[])
{
if ( cap )
{
@ -388,7 +388,7 @@ int FOptiMove::set_parm_left_cursor (char*& cap)
}
//----------------------------------------------------------------------
int FOptiMove::set_parm_right_cursor (char*& cap)
int FOptiMove::set_parm_right_cursor (char cap[])
{
if ( cap )
{
@ -408,7 +408,7 @@ int FOptiMove::set_parm_right_cursor (char*& cap)
}
//----------------------------------------------------------------------
int FOptiMove::set_erase_chars (char*& cap)
int FOptiMove::set_erase_chars (char cap[])
{
if ( cap )
{
@ -428,7 +428,7 @@ int FOptiMove::set_erase_chars (char*& cap)
}
//----------------------------------------------------------------------
int FOptiMove::set_repeat_char (char*& cap)
int FOptiMove::set_repeat_char (char cap[])
{
if ( cap )
{
@ -448,7 +448,7 @@ int FOptiMove::set_repeat_char (char*& cap)
}
//----------------------------------------------------------------------
int FOptiMove::set_clr_bol (char*& cap)
int FOptiMove::set_clr_bol (char cap[])
{
if ( cap )
{
@ -467,7 +467,7 @@ int FOptiMove::set_clr_bol (char*& cap)
}
//----------------------------------------------------------------------
int FOptiMove::set_clr_eol (char*& cap)
int FOptiMove::set_clr_eol (char cap[])
{
if ( cap )
{
@ -591,7 +591,7 @@ void FOptiMove::calculateCharDuration()
}
//----------------------------------------------------------------------
int FOptiMove::capDuration (char*& cap, int affcnt)
int FOptiMove::capDuration (char cap[], int affcnt)
{
// calculate the duration in milliseconds of a given operation
// cap - the term capability
@ -671,7 +671,7 @@ int FOptiMove::repeatedAppend (const capability& o, int count, char* dst)
}
//----------------------------------------------------------------------
int FOptiMove::relativeMove ( char*& move
int FOptiMove::relativeMove ( char move[]
, int from_x, int from_y
, int to_x, int to_y )
{

View File

@ -2937,7 +2937,7 @@ char* FTerm::init_256colorTerminal()
}
//----------------------------------------------------------------------
char* FTerm::determineMaxColor (char*& current_termtype)
char* FTerm::determineMaxColor (char current_termtype[])
{
// Determine xterm maximum number of colors via OSC 4
@ -2971,7 +2971,7 @@ char* FTerm::determineMaxColor (char*& current_termtype)
}
//----------------------------------------------------------------------
char* FTerm::parseAnswerbackMsg (char*& current_termtype)
char* FTerm::parseAnswerbackMsg (char current_termtype[])
{
char* new_termtype = current_termtype;
@ -3013,7 +3013,7 @@ char* FTerm::parseAnswerbackMsg (char*& current_termtype)
}
//----------------------------------------------------------------------
char* FTerm::parseSecDA (char*& current_termtype)
char* FTerm::parseSecDA (char current_termtype[])
{
char* new_termtype = current_termtype;
@ -4497,7 +4497,7 @@ void FTerm::init()
if ( init_values.color_change )
redefineColorPalette();
// set 200 Hz beep (100 ms)
// Set 200 Hz beep (100 ms)
setBeep(200, 100);
// Set FTerm signal handler

View File

@ -2405,9 +2405,9 @@ bool FVTerm::canClearLeadingWS (uInt& xmin, uInt y)
}
//----------------------------------------------------------------------
bool FVTerm::canClearTailingWS (uInt& xmax, uInt y)
bool FVTerm::canClearTrailingWS (uInt& xmax, uInt y)
{
// Line has tailing whitespace
// Line has trailing whitespace
// => clear from xmax to end of line
term_area*& vt = vterm;
@ -2416,7 +2416,7 @@ bool FVTerm::canClearTailingWS (uInt& xmax, uInt y)
if ( ce && last_char->code == ' ' )
{
uInt tailing_whitespace = 1;
uInt trailing_whitespace = 1;
bool normal = isNormal(last_char);
bool& ut = FTermcap::background_color_erase;
@ -2425,16 +2425,16 @@ bool FVTerm::canClearTailingWS (uInt& xmax, uInt y)
char_data* ch = &vt->text[y * uInt(vt->width) + x];
if ( *last_char == *ch )
tailing_whitespace++;
trailing_whitespace++;
else
break;
}
if ( tailing_whitespace > uInt(vt->width) - xmax
if ( trailing_whitespace > uInt(vt->width) - xmax
&& (ut || normal)
&& clr_bol_length < int(tailing_whitespace) )
&& clr_bol_length < int(trailing_whitespace) )
{
xmax = uInt(vt->width) - tailing_whitespace;
xmax = uInt(vt->width) - trailing_whitespace;
return true;
}
}
@ -2478,7 +2478,7 @@ bool FVTerm::skipUnchangedCharacters(uInt& x, uInt xmax, uInt y)
//----------------------------------------------------------------------
void FVTerm::printRange ( uInt xmin, uInt xmax, uInt y
, bool draw_tailing_ws )
, bool draw_trailing_ws )
{
for (uInt x = xmin; x <= xmax; x++)
{
@ -2497,7 +2497,7 @@ void FVTerm::printRange ( uInt xmin, uInt xmax, uInt y
if ( ec && print_char->code == ' ' )
{
exit_state erase_state = \
eraseCharacters(x, xmax, y, draw_tailing_ws);
eraseCharacters(x, xmax, y, draw_trailing_ws);
if ( erase_state == line_completely_printed )
break;
@ -2516,7 +2516,7 @@ void FVTerm::printRange ( uInt xmin, uInt xmax, uInt y
}
//----------------------------------------------------------------------
FVTerm::exit_state FVTerm::eraseCharacters ( uInt& x, uInt xmax, uInt y
, bool draw_tailing_ws )
, bool draw_trailing_ws )
{
// Erase a number of characters to draw simple whitespaces
@ -2556,7 +2556,7 @@ FVTerm::exit_state FVTerm::eraseCharacters ( uInt& x, uInt xmax, uInt y
appendAttributes (print_char);
appendOutputBuffer (tparm(ec, whitespace, 0, 0, 0, 0, 0, 0, 0, 0));
if ( x + whitespace - 1 < xmax || draw_tailing_ws )
if ( x + whitespace - 1 < xmax || draw_trailing_ws )
setTermXY (int(x + whitespace), int(y));
else
return line_completely_printed;
@ -2675,7 +2675,7 @@ void FVTerm::updateTerminalLine (uInt y)
if ( xmin <= xmax )
{
bool draw_leading_ws = false;
bool draw_tailing_ws = false;
bool draw_trailing_ws = false;
char*& ce = TCAP(fc::t_clr_eol);
char_data* first_char = &vt->text[y * uInt(vt->width)];
char_data* last_char = &vt->text[(y + 1) * uInt(vt->width) - 1];
@ -2689,8 +2689,8 @@ void FVTerm::updateTerminalLine (uInt y)
// leading whitespace
draw_leading_ws = canClearLeadingWS (xmin, y);
// tailing whitespace
draw_tailing_ws = canClearTailingWS (xmax, y);
// trailing whitespace
draw_trailing_ws = canClearTrailingWS (xmax, y);
}
setTermXY (int(xmin), int(y));
@ -2711,9 +2711,9 @@ void FVTerm::updateTerminalLine (uInt y)
markAsPrinted (0, xmin, y);
}
printRange (xmin, xmax, y, draw_tailing_ws);
printRange (xmin, xmax, y, draw_trailing_ws);
if ( draw_tailing_ws )
if ( draw_trailing_ws )
{
appendAttributes (last_char);
appendOutputBuffer (ce);
@ -2973,7 +2973,7 @@ inline void FVTerm::appendOutputBuffer (const std::string& s)
}
//----------------------------------------------------------------------
inline void FVTerm::appendOutputBuffer (const char*& s)
inline void FVTerm::appendOutputBuffer (const char s[])
{
#if defined(__sun) && defined(__SVR4)
tputs (C_STR(s), 1, appendOutputBuffer);
@ -2993,8 +2993,7 @@ int FVTerm::appendOutputBuffer (char ch)
return ch;
}
#endif
#else
//----------------------------------------------------------------------
int FVTerm::appendOutputBuffer (int ch)
{
@ -3005,3 +3004,4 @@ int FVTerm::appendOutputBuffer (int ch)
return ch;
}
#endif