Compiles now with newer gcc

This commit is contained in:
Markus Gans 2018-09-02 03:57:57 +02:00
parent 627ee0f094
commit 9f0ed5bb26
11 changed files with 107 additions and 100 deletions

View File

@ -94,8 +94,8 @@ Menu::Menu (FWidget* parent)
defaultCallback (Menubar);
// Statusbar at the bottom
FStatusBar* statusbar = new FStatusBar (this);
statusbar->setMessage("Status bar message");
FStatusBar* Statusbar = new FStatusBar (this);
Statusbar->setMessage("Status bar message");
// Headline labels
FLabel* Headline1 = new FLabel(" Key ", this);

View File

@ -481,11 +481,11 @@ void MouseDraw::drawCanvas()
for (int y = 0; y < y_end; y++) // line loop
{
charData* cc; // canvas character
charData* wc; // window character
cc = &canvas->text[y * x_end];
wc = &print_area->text[(ay + y) * w_line_len + ax];
std::memcpy (wc, cc, sizeof(charData) * unsigned(x_end));
charData* canvaschar; // canvas character
charData* winchar; // window character
canvaschar = &canvas->text[y * x_end];
winchar = &print_area->text[(ay + y) * w_line_len + ax];
std::memcpy (winchar, canvaschar, sizeof(charData) * unsigned(x_end));
if ( short(print_area->changes[ay + y].xmin) > ax )
print_area->changes[ay + y].xmin = uInt(ax);

View File

@ -3,7 +3,7 @@
* *
* This file is part of the Final Cut widget toolkit *
* *
* Copyright 2016-2017 Markus Gans *
* Copyright 2016-2018 Markus Gans *
* *
* The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License *
@ -212,8 +212,8 @@ MainWindow::MainWindow (FWidget* parent)
ibg->unsetTransparentShadow();
// Statusbar at the bottom
FStatusBar* statusbar = new FStatusBar (this);
statusbar->setMessage("Press Q to quit");
FStatusBar* status_bar = new FStatusBar (this);
status_bar->setMessage("Press Q to quit");
addAccelerator('q');
unsetTransparentShadow();

View File

@ -555,12 +555,12 @@ void MyDialog::initHelpMenuCallback()
void MyDialog::initStatusBar()
{
// Statusbar at the bottom
FStatusBar* statusbar = new FStatusBar (this);
FStatusBar* Statusbar = new FStatusBar (this);
// Statusbar keys
key_F1 = new FStatusKey (fc::Fkey_f1, "About", statusbar);
key_F2 = new FStatusKey (fc::Fkey_f2, "View", statusbar);
key_F3 = new FStatusKey (fc::Fkey_f3, "Quit", statusbar);
key_F1 = new FStatusKey (fc::Fkey_f1, "About", Statusbar);
key_F2 = new FStatusKey (fc::Fkey_f2, "View", Statusbar);
key_F3 = new FStatusKey (fc::Fkey_f3, "Quit", Statusbar);
}
//----------------------------------------------------------------------

View File

@ -229,7 +229,7 @@ Window::Window (FWidget* parent)
FDialogListMenu* DglList;
FString drop_down_symbol;
FMenuBar* Menubar;
FStatusBar* statusbar;
FStatusBar* Statusbar;
// Menu bar
Menubar = new FMenuBar (this);
@ -250,8 +250,8 @@ Window::Window (FWidget* parent)
createDialogButtons();
// Statusbar at the bottom
statusbar = new FStatusBar (this);
statusbar->setMessage("Status bar message");
Statusbar = new FStatusBar (this);
Statusbar->setMessage("Status bar message");
// Generate data vector for the windows
for (int n = 1; n <= 6; n++)

View File

@ -44,6 +44,9 @@
class FColorPalette
{
public:
// Destructor
virtual ~FColorPalette() = 0;
// Typedefs
typedef void (*funcp)(short, int, int, int);

View File

@ -869,12 +869,12 @@ void FApplication::unselectMenubarItems()
if ( open_menu || (mouse && mouse->isMoved()) )
return;
FMenuBar* menubar = getMenuBar();
FMenuBar* menu_bar = getMenuBar();
if ( ! menubar )
if ( ! menu_bar )
return;
if ( ! menubar->hasSelectedItem() )
if ( ! menu_bar->hasSelectedItem() )
return;
if ( ! mouse )

View File

@ -143,18 +143,18 @@ void FMenu::hide()
//----------------------------------------------------------------------
void FMenu::onKeyPress (FKeyEvent* ev)
{
FWidget* menubar;
FWidget* menu_bar;
// looking for menu hotkey
if ( hotkeyMenu(ev) )
return;
// looking for menu bar hotkey
menubar = getMenuBar();
menu_bar = getMenuBar();
if ( menubar )
if ( menu_bar )
{
FMenuBar* mbar = static_cast<FMenuBar*>(menubar);
FMenuBar* mbar = static_cast<FMenuBar*>(menu_bar);
if ( mbar->hotkeyMenu(ev) )
return;
@ -1004,16 +1004,16 @@ void FMenu::passEventToMenuBar (FMouseEvent*& ev)
{
// Mouse event handover to the menu bar
FWidget* menubar = getMenuBar();
FWidget* menu_bar = getMenuBar();
const FPoint& t = ev->getTermPos();
const FPoint& p = menubar->termToWidgetPos(t);
const FPoint& p = menu_bar->termToWidgetPos(t);
int b = ev->getButton();
try
{
FMouseEvent* _ev = new FMouseEvent (fc::MouseMove_Event, p, t, b);
setClickedWidget(menubar);
FMenuBar* mbar = static_cast<FMenuBar*>(menubar);
setClickedWidget(menu_bar);
FMenuBar* mbar = static_cast<FMenuBar*>(menu_bar);
mbar->mouse_down = true;
mbar->onMouseMove(_ev);
delete _ev;

View File

@ -519,22 +519,22 @@ void FMouseX11::processEvent (struct timeval* time)
const FPoint& mouse_position = getPos();
uChar x, y;
int button;
int btn;
x = uChar(x11_mouse[1] - 0x20);
y = uChar(x11_mouse[2] - 0x20);
button = x11_mouse[0];
btn = x11_mouse[0];
new_mouse_position.setPoint (x, y);
// Fill bit field with 0
std::memset(&b_state, 0x00, sizeof(b_state));
setKeyState (button);
setMoveState (mouse_position, button);
setButtonState (button & button_mask, time);
setKeyState (btn);
setMoveState (mouse_position, btn);
setButtonState (btn & button_mask, time);
if ( new_mouse_position == mouse_position
&& ! isWheelUp()
&& ! isWheelDown()
&& uChar(button) == x11_button_state )
&& uChar(btn) == x11_button_state )
{
mouse_event_occurred = false;
x11_mouse[0] = '\0'; // Delete already interpreted data
@ -544,7 +544,7 @@ void FMouseX11::processEvent (struct timeval* time)
mouse_event_occurred = true;
setPos (FPoint(x, y));
// Get the button state from string
x11_button_state = uChar(button);
x11_button_state = uChar(btn);
// Delete already interpreted data
x11_mouse[0] = '\0';
}
@ -552,23 +552,23 @@ void FMouseX11::processEvent (struct timeval* time)
// private methods of FMouseX11
//----------------------------------------------------------------------
void FMouseX11::setKeyState (int button)
void FMouseX11::setKeyState (int btn)
{
if ( (button & key_shift) == key_shift )
if ( (btn & key_shift) == key_shift )
b_state.shift_button = Pressed;
if ( (button & key_meta) == key_meta )
if ( (btn & key_meta) == key_meta )
b_state.meta_button = Pressed;
if ( (button & key_ctrl) == key_ctrl )
if ( (btn & key_ctrl) == key_ctrl )
b_state.control_button = Pressed;
}
//----------------------------------------------------------------------
void FMouseX11::setMoveState (const FPoint& mouse_position, int button)
void FMouseX11::setMoveState (const FPoint& mouse_position, int btn)
{
if ( (button & button_mask) >= button1_pressed_move
&& (button & button_mask) <= button3_pressed_move
if ( (btn & button_mask) >= button1_pressed_move
&& (btn & button_mask) <= button3_pressed_move
&& mouse_position != zero_point )
{
b_state.mouse_moved = true;
@ -576,13 +576,13 @@ void FMouseX11::setMoveState (const FPoint& mouse_position, int button)
}
//----------------------------------------------------------------------
void FMouseX11::setButtonState (int button, struct timeval* time)
void FMouseX11::setButtonState (int btn, struct timeval* time)
{
// Get the x11 mouse button state
const FPoint& mouse_position = getPos();
switch ( button )
switch ( btn )
{
case button1_pressed:
case button1_pressed_move:
@ -723,12 +723,12 @@ void FMouseSGR::processEvent (struct timeval* time)
{
const FPoint& mouse_position = getPos();
register char* p;
int button;
int btn;
short x, y;
x = 0;
y = 0;
button = 0;
btn = 0;
// parse the SGR mouse string
p = sgr_mouse;
@ -742,7 +742,7 @@ void FMouseSGR::processEvent (struct timeval* time)
return;
}
button = 10 * button + (*p - '0');
btn = 10 * btn + (*p - '0');
p++;
}
@ -773,18 +773,18 @@ void FMouseSGR::processEvent (struct timeval* time)
new_mouse_position.setPoint (x, y);
// Fill bit field with 0
std::memset(&b_state, 0x00, sizeof(b_state));
setKeyState (button);
setMoveState (mouse_position, button);
setKeyState (btn);
setMoveState (mouse_position, btn);
if ( *p == pressed )
setPressedButtonState (button & button_mask, time);
setPressedButtonState (btn & button_mask, time);
else // *p == released
setReleasedButtonState (button & button_mask);
setReleasedButtonState (btn & button_mask);
if ( mouse_position == new_mouse_position
&& ! isWheelUp()
&& ! isWheelDown()
&& sgr_button_state == uChar(((*p & 0x20) << 2) + button) )
&& sgr_button_state == uChar(((*p & 0x20) << 2) + btn) )
{
mouse_event_occurred = false;
sgr_mouse[0] = '\0'; // Delete already interpreted data
@ -794,30 +794,30 @@ void FMouseSGR::processEvent (struct timeval* time)
mouse_event_occurred = true;
setPos (FPoint(x, y));
// Get the button state from string
sgr_button_state = uChar(((*p & 0x20) << 2) + button);
sgr_button_state = uChar(((*p & 0x20) << 2) + btn);
// Delete already interpreted data
sgr_mouse[0] = '\0';
}
// private methods of FMouseSGR
//----------------------------------------------------------------------
void FMouseSGR::setKeyState (int button)
void FMouseSGR::setKeyState (int btn)
{
if ( (button & key_shift) == key_shift )
if ( (btn & key_shift) == key_shift )
b_state.shift_button = true;
if ( (button & key_meta) == key_meta )
if ( (btn & key_meta) == key_meta )
b_state.meta_button = true;
if ( (button & key_ctrl) == key_ctrl )
if ( (btn & key_ctrl) == key_ctrl )
b_state.control_button = true;
}
//----------------------------------------------------------------------
void FMouseSGR::setMoveState (const FPoint& mouse_position, int button)
void FMouseSGR::setMoveState (const FPoint& mouse_position, int btn)
{
if ( (button & button_mask) >= button1_move
&& (button & button_mask) <= button3_move
if ( (btn & button_mask) >= button1_move
&& (btn & button_mask) <= button3_move
&& mouse_position != zero_point )
{
b_state.mouse_moved = true;
@ -825,13 +825,13 @@ void FMouseSGR::setMoveState (const FPoint& mouse_position, int button)
}
//----------------------------------------------------------------------
void FMouseSGR::setPressedButtonState (int button, struct timeval* time)
void FMouseSGR::setPressedButtonState (int btn, struct timeval* time)
{
// Gets the extended x11 mouse mode (SGR) status for pressed buttons
const FPoint& mouse_position = getPos();
switch ( button )
switch ( btn )
{
case button1:
case button1_move:
@ -882,11 +882,11 @@ void FMouseSGR::setPressedButtonState (int button, struct timeval* time)
}
//----------------------------------------------------------------------
void FMouseSGR::setReleasedButtonState (int button)
void FMouseSGR::setReleasedButtonState (int btn)
{
// Gets the extended x11 mouse mode (SGR) status for released buttons
switch ( button )
switch ( btn )
{
case button1:
case button1_move:
@ -980,12 +980,12 @@ void FMouseUrxvt::processEvent (struct timeval* time)
register char* p;
register bool x_neg;
register bool y_neg;
int button;
int btn;
short x, y;
x = 0;
y = 0;
button = 0;
btn = 0;
// Parse the Urxvt mouse string
p = urxvt_mouse;
@ -1001,7 +1001,7 @@ void FMouseUrxvt::processEvent (struct timeval* time)
return;
}
button = 10 * button + (*p - '0');
btn = 10 * btn + (*p - '0');
p++;
}
@ -1058,14 +1058,14 @@ void FMouseUrxvt::processEvent (struct timeval* time)
new_mouse_position.setPoint (x, y);
// Fill bit field with 0
std::memset(&b_state, 0x00, sizeof(b_state));
setKeyState (button);
setMoveState (mouse_position, button);
setButtonState (button & button_mask, time);
setKeyState (btn);
setMoveState (mouse_position, btn);
setButtonState (btn & button_mask, time);
if ( mouse_position == new_mouse_position
&& ! isWheelUp()
&& ! isWheelDown()
&& urxvt_button_state == uChar(button) )
&& urxvt_button_state == uChar(btn) )
{
mouse_event_occurred = false;
urxvt_mouse[0] = '\0'; // Delete already interpreted data
@ -1074,7 +1074,7 @@ void FMouseUrxvt::processEvent (struct timeval* time)
mouse_event_occurred = true;
setPos (FPoint(x, y));
urxvt_button_state = uChar(button);
urxvt_button_state = uChar(btn);
// Delete already interpreted data
urxvt_mouse[0] = '\0';
}
@ -1082,23 +1082,23 @@ void FMouseUrxvt::processEvent (struct timeval* time)
// private methods of FMouseUrxvt
//----------------------------------------------------------------------
void FMouseUrxvt::setKeyState (int button)
void FMouseUrxvt::setKeyState (int btn)
{
if ( (button & key_shift) == key_shift )
if ( (btn & key_shift) == key_shift )
b_state.shift_button = Pressed;
if ( (button & key_meta) == key_meta )
if ( (btn & key_meta) == key_meta )
b_state.meta_button = Pressed;
if ( (button & key_ctrl) == key_ctrl )
if ( (btn & key_ctrl) == key_ctrl )
b_state.control_button = Pressed;
}
//----------------------------------------------------------------------
void FMouseUrxvt::setMoveState (const FPoint& mouse_position, int button)
void FMouseUrxvt::setMoveState (const FPoint& mouse_position, int btn)
{
if ( (button & button_mask) >= button1_pressed_move
&& (button & button_mask) <= button3_pressed_move
if ( (btn & button_mask) >= button1_pressed_move
&& (btn & button_mask) <= button3_pressed_move
&& mouse_position != zero_point )
{
b_state.mouse_moved = true;
@ -1106,13 +1106,13 @@ void FMouseUrxvt::setMoveState (const FPoint& mouse_position, int button)
}
//----------------------------------------------------------------------
void FMouseUrxvt::setButtonState (int button, struct timeval* time)
void FMouseUrxvt::setButtonState (int btn, struct timeval* time)
{
// Get the urxvt mouse button state
const FPoint& mouse_position = getPos();
switch ( button )
switch ( btn )
{
case button1_pressed:
case button1_pressed_move:

View File

@ -332,9 +332,12 @@ char* FTermDetection::init_256colorTerminal()
#if DEBUG
if ( new_termtype )
{
std::strncpy ( termtype_256color
, new_termtype
, std::strlen(new_termtype) + 1 );
, sizeof(termtype_256color) );
termtype_256color[sizeof(termtype_256color) - 1] = '\0';
}
#endif
return new_termtype;
@ -472,7 +475,7 @@ const FString FTermDetection::getXTermColorName (int color)
int stdin_no = FTermios::getStdIn();
char temp[512] = { };
FTerm::putstringf (OSC "4;%d;?" BEL, color); // get color
std::fprintf (stdout, OSC "4;%d;?" BEL, color); // get color
std::fflush(stdout);
FD_ZERO(&ifds);
@ -534,9 +537,12 @@ char* FTermDetection::parseAnswerbackMsg (char current_termtype[])
#if DEBUG
if ( new_termtype )
{
std::strncpy ( termtype_Answerback
, new_termtype
, std::strlen(new_termtype) + 1 );
, sizeof(termtype_Answerback) );
termtype_Answerback[sizeof(termtype_Answerback) - 1] = '\0';
}
#endif
return new_termtype;
@ -648,9 +654,10 @@ char* FTermDetection::parseSecDA (char current_termtype[])
#if DEBUG
if ( new_termtype )
std::strncpy ( termtype_SecDA
, new_termtype
, std::strlen(new_termtype) + 1 );
{
std::strncpy (termtype_SecDA, new_termtype, sizeof(termtype_SecDA));
termtype_SecDA[sizeof(termtype_SecDA) - 1] = '\0';
}
#endif
return new_termtype;
@ -664,16 +671,13 @@ const FString FTermDetection::getSecDA()
int a = 0
, b = 0
, c = 0
, stdin_no = FTermios::getStdIn();
, stdin_no = FTermios::getStdIn()
, stdout_no = FTermios::getStdOut();
fd_set ifds;
struct timeval tv;
// Get the secondary device attributes
#if defined(__CYGWIN__)
puts (SECDA);
#else
FTerm::putstring (SECDA);
#endif
write(stdout_no, SECDA, std::strlen(SECDA));
std::fflush(stdout);
FD_ZERO(&ifds);

View File

@ -2114,15 +2114,15 @@ void FVTerm::init()
}
//----------------------------------------------------------------------
void FVTerm::init_characterLengths (FOptiMove* opti_move)
void FVTerm::init_characterLengths (FOptiMove* optimove)
{
if ( opti_move )
if ( optimove )
{
cursor_address_length = opti_move->getCursorAddressLength();
erase_char_length = opti_move->getEraseCharsLength();
repeat_char_length = opti_move->getRepeatCharLength();
clr_bol_length = opti_move->getClrBolLength();
clr_eol_length = opti_move->getClrEolLength();
cursor_address_length = optimove->getCursorAddressLength();
erase_char_length = optimove->getEraseCharsLength();
repeat_char_length = optimove->getRepeatCharLength();
clr_bol_length = optimove->getClrBolLength();
clr_eol_length = optimove->getClrEolLength();
}
else
{