2017-11-04 07:03:53 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* fdialog.cpp - Widget FDialog *
|
|
|
|
* *
|
|
|
|
* This file is part of the Final Cut widget toolkit *
|
|
|
|
* *
|
2018-01-21 16:25:19 +01:00
|
|
|
* Copyright 2012-2018 Markus Gans *
|
2017-11-04 07:03:53 +01:00
|
|
|
* *
|
|
|
|
* The Final Cut is free software; you can redistribute it and/or *
|
|
|
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
|
|
* as published by the Free Software Foundation; either version 3 of *
|
|
|
|
* the License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* The Final Cut is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU Lesser General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU Lesser General Public *
|
|
|
|
* License along with this program. If not, see *
|
|
|
|
* <http://www.gnu.org/licenses/>. *
|
|
|
|
***********************************************************************/
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2017-09-17 21:32:46 +02:00
|
|
|
#include "final/fapplication.h"
|
|
|
|
#include "final/fdialog.h"
|
|
|
|
#include "final/fstatusbar.h"
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2018-09-20 23:59:01 +02:00
|
|
|
namespace finalcut
|
|
|
|
{
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FDialog
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
// constructor and destructor
|
|
|
|
//----------------------------------------------------------------------
|
2016-10-01 23:18:49 +02:00
|
|
|
FDialog::FDialog (FWidget* parent)
|
2015-09-22 04:18:20 +02:00
|
|
|
: FWindow(parent)
|
|
|
|
, tb_text()
|
|
|
|
, result_code(FDialog::Reject)
|
2016-09-11 16:48:39 +02:00
|
|
|
, zoom_button_pressed(false)
|
|
|
|
, zoom_button_active(false)
|
2017-12-27 01:38:28 +01:00
|
|
|
, setPos_error(false)
|
|
|
|
, setSize_error(false)
|
2016-09-27 00:46:05 +02:00
|
|
|
, titlebar_click_pos()
|
2016-09-29 04:29:12 +02:00
|
|
|
, resize_click_pos()
|
2016-09-30 04:55:28 +02:00
|
|
|
, save_geometry()
|
2016-06-12 23:06:58 +02:00
|
|
|
, dialog_menu()
|
|
|
|
, dgl_menuitem()
|
2016-09-30 04:55:28 +02:00
|
|
|
, move_size_item()
|
2016-09-11 16:48:39 +02:00
|
|
|
, zoom_item()
|
|
|
|
, close_item()
|
2016-10-01 23:18:49 +02:00
|
|
|
, tooltip()
|
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
|
|
|
FDialog::FDialog (const FString& txt, FWidget* parent)
|
|
|
|
: FWindow(parent)
|
|
|
|
, tb_text(txt)
|
|
|
|
, result_code(FDialog::Reject)
|
2016-09-11 16:48:39 +02:00
|
|
|
, zoom_button_pressed(false)
|
|
|
|
, zoom_button_active(false)
|
2017-12-27 01:38:28 +01:00
|
|
|
, setPos_error(false)
|
|
|
|
, setSize_error(false)
|
2016-09-27 00:46:05 +02:00
|
|
|
, titlebar_click_pos()
|
2016-09-29 04:29:12 +02:00
|
|
|
, resize_click_pos()
|
2016-09-30 04:55:28 +02:00
|
|
|
, save_geometry()
|
2016-06-12 23:06:58 +02:00
|
|
|
, dialog_menu()
|
|
|
|
, dgl_menuitem()
|
2016-09-30 04:55:28 +02:00
|
|
|
, move_size_item()
|
2016-09-11 16:48:39 +02:00
|
|
|
, zoom_item()
|
|
|
|
, close_item()
|
2016-10-01 23:18:49 +02:00
|
|
|
, tooltip(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
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
FDialog::~FDialog() // destructor
|
|
|
|
{
|
2016-07-28 01:04:27 +02:00
|
|
|
FApplication* fapp = static_cast<FApplication*>(getRootWidget());
|
|
|
|
bool is_quit = fapp->isQuit();
|
2016-07-10 00:23:39 +02:00
|
|
|
delete dialog_menu;
|
|
|
|
dgl_menuitem = 0;
|
2015-05-23 13:35:12 +02:00
|
|
|
delete accelerator_list;
|
|
|
|
accelerator_list = 0;
|
2016-07-28 01:04:27 +02:00
|
|
|
|
|
|
|
if ( ! is_quit )
|
|
|
|
switchToPrevWindow();
|
|
|
|
|
2016-07-14 23:55:22 +02:00
|
|
|
delDialog(this);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
if ( isModal() )
|
|
|
|
unsetModal();
|
|
|
|
}
|
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
|
|
|
|
// public methods of FDialog
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
bool FDialog::setDialogWidget (bool on)
|
|
|
|
{
|
|
|
|
if ( isDialogWidget() == on )
|
|
|
|
return true;
|
2016-07-09 00:01:59 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
if ( on )
|
2015-07-12 21:49:30 +02:00
|
|
|
{
|
2016-11-02 00:37:58 +01:00
|
|
|
flags |= fc::dialog_widget;
|
|
|
|
setTermOffsetWithPadding();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
flags &= ~fc::dialog_widget;
|
|
|
|
setParentOffset();
|
2015-07-12 21:49:30 +02:00
|
|
|
}
|
2016-06-12 23:06:58 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
return on;
|
|
|
|
}
|
2016-07-09 00:01:59 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
bool FDialog::setModal (bool on)
|
|
|
|
{
|
|
|
|
if ( isModal() == on )
|
|
|
|
return true;
|
|
|
|
|
|
|
|
if ( on )
|
2016-06-12 23:06:58 +02:00
|
|
|
{
|
2016-11-02 00:37:58 +01:00
|
|
|
flags |= fc::modal;
|
|
|
|
modal_dialogs++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
flags &= ~fc::modal;
|
|
|
|
modal_dialogs--;
|
2016-06-12 23:06:58 +02:00
|
|
|
}
|
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
return on;
|
|
|
|
}
|
2016-09-30 04:55:28 +02:00
|
|
|
|
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
bool FDialog::setScrollable (bool on)
|
|
|
|
{
|
|
|
|
if ( on )
|
|
|
|
flags |= fc::scrollable;
|
|
|
|
else
|
|
|
|
flags &= ~fc::scrollable;
|
2016-09-11 16:48:39 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
return on;
|
|
|
|
}
|
2016-09-11 16:48:39 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
bool FDialog::setResizeable (bool on)
|
|
|
|
{
|
|
|
|
FWindow::setResizeable (on);
|
2016-06-12 23:06:58 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
if ( on )
|
|
|
|
zoom_item->setEnable();
|
|
|
|
else
|
|
|
|
zoom_item->setDisable();
|
|
|
|
|
|
|
|
return on;
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2016-11-02 00:37:58 +01:00
|
|
|
void FDialog::show()
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2016-11-02 00:37:58 +01:00
|
|
|
if ( ! isVisible() )
|
|
|
|
return;
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
FWindow::show();
|
2016-09-11 16:48:39 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
if ( isModal() )
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2016-11-02 00:37:58 +01:00
|
|
|
FApplication* fapp = static_cast<FApplication*>(getRootWidget());
|
|
|
|
fapp->enter_loop();
|
2016-07-09 00:01:59 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
if ( this == getMainWidget() )
|
|
|
|
fapp->quit();
|
|
|
|
}
|
|
|
|
}
|
2016-09-11 16:48:39 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FDialog::hide()
|
|
|
|
{
|
|
|
|
FWindow::hide();
|
2016-07-09 00:01:59 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
if ( isModal() )
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2016-11-02 00:37:58 +01:00
|
|
|
FApplication* fapp = static_cast<FApplication*>(getRootWidget());
|
|
|
|
fapp->exit_loop();
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2016-11-02 00:37:58 +01:00
|
|
|
int FDialog::exec()
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2016-11-02 00:37:58 +01:00
|
|
|
result_code = FDialog::Reject;
|
|
|
|
show();
|
|
|
|
return result_code;
|
|
|
|
}
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FDialog::setPos (int x, int y, bool)
|
|
|
|
{
|
2017-10-02 07:32:33 +02:00
|
|
|
int rsw, bsh, width, height;
|
2016-11-02 00:37:58 +01:00
|
|
|
FRect old_geometry;
|
2017-12-27 01:38:28 +01:00
|
|
|
setPos_error = false;
|
2016-09-11 16:48:39 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
if ( getX() == x && getY() == y )
|
2017-12-27 01:38:28 +01:00
|
|
|
{
|
|
|
|
setPos_error = true;
|
2016-11-02 00:37:58 +01:00
|
|
|
return;
|
2017-12-27 01:38:28 +01:00
|
|
|
}
|
2016-07-09 00:01:59 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
width = getWidth();
|
|
|
|
height = getHeight();
|
2015-10-11 04:09:58 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
// Avoid to move widget completely outside the terminal
|
2017-08-27 09:50:30 +02:00
|
|
|
if ( x + width <= 1 || x > getMaxWidth() || y < 1 || y > getMaxHeight() )
|
2017-12-27 01:38:28 +01:00
|
|
|
{
|
|
|
|
setPos_error = true;
|
2016-11-02 00:37:58 +01:00
|
|
|
return;
|
2017-12-27 01:38:28 +01:00
|
|
|
}
|
2015-10-23 23:57:00 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
if ( isZoomed() )
|
2017-12-27 01:38:28 +01:00
|
|
|
{
|
|
|
|
setPos_error = true;
|
2016-11-02 00:37:58 +01:00
|
|
|
return;
|
2017-12-27 01:38:28 +01:00
|
|
|
}
|
2016-11-02 00:37:58 +01:00
|
|
|
|
2017-10-02 07:32:33 +02:00
|
|
|
int dx = getX() - x
|
|
|
|
, dy = getY() - y
|
|
|
|
, old_x = getTermX()
|
|
|
|
, old_y = getTermY();
|
2016-11-02 00:37:58 +01:00
|
|
|
const FPoint& shadow = getShadow();
|
|
|
|
rsw = shadow.getX(); // right shadow width;
|
|
|
|
bsh = shadow.getY(); // bottom shadow height
|
|
|
|
old_geometry = getTermGeometryWithShadow();
|
|
|
|
|
|
|
|
// move to the new position
|
|
|
|
FWindow::setPos(x, y, false);
|
|
|
|
putArea (getTermPos(), vwin);
|
|
|
|
|
|
|
|
// restoring the non-covered terminal areas
|
|
|
|
if ( getTermGeometry().overlap(old_geometry) )
|
2016-06-12 23:06:58 +02:00
|
|
|
{
|
2016-11-02 00:37:58 +01:00
|
|
|
// dx > 0 : move left
|
|
|
|
// dx = 0 : move vertical
|
|
|
|
// dx < 0 : move right
|
|
|
|
// dy > 0 : move up
|
|
|
|
// dy = 0 : move horizontal
|
|
|
|
// dy < 0 : move down
|
2016-07-09 00:01:59 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
if ( dx > 0 )
|
|
|
|
{
|
|
|
|
if ( dy > 0 )
|
2017-08-27 09:50:30 +02:00
|
|
|
restoreVTerm ( old_x + width + rsw - dx, old_y
|
|
|
|
, dx, getHeight() + bsh - dy );
|
2016-11-02 00:37:58 +01:00
|
|
|
else
|
2017-08-27 09:50:30 +02:00
|
|
|
restoreVTerm ( old_x + width + rsw - dx, old_y + std::abs(dy)
|
|
|
|
, dx, height + bsh - std::abs(dy));
|
2016-11-02 00:37:58 +01:00
|
|
|
}
|
2016-06-12 23:06:58 +02:00
|
|
|
else
|
2016-11-02 00:37:58 +01:00
|
|
|
{
|
|
|
|
if ( dy > 0 )
|
2017-08-27 09:50:30 +02:00
|
|
|
restoreVTerm (old_x, old_y, std::abs(dx), height + bsh - dy);
|
2016-11-02 00:37:58 +01:00
|
|
|
else
|
2017-08-27 09:50:30 +02:00
|
|
|
restoreVTerm ( old_x, old_y + std::abs(dy)
|
|
|
|
, std::abs(dx), height + bsh - std::abs(dy) );
|
2016-11-02 00:37:58 +01:00
|
|
|
}
|
2016-07-09 00:01:59 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
if ( dy > 0 )
|
2017-08-27 09:50:30 +02:00
|
|
|
restoreVTerm (old_x, old_y + height + bsh - dy, width + rsw, dy);
|
2016-11-02 00:37:58 +01:00
|
|
|
else
|
2017-08-27 09:50:30 +02:00
|
|
|
restoreVTerm (old_x, old_y, width + rsw, std::abs(dy));
|
2016-06-12 23:06:58 +02:00
|
|
|
}
|
2015-05-23 13:35:12 +02:00
|
|
|
else
|
2016-06-12 23:06:58 +02:00
|
|
|
{
|
2016-11-02 00:37:58 +01:00
|
|
|
restoreVTerm (old_geometry);
|
|
|
|
}
|
2016-07-09 00:01:59 +02:00
|
|
|
|
2018-01-31 00:17:00 +01:00
|
|
|
restoreOverlaidWindows();
|
2016-11-02 00:37:58 +01:00
|
|
|
FWindow::adjustSize();
|
2018-01-31 00:17:00 +01:00
|
|
|
setCursorToFocusWidget();
|
2016-11-02 00:37:58 +01:00
|
|
|
updateTerminal();
|
|
|
|
}
|
2016-09-11 16:48:39 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
//----------------------------------------------------------------------
|
2017-12-27 01:51:28 +01:00
|
|
|
void FDialog::move (int dx, int dy)
|
2016-11-02 00:37:58 +01:00
|
|
|
{
|
|
|
|
setPos (getX() + dx, getY() + dy);
|
|
|
|
}
|
2016-09-11 16:48:39 +02:00
|
|
|
|
2017-12-27 01:38:28 +01:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FDialog::moveUp (int n)
|
|
|
|
{
|
|
|
|
move (0, -n);
|
|
|
|
return ! setPos_error;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FDialog::moveDown (int n)
|
|
|
|
{
|
|
|
|
move (0, n);
|
|
|
|
return ! setPos_error;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FDialog::moveLeft (int n)
|
|
|
|
{
|
|
|
|
move (-n, 0);
|
|
|
|
return ! setPos_error;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FDialog::moveRight (int n)
|
|
|
|
{
|
|
|
|
move (n, 0);
|
|
|
|
return ! setPos_error;
|
|
|
|
}
|
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FDialog::setSize (int w, int h, bool adjust)
|
|
|
|
{
|
2017-12-27 01:38:28 +01:00
|
|
|
setSize_error = false;
|
2016-09-11 16:48:39 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
if ( getWidth() == w && getHeight() == h )
|
2017-12-27 01:38:28 +01:00
|
|
|
{
|
|
|
|
setSize_error = true;
|
2016-11-02 00:37:58 +01:00
|
|
|
return;
|
2017-12-27 01:38:28 +01:00
|
|
|
}
|
2016-09-11 16:48:39 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
if ( isZoomed() )
|
2017-12-27 01:38:28 +01:00
|
|
|
{
|
|
|
|
setSize_error = true;
|
2016-11-02 00:37:58 +01:00
|
|
|
return;
|
2017-12-27 01:38:28 +01:00
|
|
|
}
|
2016-09-11 16:48:39 +02:00
|
|
|
|
2017-10-02 07:32:33 +02:00
|
|
|
int x = getTermX()
|
|
|
|
, y = getTermY()
|
|
|
|
, old_width = getWidth()
|
|
|
|
, old_height = getHeight()
|
|
|
|
, dw = old_width - w
|
|
|
|
, dh = old_height - h;
|
2016-11-02 00:37:58 +01:00
|
|
|
const FPoint& shadow = getShadow();
|
2017-10-02 07:32:33 +02:00
|
|
|
int rsw = shadow.getX(); // right shadow width;
|
|
|
|
int bsh = shadow.getY(); // bottom shadow height
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
FWindow::setSize (w, h, adjust);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
// get adjust width and height
|
|
|
|
w = getWidth();
|
|
|
|
h = getHeight();
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
// dw > 0 : scale down width
|
|
|
|
// dw = 0 : scale only height
|
|
|
|
// dw < 0 : scale up width
|
|
|
|
// dh > 0 : scale down height
|
|
|
|
// dh = 0 : scale only width
|
|
|
|
// dh < 0 : scale up height
|
2016-08-21 21:27:44 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
// restoring the non-covered terminal areas
|
|
|
|
if ( dw > 0 )
|
2017-08-27 09:50:30 +02:00
|
|
|
restoreVTerm (x + w + rsw, y, dw, h + bsh + dh); // restore right
|
2016-11-02 00:37:58 +01:00
|
|
|
|
|
|
|
if ( dh > 0 )
|
2017-08-27 09:50:30 +02:00
|
|
|
restoreVTerm (x, y + h + bsh, w + rsw + dw, dh); // restore bottom
|
2016-08-21 21:27:44 +02:00
|
|
|
|
2016-06-13 22:44:15 +02:00
|
|
|
redraw();
|
2016-07-09 00:01:59 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
// handle overlaid windows
|
|
|
|
if ( window_list && ! window_list->empty() )
|
|
|
|
{
|
|
|
|
bool overlaid = false;
|
2017-09-17 01:50:41 +02:00
|
|
|
widgetList::const_iterator iter, last;
|
2016-11-02 00:37:58 +01:00
|
|
|
iter = window_list->begin();
|
2017-09-17 01:50:41 +02:00
|
|
|
last = window_list->end();
|
2016-07-09 00:01:59 +02:00
|
|
|
|
2017-09-17 01:50:41 +02:00
|
|
|
while ( iter != last )
|
2016-11-02 00:37:58 +01:00
|
|
|
{
|
|
|
|
if ( overlaid )
|
|
|
|
putArea ((*iter)->getTermPos(), (*iter)->getVWin());
|
2016-06-13 22:44:15 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
if ( vwin == (*iter)->getVWin() )
|
|
|
|
overlaid = true;
|
2016-09-25 23:53:48 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
++iter;
|
|
|
|
}
|
2016-09-25 23:53:48 +02:00
|
|
|
}
|
2016-11-02 00:37:58 +01:00
|
|
|
|
|
|
|
// set the cursor to the focus widget
|
|
|
|
FWidget* focus_widget = FWidget::getFocusWidget();
|
2016-12-18 23:34:11 +01:00
|
|
|
if ( focus_widget
|
2017-11-26 22:37:18 +01:00
|
|
|
&& focus_widget->isVisible()
|
|
|
|
&& focus_widget->hasVisibleCursor() )
|
2016-09-25 23:53:48 +02:00
|
|
|
{
|
2016-11-02 00:37:58 +01:00
|
|
|
FPoint cursor_pos = focus_widget->getCursorPos();
|
|
|
|
focus_widget->setCursorPos(cursor_pos);
|
2016-09-25 23:53:48 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-27 01:38:28 +01:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
bool FDialog::reduceHeight (int n)
|
|
|
|
{
|
|
|
|
if ( ! isResizeable() )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
setSize (getWidth(), getHeight() - n);
|
|
|
|
return ! setSize_error;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
bool FDialog::expandHeight (int n)
|
|
|
|
{
|
|
|
|
if ( ! isResizeable() || getHeight() + getY() > getMaxHeight() )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
setSize (getWidth(), getHeight() + n);
|
|
|
|
return ! setSize_error;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
bool FDialog::reduceWidth (int n)
|
|
|
|
{
|
|
|
|
if ( ! isResizeable() )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
setSize (getWidth() - n, getHeight());
|
|
|
|
return ! setSize_error;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
bool FDialog::expandWidth (int n)
|
|
|
|
{
|
|
|
|
if ( ! isResizeable() || getWidth() + getX() > getMaxWidth() )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
setSize (getWidth() + n, getHeight());
|
|
|
|
return ! setSize_error;
|
|
|
|
}
|
|
|
|
|
2016-09-25 23:53:48 +02:00
|
|
|
//----------------------------------------------------------------------
|
2016-11-02 00:37:58 +01:00
|
|
|
void FDialog::activateDialog()
|
2016-09-25 23:53:48 +02:00
|
|
|
{
|
2017-12-29 02:10:05 +01:00
|
|
|
if ( isWindowActive() )
|
|
|
|
return;
|
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
FWidget* old_focus = FWidget::getFocusWidget();
|
|
|
|
FWidget* win_focus = getWindowFocusWidget();
|
|
|
|
setActiveWindow(this);
|
|
|
|
setFocus();
|
|
|
|
setFocusWidget(this);
|
2016-09-25 23:53:48 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
if ( win_focus && numOfFocusableChildren() > 1 )
|
|
|
|
{
|
|
|
|
win_focus->setFocus();
|
|
|
|
win_focus->redraw();
|
2016-09-25 23:53:48 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
if ( old_focus )
|
|
|
|
old_focus->redraw();
|
|
|
|
}
|
|
|
|
else if ( old_focus )
|
|
|
|
{
|
|
|
|
if ( ! focusFirstChild() )
|
|
|
|
old_focus->unsetFocus();
|
|
|
|
|
|
|
|
if ( ! old_focus->isWindowWidget() )
|
|
|
|
old_focus->redraw();
|
|
|
|
}
|
2016-09-25 23:53:48 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
if ( getStatusBar() )
|
|
|
|
getStatusBar()->drawMessage();
|
2016-09-25 23:53:48 +02:00
|
|
|
|
|
|
|
updateTerminal();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2016-11-02 00:37:58 +01:00
|
|
|
void FDialog::onKeyPress (FKeyEvent* ev)
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2016-09-25 23:53:48 +02:00
|
|
|
if ( ! isEnabled() )
|
|
|
|
return;
|
|
|
|
|
2017-12-29 02:10:05 +01:00
|
|
|
cancelMouseResize();
|
2016-09-29 04:29:12 +02:00
|
|
|
|
2017-11-26 22:37:18 +01:00
|
|
|
if ( ev->key() == fc::Fckey_caret // Ctrl+^ (Ctrl+6)
|
|
|
|
|| ev->key() == fc::Fkey_f22 ) // Shift+F10
|
2016-09-25 23:53:48 +02:00
|
|
|
{
|
|
|
|
ev->accept();
|
|
|
|
// open the titlebar menu
|
|
|
|
openMenu();
|
|
|
|
// focus to the first enabled item
|
|
|
|
selectFirstMenuItem();
|
|
|
|
}
|
|
|
|
|
2017-12-29 02:10:05 +01:00
|
|
|
// Dialog move and resize functions
|
2016-10-01 23:18:49 +02:00
|
|
|
if ( getMoveSizeWidget() )
|
2017-12-27 01:38:28 +01:00
|
|
|
moveSizeKey(ev);
|
2016-09-30 04:55:28 +02:00
|
|
|
|
2016-09-25 23:53:48 +02:00
|
|
|
if ( this == getMainWidget() )
|
2015-05-23 13:35:12 +02:00
|
|
|
return;
|
|
|
|
|
2016-12-18 23:34:11 +01:00
|
|
|
if ( ev->key() == fc::Fkey_escape
|
2017-11-26 22:37:18 +01:00
|
|
|
|| ev->key() == fc::Fkey_escape_mintty )
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2015-09-20 05:44:50 +02:00
|
|
|
ev->accept();
|
2016-07-09 00:01:59 +02:00
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
if ( isModal() )
|
|
|
|
done (FDialog::Reject);
|
|
|
|
else
|
|
|
|
close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2015-09-20 05:44:50 +02:00
|
|
|
void FDialog::onMouseDown (FMouseEvent* ev)
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2017-12-29 02:10:05 +01:00
|
|
|
mouseStates ms =
|
2016-09-11 16:48:39 +02:00
|
|
|
{
|
2017-12-29 02:10:05 +01:00
|
|
|
ev->getX(),
|
|
|
|
ev->getY(),
|
|
|
|
ev->getTermPos(),
|
|
|
|
getZoomButtonWidth(),
|
|
|
|
false // mouse_over_menu
|
|
|
|
};
|
|
|
|
|
|
|
|
deactivateZoomButton();
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2016-01-17 02:57:08 +01:00
|
|
|
if ( ev->getButton() == fc::LeftButton )
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2017-12-29 02:10:05 +01:00
|
|
|
// Click on titlebar or window: raise + activate
|
|
|
|
raiseActivateDialog();
|
2016-07-09 00:01:59 +02:00
|
|
|
|
2017-12-29 02:10:05 +01:00
|
|
|
if ( ms.mouse_x >= 4
|
|
|
|
&& ms.mouse_x <= getWidth() - ms.zoom_btn
|
|
|
|
&& ms.mouse_y == 1 )
|
2016-09-27 00:46:05 +02:00
|
|
|
titlebar_click_pos.setPoint (ev->getTermX(), ev->getTermY());
|
2015-05-23 13:35:12 +02:00
|
|
|
else
|
2016-09-27 00:46:05 +02:00
|
|
|
titlebar_click_pos.setPoint (0,0);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2017-12-29 02:10:05 +01:00
|
|
|
// Click on titlebar menu button
|
|
|
|
if ( ms.mouse_x < 4 && ms.mouse_y == 1 )
|
2016-09-25 23:53:48 +02:00
|
|
|
openMenu();
|
2016-09-29 04:29:12 +02:00
|
|
|
else
|
2017-12-29 02:10:05 +01:00
|
|
|
activateZoomButton(ms);
|
|
|
|
|
|
|
|
// Click on the lower right resize corner
|
|
|
|
resizeMouseDown(ms);
|
2016-06-12 23:06:58 +02:00
|
|
|
}
|
|
|
|
else // ev->getButton() != fc::LeftButton
|
|
|
|
{
|
2017-12-29 02:10:05 +01:00
|
|
|
// Click on titlebar menu button
|
|
|
|
if ( ms.mouse_x < 4 && ms.mouse_y == 1
|
|
|
|
&& dialog_menu->isVisible() )
|
2016-06-13 22:44:15 +02:00
|
|
|
leaveMenu(); // close menu
|
2016-09-29 04:29:12 +02:00
|
|
|
|
2017-12-29 02:10:05 +01:00
|
|
|
cancelMouseResize(); // Cancel resize
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
|
|
|
|
2017-12-29 02:10:05 +01:00
|
|
|
// Click on titlebar: just activate
|
|
|
|
if ( ev->getButton() == fc::RightButton
|
|
|
|
&& ms.mouse_x >= 4
|
|
|
|
&& ms.mouse_x <= getWidth()
|
|
|
|
&& ms.mouse_y == 1 )
|
|
|
|
activateDialog();
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2017-12-29 02:10:05 +01:00
|
|
|
// Click on titlebar: lower + activate
|
|
|
|
if ( ev->getButton() == fc::MiddleButton
|
|
|
|
&& ms.mouse_x >= 4 && ms.mouse_x <= getWidth()
|
|
|
|
&& ms.mouse_y == 1 )
|
|
|
|
lowerActivateDialog();
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2015-09-20 05:44:50 +02:00
|
|
|
void FDialog::onMouseUp (FMouseEvent* ev)
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2017-12-29 02:10:05 +01:00
|
|
|
mouseStates ms =
|
|
|
|
{
|
|
|
|
ev->getX(),
|
|
|
|
ev->getY(),
|
|
|
|
ev->getTermPos(),
|
|
|
|
getZoomButtonWidth(),
|
|
|
|
false // mouse_over_menu
|
|
|
|
};
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2016-01-17 02:57:08 +01:00
|
|
|
if ( ev->getButton() == fc::LeftButton )
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2017-12-29 02:10:05 +01:00
|
|
|
int titlebar_x = titlebar_click_pos.getX()
|
2017-10-02 07:32:33 +02:00
|
|
|
, titlebar_y = titlebar_click_pos.getY();
|
2016-06-12 23:06:58 +02:00
|
|
|
|
2016-12-18 23:34:11 +01:00
|
|
|
if ( ! titlebar_click_pos.isNull()
|
2017-11-26 22:37:18 +01:00
|
|
|
&& titlebar_x > getTermX() + 3
|
|
|
|
&& titlebar_x < getTermX() + getWidth()
|
|
|
|
&& titlebar_y == getTermY() )
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2017-12-29 02:10:05 +01:00
|
|
|
FPoint deltaPos = ms.termPos - titlebar_click_pos;
|
2016-10-14 13:02:35 +02:00
|
|
|
move (deltaPos);
|
2017-12-29 02:10:05 +01:00
|
|
|
titlebar_click_pos = ms.termPos;
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
2016-06-12 23:06:58 +02:00
|
|
|
|
2017-12-29 02:10:05 +01:00
|
|
|
// Click on titlebar menu button
|
|
|
|
if ( ms.mouse_x < 4
|
|
|
|
&& ms.mouse_y == 1
|
2017-11-26 22:37:18 +01:00
|
|
|
&& dialog_menu->isVisible()
|
|
|
|
&& ! dialog_menu->hasSelectedItem() )
|
2016-06-12 23:06:58 +02:00
|
|
|
{
|
2016-09-25 23:53:48 +02:00
|
|
|
// Sets focus to the first item
|
|
|
|
selectFirstMenuItem();
|
2016-06-12 23:06:58 +02:00
|
|
|
}
|
2017-12-29 02:10:05 +01:00
|
|
|
else
|
2016-09-11 16:48:39 +02:00
|
|
|
{
|
2017-12-29 02:10:05 +01:00
|
|
|
// Zoom to maximum or restore the window size
|
|
|
|
pressZoomButton(ms);
|
2016-09-11 16:48:39 +02:00
|
|
|
}
|
2016-09-29 04:29:12 +02:00
|
|
|
|
2017-12-29 02:10:05 +01:00
|
|
|
// Resize the dialog
|
|
|
|
resizeMouseUpMove (ms, true);
|
2016-09-11 16:48:39 +02:00
|
|
|
}
|
|
|
|
|
2017-12-29 02:10:05 +01:00
|
|
|
deactivateZoomButton();
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2015-09-20 05:44:50 +02:00
|
|
|
void FDialog::onMouseMove (FMouseEvent* ev)
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2017-12-29 02:10:05 +01:00
|
|
|
mouseStates ms =
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2017-12-29 02:10:05 +01:00
|
|
|
ev->getX(),
|
|
|
|
ev->getY(),
|
|
|
|
ev->getTermPos(),
|
|
|
|
getZoomButtonWidth(),
|
|
|
|
isMouseOverMenu(ev->getTermPos())
|
|
|
|
};
|
2016-09-29 04:29:12 +02:00
|
|
|
|
2017-12-29 02:10:05 +01:00
|
|
|
if ( ev->getButton() != fc::LeftButton )
|
|
|
|
return;
|
2016-09-29 04:29:12 +02:00
|
|
|
|
2017-12-29 02:10:05 +01:00
|
|
|
if ( ! titlebar_click_pos.isNull() )
|
|
|
|
{
|
|
|
|
FPoint deltaPos = ms.termPos - titlebar_click_pos;
|
|
|
|
move (deltaPos);
|
|
|
|
titlebar_click_pos = ms.termPos;
|
|
|
|
}
|
2016-09-29 04:29:12 +02:00
|
|
|
|
2017-12-29 02:10:05 +01:00
|
|
|
// Mouse event handover to the menu
|
|
|
|
if ( ms.mouse_over_menu )
|
|
|
|
passEventToSubMenu (ms, ev);
|
2016-09-29 04:29:12 +02:00
|
|
|
|
2017-12-29 02:10:05 +01:00
|
|
|
leaveZoomButton(ms); // Check zoom button pressed
|
|
|
|
resizeMouseUpMove(ms); // Resize the dialog
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2015-09-20 05:44:50 +02:00
|
|
|
void FDialog::onMouseDoubleClick (FMouseEvent* ev)
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2017-12-29 02:10:05 +01:00
|
|
|
mouseStates ms =
|
|
|
|
{
|
|
|
|
ev->getX(),
|
|
|
|
ev->getY(),
|
|
|
|
ev->getTermPos(),
|
|
|
|
getZoomButtonWidth(),
|
|
|
|
false // mouse_over_menu
|
|
|
|
};
|
|
|
|
int x, y;
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2016-01-17 02:57:08 +01:00
|
|
|
if ( ev->getButton() != fc::LeftButton )
|
2015-05-23 13:35:12 +02:00
|
|
|
return;
|
|
|
|
|
2016-09-25 23:53:48 +02:00
|
|
|
x = getTermX();
|
|
|
|
y = getTermY();
|
2015-05-23 13:35:12 +02:00
|
|
|
FRect title_button(x, y, 3, 1);
|
2017-12-29 02:10:05 +01:00
|
|
|
FPoint tPos = ms.termPos;
|
2016-07-09 00:01:59 +02:00
|
|
|
|
2016-09-25 23:53:48 +02:00
|
|
|
if ( title_button.contains(tPos) )
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2017-12-29 02:10:05 +01:00
|
|
|
// Double click on title button
|
2016-08-21 00:16:34 +02:00
|
|
|
FWidget* window_focus_widget;
|
2016-06-12 23:06:58 +02:00
|
|
|
dialog_menu->unselectItem();
|
|
|
|
dialog_menu->hide();
|
2016-07-10 00:23:39 +02:00
|
|
|
activateWindow();
|
|
|
|
raiseWindow();
|
2016-08-21 00:16:34 +02:00
|
|
|
window_focus_widget = getWindowFocusWidget();
|
|
|
|
|
|
|
|
if ( window_focus_widget )
|
|
|
|
window_focus_widget->setFocus();
|
2016-08-21 21:27:44 +02:00
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
setClickedWidget(0);
|
2016-06-12 23:06:58 +02:00
|
|
|
|
|
|
|
if ( isModal() )
|
2016-07-10 00:23:39 +02:00
|
|
|
done (FDialog::Reject);
|
2016-06-12 23:06:58 +02:00
|
|
|
else
|
|
|
|
close();
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
2016-09-30 04:55:28 +02:00
|
|
|
else if ( isResizeable()
|
2017-12-29 02:10:05 +01:00
|
|
|
&& ms.mouse_x >= 4
|
|
|
|
&& ms.mouse_x <= getWidth() - ms.zoom_btn
|
|
|
|
&& ms.mouse_y == 1 )
|
2016-09-25 23:53:48 +02:00
|
|
|
{
|
2017-12-29 02:10:05 +01:00
|
|
|
// Double click on titlebar
|
2016-09-25 23:53:48 +02:00
|
|
|
zoomWindow(); // window zoom/unzoom
|
|
|
|
setZoomItem();
|
|
|
|
}
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
|
|
|
|
2016-07-16 20:39:38 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FDialog::onAccel (FAccelEvent*)
|
|
|
|
{
|
2016-10-11 04:57:36 +02:00
|
|
|
if ( ! (isWindowHidden() || isWindowActive()) )
|
2016-07-16 20:39:38 +02:00
|
|
|
{
|
2016-07-25 23:50:57 +02:00
|
|
|
bool has_raised = raiseWindow();
|
|
|
|
activateDialog();
|
2016-07-16 20:39:38 +02:00
|
|
|
|
2016-07-25 23:50:57 +02:00
|
|
|
if ( has_raised )
|
|
|
|
redraw();
|
2016-07-16 20:39:38 +02:00
|
|
|
|
2016-07-25 23:50:57 +02:00
|
|
|
updateTerminal();
|
2016-07-16 20:39:38 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FDialog::onWindowActive (FEvent*)
|
|
|
|
{
|
|
|
|
if ( isVisible() && isShown() )
|
|
|
|
drawTitleBar();
|
|
|
|
|
2016-06-16 22:50:34 +02:00
|
|
|
if ( ! FWidget::getFocusWidget() )
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2016-08-25 01:54:10 +02:00
|
|
|
FWidget* win_focus = getWindowFocusWidget();
|
2016-08-21 21:27:44 +02:00
|
|
|
|
2016-08-25 01:54:10 +02:00
|
|
|
if ( win_focus
|
2017-11-26 22:37:18 +01:00
|
|
|
&& win_focus->isVisible()
|
|
|
|
&& win_focus->isShown() )
|
2016-06-16 22:50:34 +02:00
|
|
|
{
|
2016-08-25 01:54:10 +02:00
|
|
|
win_focus->setFocus();
|
|
|
|
win_focus->redraw();
|
2016-06-16 22:50:34 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
focusFirstChild();
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
2016-06-18 19:10:41 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
if ( getStatusBar() )
|
|
|
|
getStatusBar()->drawMessage();
|
2016-06-18 19:10:41 +02:00
|
|
|
|
|
|
|
updateTerminal();
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FDialog::onWindowInactive (FEvent*)
|
|
|
|
{
|
2016-08-20 22:27:23 +02:00
|
|
|
if ( dialog_menu && ! dialog_menu->isVisible() )
|
2016-10-13 02:16:51 +02:00
|
|
|
FWindow::previous_window = this;
|
2016-06-26 16:08:03 +02:00
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
if ( isVisible() && isEnabled() )
|
|
|
|
drawTitleBar();
|
2016-06-19 20:32:03 +02:00
|
|
|
|
|
|
|
if ( hasFocus() )
|
|
|
|
unsetFocus();
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FDialog::onWindowRaised (FEvent*)
|
|
|
|
{
|
2016-08-21 21:27:44 +02:00
|
|
|
if ( ! (isVisible() && isShown()) )
|
2015-09-15 23:07:24 +02:00
|
|
|
return;
|
|
|
|
|
2016-09-25 23:53:48 +02:00
|
|
|
putArea (getTermPos(), vwin);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2017-12-29 02:10:05 +01:00
|
|
|
// Handle always-on-top windows
|
2016-10-01 23:18:49 +02:00
|
|
|
if ( always_on_top_list && ! always_on_top_list->empty() )
|
|
|
|
{
|
2017-09-17 01:50:41 +02:00
|
|
|
widgetList::const_iterator iter, last;
|
2016-10-01 23:18:49 +02:00
|
|
|
iter = always_on_top_list->begin();
|
2017-09-17 01:50:41 +02:00
|
|
|
last = always_on_top_list->end();
|
2016-10-01 23:18:49 +02:00
|
|
|
|
2017-09-17 01:50:41 +02:00
|
|
|
while ( iter != last )
|
2016-10-01 23:18:49 +02:00
|
|
|
{
|
|
|
|
putArea ((*iter)->getTermPos(), (*iter)->getVWin());
|
|
|
|
++iter;
|
|
|
|
}
|
|
|
|
}
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FDialog::onWindowLowered (FEvent*)
|
|
|
|
{
|
2017-09-17 01:50:41 +02:00
|
|
|
widgetList::const_iterator iter, last;
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
if ( ! window_list )
|
|
|
|
return;
|
2016-07-09 00:01:59 +02:00
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
if ( window_list->empty() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
iter = window_list->begin();
|
2017-12-29 02:10:05 +01:00
|
|
|
last = window_list->end();
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2017-09-17 01:50:41 +02:00
|
|
|
while ( iter != last )
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2016-09-25 23:53:48 +02:00
|
|
|
putArea ((*iter)->getTermPos(), (*iter)->getVWin());
|
2015-05-23 13:35:12 +02:00
|
|
|
++iter;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
|
|
|
|
// protected methods of FDialog
|
2015-05-23 13:35:12 +02:00
|
|
|
//----------------------------------------------------------------------
|
2016-11-02 00:37:58 +01:00
|
|
|
void FDialog::done(int result)
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2016-11-02 00:37:58 +01:00
|
|
|
hide();
|
|
|
|
result_code = result;
|
|
|
|
}
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FDialog::draw()
|
|
|
|
{
|
|
|
|
if ( tooltip && ! getMoveSizeWidget() )
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2017-08-12 20:10:27 +02:00
|
|
|
delete tooltip;
|
2016-11-02 00:37:58 +01:00
|
|
|
tooltip = 0;
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
2016-11-02 00:37:58 +01:00
|
|
|
|
2017-12-29 02:10:05 +01:00
|
|
|
// Fill the background
|
2016-11-02 00:37:58 +01:00
|
|
|
setColor();
|
|
|
|
|
|
|
|
if ( isMonochron() )
|
|
|
|
setReverse(true);
|
|
|
|
|
2016-12-28 16:29:49 +01:00
|
|
|
clearArea();
|
2016-11-02 00:37:58 +01:00
|
|
|
drawBorder();
|
|
|
|
drawTitleBar();
|
|
|
|
setCursorPos(2, getHeight() - 1);
|
|
|
|
|
|
|
|
if ( (flags & fc::shadow) != 0 )
|
|
|
|
drawDialogShadow();
|
|
|
|
|
|
|
|
if ( isMonochron() )
|
|
|
|
setReverse(false);
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2016-11-02 00:37:58 +01:00
|
|
|
void FDialog::drawDialogShadow()
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2016-11-02 00:37:58 +01:00
|
|
|
if ( isMonochron() && (flags & fc::trans_shadow) == 0 )
|
|
|
|
return;
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
drawShadow();
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2016-11-02 00:37:58 +01:00
|
|
|
void FDialog::onShow (FShowEvent*)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FDialog::onHide (FHideEvent*)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FDialog::onClose (FCloseEvent* ev)
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2016-11-02 00:37:58 +01:00
|
|
|
ev->accept();
|
2015-05-23 13:35:12 +02:00
|
|
|
result_code = FDialog::Reject;
|
|
|
|
}
|
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
|
|
|
|
// private methods of FDialog
|
2015-05-23 13:35:12 +02:00
|
|
|
//----------------------------------------------------------------------
|
2016-11-02 00:37:58 +01:00
|
|
|
void FDialog::init()
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2016-11-02 00:37:58 +01:00
|
|
|
FWidget* old_focus;
|
|
|
|
setTopPadding(2);
|
|
|
|
setLeftPadding(1);
|
|
|
|
setBottomPadding(1);
|
|
|
|
setRightPadding(1);
|
|
|
|
ignorePadding();
|
|
|
|
setDialogWidget();
|
2017-12-29 02:10:05 +01:00
|
|
|
// Initialize geometry values
|
2016-11-02 00:37:58 +01:00
|
|
|
setGeometry (1, 1, 10, 10, false);
|
|
|
|
setMinimumSize (15, 4);
|
|
|
|
addDialog(this);
|
|
|
|
setActiveWindow(this);
|
|
|
|
setTransparentShadow();
|
|
|
|
setForegroundColor (wc.dialog_fg);
|
|
|
|
setBackgroundColor (wc.dialog_bg);
|
|
|
|
old_focus = FWidget::getFocusWidget();
|
|
|
|
|
|
|
|
if ( old_focus )
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2016-11-02 00:37:58 +01:00
|
|
|
setFocus();
|
|
|
|
old_focus->redraw();
|
|
|
|
}
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2017-08-12 22:55:29 +02:00
|
|
|
try
|
|
|
|
{
|
|
|
|
accelerator_list = new Accelerators();
|
|
|
|
}
|
|
|
|
catch (const std::bad_alloc& ex)
|
|
|
|
{
|
|
|
|
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
// Add the dialog menu
|
2018-01-21 16:21:41 +01:00
|
|
|
initDialogMenu();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FDialog::initDialogMenu()
|
|
|
|
{
|
|
|
|
// Create the dialog Menu (access via Shift-F10 or Ctrl-^)
|
|
|
|
|
2017-08-12 22:55:29 +02:00
|
|
|
try
|
|
|
|
{
|
|
|
|
dialog_menu = new FMenu ("-", this);
|
|
|
|
}
|
|
|
|
catch (const std::bad_alloc& ex)
|
|
|
|
{
|
|
|
|
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-08-27 09:50:30 +02:00
|
|
|
dialog_menu->setPos (getX(), getY() + 1);
|
2016-11-02 00:37:58 +01:00
|
|
|
dgl_menuitem = dialog_menu->getItem();
|
|
|
|
|
|
|
|
if ( dgl_menuitem )
|
|
|
|
{
|
|
|
|
dgl_menuitem->ignorePadding();
|
|
|
|
dgl_menuitem->unsetFocusable();
|
|
|
|
}
|
|
|
|
|
2018-02-18 22:45:49 +01:00
|
|
|
// Add the move/size menu item
|
|
|
|
initMoveSizeMenuItem (dialog_menu);
|
|
|
|
|
|
|
|
// Add the zoom menu item
|
|
|
|
initZoomMenuItem (dialog_menu);
|
|
|
|
|
|
|
|
// Add the close menu item
|
|
|
|
initCloseMenuItem (dialog_menu);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FDialog::initMoveSizeMenuItem (FMenu* menu)
|
|
|
|
{
|
2017-08-12 22:55:29 +02:00
|
|
|
try
|
|
|
|
{
|
2018-02-18 22:45:49 +01:00
|
|
|
move_size_item = new FMenuItem (menu);
|
2017-08-12 22:55:29 +02:00
|
|
|
}
|
|
|
|
catch (const std::bad_alloc& ex)
|
|
|
|
{
|
|
|
|
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
move_size_item->setText ("&Move/Size");
|
|
|
|
move_size_item->setStatusbarMessage ("Move or change the size of the window");
|
|
|
|
|
|
|
|
move_size_item->addCallback
|
|
|
|
(
|
|
|
|
"clicked",
|
2017-04-09 20:08:53 +02:00
|
|
|
F_METHOD_CALLBACK (this, &FDialog::cb_move)
|
2016-11-02 00:37:58 +01:00
|
|
|
);
|
2018-02-18 22:45:49 +01:00
|
|
|
}
|
2016-11-02 00:37:58 +01:00
|
|
|
|
2018-02-18 22:45:49 +01:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FDialog::initZoomMenuItem (FMenu* menu)
|
|
|
|
{
|
2017-08-12 22:55:29 +02:00
|
|
|
try
|
|
|
|
{
|
2018-02-18 22:45:49 +01:00
|
|
|
zoom_item = new FMenuItem (menu);
|
2017-08-12 22:55:29 +02:00
|
|
|
}
|
|
|
|
catch (const std::bad_alloc& ex)
|
|
|
|
{
|
|
|
|
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
setZoomItem();
|
|
|
|
zoom_item->setDisable();
|
|
|
|
|
|
|
|
zoom_item->addCallback
|
|
|
|
(
|
|
|
|
"clicked",
|
2017-04-09 20:08:53 +02:00
|
|
|
F_METHOD_CALLBACK (this, &FDialog::cb_zoom)
|
2016-11-02 00:37:58 +01:00
|
|
|
);
|
2018-02-18 22:45:49 +01:00
|
|
|
}
|
2016-11-02 00:37:58 +01:00
|
|
|
|
2018-02-18 22:45:49 +01:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FDialog::initCloseMenuItem (FMenu* menu)
|
|
|
|
{
|
2017-08-12 22:55:29 +02:00
|
|
|
try
|
|
|
|
{
|
2018-02-18 22:45:49 +01:00
|
|
|
close_item = new FMenuItem ("&Close", menu);
|
2017-08-12 22:55:29 +02:00
|
|
|
}
|
|
|
|
catch (const std::bad_alloc& ex)
|
|
|
|
{
|
|
|
|
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
close_item->setStatusbarMessage ("Close this window");
|
|
|
|
|
|
|
|
close_item->addCallback
|
|
|
|
(
|
|
|
|
"clicked",
|
2017-04-09 20:08:53 +02:00
|
|
|
F_METHOD_CALLBACK (this, &FDialog::cb_close)
|
2016-11-02 00:37:58 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FDialog::drawBorder()
|
|
|
|
{
|
2017-10-02 07:32:33 +02:00
|
|
|
int x1 = 1
|
|
|
|
, x2 = 1 + getWidth() - 1
|
|
|
|
, y1 = 2
|
|
|
|
, y2 = 1 + getHeight() - 1;
|
2016-11-02 00:37:58 +01:00
|
|
|
|
2017-10-06 12:19:39 +02:00
|
|
|
if ( (getMoveSizeWidget() == this || ! resize_click_pos.isNull() )
|
2017-11-26 22:37:18 +01:00
|
|
|
&& ! isZoomed() )
|
2016-11-02 00:37:58 +01:00
|
|
|
setColor (wc.dialog_resize_fg, getBackgroundColor());
|
|
|
|
else
|
|
|
|
setColor();
|
|
|
|
|
|
|
|
if ( isNewFont() )
|
|
|
|
{
|
2017-08-27 09:50:30 +02:00
|
|
|
for (int y = y1; y < y2; y++)
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2016-11-02 00:37:58 +01:00
|
|
|
setPrintPos (x1, y);
|
2017-12-29 02:10:05 +01:00
|
|
|
// Border left ⎸
|
2016-11-02 00:37:58 +01:00
|
|
|
print (fc::NF_border_line_left);
|
|
|
|
setPrintPos (x2, y);
|
2017-12-29 02:10:05 +01:00
|
|
|
// Border right⎹
|
2016-11-02 00:37:58 +01:00
|
|
|
print (fc::NF_rev_border_line_right);
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
2016-11-02 00:37:58 +01:00
|
|
|
|
|
|
|
setPrintPos (x1, y2);
|
2017-12-29 02:10:05 +01:00
|
|
|
// Lower left corner border ⎣
|
2016-11-02 00:37:58 +01:00
|
|
|
print (fc::NF_border_corner_lower_left);
|
|
|
|
|
2017-09-11 03:06:02 +02:00
|
|
|
for (int x = 1; x < getWidth() - 1; x++) // low line _
|
2016-11-02 00:37:58 +01:00
|
|
|
print (fc::NF_border_line_bottom);
|
|
|
|
|
|
|
|
setPrintPos (x2, y2);
|
2017-12-29 02:10:05 +01:00
|
|
|
// Lower right corner border ⎦
|
2016-11-02 00:37:58 +01:00
|
|
|
print (fc::NF_rev_border_corner_lower_right);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FWidget::drawBorder(x1, y1, x2, y2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FDialog::drawTitleBar()
|
|
|
|
{
|
2017-12-27 01:38:28 +01:00
|
|
|
// Draw the title button
|
|
|
|
drawBarButton();
|
|
|
|
// Print the text bar
|
|
|
|
drawTextBar();
|
|
|
|
// Draw the zoom/unzoom button
|
|
|
|
drawZoomButton();
|
2016-11-02 00:37:58 +01:00
|
|
|
|
2017-12-27 01:38:28 +01:00
|
|
|
if ( isMonochron() )
|
|
|
|
setReverse(false);
|
|
|
|
|
|
|
|
#if DEBUG
|
|
|
|
if ( PRINT_WIN_NUMBER )
|
|
|
|
{
|
|
|
|
// Print the number of window in stack
|
|
|
|
setPrintPos (getWidth() - 2, 1);
|
|
|
|
printf ("(%d)", getWindowLayer(this));
|
|
|
|
}
|
2018-09-20 23:59:01 +02:00
|
|
|
#endif // DEBUG
|
2017-12-27 01:38:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FDialog::drawBarButton()
|
|
|
|
{
|
|
|
|
// Print the title button
|
2016-11-02 00:37:58 +01:00
|
|
|
setPrintPos (1, 1);
|
|
|
|
|
|
|
|
if ( dialog_menu && dialog_menu->isVisible() )
|
|
|
|
setColor (wc.titlebar_button_focus_fg, wc.titlebar_button_focus_bg);
|
|
|
|
else
|
|
|
|
setColor (wc.titlebar_button_fg, wc.titlebar_button_bg);
|
|
|
|
|
|
|
|
if ( isMonochron() )
|
|
|
|
{
|
|
|
|
if ( isWindowActive() )
|
|
|
|
setReverse(false);
|
2015-05-23 13:35:12 +02:00
|
|
|
else
|
2016-11-02 00:37:58 +01:00
|
|
|
setReverse(true);
|
|
|
|
}
|
2016-09-29 04:29:12 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
if ( isNewFont() )
|
|
|
|
{
|
|
|
|
print (fc::NF_rev_menu_button1);
|
|
|
|
print (fc::NF_rev_menu_button2);
|
|
|
|
print (fc::NF_rev_menu_button3);
|
|
|
|
}
|
|
|
|
else if ( isMonochron() )
|
|
|
|
{
|
|
|
|
print ('[');
|
|
|
|
|
|
|
|
if ( dgl_menuitem )
|
|
|
|
print (dgl_menuitem->getText());
|
2015-05-23 13:35:12 +02:00
|
|
|
else
|
2016-11-02 00:37:58 +01:00
|
|
|
print ('-');
|
|
|
|
|
|
|
|
print (']');
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-11-02 00:37:58 +01:00
|
|
|
print (' ');
|
|
|
|
|
|
|
|
if ( dgl_menuitem )
|
|
|
|
print (dgl_menuitem->getText());
|
|
|
|
else
|
|
|
|
print ('-');
|
|
|
|
|
|
|
|
print (' ');
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
2017-12-27 01:38:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FDialog::drawZoomButton()
|
|
|
|
{
|
|
|
|
// Draw the zoom/unzoom button
|
|
|
|
|
|
|
|
if ( ! isResizeable() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
if ( zoom_button_pressed )
|
|
|
|
setColor (wc.titlebar_button_focus_fg, wc.titlebar_button_focus_bg);
|
|
|
|
else
|
|
|
|
setColor (wc.titlebar_button_fg, wc.titlebar_button_bg);
|
|
|
|
|
|
|
|
if ( isZoomed() )
|
2018-02-24 19:19:28 +01:00
|
|
|
drawRestoreSizeButton();
|
|
|
|
else
|
|
|
|
drawZoomedButton();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline void FDialog::drawRestoreSizeButton()
|
|
|
|
{
|
|
|
|
if ( isNewFont() )
|
2017-12-27 01:38:28 +01:00
|
|
|
{
|
2018-02-24 19:19:28 +01:00
|
|
|
print (fc::NF_rev_down_pointing_triangle1);
|
|
|
|
print (fc::NF_rev_down_pointing_triangle2);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( isMonochron() )
|
2017-12-27 01:38:28 +01:00
|
|
|
{
|
2018-02-24 19:19:28 +01:00
|
|
|
print ('[');
|
|
|
|
print (fc::BlackDownPointingTriangle); // ▼
|
|
|
|
print (']');
|
2017-12-27 01:38:28 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-02-24 19:19:28 +01:00
|
|
|
print (' ');
|
|
|
|
print (fc::BlackDownPointingTriangle); // ▼
|
|
|
|
print (' ');
|
2017-12-27 01:38:28 +01:00
|
|
|
}
|
|
|
|
}
|
2018-02-24 19:19:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline void FDialog::drawZoomedButton()
|
|
|
|
{
|
|
|
|
if ( isNewFont() )
|
2017-12-27 01:38:28 +01:00
|
|
|
{
|
2018-02-24 19:19:28 +01:00
|
|
|
print (fc::NF_rev_up_pointing_triangle1);
|
|
|
|
print (fc::NF_rev_up_pointing_triangle2);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( isMonochron() )
|
2017-12-27 01:38:28 +01:00
|
|
|
{
|
2018-02-24 19:19:28 +01:00
|
|
|
print ('[');
|
|
|
|
print (fc::BlackUpPointingTriangle); // ▲
|
|
|
|
print (']');
|
2017-12-27 01:38:28 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-02-24 19:19:28 +01:00
|
|
|
print (' ');
|
|
|
|
print (fc::BlackUpPointingTriangle); // ▲
|
|
|
|
print (' ');
|
2017-12-27 01:38:28 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2017-12-27 01:38:28 +01:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FDialog::drawTextBar()
|
|
|
|
{
|
2017-12-29 02:10:05 +01:00
|
|
|
// Fill with spaces (left of the title)
|
2017-12-27 01:38:28 +01:00
|
|
|
int center_offset
|
|
|
|
, zoom_btn
|
|
|
|
, length
|
|
|
|
, x;
|
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
if ( getMaxColor() < 16 )
|
|
|
|
setBold();
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
if ( isWindowActive() || (dialog_menu && dialog_menu->isVisible()) )
|
|
|
|
setColor (wc.titlebar_active_fg, wc.titlebar_active_bg);
|
|
|
|
else
|
|
|
|
setColor (wc.titlebar_inactive_fg, wc.titlebar_inactive_bg);
|
2016-07-09 00:01:59 +02:00
|
|
|
|
2017-12-29 02:10:05 +01:00
|
|
|
zoom_btn = getZoomButtonWidth();
|
2016-11-02 00:37:58 +01:00
|
|
|
length = int(tb_text.getLength());
|
2017-12-27 01:38:28 +01:00
|
|
|
center_offset = int((getWidth() - length - MENU_BTN - zoom_btn) / 2);
|
2016-11-02 00:37:58 +01:00
|
|
|
|
2017-12-27 01:38:28 +01:00
|
|
|
for (x = 1; x <= center_offset; x++)
|
2016-11-02 00:37:58 +01:00
|
|
|
print (' ');
|
|
|
|
|
2017-12-21 00:25:58 +01:00
|
|
|
// Print title bar text
|
2018-03-21 00:02:43 +01:00
|
|
|
if ( ! tb_text.isEmpty() )
|
2016-11-02 00:37:58 +01:00
|
|
|
{
|
2017-12-27 01:38:28 +01:00
|
|
|
if ( length <= getWidth() - MENU_BTN - zoom_btn )
|
2016-11-02 00:37:58 +01:00
|
|
|
print (tb_text);
|
|
|
|
else
|
|
|
|
{
|
2017-12-21 00:25:58 +01:00
|
|
|
// Print ellipsis
|
2017-12-27 01:38:28 +01:00
|
|
|
print (tb_text.left(getWidth() - MENU_BTN - zoom_btn - 2));
|
2016-11-02 00:37:58 +01:00
|
|
|
print ("..");
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-21 00:25:58 +01:00
|
|
|
// Fill the rest of the bar
|
2017-08-27 09:50:30 +02:00
|
|
|
for ( ; x + 1 + length < getWidth() - zoom_btn - 1; x++)
|
2016-11-02 00:37:58 +01:00
|
|
|
print (' ');
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
if ( getMaxColor() < 16 )
|
|
|
|
unsetBold();
|
2016-10-14 13:02:35 +02:00
|
|
|
}
|
|
|
|
|
2018-01-31 00:17:00 +01:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FDialog::restoreOverlaidWindows()
|
|
|
|
{
|
|
|
|
// Restoring overlaid windows
|
|
|
|
|
|
|
|
if ( ! window_list || window_list->empty() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
bool overlaid = false;
|
|
|
|
widgetList::const_iterator iter, last;
|
|
|
|
iter = window_list->begin();
|
|
|
|
last = window_list->end();
|
|
|
|
|
|
|
|
while ( iter != last )
|
|
|
|
{
|
|
|
|
if ( overlaid )
|
|
|
|
putArea ((*iter)->getTermPos(), (*iter)->getVWin());
|
|
|
|
|
|
|
|
if ( vwin == (*iter)->getVWin() )
|
|
|
|
overlaid = true;
|
|
|
|
|
|
|
|
++iter;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FDialog::setCursorToFocusWidget()
|
|
|
|
{
|
|
|
|
// Set the cursor to the focus widget
|
|
|
|
|
|
|
|
FWidget* focus_widget = FWidget::getFocusWidget();
|
|
|
|
|
|
|
|
if ( focus_widget
|
|
|
|
&& focus_widget->isVisible()
|
|
|
|
&& focus_widget->hasVisibleCursor() )
|
|
|
|
{
|
|
|
|
FPoint cursor_pos = focus_widget->getCursorPos();
|
|
|
|
focus_widget->setCursorPos(cursor_pos);
|
|
|
|
updateVTermCursor(vwin);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-29 04:29:12 +02:00
|
|
|
//----------------------------------------------------------------------
|
2016-11-02 00:37:58 +01:00
|
|
|
void FDialog::leaveMenu()
|
2016-09-29 04:29:12 +02:00
|
|
|
{
|
2016-11-02 00:37:58 +01:00
|
|
|
dialog_menu->unselectItem();
|
|
|
|
dialog_menu->hide();
|
|
|
|
activateWindow();
|
|
|
|
raiseWindow();
|
2016-09-29 04:29:12 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
if ( getWindowFocusWidget() )
|
|
|
|
getWindowFocusWidget()->setFocus();
|
2016-09-29 04:29:12 +02:00
|
|
|
|
|
|
|
redraw();
|
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
if ( getStatusBar() )
|
|
|
|
getStatusBar()->drawMessage();
|
2016-09-29 04:29:12 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
updateTerminal();
|
|
|
|
flush_out();
|
|
|
|
}
|
2016-09-29 04:29:12 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FDialog::openMenu()
|
|
|
|
{
|
2017-12-29 02:10:05 +01:00
|
|
|
// Open the titlebar menu
|
2016-11-02 00:37:58 +01:00
|
|
|
if ( ! dialog_menu )
|
|
|
|
return;
|
2016-09-29 04:29:12 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
if ( dialog_menu->isVisible() )
|
|
|
|
{
|
|
|
|
leaveMenu();
|
|
|
|
drawTitleBar();
|
2016-09-29 04:29:12 +02:00
|
|
|
}
|
2016-11-02 00:37:58 +01:00
|
|
|
else
|
2016-09-29 04:29:12 +02:00
|
|
|
{
|
2016-11-02 00:37:58 +01:00
|
|
|
setOpenMenu(dialog_menu);
|
2017-08-27 09:50:30 +02:00
|
|
|
dialog_menu->setPos (getX(), getY() + 1);
|
2016-11-02 00:37:58 +01:00
|
|
|
dialog_menu->setVisible();
|
|
|
|
drawTitleBar();
|
|
|
|
dialog_menu->show();
|
2017-08-12 20:10:27 +02:00
|
|
|
dialog_menu->raiseWindow();
|
2016-11-02 00:37:58 +01:00
|
|
|
dialog_menu->redraw();
|
2016-09-29 04:29:12 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-07-25 23:50:57 +02:00
|
|
|
//----------------------------------------------------------------------
|
2016-11-02 00:37:58 +01:00
|
|
|
void FDialog::selectFirstMenuItem()
|
2016-07-25 23:50:57 +02:00
|
|
|
{
|
2017-12-29 02:10:05 +01:00
|
|
|
// Focus to the first enabled menu item
|
2016-11-02 00:37:58 +01:00
|
|
|
FMenuItem* first_item;
|
|
|
|
dialog_menu->selectFirstItem();
|
|
|
|
first_item = dialog_menu->getSelectedItem();
|
2016-07-25 23:50:57 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
if ( first_item )
|
|
|
|
first_item->setFocus();
|
2016-07-25 23:50:57 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
dialog_menu->redraw();
|
2016-07-25 23:50:57 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
if ( getStatusBar() )
|
|
|
|
getStatusBar()->drawMessage();
|
2016-07-25 23:50:57 +02:00
|
|
|
|
|
|
|
updateTerminal();
|
2016-11-02 00:37:58 +01:00
|
|
|
flush_out();
|
2016-07-25 23:50:57 +02:00
|
|
|
}
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
//----------------------------------------------------------------------
|
2016-11-02 00:37:58 +01:00
|
|
|
void FDialog::setZoomItem()
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2016-11-02 00:37:58 +01:00
|
|
|
if ( isZoomed() )
|
|
|
|
{
|
|
|
|
zoom_item->setText ("&Unzoom");
|
|
|
|
zoom_item->setStatusbarMessage ("Restore the window size");
|
|
|
|
move_size_item->setDisable();
|
|
|
|
}
|
2015-05-23 13:35:12 +02:00
|
|
|
else
|
2016-11-02 00:37:58 +01:00
|
|
|
{
|
|
|
|
zoom_item->setText ("&Zoom");
|
|
|
|
zoom_item->setStatusbarMessage ("Enlarge the window to the entire desktop");
|
|
|
|
move_size_item->setEnable();
|
|
|
|
}
|
|
|
|
}
|
2016-07-09 00:01:59 +02:00
|
|
|
|
2017-12-29 02:10:05 +01:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline int FDialog::getZoomButtonWidth()
|
|
|
|
{
|
|
|
|
if ( ! isResizeable() )
|
|
|
|
return 0;
|
|
|
|
else if ( isNewFont() )
|
|
|
|
return 2;
|
|
|
|
else
|
|
|
|
return 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline void FDialog::deactivateZoomButton()
|
|
|
|
{
|
|
|
|
if ( ! zoom_button_pressed && ! zoom_button_active )
|
|
|
|
return;
|
|
|
|
|
|
|
|
zoom_button_pressed = false;
|
|
|
|
zoom_button_active = false;
|
|
|
|
drawTitleBar();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline void FDialog::activateZoomButton (mouseStates& ms)
|
|
|
|
{
|
|
|
|
if ( ms.mouse_x <= getWidth() - ms.zoom_btn
|
|
|
|
|| ms.mouse_y != 1 )
|
|
|
|
return;
|
|
|
|
|
|
|
|
zoom_button_pressed = true;
|
|
|
|
zoom_button_active = true;
|
|
|
|
drawTitleBar();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline void FDialog::leaveZoomButton (mouseStates& ms)
|
|
|
|
{
|
|
|
|
bool zoom_button_pressed_before = zoom_button_pressed;
|
|
|
|
|
|
|
|
if ( ms.mouse_x > getWidth() - ms.zoom_btn
|
|
|
|
&& ms.mouse_x <= getWidth()
|
|
|
|
&& ms.mouse_y == 1
|
|
|
|
&& zoom_button_active )
|
|
|
|
zoom_button_pressed = true;
|
|
|
|
else if ( zoom_button_pressed )
|
|
|
|
zoom_button_pressed = false;
|
|
|
|
|
|
|
|
if ( zoom_button_pressed_before != zoom_button_pressed )
|
|
|
|
drawTitleBar();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FDialog::pressZoomButton (mouseStates& ms)
|
|
|
|
{
|
|
|
|
if ( ms.mouse_x <= getWidth() - ms.zoom_btn
|
|
|
|
|| ms.mouse_y != 1
|
|
|
|
|| ! zoom_button_pressed )
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Zoom to maximum or restore the window size
|
|
|
|
zoomWindow();
|
|
|
|
setZoomItem();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FDialog::isMouseOverMenu (const FPoint& termpos)
|
|
|
|
{
|
|
|
|
const FRect& menu_geometry = dialog_menu->getTermGeometry();
|
|
|
|
|
|
|
|
if ( dialog_menu->getCount() > 0 && menu_geometry.contains(termpos) )
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline void FDialog::passEventToSubMenu ( mouseStates& ms
|
|
|
|
, FMouseEvent* ev )
|
|
|
|
{
|
|
|
|
// Mouse event handover to the dialog menu
|
|
|
|
if ( ! ms.mouse_over_menu
|
|
|
|
|| ! dialog_menu->isVisible()
|
|
|
|
|| ! dialog_menu->isShown() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
const FPoint& g = ms.termPos;
|
|
|
|
const FPoint& p = dialog_menu->termToWidgetPos(g);
|
|
|
|
int b = ev->getButton();
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
FMouseEvent* _ev = new FMouseEvent (fc::MouseMove_Event, p, g, b);
|
|
|
|
dialog_menu->mouse_down = true;
|
|
|
|
setClickedWidget(dialog_menu);
|
|
|
|
dialog_menu->onMouseMove(_ev);
|
|
|
|
delete _ev;
|
|
|
|
}
|
|
|
|
catch (const std::bad_alloc& ex)
|
|
|
|
{
|
|
|
|
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-27 01:38:28 +01:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline void FDialog::moveSizeKey (FKeyEvent* ev)
|
|
|
|
{
|
|
|
|
switch ( ev->key() )
|
|
|
|
{
|
|
|
|
case fc::Fkey_up:
|
2018-02-10 17:35:09 +01:00
|
|
|
moveUp(1);
|
|
|
|
ev->accept();
|
2017-12-27 01:38:28 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fc::Fkey_down:
|
2018-02-10 17:35:09 +01:00
|
|
|
moveDown(1);
|
|
|
|
ev->accept();
|
2017-12-27 01:38:28 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fc::Fkey_left:
|
2018-02-10 17:35:09 +01:00
|
|
|
moveLeft(1);
|
|
|
|
ev->accept();
|
2017-12-27 01:38:28 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fc::Fkey_right:
|
2018-02-10 17:35:09 +01:00
|
|
|
moveRight(1);
|
|
|
|
ev->accept();
|
2017-12-27 01:38:28 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fc::Fmkey_up:
|
|
|
|
case fc::Fkey_sr:
|
|
|
|
if ( reduceHeight(1) )
|
|
|
|
ev->accept();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fc::Fmkey_down:
|
|
|
|
case fc::Fkey_sf:
|
|
|
|
if ( expandHeight(1) )
|
|
|
|
ev->accept();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fc::Fmkey_left:
|
|
|
|
case fc::Fkey_sleft:
|
|
|
|
if ( reduceWidth(1) )
|
|
|
|
ev->accept();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fc::Fmkey_right:
|
|
|
|
case fc::Fkey_sright:
|
|
|
|
if ( expandWidth(1) )
|
|
|
|
ev->accept();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fc::Fkey_return:
|
|
|
|
case fc::Fkey_enter:
|
|
|
|
acceptMoveSize();
|
|
|
|
ev->accept();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fc::Fkey_escape:
|
|
|
|
case fc::Fkey_escape_mintty:
|
|
|
|
cancelMoveSize();
|
|
|
|
ev->accept();
|
|
|
|
return;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-29 02:10:05 +01:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline void FDialog::raiseActivateDialog()
|
|
|
|
{
|
|
|
|
bool has_raised = raiseWindow();
|
|
|
|
activateDialog();
|
|
|
|
|
|
|
|
if ( has_raised )
|
|
|
|
redraw();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline void FDialog::lowerActivateDialog()
|
|
|
|
{
|
|
|
|
bool has_lowered = lowerWindow();
|
|
|
|
|
|
|
|
if ( ! isWindowActive() )
|
|
|
|
activateDialog();
|
|
|
|
else if ( has_lowered )
|
|
|
|
updateTerminal();
|
|
|
|
}
|
|
|
|
|
2018-10-01 22:27:54 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
bool FDialog::isLowerRightResizeCorner (mouseStates& ms)
|
|
|
|
{
|
|
|
|
// 3 characters in the lower right corner |
|
|
|
|
// x
|
|
|
|
// -----xx
|
|
|
|
|
|
|
|
if ( (ms.mouse_x == getWidth() && ms.mouse_y == getHeight() - 1)
|
|
|
|
|| ( ( ms.mouse_x == getWidth() - 1
|
|
|
|
|| ms.mouse_x == getWidth() ) && ms.mouse_y == getHeight() ) )
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-29 02:10:05 +01:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FDialog::resizeMouseDown (mouseStates& ms)
|
|
|
|
{
|
|
|
|
// Click on the lower right resize corner
|
|
|
|
|
2018-10-01 22:27:54 +02:00
|
|
|
if ( isResizeable() && isLowerRightResizeCorner(ms) )
|
2017-12-29 02:10:05 +01:00
|
|
|
{
|
|
|
|
resize_click_pos = ms.termPos;
|
|
|
|
FPoint lower_right_pos = getTermGeometry().getLowerRightPos();
|
|
|
|
|
|
|
|
if ( ms.termPos != lower_right_pos )
|
|
|
|
{
|
|
|
|
FPoint deltaPos = ms.termPos - lower_right_pos;
|
|
|
|
int w = lower_right_pos.getX() + deltaPos.getX() - getTermX() + 1;
|
|
|
|
int h = lower_right_pos.getY() + deltaPos.getY() - getTermY() + 1;
|
|
|
|
setSize (w, h);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
drawBorder();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
resize_click_pos.setPoint (0,0);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FDialog::resizeMouseUpMove (mouseStates& ms, bool mouse_up)
|
|
|
|
{
|
|
|
|
// Resize the dialog
|
|
|
|
if ( isResizeable() && ! resize_click_pos.isNull() )
|
|
|
|
{
|
|
|
|
FWidget* r = getRootWidget();
|
|
|
|
resize_click_pos = ms.termPos;
|
|
|
|
int x2 = resize_click_pos.getX()
|
|
|
|
, y2 = resize_click_pos.getY()
|
|
|
|
, x2_offset = 0
|
|
|
|
, y2_offset = 0;
|
|
|
|
|
|
|
|
if ( r )
|
|
|
|
{
|
|
|
|
x2_offset = r->getLeftPadding();
|
|
|
|
y2_offset = r->getTopPadding();
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( ms.termPos != getTermGeometry().getLowerRightPos() )
|
|
|
|
{
|
|
|
|
int w, h;
|
|
|
|
FPoint deltaPos = ms.termPos - resize_click_pos;
|
|
|
|
|
|
|
|
if ( x2 - x2_offset <= getMaxWidth() )
|
|
|
|
w = resize_click_pos.getX() + deltaPos.getX() - getTermX() + 1;
|
|
|
|
else
|
|
|
|
w = getMaxWidth() - getTermX() + x2_offset + 1;
|
|
|
|
|
|
|
|
if ( y2 - y2_offset <= getMaxHeight() )
|
|
|
|
h = resize_click_pos.getY() + deltaPos.getY() - getTermY() + 1;
|
|
|
|
else
|
|
|
|
h = getMaxHeight() - getTermY() + y2_offset + 1;
|
|
|
|
|
|
|
|
setSize (w, h);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( mouse_up )
|
|
|
|
{
|
|
|
|
// Reset the border color
|
|
|
|
resize_click_pos.setPoint (0,0);
|
|
|
|
|
|
|
|
// redraw() is required to draw the standard (black) border
|
|
|
|
// and client objects with ignorePadding() option.
|
|
|
|
redraw();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FDialog::cancelMouseResize()
|
|
|
|
{
|
|
|
|
// Cancel resize by mouse
|
|
|
|
|
|
|
|
if ( resize_click_pos.isNull() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
resize_click_pos.setPoint (0,0);
|
|
|
|
drawBorder();
|
|
|
|
updateTerminal();
|
|
|
|
}
|
|
|
|
|
2017-12-27 01:38:28 +01:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline void FDialog::acceptMoveSize()
|
|
|
|
{
|
|
|
|
setMoveSizeWidget(0);
|
|
|
|
|
|
|
|
if ( tooltip )
|
|
|
|
delete tooltip;
|
|
|
|
|
|
|
|
tooltip = 0;
|
|
|
|
redraw();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline void FDialog::cancelMoveSize()
|
|
|
|
{
|
|
|
|
setMoveSizeWidget(0);
|
|
|
|
|
|
|
|
if ( tooltip )
|
|
|
|
delete tooltip;
|
|
|
|
|
|
|
|
tooltip = 0;
|
|
|
|
setPos (save_geometry.getPos());
|
|
|
|
|
|
|
|
if ( isResizeable() )
|
|
|
|
setSize (save_geometry.getWidth(), save_geometry.getHeight());
|
|
|
|
|
|
|
|
redraw();
|
|
|
|
}
|
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FDialog::addDialog (FWidget* obj)
|
|
|
|
{
|
2017-12-29 02:10:05 +01:00
|
|
|
// Add the dialog object obj to the dialog list
|
2016-11-02 00:37:58 +01:00
|
|
|
if ( dialog_list )
|
|
|
|
dialog_list->push_back(obj);
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
|
|
|
|
2016-09-25 23:53:48 +02:00
|
|
|
//----------------------------------------------------------------------
|
2016-11-02 00:37:58 +01:00
|
|
|
void FDialog::delDialog (FWidget* obj)
|
2016-09-25 23:53:48 +02:00
|
|
|
{
|
2017-12-29 02:10:05 +01:00
|
|
|
// Delete the dialog object obj from the dialog list
|
2016-11-02 00:37:58 +01:00
|
|
|
if ( ! dialog_list || dialog_list->empty() )
|
|
|
|
return;
|
2016-09-25 23:53:48 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
widgetList::iterator iter;
|
|
|
|
iter = dialog_list->begin();
|
|
|
|
|
|
|
|
while ( iter != dialog_list->end() )
|
2016-09-25 23:53:48 +02:00
|
|
|
{
|
2016-11-02 00:37:58 +01:00
|
|
|
if ( (*iter) == obj )
|
|
|
|
{
|
|
|
|
dialog_list->erase(iter);
|
|
|
|
return;
|
|
|
|
}
|
2016-09-25 23:53:48 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
++iter;
|
|
|
|
}
|
2016-09-25 23:53:48 +02:00
|
|
|
}
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
//----------------------------------------------------------------------
|
2017-02-24 00:30:07 +01:00
|
|
|
void FDialog::cb_move (FWidget*, data_ptr)
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2016-11-02 00:37:58 +01:00
|
|
|
if ( isZoomed() )
|
|
|
|
return;
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
setMoveSizeWidget(this);
|
2016-11-03 23:26:19 +01:00
|
|
|
|
|
|
|
if ( isMonochron() )
|
2017-08-12 22:55:29 +02:00
|
|
|
setReverse(true);
|
2016-11-03 23:26:19 +01:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
drawBorder();
|
2016-11-03 23:26:19 +01:00
|
|
|
|
|
|
|
if ( isMonochron() )
|
2017-08-12 22:55:29 +02:00
|
|
|
setReverse(false);
|
2016-11-03 23:26:19 +01:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
save_geometry = getGeometry();
|
2017-08-12 22:55:29 +02:00
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
tooltip = new FToolTip(this);
|
|
|
|
}
|
|
|
|
catch (const std::bad_alloc& ex)
|
|
|
|
{
|
|
|
|
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
|
|
|
|
return;
|
|
|
|
}
|
2016-11-02 00:37:58 +01:00
|
|
|
|
|
|
|
if ( isResizeable() )
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2016-11-02 00:37:58 +01:00
|
|
|
if ( isLinuxTerm() )
|
|
|
|
tooltip->setText ( " Arrow keys: Move\n"
|
|
|
|
"Shift + Arrow keys: Resize\n"
|
|
|
|
" Enter: Done\n"
|
|
|
|
" Esc: Cancel" );
|
|
|
|
else
|
|
|
|
tooltip->setText ( " Arrow keys: Move\n"
|
|
|
|
"Meta + Arrow keys: Resize\n"
|
|
|
|
" Enter: Done\n"
|
|
|
|
" Esc: Cancel" );
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-11-02 00:37:58 +01:00
|
|
|
tooltip->setText ( "Arrow keys: Move\n"
|
|
|
|
" Enter: Done\n"
|
|
|
|
" Esc: Cancel" );
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
2016-07-09 00:01:59 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
tooltip->show();
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2017-02-24 00:30:07 +01:00
|
|
|
void FDialog::cb_zoom (FWidget*, data_ptr)
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2016-11-02 00:37:58 +01:00
|
|
|
dialog_menu->unselectItem();
|
|
|
|
dialog_menu->hide();
|
|
|
|
setClickedWidget(0);
|
|
|
|
drawTitleBar();
|
|
|
|
zoomWindow();
|
|
|
|
setZoomItem();
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2017-02-24 00:30:07 +01:00
|
|
|
void FDialog::cb_close (FWidget*, data_ptr)
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2016-11-02 00:37:58 +01:00
|
|
|
dialog_menu->unselectItem();
|
|
|
|
dialog_menu->hide();
|
|
|
|
setClickedWidget(0);
|
|
|
|
drawTitleBar();
|
|
|
|
close();
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
2018-09-20 23:59:01 +02:00
|
|
|
|
|
|
|
} // namespace finalcut
|