2017-11-04 07:03:53 +01:00
|
|
|
|
/***********************************************************************
|
2019-09-28 03:13:06 +02:00
|
|
|
|
* ui.cpp - Example of a user interface *
|
2017-11-04 07:03:53 +01:00
|
|
|
|
* *
|
2020-07-08 21:32:47 +02:00
|
|
|
|
* This file is part of the FINAL CUT widget toolkit *
|
2017-11-04 07:03:53 +01:00
|
|
|
|
* *
|
2019-01-02 03:00:07 +01:00
|
|
|
|
* Copyright 2012-2019 Markus Gans *
|
2017-11-04 07:03:53 +01:00
|
|
|
|
* *
|
2020-07-08 21:32:47 +02:00
|
|
|
|
* 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 *
|
2017-11-04 07:03:53 +01:00
|
|
|
|
* the License, or (at your option) any later version. *
|
|
|
|
|
* *
|
2020-07-08 21:32:47 +02:00
|
|
|
|
* FINAL CUT is distributed in the hope that it will be useful, but *
|
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
2017-11-04 07:03:53 +01:00
|
|
|
|
* 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
|
|
|
|
|
|
|
|
|
#include <fstream>
|
2019-10-05 23:20:07 +02:00
|
|
|
|
#include <functional>
|
2019-08-06 23:45:28 +02:00
|
|
|
|
#include <map>
|
2017-09-11 03:06:02 +02:00
|
|
|
|
#include <iostream>
|
|
|
|
|
#include <string>
|
2019-08-06 23:45:28 +02:00
|
|
|
|
#include <vector>
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
2017-09-17 21:32:46 +02:00
|
|
|
|
#include <final/final.h>
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
2019-04-26 21:06:04 +02:00
|
|
|
|
namespace fc = finalcut::fc;
|
2019-01-21 03:42:18 +01:00
|
|
|
|
using finalcut::FPoint;
|
2020-04-17 02:49:33 +02:00
|
|
|
|
using finalcut::FRect;
|
2019-01-21 03:42:18 +01:00
|
|
|
|
using finalcut::FSize;
|
|
|
|
|
|
2015-12-18 21:48:27 +01:00
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
// class ProgressDialog
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
2020-04-14 23:46:42 +02:00
|
|
|
|
class ProgressDialog final : public finalcut::FDialog
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
2017-09-11 03:06:02 +02:00
|
|
|
|
public:
|
2020-04-17 02:49:33 +02:00
|
|
|
|
// Using-declaration
|
|
|
|
|
using FDialog::setGeometry;
|
|
|
|
|
|
2017-09-11 03:06:02 +02:00
|
|
|
|
// Constructor
|
2018-12-10 01:48:26 +01:00
|
|
|
|
explicit ProgressDialog (finalcut::FWidget* = nullptr);
|
2018-12-24 18:11:16 +01:00
|
|
|
|
|
2020-04-15 00:28:18 +02:00
|
|
|
|
// Disable copy constructor
|
|
|
|
|
ProgressDialog (const ProgressDialog&) = delete;
|
2018-12-24 18:11:16 +01:00
|
|
|
|
|
2017-09-11 03:06:02 +02:00
|
|
|
|
// Destructor
|
2020-02-19 21:59:13 +01:00
|
|
|
|
~ProgressDialog() override;
|
2017-09-11 03:06:02 +02:00
|
|
|
|
|
2020-04-15 23:44:08 +02:00
|
|
|
|
// Disable copy assignment operator (=)
|
2020-04-15 00:28:18 +02:00
|
|
|
|
ProgressDialog& operator = (const ProgressDialog&) = delete;
|
2018-12-09 22:04:55 +01:00
|
|
|
|
|
2017-09-11 03:06:02 +02:00
|
|
|
|
private:
|
|
|
|
|
// Event handlers
|
2019-08-06 23:45:28 +02:00
|
|
|
|
void onShow (finalcut::FShowEvent*) override;
|
|
|
|
|
void onTimer (finalcut::FTimerEvent*) override;
|
2017-09-11 03:06:02 +02:00
|
|
|
|
|
|
|
|
|
// Callback methods
|
2020-08-11 23:04:46 +02:00
|
|
|
|
void cb_reset_bar();
|
|
|
|
|
void cb_more_bar();
|
|
|
|
|
void cb_exit_bar();
|
2017-09-11 03:06:02 +02:00
|
|
|
|
|
2019-09-04 23:57:31 +02:00
|
|
|
|
// Data members
|
2020-09-25 00:48:58 +02:00
|
|
|
|
finalcut::FProgressbar progressbar{this};
|
2018-12-03 03:22:36 +01:00
|
|
|
|
finalcut::FButton reset{this};
|
|
|
|
|
finalcut::FButton more{this};
|
|
|
|
|
finalcut::FButton quit{this};
|
2015-05-23 13:35:12 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2018-09-20 23:59:01 +02:00
|
|
|
|
ProgressDialog::ProgressDialog (finalcut::FWidget* parent)
|
2020-05-24 23:55:08 +02:00
|
|
|
|
: finalcut::FDialog{parent}
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
2020-04-19 20:38:52 +02:00
|
|
|
|
// Dialog settings
|
|
|
|
|
// Avoids calling a virtual function from the constructor
|
|
|
|
|
// (CERT, OOP50-CPP)
|
2020-05-02 00:07:35 +02:00
|
|
|
|
FDialog::setGeometry ( FPoint{int((getParentWidget()->getWidth() - 40) / 2), 7}
|
|
|
|
|
, FSize{40, 10} );
|
2020-04-19 20:38:52 +02:00
|
|
|
|
FDialog::setText("Progress bar");
|
2015-05-23 13:35:12 +02:00
|
|
|
|
//setModal();
|
|
|
|
|
|
2018-10-03 22:23:55 +02:00
|
|
|
|
reset.setText("&Reset");
|
|
|
|
|
reset.setStatusbarMessage ("Reset the progress bar");
|
2020-05-02 00:07:35 +02:00
|
|
|
|
reset.setGeometry(FPoint{2, 6}, FSize{8, 1}, false);
|
2018-10-03 22:23:55 +02:00
|
|
|
|
reset.setDisable();
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
2018-10-03 22:23:55 +02:00
|
|
|
|
more.setText("&More");
|
|
|
|
|
more.setStatusbarMessage ("Increases the progress bar position");
|
2020-05-02 00:07:35 +02:00
|
|
|
|
more.setGeometry(FPoint{15, 6}, FSize{8, 1}, false);
|
2018-10-03 22:23:55 +02:00
|
|
|
|
more.setDisable();
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
2018-10-03 22:23:55 +02:00
|
|
|
|
quit.setText("E&xit");
|
2020-05-02 00:07:35 +02:00
|
|
|
|
quit.setGeometry(FPoint{28, 6}, FSize{8, 1}, false);
|
2018-10-03 22:23:55 +02:00
|
|
|
|
quit.setDisable();
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
2020-09-25 00:48:58 +02:00
|
|
|
|
progressbar.setGeometry(FPoint{2, 3}, FSize{34, 1}, false);
|
|
|
|
|
//progressbar.setPercentage(78);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
2018-10-03 22:23:55 +02:00
|
|
|
|
reset.addCallback
|
2015-05-23 13:35:12 +02:00
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2020-08-11 23:04:46 +02:00
|
|
|
|
this, &ProgressDialog::cb_reset_bar
|
2015-05-23 13:35:12 +02:00
|
|
|
|
);
|
|
|
|
|
|
2018-10-03 22:23:55 +02:00
|
|
|
|
more.addCallback
|
2015-05-23 13:35:12 +02:00
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2020-08-11 23:04:46 +02:00
|
|
|
|
this, &ProgressDialog::cb_more_bar
|
2015-05-23 13:35:12 +02:00
|
|
|
|
);
|
|
|
|
|
|
2018-10-03 22:23:55 +02:00
|
|
|
|
quit.addCallback
|
2015-05-23 13:35:12 +02:00
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2020-08-11 23:04:46 +02:00
|
|
|
|
this, &ProgressDialog::cb_exit_bar
|
2015-05-23 13:35:12 +02:00
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2017-09-11 03:06:02 +02:00
|
|
|
|
ProgressDialog::~ProgressDialog() // destructor
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
2020-07-19 14:15:02 +02:00
|
|
|
|
delOwnTimers();
|
2018-10-03 22:23:55 +02:00
|
|
|
|
delCallback(&quit);
|
|
|
|
|
delCallback(&more);
|
|
|
|
|
delCallback(&reset);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2018-09-20 23:59:01 +02:00
|
|
|
|
void ProgressDialog::onShow (finalcut::FShowEvent*)
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
2020-04-04 20:58:47 +02:00
|
|
|
|
addTimer(15); // Starts the timer every 15 ms
|
2015-07-02 01:00:30 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2018-09-20 23:59:01 +02:00
|
|
|
|
void ProgressDialog::onTimer (finalcut::FTimerEvent*)
|
2015-07-02 01:00:30 +02:00
|
|
|
|
{
|
2020-09-25 00:48:58 +02:00
|
|
|
|
auto p = progressbar.getPercentage();
|
2020-04-19 20:38:52 +02:00
|
|
|
|
p++;
|
2020-09-25 00:48:58 +02:00
|
|
|
|
progressbar.setPercentage(p);
|
2019-12-16 11:14:24 +01:00
|
|
|
|
flush();
|
2015-07-02 01:00:30 +02:00
|
|
|
|
|
2016-10-17 08:44:38 +02:00
|
|
|
|
if ( p != 100 )
|
|
|
|
|
return;
|
|
|
|
|
|
2020-07-19 14:15:02 +02:00
|
|
|
|
delOwnTimers();
|
2016-10-17 08:44:38 +02:00
|
|
|
|
activateWindow();
|
|
|
|
|
raiseWindow();
|
2018-10-03 22:23:55 +02:00
|
|
|
|
reset.setEnable();
|
|
|
|
|
reset.setFocus();
|
|
|
|
|
more.setEnable();
|
|
|
|
|
quit.setEnable();
|
2016-10-17 08:44:38 +02:00
|
|
|
|
redraw();
|
|
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
|
if ( getStatusBar() )
|
|
|
|
|
getStatusBar()->drawMessage();
|
2015-05-23 13:35:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2020-08-11 23:04:46 +02:00
|
|
|
|
void ProgressDialog::cb_reset_bar()
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
2020-09-25 00:48:58 +02:00
|
|
|
|
progressbar.reset();
|
2015-05-23 13:35:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2020-08-11 23:04:46 +02:00
|
|
|
|
void ProgressDialog::cb_more_bar()
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
2020-09-25 00:48:58 +02:00
|
|
|
|
auto p = progressbar.getPercentage();
|
2020-04-19 20:38:52 +02:00
|
|
|
|
p++;
|
2020-09-25 00:48:58 +02:00
|
|
|
|
progressbar.setPercentage(p);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2020-08-11 23:04:46 +02:00
|
|
|
|
void ProgressDialog::cb_exit_bar()
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
2015-09-24 19:01:27 +02:00
|
|
|
|
close();
|
2015-05-23 13:35:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2016-09-11 16:48:39 +02:00
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
// class TextWindow
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
2020-04-14 23:46:42 +02:00
|
|
|
|
class TextWindow final : public finalcut::FDialog
|
2016-09-11 16:48:39 +02:00
|
|
|
|
{
|
2017-09-11 03:06:02 +02:00
|
|
|
|
public:
|
|
|
|
|
// Constructor
|
2018-12-10 01:48:26 +01:00
|
|
|
|
explicit TextWindow (finalcut::FWidget* = nullptr);
|
2018-12-24 18:11:16 +01:00
|
|
|
|
|
2018-12-06 21:19:37 +01:00
|
|
|
|
// Disable copy constructor
|
|
|
|
|
TextWindow (const TextWindow&) = delete;
|
2018-12-24 18:11:16 +01:00
|
|
|
|
|
2017-09-11 03:06:02 +02:00
|
|
|
|
// Destructor
|
2020-02-19 21:59:13 +01:00
|
|
|
|
~TextWindow() override;
|
2016-11-02 00:37:58 +01:00
|
|
|
|
|
2020-04-15 23:44:08 +02:00
|
|
|
|
// Disable copy assignment operator (=)
|
2018-12-09 22:04:55 +01:00
|
|
|
|
TextWindow& operator = (const TextWindow&) = delete;
|
|
|
|
|
|
2018-12-06 21:19:37 +01:00
|
|
|
|
// Method
|
2018-09-20 23:59:01 +02:00
|
|
|
|
void append (const finalcut::FString&);
|
2016-09-11 16:48:39 +02:00
|
|
|
|
|
2017-09-11 03:06:02 +02:00
|
|
|
|
private:
|
2018-05-20 15:15:42 +02:00
|
|
|
|
// Method
|
2019-08-06 23:45:28 +02:00
|
|
|
|
void adjustSize() override;
|
2016-09-11 16:48:39 +02:00
|
|
|
|
|
2019-09-04 23:57:31 +02:00
|
|
|
|
// Data members
|
2020-09-25 00:48:58 +02:00
|
|
|
|
finalcut::FTextView scrolltext{this};
|
2016-09-11 16:48:39 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2018-09-20 23:59:01 +02:00
|
|
|
|
TextWindow::TextWindow (finalcut::FWidget* parent)
|
2020-05-24 23:55:08 +02:00
|
|
|
|
: finalcut::FDialog{parent}
|
2016-09-11 16:48:39 +02:00
|
|
|
|
{
|
2020-09-25 00:48:58 +02:00
|
|
|
|
scrolltext.ignorePadding();
|
|
|
|
|
scrolltext.setGeometry (FPoint{1, 2}, FSize{getWidth(), getHeight() - 1});
|
2020-05-02 00:07:35 +02:00
|
|
|
|
setMinimumSize (FSize{51, 6});
|
2020-09-25 00:48:58 +02:00
|
|
|
|
scrolltext.setFocus();
|
|
|
|
|
scrolltext.insert(" -----------------------------------------------\n"
|
2018-10-03 22:23:55 +02:00
|
|
|
|
" line 1\n"
|
|
|
|
|
" -----------------------------------------------\n"
|
|
|
|
|
" line 3\n"
|
|
|
|
|
" line 4"
|
|
|
|
|
, -1);
|
2020-09-25 00:48:58 +02:00
|
|
|
|
scrolltext.replaceRange(" File viewer", 1, 1);
|
|
|
|
|
scrolltext.deleteRange(3, 4);
|
2016-09-11 16:48:39 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2017-09-11 03:06:02 +02:00
|
|
|
|
TextWindow::~TextWindow() // destructor
|
2016-09-11 16:48:39 +02:00
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2018-09-20 23:59:01 +02:00
|
|
|
|
void TextWindow::append (const finalcut::FString& str)
|
2016-09-11 16:48:39 +02:00
|
|
|
|
{
|
2020-09-25 00:48:58 +02:00
|
|
|
|
scrolltext.append(str);
|
2016-09-11 16:48:39 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
void TextWindow::adjustSize()
|
|
|
|
|
{
|
2018-09-20 23:59:01 +02:00
|
|
|
|
finalcut::FDialog::adjustSize();
|
2020-09-25 00:48:58 +02:00
|
|
|
|
scrolltext.setGeometry (FPoint{1, 2}, FSize(getWidth(), getHeight() - 1));
|
2016-09-11 16:48:39 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
// class MyDialog
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
2020-04-14 23:46:42 +02:00
|
|
|
|
class MyDialog final : public finalcut::FDialog
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
2017-09-11 03:06:02 +02:00
|
|
|
|
public:
|
|
|
|
|
// Constructor
|
2018-12-10 01:48:26 +01:00
|
|
|
|
explicit MyDialog (finalcut::FWidget* = nullptr);
|
2018-12-24 18:11:16 +01:00
|
|
|
|
|
2018-12-06 21:19:37 +01:00
|
|
|
|
// Disable copy constructor
|
|
|
|
|
MyDialog (const MyDialog&) = delete;
|
2018-12-24 18:11:16 +01:00
|
|
|
|
|
2017-09-11 03:06:02 +02:00
|
|
|
|
// Destructor
|
2020-02-19 21:59:13 +01:00
|
|
|
|
~MyDialog() override;
|
2017-09-11 03:06:02 +02:00
|
|
|
|
|
2020-04-15 23:44:08 +02:00
|
|
|
|
// Disable copy assignment operator (=)
|
2018-12-09 22:04:55 +01:00
|
|
|
|
MyDialog& operator = (const MyDialog&) = delete;
|
|
|
|
|
|
2017-09-11 03:06:02 +02:00
|
|
|
|
private:
|
2019-02-24 00:25:36 +01:00
|
|
|
|
// Methods
|
2020-04-19 20:38:52 +02:00
|
|
|
|
void init();
|
2017-11-02 16:05:34 +01:00
|
|
|
|
void initMenu();
|
2017-11-19 19:47:24 +01:00
|
|
|
|
void initMenuCallbacks();
|
2018-02-24 18:13:42 +01:00
|
|
|
|
void initFileMenuCallbacks();
|
|
|
|
|
void initEditMenuCallbacks();
|
|
|
|
|
void initViewMenuCallbacks();
|
|
|
|
|
void initHelpMenuCallback();
|
2017-11-19 19:47:24 +01:00
|
|
|
|
void initStatusBarCallbacks();
|
2017-11-02 16:05:34 +01:00
|
|
|
|
void initWidgets();
|
2018-01-30 00:11:58 +01:00
|
|
|
|
void initFlatButtons();
|
|
|
|
|
void initToggleButtons();
|
|
|
|
|
void initButtons();
|
|
|
|
|
void initLabels();
|
2017-11-22 23:56:21 +01:00
|
|
|
|
void initWidgetsCallbacks();
|
2019-08-06 23:45:28 +02:00
|
|
|
|
void adjustSize() override;
|
2017-09-11 03:06:02 +02:00
|
|
|
|
|
|
|
|
|
// Event handlers
|
2019-08-06 23:45:28 +02:00
|
|
|
|
void onClose (finalcut::FCloseEvent*) override;
|
2017-09-11 03:06:02 +02:00
|
|
|
|
|
|
|
|
|
// Callback methods
|
2020-08-23 00:32:41 +02:00
|
|
|
|
void cb_noFunctionMsg (const finalcut::FButton&);
|
2020-08-11 23:04:46 +02:00
|
|
|
|
void cb_about();
|
|
|
|
|
void cb_terminfo();
|
|
|
|
|
void cb_drives();
|
|
|
|
|
void cb_cutClipboard();
|
|
|
|
|
void cb_copyClipboard();
|
|
|
|
|
void cb_pasteClipboard();
|
|
|
|
|
void cb_clearInput();
|
2020-10-14 17:31:52 +02:00
|
|
|
|
void cb_switchTheme (const finalcut::FCheckMenuItem*);
|
2020-08-11 23:04:46 +02:00
|
|
|
|
void cb_input2buttonText ( finalcut::FButton&
|
|
|
|
|
, const finalcut::FLineEdit& ) const;
|
2020-08-12 22:28:02 +02:00
|
|
|
|
void cb_setTitlebar (const finalcut::FLineEdit&);
|
2020-08-11 23:04:46 +02:00
|
|
|
|
void cb_showProgressBar();
|
2020-10-08 05:55:32 +02:00
|
|
|
|
void cb_updateNumber();
|
2020-08-12 22:28:02 +02:00
|
|
|
|
void cb_activateButton ( const finalcut::FRadioButton&
|
2020-08-11 23:04:46 +02:00
|
|
|
|
, finalcut::FButton& ) const;
|
2020-08-12 22:28:02 +02:00
|
|
|
|
void cb_view (const finalcut::FMenuItem*);
|
2020-08-23 00:32:41 +02:00
|
|
|
|
void cb_setInput (const finalcut::FListBox&, finalcut::FLineEdit&) const;
|
2017-09-11 03:06:02 +02:00
|
|
|
|
|
2019-09-04 23:57:31 +02:00
|
|
|
|
// Data members
|
2018-12-03 03:22:36 +01:00
|
|
|
|
bool initialized{false};
|
|
|
|
|
finalcut::FMenuBar Menubar{this};
|
|
|
|
|
// Menu bar items
|
|
|
|
|
finalcut::FMenu File{"&File", &Menubar};
|
|
|
|
|
finalcut::FMenu Edit{"&Edit", &Menubar};
|
|
|
|
|
finalcut::FMenu View{"&View", &Menubar};
|
|
|
|
|
finalcut::FMenuItem Options{"&Options", &Menubar};
|
|
|
|
|
finalcut::FDialogListMenu Window{"&Window", &Menubar};
|
|
|
|
|
finalcut::FMenuItem Help{"&Help", &Menubar};
|
|
|
|
|
// "File" menu items
|
|
|
|
|
finalcut::FMenuItem Open{"&Open...", &File};
|
|
|
|
|
finalcut::FMenu Recent{"&System files", &File};
|
|
|
|
|
finalcut::FMenuItem Line1{&File};
|
|
|
|
|
finalcut::FMenuItem Quit{"&Quit", &File};
|
|
|
|
|
// "Recent" menu items
|
|
|
|
|
finalcut::FMenuItem File1{"/etc/services", &Recent};
|
|
|
|
|
finalcut::FMenuItem File2{"/etc/fstab", &Recent};
|
|
|
|
|
finalcut::FMenuItem File3{"/etc/passwd", &Recent};
|
|
|
|
|
// "Edit" menu items
|
2019-04-26 21:06:04 +02:00
|
|
|
|
finalcut::FMenuItem Undo{fc::Fckey_z, "Undo", &Edit};
|
|
|
|
|
finalcut::FMenuItem Redo{fc::Fckey_y, "Redo", &Edit};
|
2018-12-03 03:22:36 +01:00
|
|
|
|
finalcut::FMenuItem Line2{&Edit};
|
2019-04-26 21:06:04 +02:00
|
|
|
|
finalcut::FMenuItem Cut{fc::Fckey_x, "Cu&t", &Edit};
|
|
|
|
|
finalcut::FMenuItem Copy{fc::Fckey_c, "&Copy", &Edit};
|
|
|
|
|
finalcut::FMenuItem Paste{fc::Fckey_v, "&Paste", &Edit};
|
|
|
|
|
finalcut::FMenuItem Clear{fc::Fkey_dc, "C&lear", &Edit};
|
2018-12-03 03:22:36 +01:00
|
|
|
|
// "View" menu items
|
|
|
|
|
finalcut::FMenuItem Env{"&Terminal...", &View};
|
|
|
|
|
finalcut::FMenuItem Drive{"&Drive symbols...", &View};
|
2020-05-30 23:02:53 +02:00
|
|
|
|
finalcut::FMenuItem Line3{&View};
|
|
|
|
|
finalcut::FCheckMenuItem Theme{"Dark &mode", &View};
|
2018-12-03 03:22:36 +01:00
|
|
|
|
// Statusbar
|
|
|
|
|
finalcut::FStatusBar Statusbar{this};
|
2019-04-26 21:06:04 +02:00
|
|
|
|
finalcut::FStatusKey key_F1{fc::Fkey_f1, "About", &Statusbar};
|
|
|
|
|
finalcut::FStatusKey key_F2{fc::Fkey_f2, "View", &Statusbar};
|
|
|
|
|
finalcut::FStatusKey key_F3{fc::Fkey_f3, "Quit", &Statusbar};
|
2018-12-03 03:22:36 +01:00
|
|
|
|
// Dialog widgets
|
|
|
|
|
finalcut::FButton MyButton1{this};
|
|
|
|
|
finalcut::FButton MyButton2{this};
|
|
|
|
|
finalcut::FButton MyButton3{this};
|
|
|
|
|
finalcut::FButtonGroup radioButtonGroup{"Button", this};
|
|
|
|
|
finalcut::FRadioButton radio1{"E&nable", &radioButtonGroup};
|
|
|
|
|
finalcut::FRadioButton radio2{&radioButtonGroup};
|
|
|
|
|
finalcut::FButtonGroup checkButtonGroup{"Options", this};
|
|
|
|
|
finalcut::FCheckBox check1{"&Bitmode", &checkButtonGroup};
|
|
|
|
|
finalcut::FCheckBox check2{"&8-Bit", &checkButtonGroup};
|
|
|
|
|
finalcut::FLineEdit myLineEdit{this};
|
|
|
|
|
finalcut::FButton MyButton4{this};
|
|
|
|
|
finalcut::FButton MyButton5{this};
|
|
|
|
|
finalcut::FButton MyButton6{this};
|
|
|
|
|
finalcut::FListBox myList{this};
|
|
|
|
|
finalcut::FLabel headline{this};
|
|
|
|
|
finalcut::FLabel tagged{L"Tagged:", this};
|
|
|
|
|
finalcut::FLabel tagged_count{this};
|
|
|
|
|
finalcut::FLabel sum{L"Sum:", this};
|
|
|
|
|
finalcut::FLabel sum_count{this};
|
|
|
|
|
finalcut::FString clipboard{};
|
2015-05-23 13:35:12 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2018-09-20 23:59:01 +02:00
|
|
|
|
MyDialog::MyDialog (finalcut::FWidget* parent)
|
2020-05-24 23:55:08 +02:00
|
|
|
|
: finalcut::FDialog{parent}
|
2020-04-19 20:38:52 +02:00
|
|
|
|
{
|
|
|
|
|
init();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
MyDialog::~MyDialog() // destructor
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
void MyDialog::init()
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
2017-11-19 19:47:24 +01:00
|
|
|
|
initMenu(); // Initialize the program menu
|
|
|
|
|
initMenuCallbacks(); // Initialize program menu callbacks
|
|
|
|
|
initStatusBarCallbacks(); // Initialize status bar callbacks
|
|
|
|
|
initWidgets(); // Initialize the dialog widgets
|
2017-11-22 23:56:21 +01:00
|
|
|
|
initWidgetsCallbacks(); // Initialize dialog widget callbacks
|
2018-10-03 22:23:55 +02:00
|
|
|
|
initialized = true;
|
2017-11-02 16:05:34 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
void MyDialog::initMenu()
|
|
|
|
|
{
|
|
|
|
|
// Menu bar items
|
2018-10-03 22:23:55 +02:00
|
|
|
|
File.setStatusbarMessage ("File management commands");
|
|
|
|
|
Edit.setStatusbarMessage ("Cut-and-paste editing commands");
|
|
|
|
|
View.setStatusbarMessage ("Show internal informations");
|
|
|
|
|
Options.setStatusbarMessage ("Set program defaults");
|
|
|
|
|
Options.setDisable();
|
|
|
|
|
Window.setStatusbarMessage ("List of all the active dialogs");
|
|
|
|
|
Help.setStatusbarMessage ("Show version and copyright information");
|
2015-09-24 19:01:27 +02:00
|
|
|
|
|
2015-11-01 22:45:23 +01:00
|
|
|
|
// "File" menu items
|
2019-04-26 21:06:04 +02:00
|
|
|
|
Open.addAccelerator (fc::Fckey_o); // Ctrl + O
|
2018-10-03 22:23:55 +02:00
|
|
|
|
Open.setStatusbarMessage ("Locate and open a text file");
|
|
|
|
|
Recent.setStatusbarMessage ("View text file");
|
|
|
|
|
Line1.setSeparator();
|
2019-04-26 21:06:04 +02:00
|
|
|
|
Quit.addAccelerator (fc::Fmkey_x); // Meta/Alt + X
|
2018-10-03 22:23:55 +02:00
|
|
|
|
Quit.setStatusbarMessage ("Exit the program");
|
2015-11-29 15:58:36 +01:00
|
|
|
|
|
2015-11-01 22:45:23 +01:00
|
|
|
|
// "Edit" menu items
|
2018-10-03 22:23:55 +02:00
|
|
|
|
Undo.setDisable();
|
|
|
|
|
Redo.setDisable();
|
|
|
|
|
Line2.setSeparator();
|
|
|
|
|
Cut.setStatusbarMessage ( "Remove the input text"
|
|
|
|
|
" and put it in the clipboard" );
|
|
|
|
|
Copy.setStatusbarMessage ("Copy the input text into the clipboad");
|
|
|
|
|
Paste.setStatusbarMessage ("Insert text form clipboard");
|
|
|
|
|
Clear.setStatusbarMessage ("Delete input text");
|
2015-10-10 03:14:14 +02:00
|
|
|
|
|
2015-11-01 22:45:23 +01:00
|
|
|
|
// "View" menu items
|
2018-10-03 22:23:55 +02:00
|
|
|
|
Env.setStatusbarMessage ("Informations about this terminal");
|
|
|
|
|
Drive.setStatusbarMessage ("Show drive symbols");
|
2020-05-30 23:02:53 +02:00
|
|
|
|
Line3.setSeparator();
|
|
|
|
|
|
|
|
|
|
if ( finalcut::FStartOptions::getFStartOptions().dark_theme )
|
|
|
|
|
Theme.setChecked();
|
2017-11-19 19:47:24 +01:00
|
|
|
|
}
|
2015-10-10 03:14:14 +02:00
|
|
|
|
|
2017-11-19 19:47:24 +01:00
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
void MyDialog::initMenuCallbacks()
|
|
|
|
|
{
|
2015-11-01 22:45:23 +01:00
|
|
|
|
// Menu function callbacks
|
2018-02-24 18:13:42 +01:00
|
|
|
|
initFileMenuCallbacks();
|
|
|
|
|
initEditMenuCallbacks();
|
|
|
|
|
initViewMenuCallbacks();
|
|
|
|
|
initHelpMenuCallback();
|
|
|
|
|
}
|
2017-11-19 19:47:24 +01:00
|
|
|
|
|
2018-02-24 18:13:42 +01:00
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
void MyDialog::initFileMenuCallbacks()
|
|
|
|
|
{
|
|
|
|
|
// File menu
|
2018-10-03 22:23:55 +02:00
|
|
|
|
Open.addCallback
|
2015-10-10 03:14:14 +02:00
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2020-08-11 23:04:46 +02:00
|
|
|
|
this, &MyDialog::cb_view,
|
|
|
|
|
nullptr
|
2015-10-10 03:14:14 +02:00
|
|
|
|
);
|
2017-01-15 19:48:27 +01:00
|
|
|
|
|
2018-10-03 22:23:55 +02:00
|
|
|
|
Quit.addCallback
|
2015-09-24 19:01:27 +02:00
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2020-08-11 23:04:46 +02:00
|
|
|
|
finalcut::getFApplication(),
|
|
|
|
|
&finalcut::FApplication::cb_exitApp,
|
|
|
|
|
this
|
2015-09-24 19:01:27 +02:00
|
|
|
|
);
|
2017-01-15 19:48:27 +01:00
|
|
|
|
|
2018-02-24 18:13:42 +01:00
|
|
|
|
// System files submenu
|
2018-10-03 22:23:55 +02:00
|
|
|
|
File1.addCallback
|
2018-02-24 18:13:42 +01:00
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2020-08-11 23:04:46 +02:00
|
|
|
|
this, &MyDialog::cb_view,
|
|
|
|
|
&File1
|
2018-02-24 18:13:42 +01:00
|
|
|
|
);
|
|
|
|
|
|
2018-10-03 22:23:55 +02:00
|
|
|
|
File2.addCallback
|
2018-02-24 18:13:42 +01:00
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2020-08-11 23:04:46 +02:00
|
|
|
|
this, &MyDialog::cb_view,
|
|
|
|
|
&File2
|
2018-02-24 18:13:42 +01:00
|
|
|
|
);
|
|
|
|
|
|
2018-10-03 22:23:55 +02:00
|
|
|
|
File3.addCallback
|
2018-02-24 18:13:42 +01:00
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2020-08-11 23:04:46 +02:00
|
|
|
|
this, &MyDialog::cb_view,
|
|
|
|
|
&File3
|
2018-02-24 18:13:42 +01:00
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
void MyDialog::initEditMenuCallbacks()
|
|
|
|
|
{
|
|
|
|
|
// Edit menu
|
2018-10-03 22:23:55 +02:00
|
|
|
|
Cut.addCallback
|
2015-10-10 03:14:14 +02:00
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2020-08-11 23:04:46 +02:00
|
|
|
|
this, &MyDialog::cb_cutClipboard
|
2015-10-10 03:14:14 +02:00
|
|
|
|
);
|
2017-01-15 19:48:27 +01:00
|
|
|
|
|
2018-10-03 22:23:55 +02:00
|
|
|
|
Copy.addCallback
|
2015-10-10 03:14:14 +02:00
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2020-08-11 23:04:46 +02:00
|
|
|
|
this, &MyDialog::cb_copyClipboard
|
2015-10-10 03:14:14 +02:00
|
|
|
|
);
|
2017-01-15 19:48:27 +01:00
|
|
|
|
|
2018-10-03 22:23:55 +02:00
|
|
|
|
Paste.addCallback
|
2015-10-10 03:14:14 +02:00
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2020-08-11 23:04:46 +02:00
|
|
|
|
this, &MyDialog::cb_pasteClipboard
|
2015-10-10 03:14:14 +02:00
|
|
|
|
);
|
2017-01-15 19:48:27 +01:00
|
|
|
|
|
2018-10-03 22:23:55 +02:00
|
|
|
|
Clear.addCallback
|
2015-11-01 22:45:23 +01:00
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2020-08-11 23:04:46 +02:00
|
|
|
|
this, &MyDialog::cb_clearInput
|
2015-11-01 22:45:23 +01:00
|
|
|
|
);
|
2018-02-24 18:13:42 +01:00
|
|
|
|
}
|
2017-01-15 19:48:27 +01:00
|
|
|
|
|
2018-02-24 18:13:42 +01:00
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
void MyDialog::initViewMenuCallbacks()
|
|
|
|
|
{
|
|
|
|
|
// View menu
|
2018-10-03 22:23:55 +02:00
|
|
|
|
Env.addCallback
|
2015-10-10 03:14:14 +02:00
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2020-08-11 23:04:46 +02:00
|
|
|
|
this, &MyDialog::cb_terminfo
|
2015-10-10 03:14:14 +02:00
|
|
|
|
);
|
2017-01-15 19:48:27 +01:00
|
|
|
|
|
2018-10-03 22:23:55 +02:00
|
|
|
|
Drive.addCallback
|
2015-10-10 03:14:14 +02:00
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2020-08-11 23:04:46 +02:00
|
|
|
|
this, &MyDialog::cb_drives
|
2015-10-10 03:14:14 +02:00
|
|
|
|
);
|
2020-05-30 23:02:53 +02:00
|
|
|
|
|
|
|
|
|
Theme.addCallback
|
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2020-08-11 23:04:46 +02:00
|
|
|
|
this, &MyDialog::cb_switchTheme,
|
|
|
|
|
&Theme
|
2020-05-30 23:02:53 +02:00
|
|
|
|
);
|
2018-02-24 18:13:42 +01:00
|
|
|
|
}
|
2017-01-15 19:48:27 +01:00
|
|
|
|
|
2018-02-24 18:13:42 +01:00
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
void MyDialog::initHelpMenuCallback()
|
|
|
|
|
{
|
2018-10-03 22:23:55 +02:00
|
|
|
|
Help.addCallback
|
2015-10-10 03:14:14 +02:00
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2020-08-11 23:04:46 +02:00
|
|
|
|
this, &MyDialog::cb_about
|
2015-10-10 03:14:14 +02:00
|
|
|
|
);
|
2017-11-02 16:05:34 +01:00
|
|
|
|
}
|
|
|
|
|
|
2017-11-19 19:47:24 +01:00
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
void MyDialog::initStatusBarCallbacks()
|
|
|
|
|
{
|
2018-01-30 00:11:58 +01:00
|
|
|
|
// Add statusbar function callbacks
|
2017-11-19 19:47:24 +01:00
|
|
|
|
|
2018-10-03 22:23:55 +02:00
|
|
|
|
key_F1.addCallback
|
2017-11-02 16:05:34 +01:00
|
|
|
|
(
|
|
|
|
|
"activate",
|
2020-08-11 23:04:46 +02:00
|
|
|
|
this, &MyDialog::cb_about
|
2017-11-02 16:05:34 +01:00
|
|
|
|
);
|
|
|
|
|
|
2018-10-03 22:23:55 +02:00
|
|
|
|
key_F2.addCallback
|
2017-11-02 16:05:34 +01:00
|
|
|
|
(
|
|
|
|
|
"activate",
|
2020-08-11 23:04:46 +02:00
|
|
|
|
this, &MyDialog::cb_view,
|
|
|
|
|
nullptr
|
2017-11-02 16:05:34 +01:00
|
|
|
|
);
|
|
|
|
|
|
2018-10-03 22:23:55 +02:00
|
|
|
|
key_F3.addCallback
|
2017-11-02 16:05:34 +01:00
|
|
|
|
(
|
|
|
|
|
"activate",
|
2020-08-11 23:04:46 +02:00
|
|
|
|
finalcut::getFApplication(),
|
|
|
|
|
&finalcut::FApplication::cb_exitApp,
|
|
|
|
|
this
|
2017-11-02 16:05:34 +01:00
|
|
|
|
);
|
|
|
|
|
}
|
2015-10-10 03:14:14 +02:00
|
|
|
|
|
2017-11-02 16:05:34 +01:00
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
void MyDialog::initWidgets()
|
|
|
|
|
{
|
2018-01-30 00:11:58 +01:00
|
|
|
|
// Flat buttons
|
|
|
|
|
initFlatButtons();
|
|
|
|
|
|
|
|
|
|
// Radio buttons and check boxes
|
|
|
|
|
initToggleButtons();
|
|
|
|
|
|
|
|
|
|
// A text input field
|
2020-05-02 00:07:35 +02:00
|
|
|
|
myLineEdit.setGeometry(FPoint{22, 1}, FSize{10, 1});
|
2018-10-03 22:23:55 +02:00
|
|
|
|
myLineEdit.setLabelText (L"&Input");
|
|
|
|
|
myLineEdit.setStatusbarMessage ("Press Enter to set the title");
|
2020-05-02 00:07:35 +02:00
|
|
|
|
myLineEdit << finalcut::FString{"EnTry"}.toLower();
|
2018-01-30 00:11:58 +01:00
|
|
|
|
|
2015-11-01 22:45:23 +01:00
|
|
|
|
// Buttons
|
2018-01-30 00:11:58 +01:00
|
|
|
|
initButtons();
|
|
|
|
|
|
|
|
|
|
// A multiple selection listbox
|
2020-05-02 00:07:35 +02:00
|
|
|
|
myList.setGeometry(FPoint{38, 1}, FSize{14, 17});
|
2018-10-03 22:23:55 +02:00
|
|
|
|
myList.setText ("Items");
|
2019-09-28 03:13:06 +02:00
|
|
|
|
|
2018-10-03 22:23:55 +02:00
|
|
|
|
myList.setStatusbarMessage ("99 items in a list");
|
|
|
|
|
myList.setMultiSelection();
|
2019-04-27 00:38:15 +02:00
|
|
|
|
myList.reserve(100);
|
2018-01-30 00:11:58 +01:00
|
|
|
|
|
2020-10-25 01:21:45 +02:00
|
|
|
|
for (auto z{1}; z < 100; z++)
|
2020-05-02 00:07:35 +02:00
|
|
|
|
myList.insert (finalcut::FString{} << z << L" placeholder");
|
2018-01-30 00:11:58 +01:00
|
|
|
|
|
|
|
|
|
// Text labels
|
|
|
|
|
initLabels();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
void MyDialog::initFlatButtons()
|
|
|
|
|
{
|
|
|
|
|
// Flat buttons
|
2020-05-02 00:07:35 +02:00
|
|
|
|
MyButton1.setGeometry(FPoint{3, 3}, FSize{5, 1});
|
2018-10-03 22:23:55 +02:00
|
|
|
|
MyButton1.setText (L"&SIN");
|
|
|
|
|
MyButton1.setStatusbarMessage ("Sine function");
|
|
|
|
|
MyButton1.setNoUnderline();
|
|
|
|
|
MyButton1.setFlat();
|
2019-04-26 21:06:04 +02:00
|
|
|
|
MyButton1.setDoubleFlatLine (fc::bottom);
|
2018-10-03 22:23:55 +02:00
|
|
|
|
|
2020-05-02 00:07:35 +02:00
|
|
|
|
MyButton2.setGeometry(FPoint{3, 5}, FSize{5, 1});
|
2018-10-03 22:23:55 +02:00
|
|
|
|
MyButton2.setText (L"&COS");
|
|
|
|
|
MyButton2.setStatusbarMessage ("Cosine function");
|
|
|
|
|
MyButton2.setNoUnderline();
|
|
|
|
|
MyButton2.setFlat();
|
2019-04-26 21:06:04 +02:00
|
|
|
|
MyButton2.setDoubleFlatLine (fc::top);
|
2018-10-03 22:23:55 +02:00
|
|
|
|
|
2020-05-02 00:07:35 +02:00
|
|
|
|
MyButton3.setGeometry(FPoint{10, 3}, FSize{5, 3});
|
2018-10-03 22:23:55 +02:00
|
|
|
|
MyButton3.setText (L"&=");
|
|
|
|
|
MyButton3.setStatusbarMessage ("Equal");
|
|
|
|
|
MyButton3.setNoUnderline();
|
|
|
|
|
MyButton3.setFlat();
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
2018-01-30 00:11:58 +01:00
|
|
|
|
// Add button callback functions
|
2018-10-03 22:23:55 +02:00
|
|
|
|
MyButton1.addCallback
|
2018-01-30 00:11:58 +01:00
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2020-08-11 23:04:46 +02:00
|
|
|
|
this, &MyDialog::cb_noFunctionMsg,
|
|
|
|
|
std::ref(MyButton1)
|
2018-01-30 00:11:58 +01:00
|
|
|
|
);
|
|
|
|
|
|
2018-10-03 22:23:55 +02:00
|
|
|
|
MyButton2.addCallback
|
2018-01-30 00:11:58 +01:00
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2020-08-11 23:04:46 +02:00
|
|
|
|
this, &MyDialog::cb_noFunctionMsg,
|
|
|
|
|
std::ref(MyButton2)
|
2018-01-30 00:11:58 +01:00
|
|
|
|
);
|
|
|
|
|
|
2018-10-03 22:23:55 +02:00
|
|
|
|
MyButton3.addCallback
|
2018-01-30 00:11:58 +01:00
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2020-08-11 23:04:46 +02:00
|
|
|
|
this, &MyDialog::cb_noFunctionMsg,
|
|
|
|
|
std::ref(MyButton3)
|
2018-01-30 00:11:58 +01:00
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
void MyDialog::initToggleButtons()
|
|
|
|
|
{
|
2015-11-01 22:45:23 +01:00
|
|
|
|
// Radio buttons in a group
|
2020-05-02 00:07:35 +02:00
|
|
|
|
radioButtonGroup.setGeometry(FPoint{3, 8}, FSize{14, 4});
|
2015-05-23 13:35:12 +02:00
|
|
|
|
//radioButtonGroup->unsetBorder();
|
|
|
|
|
|
2020-05-02 00:07:35 +02:00
|
|
|
|
radio1.setGeometry(FPoint{1, 1}, FSize{10, 1});
|
2018-10-03 22:23:55 +02:00
|
|
|
|
radio1.setStatusbarMessage ("Enable button Test");
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
2020-05-02 00:07:35 +02:00
|
|
|
|
radio2.setGeometry(FPoint{1, 2}, FSize{11, 1});
|
2018-10-03 22:23:55 +02:00
|
|
|
|
radio2.setText ("&Disable");
|
|
|
|
|
radio2.setStatusbarMessage ("Disable button Test");
|
|
|
|
|
radio2.setChecked();
|
|
|
|
|
//radio2.setDisable();
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
2015-11-01 22:45:23 +01:00
|
|
|
|
// Checkboxes in a group
|
2020-05-02 00:07:35 +02:00
|
|
|
|
checkButtonGroup.setGeometry(FPoint{3, 12}, FSize{14, 4});
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
2020-05-02 00:07:35 +02:00
|
|
|
|
check1.setGeometry(FPoint{1, 1}, FSize{11, 1});
|
2018-10-03 22:23:55 +02:00
|
|
|
|
check1.setNoUnderline();
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
2020-05-02 00:07:35 +02:00
|
|
|
|
check2.setGeometry(FPoint{1, 2}, FSize{9, 1});
|
2018-10-03 22:23:55 +02:00
|
|
|
|
check2.setChecked();
|
|
|
|
|
check2.setNoUnderline();
|
2018-01-30 00:11:58 +01:00
|
|
|
|
}
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
2018-01-30 00:11:58 +01:00
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
void MyDialog::initButtons()
|
|
|
|
|
{
|
2015-11-01 22:45:23 +01:00
|
|
|
|
// Buttons
|
2020-05-02 00:07:35 +02:00
|
|
|
|
MyButton4.setGeometry(FPoint{20, 8}, FSize{12, 1});
|
2018-10-03 22:23:55 +02:00
|
|
|
|
MyButton4.setText (L"&Get input");
|
|
|
|
|
MyButton4.setStatusbarMessage ("Take text from input field");
|
|
|
|
|
MyButton4.setFocus();
|
|
|
|
|
|
2020-05-02 00:07:35 +02:00
|
|
|
|
MyButton5.setGeometry(FPoint{20, 11}, FSize{12, 1});
|
2018-10-03 22:23:55 +02:00
|
|
|
|
MyButton5.setText (L"&Test");
|
|
|
|
|
MyButton5.setStatusbarMessage ("Progressbar testing dialog");
|
|
|
|
|
MyButton5.setDisable();
|
|
|
|
|
|
2020-05-02 00:07:35 +02:00
|
|
|
|
MyButton6.setGeometry(FPoint{20, 14}, FSize{12, 1});
|
2018-10-03 22:23:55 +02:00
|
|
|
|
MyButton6.setText (L"&Quit");
|
|
|
|
|
MyButton6.setStatusbarMessage ("Exit the program");
|
|
|
|
|
MyButton6.addAccelerator('x');
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
2018-01-30 00:11:58 +01:00
|
|
|
|
// Add button callback functions
|
2018-10-03 22:23:55 +02:00
|
|
|
|
MyButton4.addCallback
|
2018-01-30 00:11:58 +01:00
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2020-08-11 23:04:46 +02:00
|
|
|
|
this, &MyDialog::cb_input2buttonText,
|
|
|
|
|
std::ref(MyButton4), std::cref(myLineEdit)
|
2018-01-30 00:11:58 +01:00
|
|
|
|
);
|
2017-04-23 18:54:46 +02:00
|
|
|
|
|
2018-10-03 22:23:55 +02:00
|
|
|
|
MyButton5.addCallback
|
2018-01-30 00:11:58 +01:00
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2020-08-11 23:04:46 +02:00
|
|
|
|
this, &MyDialog::cb_showProgressBar
|
2018-01-30 00:11:58 +01:00
|
|
|
|
);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
2018-10-03 22:23:55 +02:00
|
|
|
|
MyButton6.addCallback
|
2018-01-30 00:11:58 +01:00
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2020-08-11 23:04:46 +02:00
|
|
|
|
finalcut::getFApplication(),
|
|
|
|
|
&finalcut::FApplication::cb_exitApp,
|
|
|
|
|
this
|
2018-01-30 00:11:58 +01:00
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
void MyDialog::initLabels()
|
|
|
|
|
{
|
2015-11-01 22:45:23 +01:00
|
|
|
|
// Text labels
|
2020-05-02 00:07:35 +02:00
|
|
|
|
headline.setGeometry(FPoint{21, 3}, FSize{10, 1});
|
2018-10-03 22:23:55 +02:00
|
|
|
|
headline.setEmphasis();
|
2019-04-26 21:06:04 +02:00
|
|
|
|
headline.setAlignment (fc::alignCenter);
|
2018-10-03 22:23:55 +02:00
|
|
|
|
headline = L"List items";
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
2020-05-02 00:07:35 +02:00
|
|
|
|
tagged.setGeometry(FPoint{21, 4}, FSize{7, 1});
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
2020-05-02 00:07:35 +02:00
|
|
|
|
tagged_count.setGeometry(FPoint{29, 4}, FSize{5, 1});
|
2018-10-03 22:23:55 +02:00
|
|
|
|
tagged_count << 0;
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
2020-05-02 00:07:35 +02:00
|
|
|
|
sum.setGeometry(FPoint{21, 5}, FSize{7, 3});
|
2019-04-26 21:06:04 +02:00
|
|
|
|
sum.setAlignment (fc::alignRight);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
2020-05-02 00:07:35 +02:00
|
|
|
|
sum_count.setGeometry(FPoint{29, 5}, FSize{5, 3});
|
2018-10-03 22:23:55 +02:00
|
|
|
|
sum_count << myList.getCount();
|
2017-11-22 23:56:21 +01:00
|
|
|
|
}
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
2017-11-22 23:56:21 +01:00
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
void MyDialog::initWidgetsCallbacks()
|
|
|
|
|
{
|
2015-11-01 22:45:23 +01:00
|
|
|
|
// Add some function callbacks
|
2017-11-22 23:56:21 +01:00
|
|
|
|
|
2018-10-03 22:23:55 +02:00
|
|
|
|
myLineEdit.addCallback
|
2015-05-23 13:35:12 +02:00
|
|
|
|
(
|
|
|
|
|
"activate", // e.g. on <Enter>
|
2020-08-11 23:04:46 +02:00
|
|
|
|
this, &MyDialog::cb_setTitlebar,
|
|
|
|
|
std::ref(myLineEdit)
|
2015-05-23 13:35:12 +02:00
|
|
|
|
);
|
|
|
|
|
|
2018-10-03 22:23:55 +02:00
|
|
|
|
radio1.addCallback
|
2015-05-23 13:35:12 +02:00
|
|
|
|
(
|
|
|
|
|
"toggled",
|
2020-08-11 23:04:46 +02:00
|
|
|
|
this, &MyDialog::cb_activateButton,
|
|
|
|
|
std::ref(radio1), std::ref(MyButton5)
|
2015-05-23 13:35:12 +02:00
|
|
|
|
);
|
|
|
|
|
|
2018-10-03 22:23:55 +02:00
|
|
|
|
myList.addCallback
|
2015-05-23 13:35:12 +02:00
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2020-08-11 23:04:46 +02:00
|
|
|
|
this, &MyDialog::cb_setInput,
|
|
|
|
|
std::ref(myList), std::ref(myLineEdit)
|
2015-05-23 13:35:12 +02:00
|
|
|
|
);
|
|
|
|
|
|
2018-10-03 22:23:55 +02:00
|
|
|
|
myList.addCallback
|
2015-05-23 13:35:12 +02:00
|
|
|
|
(
|
|
|
|
|
"row-selected",
|
2020-10-08 05:55:32 +02:00
|
|
|
|
this, &MyDialog::cb_updateNumber
|
2015-05-23 13:35:12 +02:00
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-22 23:04:40 +01:00
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
void MyDialog::adjustSize()
|
|
|
|
|
{
|
2020-10-04 00:59:21 +02:00
|
|
|
|
const auto h = getDesktopHeight() - 4;
|
2017-01-22 23:04:40 +01:00
|
|
|
|
setHeight (h, false);
|
2020-10-11 09:14:52 +02:00
|
|
|
|
finalcut::FDialog::adjustSize(); // with new client area size
|
2020-10-04 00:59:21 +02:00
|
|
|
|
auto x = int((getDesktopWidth() - getWidth()) / 2);
|
2017-01-22 23:04:40 +01:00
|
|
|
|
|
2020-09-25 00:48:58 +02:00
|
|
|
|
if ( x < 1 )
|
|
|
|
|
x = 1;
|
2017-01-22 23:04:40 +01:00
|
|
|
|
|
2020-10-04 00:59:21 +02:00
|
|
|
|
setPos (FPoint{x, 2}, false);
|
2017-01-22 23:04:40 +01:00
|
|
|
|
|
2018-10-03 22:23:55 +02:00
|
|
|
|
if ( initialized )
|
2020-10-11 09:14:52 +02:00
|
|
|
|
myList.setHeight (h - 3, true);
|
2017-01-22 23:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
|
//----------------------------------------------------------------------
|
2018-09-20 23:59:01 +02:00
|
|
|
|
void MyDialog::onClose (finalcut::FCloseEvent* ev)
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
2018-09-20 23:59:01 +02:00
|
|
|
|
finalcut::FApplication::closeConfirmationDialog (this, ev);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2020-08-23 00:32:41 +02:00
|
|
|
|
void MyDialog::cb_noFunctionMsg (const finalcut::FButton& button)
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
2018-12-19 22:04:02 +01:00
|
|
|
|
auto text = button.getText();
|
2015-05-23 13:35:12 +02:00
|
|
|
|
text = text.replace('&', "");
|
2018-09-20 23:59:01 +02:00
|
|
|
|
finalcut::FMessageBox::error ( this
|
|
|
|
|
, "The \"" + text + "\" button has\n"
|
|
|
|
|
"no function");
|
2015-05-23 13:35:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2020-08-11 23:04:46 +02:00
|
|
|
|
void MyDialog::cb_about()
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
2018-12-26 23:41:49 +01:00
|
|
|
|
constexpr char libver[] = F_VERSION;
|
2019-04-26 21:06:04 +02:00
|
|
|
|
const finalcut::FString line(2, fc::BoxDrawingsHorizontal);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
2018-09-20 23:59:01 +02:00
|
|
|
|
finalcut::FMessageBox info ( "About"
|
2020-07-08 21:32:47 +02:00
|
|
|
|
, line + L" FINAL CUT " + line + L"\n\n"
|
2020-04-13 12:40:11 +02:00
|
|
|
|
L"Version " + libver + L"\n\n"
|
2020-01-20 21:40:00 +01:00
|
|
|
|
L"(c) 2020 by Markus Gans"
|
2020-10-04 00:59:21 +02:00
|
|
|
|
, finalcut::FMessageBox::Ok
|
|
|
|
|
, finalcut::FMessageBox::Reject
|
|
|
|
|
, finalcut::FMessageBox::Reject
|
|
|
|
|
, this );
|
2015-05-23 13:35:12 +02:00
|
|
|
|
info.setCenterText();
|
|
|
|
|
info.show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2020-08-11 23:04:46 +02:00
|
|
|
|
void MyDialog::cb_terminfo()
|
2015-10-29 21:10:50 +01:00
|
|
|
|
{
|
2020-02-02 22:34:27 +01:00
|
|
|
|
const auto x = getDesktopWidth();
|
|
|
|
|
const auto y = getDesktopHeight();
|
2018-09-20 23:59:01 +02:00
|
|
|
|
finalcut::FMessageBox info1 \
|
|
|
|
|
(
|
|
|
|
|
"Environment"
|
2020-05-02 00:07:35 +02:00
|
|
|
|
, finalcut::FString{}
|
2020-05-16 22:24:36 +02:00
|
|
|
|
<< " Type: " << finalcut::FTerm::getTermType() << "\n"
|
|
|
|
|
<< " Name: " << finalcut::FTerm::getTermFileName() << "\n"
|
|
|
|
|
<< " Mode: " << finalcut::FTerm::getEncodingString() << "\n"
|
2019-04-26 21:06:04 +02:00
|
|
|
|
<< " Size: " << x << fc::Times
|
2018-09-20 23:59:01 +02:00
|
|
|
|
<< y << "\n"
|
2020-05-16 22:24:36 +02:00
|
|
|
|
<< "Colors: " << finalcut::FTerm::getMaxColor()
|
2020-10-04 00:59:21 +02:00
|
|
|
|
, finalcut::FMessageBox::Ok
|
|
|
|
|
, finalcut::FMessageBox::Reject
|
|
|
|
|
, finalcut::FMessageBox::Reject
|
|
|
|
|
, this
|
2018-09-20 23:59:01 +02:00
|
|
|
|
);
|
2015-10-29 21:10:50 +01:00
|
|
|
|
info1.setHeadline("Terminal:");
|
|
|
|
|
info1.exec();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2020-08-11 23:04:46 +02:00
|
|
|
|
void MyDialog::cb_drives()
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
2018-09-20 23:59:01 +02:00
|
|
|
|
finalcut::FMessageBox info2 \
|
|
|
|
|
(
|
|
|
|
|
"Drive symbols"
|
|
|
|
|
, "Generic: \n\n"
|
|
|
|
|
"Network: \n\n"
|
|
|
|
|
" CD:"
|
2020-10-04 00:59:21 +02:00
|
|
|
|
, finalcut::FMessageBox::Ok
|
|
|
|
|
, finalcut::FMessageBox::Reject
|
|
|
|
|
, finalcut::FMessageBox::Reject
|
|
|
|
|
, this
|
2018-09-20 23:59:01 +02:00
|
|
|
|
);
|
|
|
|
|
|
2020-05-16 22:24:36 +02:00
|
|
|
|
if ( finalcut::FTerm::isNewFont() )
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
2020-05-02 00:07:35 +02:00
|
|
|
|
finalcut::FLabel drive {finalcut::NF_Drive, &info2};
|
|
|
|
|
drive.setGeometry (FPoint{11, 2}, FSize{4, 1});
|
|
|
|
|
finalcut::FLabel net {finalcut::NF_Net_Drive, &info2};
|
|
|
|
|
net.setGeometry (FPoint{11, 4}, FSize{4, 1});
|
|
|
|
|
finalcut::FLabel cd {finalcut::NF_CD_ROM, &info2};
|
|
|
|
|
cd.setGeometry (FPoint{11, 6}, FSize{4, 1});
|
2015-05-23 13:35:12 +02:00
|
|
|
|
info2.exec();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-05-02 00:07:35 +02:00
|
|
|
|
finalcut::FLabel drive {" - ", &info2};
|
|
|
|
|
drive.setGeometry (FPoint{11, 2}, FSize{4, 1});
|
|
|
|
|
finalcut::FLabel net {" N ", &info2};
|
|
|
|
|
net.setGeometry (FPoint{11, 4}, FSize{4, 1});
|
|
|
|
|
finalcut::FLabel cd {" CD ", &info2};
|
|
|
|
|
cd.setGeometry (FPoint{11, 6}, FSize{4, 1});
|
2016-07-09 00:01:59 +02:00
|
|
|
|
|
2020-05-16 22:24:36 +02:00
|
|
|
|
if ( finalcut::FTerm::isMonochron() )
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
|
|
|
|
net.setReverseMode();
|
|
|
|
|
drive.setReverseMode();
|
|
|
|
|
cd.setReverseMode();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2019-04-26 21:06:04 +02:00
|
|
|
|
net.setForegroundColor (fc::White);
|
|
|
|
|
net.setBackgroundColor (fc::DarkGray);
|
|
|
|
|
drive.setForegroundColor (fc::White);
|
|
|
|
|
drive.setBackgroundColor (fc::DarkGray);
|
|
|
|
|
cd.setForegroundColor (fc::White);
|
|
|
|
|
cd.setBackgroundColor (fc::DarkGray);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
}
|
2016-07-09 00:01:59 +02:00
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
|
info2.exec();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-29 15:58:36 +01:00
|
|
|
|
//----------------------------------------------------------------------
|
2020-08-11 23:04:46 +02:00
|
|
|
|
void MyDialog::cb_cutClipboard()
|
2015-11-29 15:58:36 +01:00
|
|
|
|
{
|
2018-10-03 22:23:55 +02:00
|
|
|
|
clipboard = myLineEdit.getText();
|
|
|
|
|
myLineEdit.clear();
|
|
|
|
|
myLineEdit.redraw();
|
2015-11-29 15:58:36 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2020-08-11 23:04:46 +02:00
|
|
|
|
void MyDialog::cb_copyClipboard()
|
2015-11-29 15:58:36 +01:00
|
|
|
|
{
|
2018-10-03 22:23:55 +02:00
|
|
|
|
clipboard = myLineEdit.getText();
|
2015-11-29 15:58:36 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2020-08-11 23:04:46 +02:00
|
|
|
|
void MyDialog::cb_pasteClipboard()
|
2015-11-29 15:58:36 +01:00
|
|
|
|
{
|
2018-10-03 22:23:55 +02:00
|
|
|
|
myLineEdit = clipboard;
|
|
|
|
|
myLineEdit.redraw();
|
2015-11-29 15:58:36 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2020-08-11 23:04:46 +02:00
|
|
|
|
void MyDialog::cb_clearInput()
|
2015-11-29 15:58:36 +01:00
|
|
|
|
{
|
|
|
|
|
clipboard.clear();
|
2018-10-03 22:23:55 +02:00
|
|
|
|
myLineEdit.clear();
|
|
|
|
|
myLineEdit.redraw();
|
2015-11-29 15:58:36 +01:00
|
|
|
|
}
|
|
|
|
|
|
2020-05-30 23:02:53 +02:00
|
|
|
|
//----------------------------------------------------------------------
|
2020-10-14 17:31:52 +02:00
|
|
|
|
void MyDialog::cb_switchTheme (const finalcut::FCheckMenuItem* check_menu)
|
2020-05-30 23:02:53 +02:00
|
|
|
|
{
|
2020-08-11 23:04:46 +02:00
|
|
|
|
if ( check_menu->isChecked() )
|
2020-05-30 23:02:53 +02:00
|
|
|
|
finalcut::FApplication::setDarkTheme();
|
|
|
|
|
else
|
|
|
|
|
finalcut::FApplication::setDefaultTheme();
|
|
|
|
|
|
|
|
|
|
auto root_widget = getRootWidget();
|
|
|
|
|
root_widget->resetColors();
|
|
|
|
|
root_widget->redraw();
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
|
//----------------------------------------------------------------------
|
2020-08-11 23:04:46 +02:00
|
|
|
|
void MyDialog::cb_input2buttonText ( finalcut::FButton& button
|
|
|
|
|
, const finalcut::FLineEdit& lineedit ) const
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
2018-12-19 22:04:02 +01:00
|
|
|
|
button.setText(lineedit.getText());
|
|
|
|
|
button.redraw();
|
2015-05-23 13:35:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2020-08-12 22:28:02 +02:00
|
|
|
|
void MyDialog::cb_setTitlebar (const finalcut::FLineEdit& lineedit)
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
2020-05-02 00:07:35 +02:00
|
|
|
|
finalcut::FString title{};
|
2018-12-19 22:04:02 +01:00
|
|
|
|
lineedit >> title;
|
2020-05-16 22:24:36 +02:00
|
|
|
|
finalcut::FTerm::setTermTitle (title);
|
2018-05-20 15:15:42 +02:00
|
|
|
|
setText (title);
|
2015-09-24 19:01:27 +02:00
|
|
|
|
redraw();
|
2015-05-23 13:35:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2020-08-11 23:04:46 +02:00
|
|
|
|
void MyDialog::cb_showProgressBar()
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
2018-12-15 00:50:09 +01:00
|
|
|
|
auto p_dgl = new ProgressDialog(this);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
p_dgl->show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2020-10-08 05:55:32 +02:00
|
|
|
|
void MyDialog::cb_updateNumber()
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
|
|
|
|
int select_num = 0;
|
2016-07-09 00:01:59 +02:00
|
|
|
|
|
2020-10-08 05:55:32 +02:00
|
|
|
|
for (auto&& item : myList.getData() )
|
|
|
|
|
if ( item.isSelected() )
|
2015-05-23 13:35:12 +02:00
|
|
|
|
select_num++;
|
2016-07-09 00:01:59 +02:00
|
|
|
|
|
2020-10-08 05:55:32 +02:00
|
|
|
|
tagged_count.clear();
|
|
|
|
|
tagged_count << select_num;
|
|
|
|
|
tagged_count.redraw();
|
2015-05-23 13:35:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2020-08-12 22:28:02 +02:00
|
|
|
|
void MyDialog::cb_activateButton ( const finalcut::FRadioButton& rb
|
2020-08-11 23:04:46 +02:00
|
|
|
|
, finalcut::FButton& button) const
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
2018-12-19 22:04:02 +01:00
|
|
|
|
if ( rb.isChecked() )
|
|
|
|
|
button.setEnable();
|
2015-05-23 13:35:12 +02:00
|
|
|
|
else
|
2018-12-19 22:04:02 +01:00
|
|
|
|
button.setDisable();
|
2016-07-09 00:01:59 +02:00
|
|
|
|
|
2018-12-19 22:04:02 +01:00
|
|
|
|
button.redraw();
|
2015-05-23 13:35:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2020-08-12 22:28:02 +02:00
|
|
|
|
void MyDialog::cb_view (const finalcut::FMenuItem* item)
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
2020-05-02 00:07:35 +02:00
|
|
|
|
finalcut::FString file{};
|
2015-12-12 00:50:59 +01:00
|
|
|
|
|
2018-03-21 00:02:43 +01:00
|
|
|
|
if ( item && ! item->getText().isEmpty() )
|
2015-11-29 15:58:36 +01:00
|
|
|
|
file = item->getText();
|
|
|
|
|
else
|
2018-09-20 23:59:01 +02:00
|
|
|
|
file = finalcut::FFileDialog::fileOpenChooser (this);
|
2016-07-09 00:01:59 +02:00
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
|
if ( file.isNull() )
|
|
|
|
|
return;
|
|
|
|
|
|
2018-12-19 22:04:02 +01:00
|
|
|
|
const auto& view = new TextWindow(this);
|
2018-09-20 23:59:01 +02:00
|
|
|
|
finalcut::FString filename(basename(const_cast<char*>(file.c_str())));
|
2016-07-03 20:08:39 +02:00
|
|
|
|
view->setText ("Viewer: " + filename);
|
2020-05-02 00:07:35 +02:00
|
|
|
|
view->setGeometry ( FPoint { 1 + int((getRootWidget()->getWidth() - 60) / 2),
|
|
|
|
|
int(getRootWidget()->getHeight() / 6) }
|
|
|
|
|
, FSize{60, getRootWidget()->getHeight() * 3 / 4} );
|
2016-09-11 16:48:39 +02:00
|
|
|
|
view->setResizeable();
|
2020-05-13 23:47:14 +02:00
|
|
|
|
std::string line{""};
|
2015-05-23 13:35:12 +02:00
|
|
|
|
std::ifstream infile;
|
2020-10-13 12:55:28 +02:00
|
|
|
|
infile.open(file.c_str());
|
2016-07-09 00:01:59 +02:00
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
|
while ( ! infile.eof() && infile.good() )
|
|
|
|
|
{
|
|
|
|
|
getline(infile, line);
|
2016-09-11 16:48:39 +02:00
|
|
|
|
view->append(line);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
}
|
2016-07-09 00:01:59 +02:00
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
|
if ( infile.is_open() )
|
|
|
|
|
infile.close();
|
2016-07-09 00:01:59 +02:00
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
|
view->show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2020-08-23 00:32:41 +02:00
|
|
|
|
void MyDialog::cb_setInput ( const finalcut::FListBox& listbox
|
2020-08-11 23:04:46 +02:00
|
|
|
|
, finalcut::FLineEdit& lineedit) const
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
2020-08-11 23:04:46 +02:00
|
|
|
|
lineedit = listbox.getItem(listbox.currentItem()).getText();
|
2018-12-19 22:04:02 +01:00
|
|
|
|
lineedit.redraw();
|
2015-05-23 13:35:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
// main part
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
int main (int argc, char* argv[])
|
|
|
|
|
{
|
2019-08-25 22:16:00 +02:00
|
|
|
|
const finalcut::FString ver{F_VERSION}; // Library version
|
2020-07-08 21:32:47 +02:00
|
|
|
|
const finalcut::FString title { "FINAL CUT " + ver
|
2020-01-20 21:40:00 +01:00
|
|
|
|
+ " (C) 2020 by Markus Gans" };
|
2015-12-19 22:01:48 +01:00
|
|
|
|
|
2017-09-19 06:18:03 +02:00
|
|
|
|
// Create the application object app
|
2020-05-02 00:07:35 +02:00
|
|
|
|
finalcut::FApplication app{argc, argv};
|
2020-03-05 21:30:54 +01:00
|
|
|
|
app.setNonBlockingRead();
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
2017-09-19 06:18:03 +02:00
|
|
|
|
// Create main dialog object d
|
2020-05-02 00:07:35 +02:00
|
|
|
|
MyDialog d{&app};
|
2015-12-19 22:01:48 +01:00
|
|
|
|
d.setText (title);
|
2020-10-04 00:59:21 +02:00
|
|
|
|
d.setSize (FSize{56, app.getHeight() - 4});
|
2020-10-05 04:24:14 +02:00
|
|
|
|
d.setShadow(); // Instead of the transparent window shadow
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
2017-09-19 06:18:03 +02:00
|
|
|
|
// Set the dialog object d as the main widget of the application.
|
|
|
|
|
// When you close the main widget, the application will be closed.
|
2020-04-13 12:40:11 +02:00
|
|
|
|
finalcut::FWidget::setMainWidget(&d);
|
2017-09-19 06:18:03 +02:00
|
|
|
|
|
|
|
|
|
// Show the dialog d
|
2015-05-23 13:35:12 +02:00
|
|
|
|
d.show();
|
2017-09-19 06:18:03 +02:00
|
|
|
|
|
2020-06-06 21:10:06 +02:00
|
|
|
|
finalcut::FTerm::redefineDefaultColors(true);
|
|
|
|
|
finalcut::FTerm::setTermTitle (title);
|
|
|
|
|
|
|
|
|
|
// Sets the terminal size to 94×30
|
|
|
|
|
//finalcut::FTerm::setTermSize(FSize{94, 30});
|
|
|
|
|
|
|
|
|
|
// Enable the final cut graphical font
|
|
|
|
|
//finalcut::FTerm::setNewFont();
|
|
|
|
|
|
2017-09-19 06:18:03 +02:00
|
|
|
|
// Start the application
|
|
|
|
|
// and return the result to the operating system
|
2015-05-23 13:35:12 +02:00
|
|
|
|
return app.exec();
|
|
|
|
|
}
|