2017-11-04 07:03:53 +01:00
|
|
|
|
/***********************************************************************
|
|
|
|
|
* ui.cpp - Example of a user interface *
|
|
|
|
|
* *
|
|
|
|
|
* This file is part of the Final Cut widget toolkit *
|
|
|
|
|
* *
|
2018-01-02 20:38:45 +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
|
|
|
|
|
|
|
|
|
#include <fstream>
|
2017-09-11 03:06:02 +02:00
|
|
|
|
#include <iostream>
|
|
|
|
|
#include <string>
|
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
|
|
|
|
|
2015-12-18 21:48:27 +01:00
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
// class ProgressDialog
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
#pragma pack(push)
|
|
|
|
|
#pragma pack(1)
|
|
|
|
|
|
|
|
|
|
class ProgressDialog : public FDialog
|
|
|
|
|
{
|
2017-09-11 03:06:02 +02:00
|
|
|
|
public:
|
|
|
|
|
// Constructor
|
|
|
|
|
explicit ProgressDialog (FWidget* = 0);
|
2018-05-20 15:15:42 +02:00
|
|
|
|
|
2017-09-11 03:06:02 +02:00
|
|
|
|
// Destructor
|
|
|
|
|
~ProgressDialog();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
// Disable copy constructor
|
|
|
|
|
ProgressDialog (const ProgressDialog&);
|
|
|
|
|
// Disable assignment operator (=)
|
|
|
|
|
ProgressDialog& operator = (const ProgressDialog&);
|
|
|
|
|
|
|
|
|
|
// Event handlers
|
|
|
|
|
void onShow (FShowEvent*);
|
|
|
|
|
void onTimer (FTimerEvent*);
|
|
|
|
|
|
|
|
|
|
// Callback methods
|
|
|
|
|
void cb_reset_bar (FWidget*, data_ptr);
|
|
|
|
|
void cb_more_bar (FWidget*, data_ptr);
|
|
|
|
|
void cb_exit_bar (FWidget*, data_ptr);
|
|
|
|
|
|
|
|
|
|
// Data Members
|
|
|
|
|
FProgressbar* progressBar;
|
|
|
|
|
FButton* reset;
|
|
|
|
|
FButton* more;
|
|
|
|
|
FButton* quit;
|
2015-05-23 13:35:12 +02:00
|
|
|
|
};
|
|
|
|
|
#pragma pack(pop)
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2015-09-24 19:01:27 +02:00
|
|
|
|
ProgressDialog::ProgressDialog (FWidget* parent)
|
|
|
|
|
: FDialog(parent)
|
2015-12-18 21:48:27 +01:00
|
|
|
|
, progressBar()
|
2015-09-24 19:01:27 +02:00
|
|
|
|
, reset()
|
|
|
|
|
, more()
|
|
|
|
|
, quit()
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
2017-09-17 01:50:41 +02:00
|
|
|
|
setGeometry (int((getParentWidget()->getWidth() - 40) / 2), 7, 40, 10);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
setText("Progress bar");
|
|
|
|
|
//setModal();
|
|
|
|
|
|
|
|
|
|
reset = new FButton(this);
|
|
|
|
|
reset->setText("&Reset");
|
2016-06-18 19:10:41 +02:00
|
|
|
|
reset->setStatusbarMessage ("Reset the progress bar");
|
2015-05-23 13:35:12 +02:00
|
|
|
|
reset->setGeometry(2, 6, 8, 1, false);
|
|
|
|
|
reset->setDisable();
|
|
|
|
|
|
|
|
|
|
more = new FButton(this);
|
|
|
|
|
more->setText("&More");
|
2016-06-18 19:10:41 +02:00
|
|
|
|
more->setStatusbarMessage ("Increases the progress bar position");
|
2015-05-23 13:35:12 +02:00
|
|
|
|
more->setGeometry(15, 6, 8, 1, false);
|
|
|
|
|
more->setDisable();
|
|
|
|
|
|
|
|
|
|
quit = new FButton(this);
|
|
|
|
|
quit->setText("E&xit");
|
|
|
|
|
quit->setGeometry(28, 6, 8, 1, false);
|
|
|
|
|
quit->setDisable();
|
|
|
|
|
|
|
|
|
|
progressBar = new FProgressbar(this);
|
|
|
|
|
progressBar->setGeometry(2, 3, 34, 1, false);
|
2016-09-25 23:53:48 +02:00
|
|
|
|
//progressBar->setPercentage(78);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
|
|
reset->addCallback
|
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2017-04-09 20:08:53 +02:00
|
|
|
|
F_METHOD_CALLBACK (this, &ProgressDialog::cb_reset_bar)
|
2015-05-23 13:35:12 +02:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
more->addCallback
|
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2017-04-09 20:08:53 +02:00
|
|
|
|
F_METHOD_CALLBACK (this, &ProgressDialog::cb_more_bar)
|
2015-05-23 13:35:12 +02:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
quit->addCallback
|
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2017-04-09 20:08:53 +02:00
|
|
|
|
F_METHOD_CALLBACK (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
|
|
|
|
{
|
2015-12-19 20:49:01 +01:00
|
|
|
|
delOwnTimer();
|
2015-05-23 13:35:12 +02:00
|
|
|
|
delCallback(quit);
|
|
|
|
|
delCallback(more);
|
|
|
|
|
delCallback(reset);
|
|
|
|
|
delete(progressBar);
|
|
|
|
|
delete(quit);
|
|
|
|
|
delete(more);
|
|
|
|
|
delete(reset);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
void ProgressDialog::onShow (FShowEvent*)
|
|
|
|
|
{
|
2015-07-02 01:00:30 +02:00
|
|
|
|
addTimer(15);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
void ProgressDialog::onTimer (FTimerEvent*)
|
|
|
|
|
{
|
|
|
|
|
int p = progressBar->getPercentage();
|
2015-07-02 21:21:18 +02:00
|
|
|
|
progressBar->setPercentage(++p);
|
|
|
|
|
flush_out();
|
2015-07-02 01:00:30 +02:00
|
|
|
|
|
2016-10-17 08:44:38 +02:00
|
|
|
|
if ( p != 100 )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
delOwnTimer();
|
|
|
|
|
activateWindow();
|
|
|
|
|
raiseWindow();
|
|
|
|
|
reset->setEnable();
|
|
|
|
|
reset->setFocus();
|
|
|
|
|
more->setEnable();
|
|
|
|
|
quit->setEnable();
|
|
|
|
|
redraw();
|
|
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
|
if ( getStatusBar() )
|
|
|
|
|
getStatusBar()->drawMessage();
|
2016-10-17 08:44:38 +02:00
|
|
|
|
|
|
|
|
|
updateTerminal();
|
|
|
|
|
flush_out();
|
2015-05-23 13:35:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2017-02-24 00:30:07 +01:00
|
|
|
|
void ProgressDialog::cb_reset_bar (FWidget*, data_ptr)
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
|
|
|
|
progressBar->reset();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2017-02-24 00:30:07 +01:00
|
|
|
|
void ProgressDialog::cb_more_bar (FWidget*, data_ptr)
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
|
|
|
|
int p = progressBar->getPercentage();
|
|
|
|
|
progressBar->setPercentage(++p);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2017-02-24 00:30:07 +01:00
|
|
|
|
void ProgressDialog::cb_exit_bar (FWidget*, data_ptr)
|
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
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
#pragma pack(push)
|
|
|
|
|
#pragma pack(1)
|
|
|
|
|
|
|
|
|
|
class TextWindow : public FDialog
|
|
|
|
|
{
|
2017-09-11 03:06:02 +02:00
|
|
|
|
public:
|
|
|
|
|
// Constructor
|
|
|
|
|
explicit TextWindow (FWidget* = 0);
|
2018-05-20 15:15:42 +02:00
|
|
|
|
|
2017-09-11 03:06:02 +02:00
|
|
|
|
// Destructor
|
|
|
|
|
~TextWindow();
|
2016-11-02 00:37:58 +01:00
|
|
|
|
|
2017-09-11 03:06:02 +02:00
|
|
|
|
void append (const FString&);
|
2016-09-11 16:48:39 +02:00
|
|
|
|
|
2017-09-11 03:06:02 +02:00
|
|
|
|
private:
|
|
|
|
|
// Disable copy constructor
|
|
|
|
|
TextWindow (const TextWindow&);
|
|
|
|
|
// Disable assignment operator (=)
|
|
|
|
|
TextWindow& operator = (const TextWindow&);
|
2016-09-30 04:55:28 +02:00
|
|
|
|
|
2018-05-20 15:15:42 +02:00
|
|
|
|
// Method
|
2017-09-11 03:06:02 +02:00
|
|
|
|
void adjustSize();
|
2016-09-11 16:48:39 +02:00
|
|
|
|
|
2017-09-11 03:06:02 +02:00
|
|
|
|
// Data Members
|
|
|
|
|
FTextView* scrollText;
|
2016-09-11 16:48:39 +02:00
|
|
|
|
};
|
|
|
|
|
#pragma pack(pop)
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
TextWindow::TextWindow (FWidget* parent)
|
|
|
|
|
: FDialog(parent)
|
|
|
|
|
, scrollText()
|
|
|
|
|
{
|
|
|
|
|
scrollText = new FTextView(this);
|
|
|
|
|
scrollText->ignorePadding();
|
2017-08-27 09:50:30 +02:00
|
|
|
|
scrollText->setGeometry (1, 2, getWidth(), getHeight() - 1);
|
2016-09-29 04:29:12 +02:00
|
|
|
|
setMinimumSize (51, 6);
|
2016-09-11 16:48:39 +02:00
|
|
|
|
scrollText->setFocus();
|
|
|
|
|
scrollText->insert(" -----------------------------------------------\n"
|
|
|
|
|
" line 1\n"
|
|
|
|
|
" -----------------------------------------------\n"
|
|
|
|
|
" line 3\n"
|
|
|
|
|
" line 4"
|
|
|
|
|
, -1);
|
|
|
|
|
scrollText->replaceRange(" File viewer", 1, 1);
|
|
|
|
|
scrollText->deleteRange(3, 4);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2017-09-11 03:06:02 +02:00
|
|
|
|
TextWindow::~TextWindow() // destructor
|
2016-09-11 16:48:39 +02:00
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
void TextWindow::append (const FString& str)
|
|
|
|
|
{
|
|
|
|
|
scrollText->append(str);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
void TextWindow::adjustSize()
|
|
|
|
|
{
|
|
|
|
|
FDialog::adjustSize();
|
2017-08-27 09:50:30 +02:00
|
|
|
|
scrollText->setGeometry (1, 2, getWidth(), getHeight() - 1);
|
2016-09-11 16:48:39 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
// class MyDialog
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
#pragma pack(push)
|
|
|
|
|
#pragma pack(1)
|
|
|
|
|
|
|
|
|
|
class MyDialog : public FDialog
|
|
|
|
|
{
|
2017-09-11 03:06:02 +02:00
|
|
|
|
public:
|
|
|
|
|
// Constructor
|
|
|
|
|
explicit MyDialog (FWidget* = 0);
|
|
|
|
|
// Destructor
|
|
|
|
|
~MyDialog();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
// Disable copy constructor
|
|
|
|
|
MyDialog (const MyDialog&);
|
|
|
|
|
// Disable assignment operator (=)
|
|
|
|
|
MyDialog& operator = (const MyDialog&);
|
|
|
|
|
|
|
|
|
|
// Method
|
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-02 16:05:34 +01:00
|
|
|
|
void initStatusBar();
|
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();
|
2017-09-11 03:06:02 +02:00
|
|
|
|
void adjustSize();
|
|
|
|
|
|
|
|
|
|
// Event handlers
|
|
|
|
|
void onClose (FCloseEvent*);
|
|
|
|
|
|
|
|
|
|
// Callback methods
|
|
|
|
|
void cb_noFunctionMsg (FWidget*, data_ptr);
|
|
|
|
|
void cb_about (FWidget*, data_ptr);
|
|
|
|
|
void cb_terminfo (FWidget*, data_ptr);
|
|
|
|
|
void cb_drives (FWidget*, data_ptr);
|
|
|
|
|
void cb_cutClipboard (FWidget*, data_ptr);
|
|
|
|
|
void cb_copyClipboard (FWidget*, data_ptr);
|
|
|
|
|
void cb_pasteClipboard (FWidget*, data_ptr);
|
|
|
|
|
void cb_clearInput (FWidget*, data_ptr);
|
|
|
|
|
void cb_input2buttonText (FWidget*, data_ptr);
|
|
|
|
|
void cb_setTitlebar (FWidget*, data_ptr);
|
|
|
|
|
void cb_ProgressBar (FWidget*, data_ptr);
|
|
|
|
|
void cb_updateNumber (FWidget*, data_ptr);
|
|
|
|
|
void cb_activateButton (FWidget*, data_ptr);
|
|
|
|
|
void cb_view (FWidget*, data_ptr);
|
|
|
|
|
void cb_setInput (FWidget*, data_ptr);
|
|
|
|
|
|
|
|
|
|
// Data Members
|
2017-11-22 23:56:21 +01:00
|
|
|
|
FMenuItem* Open;
|
|
|
|
|
FMenuItem* Quit;
|
|
|
|
|
FMenuItem* File1;
|
|
|
|
|
FMenuItem* File2;
|
|
|
|
|
FMenuItem* File3;
|
|
|
|
|
FMenuItem* Cut;
|
|
|
|
|
FMenuItem* Copy;
|
|
|
|
|
FMenuItem* Paste;
|
|
|
|
|
FMenuItem* Clear;
|
|
|
|
|
FMenuItem* Env;
|
|
|
|
|
FMenuItem* Drive;
|
|
|
|
|
FMenuItem* Help;
|
|
|
|
|
FStatusKey* key_F1;
|
|
|
|
|
FStatusKey* key_F2;
|
|
|
|
|
FStatusKey* key_F3;
|
|
|
|
|
FButton* MyButton1;
|
|
|
|
|
FButton* MyButton2;
|
|
|
|
|
FButton* MyButton3;
|
|
|
|
|
FButton* MyButton4;
|
|
|
|
|
FButton* MyButton5;
|
|
|
|
|
FButton* MyButton6;
|
|
|
|
|
FRadioButton* radio1;
|
|
|
|
|
FLabel* tagged_count;
|
|
|
|
|
FLineEdit* myLineEdit;
|
|
|
|
|
FListBox* myList;
|
|
|
|
|
FString clipboard;
|
2015-05-23 13:35:12 +02:00
|
|
|
|
};
|
|
|
|
|
#pragma pack(pop)
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2015-09-24 19:01:27 +02:00
|
|
|
|
MyDialog::MyDialog (FWidget* parent)
|
|
|
|
|
: FDialog(parent)
|
2017-12-10 15:36:02 +01:00
|
|
|
|
, Open()
|
|
|
|
|
, Quit()
|
|
|
|
|
, File1()
|
|
|
|
|
, File2()
|
|
|
|
|
, File3()
|
|
|
|
|
, Cut()
|
|
|
|
|
, Copy()
|
|
|
|
|
, Paste()
|
|
|
|
|
, Clear()
|
|
|
|
|
, Env()
|
|
|
|
|
, Drive()
|
|
|
|
|
, Help()
|
|
|
|
|
, key_F1()
|
|
|
|
|
, key_F2()
|
|
|
|
|
, key_F3()
|
|
|
|
|
, MyButton1()
|
|
|
|
|
, MyButton2()
|
|
|
|
|
, MyButton3()
|
|
|
|
|
, MyButton4()
|
|
|
|
|
, MyButton5()
|
|
|
|
|
, MyButton6()
|
|
|
|
|
, radio1()
|
|
|
|
|
, tagged_count()
|
2015-11-29 15:58:36 +01:00
|
|
|
|
, myLineEdit()
|
2015-09-24 19:01:27 +02:00
|
|
|
|
, myList()
|
2015-11-29 15:58:36 +01:00
|
|
|
|
, clipboard()
|
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
|
|
|
|
|
initStatusBar(); // Initialize the status bar
|
|
|
|
|
initStatusBarCallbacks(); // Initialize status bar callbacks
|
|
|
|
|
initWidgets(); // Initialize the dialog widgets
|
2017-11-22 23:56:21 +01:00
|
|
|
|
initWidgetsCallbacks(); // Initialize dialog widget callbacks
|
2017-11-02 16:05:34 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
MyDialog::~MyDialog() // destructor
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
void MyDialog::initMenu()
|
|
|
|
|
{
|
|
|
|
|
// Menu bar
|
2015-11-12 01:33:16 +01:00
|
|
|
|
FMenuBar* Menubar = new FMenuBar (this);
|
2015-09-24 19:01:27 +02:00
|
|
|
|
|
2017-11-02 16:05:34 +01:00
|
|
|
|
// Menu bar items
|
2015-11-12 01:33:16 +01:00
|
|
|
|
FMenu* File = new FMenu ("&File", Menubar);
|
|
|
|
|
File->setStatusbarMessage ("File management commands");
|
|
|
|
|
FMenu* Edit = new FMenu ("&Edit", Menubar);
|
|
|
|
|
Edit->setStatusbarMessage ("Cut-and-paste editing commands");
|
|
|
|
|
FMenu* View = new FMenu ("&View", Menubar);
|
|
|
|
|
View->setStatusbarMessage ("Show internal informations");
|
2015-12-11 06:04:29 +01:00
|
|
|
|
FMenuItem* Options = new FMenuItem ("&Options", Menubar);
|
2015-11-12 01:33:16 +01:00
|
|
|
|
Options->setStatusbarMessage ("Set program defaults");
|
2015-12-11 06:04:29 +01:00
|
|
|
|
Options->setDisable();
|
2016-07-03 20:08:39 +02:00
|
|
|
|
FDialogListMenu* Window = new FDialogListMenu ("&Window", Menubar);
|
|
|
|
|
Window->setStatusbarMessage ("List of all the active dialogs");
|
2017-11-19 19:47:24 +01:00
|
|
|
|
Help = new FMenuItem ("&Help", Menubar);
|
2015-11-12 01:33:16 +01:00
|
|
|
|
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
|
2017-11-19 19:47:24 +01:00
|
|
|
|
Open = new FMenuItem ("&Open...", File);
|
2017-09-11 03:06:02 +02:00
|
|
|
|
Open->addAccelerator (fc::Fckey_o); // Ctrl + O
|
2015-11-12 01:33:16 +01:00
|
|
|
|
Open->setStatusbarMessage ("Locate and open a text file");
|
2015-12-08 21:05:00 +01:00
|
|
|
|
FMenu* Recent = new FMenu ("&System files", File);
|
2015-11-29 15:58:36 +01:00
|
|
|
|
Recent->setStatusbarMessage ("View text file");
|
|
|
|
|
|
2015-11-12 01:33:16 +01:00
|
|
|
|
FMenuItem* Line1 = new FMenuItem (File);
|
2015-11-01 22:45:23 +01:00
|
|
|
|
Line1->setSeparator();
|
2017-11-19 19:47:24 +01:00
|
|
|
|
Quit = new FMenuItem ("&Quit", File);
|
2017-09-11 03:06:02 +02:00
|
|
|
|
Quit->addAccelerator (fc::Fmkey_x); // Meta/Alt + X
|
2015-11-12 01:33:16 +01:00
|
|
|
|
Quit->setStatusbarMessage ("Exit the program");
|
2015-10-10 03:14:14 +02:00
|
|
|
|
|
2015-11-29 15:58:36 +01:00
|
|
|
|
// "Recent" menu items
|
2017-11-19 19:47:24 +01:00
|
|
|
|
File1 = new FMenuItem ("/etc/services", Recent);
|
|
|
|
|
File2 = new FMenuItem ("/etc/fstab", Recent);
|
|
|
|
|
File3 = new FMenuItem ("/etc/passwd", Recent);
|
2015-11-29 15:58:36 +01:00
|
|
|
|
|
2015-11-01 22:45:23 +01:00
|
|
|
|
// "Edit" menu items
|
2015-11-12 23:14:12 +01:00
|
|
|
|
FMenuItem* Undo = new FMenuItem (fc::Fckey_z, "Undo", Edit);
|
2015-11-01 22:45:23 +01:00
|
|
|
|
Undo->setDisable();
|
2015-11-12 23:14:12 +01:00
|
|
|
|
FMenuItem* Redo = new FMenuItem (fc::Fckey_y, "Redo", Edit);
|
2015-11-01 22:45:23 +01:00
|
|
|
|
Redo->setDisable();
|
2015-11-12 01:33:16 +01:00
|
|
|
|
FMenuItem* Line2 = new FMenuItem (Edit);
|
2015-11-01 22:45:23 +01:00
|
|
|
|
Line2->setSeparator();
|
2017-11-19 19:47:24 +01:00
|
|
|
|
Cut = new FMenuItem (fc::Fckey_x, "Cu&t", Edit);
|
2017-09-11 03:06:02 +02:00
|
|
|
|
Cut->setStatusbarMessage ( "Remove the input text"
|
|
|
|
|
" and put it in the clipboard" );
|
2017-11-19 19:47:24 +01:00
|
|
|
|
Copy= new FMenuItem (fc::Fckey_c, "&Copy", Edit);
|
2015-11-12 01:33:16 +01:00
|
|
|
|
Copy->setStatusbarMessage ("Copy the input text into the clipboad");
|
2017-11-19 19:47:24 +01:00
|
|
|
|
Paste = new FMenuItem (fc::Fckey_v, "&Paste", Edit);
|
2015-11-12 01:33:16 +01:00
|
|
|
|
Paste->setStatusbarMessage ("Insert text form clipboard");
|
2017-11-19 19:47:24 +01:00
|
|
|
|
Clear = new FMenuItem (fc::Fkey_dc, "C&lear", Edit);
|
2015-11-12 01:33:16 +01:00
|
|
|
|
Clear->setStatusbarMessage ("Delete input text");
|
2015-10-10 03:14:14 +02:00
|
|
|
|
|
2015-11-01 22:45:23 +01:00
|
|
|
|
// "View" menu items
|
2017-11-19 19:47:24 +01:00
|
|
|
|
Env = new FMenuItem ("&Terminal...", View);
|
2015-11-12 01:33:16 +01:00
|
|
|
|
Env->setStatusbarMessage ("Informations about this terminal");
|
2017-11-19 19:47:24 +01:00
|
|
|
|
Drive = new FMenuItem ("&Drive symbols...", View);
|
2015-11-12 01:33:16 +01:00
|
|
|
|
Drive->setStatusbarMessage ("Show drive symbols");
|
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
|
2015-10-10 03:14:14 +02:00
|
|
|
|
Open->addCallback
|
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2017-04-09 20:08:53 +02:00
|
|
|
|
F_METHOD_CALLBACK (this, &MyDialog::cb_view)
|
2015-10-10 03:14:14 +02:00
|
|
|
|
);
|
2017-01-15 19:48:27 +01:00
|
|
|
|
|
2015-10-10 03:14:14 +02:00
|
|
|
|
Quit->addCallback
|
2015-09-24 19:01:27 +02:00
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2017-10-29 18:27:38 +01:00
|
|
|
|
F_METHOD_CALLBACK (this, &FApplication::cb_exitApp)
|
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
|
|
|
|
|
File1->addCallback
|
|
|
|
|
(
|
|
|
|
|
"clicked",
|
|
|
|
|
F_METHOD_CALLBACK (this, &MyDialog::cb_view),
|
|
|
|
|
static_cast<FWidget::data_ptr>(File1)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
File2->addCallback
|
|
|
|
|
(
|
|
|
|
|
"clicked",
|
|
|
|
|
F_METHOD_CALLBACK (this, &MyDialog::cb_view),
|
|
|
|
|
static_cast<FWidget::data_ptr>(File2)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
File3->addCallback
|
|
|
|
|
(
|
|
|
|
|
"clicked",
|
|
|
|
|
F_METHOD_CALLBACK (this, &MyDialog::cb_view),
|
|
|
|
|
static_cast<FWidget::data_ptr>(File3)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
void MyDialog::initEditMenuCallbacks()
|
|
|
|
|
{
|
|
|
|
|
// Edit menu
|
2015-10-10 03:14:14 +02:00
|
|
|
|
Cut->addCallback
|
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2017-04-09 20:08:53 +02:00
|
|
|
|
F_METHOD_CALLBACK (this, &MyDialog::cb_cutClipboard)
|
2015-10-10 03:14:14 +02:00
|
|
|
|
);
|
2017-01-15 19:48:27 +01:00
|
|
|
|
|
2015-10-10 03:14:14 +02:00
|
|
|
|
Copy->addCallback
|
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2017-04-09 20:08:53 +02:00
|
|
|
|
F_METHOD_CALLBACK (this, &MyDialog::cb_copyClipboard)
|
2015-10-10 03:14:14 +02:00
|
|
|
|
);
|
2017-01-15 19:48:27 +01:00
|
|
|
|
|
2015-10-10 03:14:14 +02:00
|
|
|
|
Paste->addCallback
|
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2017-04-09 20:08:53 +02:00
|
|
|
|
F_METHOD_CALLBACK (this, &MyDialog::cb_pasteClipboard)
|
2015-10-10 03:14:14 +02:00
|
|
|
|
);
|
2017-01-15 19:48:27 +01:00
|
|
|
|
|
2015-11-01 22:45:23 +01:00
|
|
|
|
Clear->addCallback
|
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2017-04-09 20:08:53 +02:00
|
|
|
|
F_METHOD_CALLBACK (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
|
2015-10-10 03:14:14 +02:00
|
|
|
|
Env->addCallback
|
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2017-04-09 20:08:53 +02:00
|
|
|
|
F_METHOD_CALLBACK (this, &MyDialog::cb_terminfo)
|
2015-10-10 03:14:14 +02:00
|
|
|
|
);
|
2017-01-15 19:48:27 +01:00
|
|
|
|
|
2015-10-10 03:14:14 +02:00
|
|
|
|
Drive->addCallback
|
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2017-04-09 20:08:53 +02:00
|
|
|
|
F_METHOD_CALLBACK (this, &MyDialog::cb_drives)
|
2015-10-10 03:14:14 +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()
|
|
|
|
|
{
|
2015-10-10 03:14:14 +02:00
|
|
|
|
Help->addCallback
|
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2017-04-09 20:08:53 +02:00
|
|
|
|
F_METHOD_CALLBACK (this, &MyDialog::cb_about)
|
2015-10-10 03:14:14 +02:00
|
|
|
|
);
|
2017-11-02 16:05:34 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
void MyDialog::initStatusBar()
|
|
|
|
|
{
|
|
|
|
|
// Statusbar at the bottom
|
|
|
|
|
FStatusBar* statusbar = new FStatusBar (this);
|
|
|
|
|
|
|
|
|
|
// Statusbar keys
|
2017-11-19 19:53:43 +01:00
|
|
|
|
key_F1 = new FStatusKey (fc::Fkey_f1, "About", statusbar);
|
|
|
|
|
key_F2 = new FStatusKey (fc::Fkey_f2, "View", statusbar);
|
|
|
|
|
key_F3 = new FStatusKey (fc::Fkey_f3, "Quit", statusbar);
|
2017-11-19 19:47:24 +01: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
|
|
|
|
|
2017-11-02 16:05:34 +01:00
|
|
|
|
key_F1->addCallback
|
|
|
|
|
(
|
|
|
|
|
"activate",
|
|
|
|
|
F_METHOD_CALLBACK (this, &MyDialog::cb_about)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
key_F2->addCallback
|
|
|
|
|
(
|
|
|
|
|
"activate",
|
|
|
|
|
F_METHOD_CALLBACK (this, &MyDialog::cb_view)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
key_F3->addCallback
|
|
|
|
|
(
|
|
|
|
|
"activate",
|
|
|
|
|
F_METHOD_CALLBACK (this, &FApplication::cb_exitApp)
|
|
|
|
|
);
|
|
|
|
|
}
|
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
|
|
|
|
|
myLineEdit = new FLineEdit (this);
|
|
|
|
|
myLineEdit->setGeometry(22, 1, 10, 1);
|
|
|
|
|
myLineEdit->setLabelText (L"&Input");
|
|
|
|
|
myLineEdit->setStatusbarMessage ("Press Enter to set the title");
|
|
|
|
|
*myLineEdit << FString("EnTry").toLower();
|
|
|
|
|
|
2015-11-01 22:45:23 +01:00
|
|
|
|
// Buttons
|
2018-01-30 00:11:58 +01:00
|
|
|
|
initButtons();
|
|
|
|
|
|
|
|
|
|
// A multiple selection listbox
|
|
|
|
|
myList = new FListBox (this);
|
|
|
|
|
myList->setGeometry(38, 1, 14, 17);
|
|
|
|
|
myList->setText ("Items");
|
|
|
|
|
myList->setStatusbarMessage ("99 items in a list");
|
|
|
|
|
myList->setMultiSelection();
|
|
|
|
|
|
|
|
|
|
for (int z = 1; z < 100; z++)
|
|
|
|
|
myList->insert (FString() << z << L" placeholder");
|
|
|
|
|
|
|
|
|
|
// Text labels
|
|
|
|
|
initLabels();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
void MyDialog::initFlatButtons()
|
|
|
|
|
{
|
|
|
|
|
// Flat buttons
|
2017-11-22 23:56:21 +01:00
|
|
|
|
MyButton1 = new FButton (this);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
MyButton1->setGeometry(3, 3, 5, 1);
|
2015-11-12 01:33:16 +01:00
|
|
|
|
MyButton1->setText (L"&SIN");
|
|
|
|
|
MyButton1->setStatusbarMessage ("Sine function");
|
2015-05-23 13:35:12 +02:00
|
|
|
|
MyButton1->setNoUnderline();
|
|
|
|
|
MyButton1->setFlat();
|
2015-11-12 01:33:16 +01:00
|
|
|
|
MyButton1->setDoubleFlatLine (fc::bottom);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
2017-11-22 23:56:21 +01:00
|
|
|
|
MyButton2 = new FButton (this);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
MyButton2->setGeometry(3, 5, 5, 1);
|
2015-11-12 01:33:16 +01:00
|
|
|
|
MyButton2->setText (L"&COS");
|
|
|
|
|
MyButton2->setStatusbarMessage ("Cosine function");
|
2015-05-23 13:35:12 +02:00
|
|
|
|
MyButton2->setNoUnderline();
|
|
|
|
|
MyButton2->setFlat();
|
2016-09-03 15:17:48 +02:00
|
|
|
|
MyButton2->setDoubleFlatLine (fc::top);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
2017-11-22 23:56:21 +01:00
|
|
|
|
MyButton3 = new FButton (this);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
MyButton3->setGeometry(10, 3, 5, 3);
|
2015-11-12 01:33:16 +01:00
|
|
|
|
MyButton3->setText (L"&=");
|
|
|
|
|
MyButton3->setStatusbarMessage ("Equal");
|
2015-05-23 13:35:12 +02:00
|
|
|
|
MyButton3->setNoUnderline();
|
|
|
|
|
MyButton3->setFlat();
|
|
|
|
|
|
2018-01-30 00:11:58 +01:00
|
|
|
|
// Add button callback functions
|
|
|
|
|
MyButton1->addCallback
|
|
|
|
|
(
|
|
|
|
|
"clicked",
|
|
|
|
|
F_METHOD_CALLBACK (this, &MyDialog::cb_noFunctionMsg)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
MyButton2->addCallback
|
|
|
|
|
(
|
|
|
|
|
"clicked",
|
|
|
|
|
F_METHOD_CALLBACK (this, &MyDialog::cb_noFunctionMsg)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
MyButton3->addCallback
|
|
|
|
|
(
|
|
|
|
|
"clicked",
|
|
|
|
|
F_METHOD_CALLBACK (this, &MyDialog::cb_noFunctionMsg)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
void MyDialog::initToggleButtons()
|
|
|
|
|
{
|
2015-11-01 22:45:23 +01:00
|
|
|
|
// Radio buttons in a group
|
2015-11-12 01:33:16 +01:00
|
|
|
|
FButtonGroup* radioButtonGroup = new FButtonGroup ("Button", this);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
radioButtonGroup->setGeometry(3, 8, 14, 4);
|
|
|
|
|
//radioButtonGroup->unsetBorder();
|
|
|
|
|
|
2017-11-22 23:56:21 +01:00
|
|
|
|
radio1 = new FRadioButton ("E&nable", radioButtonGroup);
|
2017-03-12 00:29:56 +01:00
|
|
|
|
radio1->setGeometry(1, 1, 10, 1);
|
2015-11-12 01:33:16 +01:00
|
|
|
|
radio1->setStatusbarMessage ("Enable button Test");
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
2015-11-12 01:33:16 +01:00
|
|
|
|
FRadioButton* radio2 = new FRadioButton (radioButtonGroup);
|
2017-03-12 00:29:56 +01:00
|
|
|
|
radio2->setGeometry(1, 2, 11, 1);
|
2015-11-12 01:33:16 +01:00
|
|
|
|
radio2->setText ("&Disable");
|
|
|
|
|
radio2->setStatusbarMessage ("Disable button Test");
|
2015-05-23 13:35:12 +02:00
|
|
|
|
radio2->setChecked();
|
|
|
|
|
//radio2->setDisable();
|
|
|
|
|
|
2015-11-01 22:45:23 +01:00
|
|
|
|
// Checkboxes in a group
|
2015-11-12 01:33:16 +01:00
|
|
|
|
FButtonGroup* checkButtonGroup = new FButtonGroup ("Options", this);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
checkButtonGroup->setGeometry(3, 12, 14, 4);
|
|
|
|
|
|
2015-11-12 01:33:16 +01:00
|
|
|
|
FCheckBox* check1 = new FCheckBox ("&Bitmode", checkButtonGroup);
|
2017-03-12 00:29:56 +01:00
|
|
|
|
check1->setGeometry(1, 1, 11, 1);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
check1->setNoUnderline();
|
|
|
|
|
|
2015-11-12 01:33:16 +01:00
|
|
|
|
FCheckBox* check2 = new FCheckBox ("&8-Bit", checkButtonGroup);
|
2017-03-12 00:29:56 +01:00
|
|
|
|
check2->setGeometry(1, 2, 9, 1);
|
2015-05-23 13:35:12 +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
|
2017-11-22 23:56:21 +01:00
|
|
|
|
MyButton4 = new FButton (this);
|
2015-10-29 21:10:50 +01:00
|
|
|
|
MyButton4->setGeometry(20, 8, 12, 1);
|
2015-11-12 01:33:16 +01:00
|
|
|
|
MyButton4->setText (L"&Get input");
|
|
|
|
|
MyButton4->setStatusbarMessage ("Take text from input field");
|
2015-10-29 21:10:50 +01:00
|
|
|
|
MyButton4->setFocus();
|
2015-05-26 23:15:49 +02:00
|
|
|
|
|
2017-11-22 23:56:21 +01:00
|
|
|
|
MyButton5 = new FButton (this);
|
2015-10-29 21:10:50 +01:00
|
|
|
|
MyButton5->setGeometry(20, 11, 12, 1);
|
2015-11-12 01:33:16 +01:00
|
|
|
|
MyButton5->setText (L"&Test");
|
|
|
|
|
MyButton5->setStatusbarMessage ("Progressbar testing dialog");
|
2015-10-29 21:10:50 +01:00
|
|
|
|
MyButton5->setDisable();
|
2015-05-26 23:15:49 +02:00
|
|
|
|
|
2017-11-22 23:56:21 +01:00
|
|
|
|
MyButton6 = new FButton (this);
|
2015-10-29 21:10:50 +01:00
|
|
|
|
MyButton6->setGeometry(20, 14, 12, 1);
|
2015-11-12 01:33:16 +01:00
|
|
|
|
MyButton6->setText (L"&Quit");
|
|
|
|
|
MyButton6->setStatusbarMessage ("Exit the program");
|
2015-10-29 21:10:50 +01:00
|
|
|
|
MyButton6->addAccelerator('x');
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
2018-01-30 00:11:58 +01:00
|
|
|
|
// Add button callback functions
|
|
|
|
|
MyButton4->addCallback
|
|
|
|
|
(
|
|
|
|
|
"clicked",
|
|
|
|
|
F_METHOD_CALLBACK (this, &MyDialog::cb_input2buttonText),
|
|
|
|
|
static_cast<FWidget::data_ptr>(myLineEdit)
|
|
|
|
|
);
|
2017-04-23 18:54:46 +02:00
|
|
|
|
|
2018-01-30 00:11:58 +01:00
|
|
|
|
MyButton5->addCallback
|
|
|
|
|
(
|
|
|
|
|
"clicked",
|
|
|
|
|
F_METHOD_CALLBACK (this, &MyDialog::cb_ProgressBar)
|
|
|
|
|
);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
2018-01-30 00:11:58 +01:00
|
|
|
|
MyButton6->addCallback
|
|
|
|
|
(
|
|
|
|
|
"clicked",
|
|
|
|
|
F_METHOD_CALLBACK (this, &FApplication::cb_exitApp)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
void MyDialog::initLabels()
|
|
|
|
|
{
|
2015-11-01 22:45:23 +01:00
|
|
|
|
// Text labels
|
2015-11-12 01:33:16 +01:00
|
|
|
|
FLabel* headline = new FLabel (this);
|
2015-10-29 21:10:50 +01:00
|
|
|
|
headline->setGeometry(21, 3, 10, 1);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
headline->setEmphasis();
|
2015-11-12 01:33:16 +01:00
|
|
|
|
headline->setAlignment (fc::alignCenter);
|
2017-09-20 05:44:41 +02:00
|
|
|
|
*headline = L"List items";
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
2015-11-12 01:33:16 +01:00
|
|
|
|
FLabel* tagged = new FLabel (L"Tagged:", this);
|
2015-10-29 21:10:50 +01:00
|
|
|
|
tagged->setGeometry(21, 4, 7, 1);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
2017-11-22 23:56:21 +01:00
|
|
|
|
tagged_count = new FLabel(this);
|
2015-10-29 21:10:50 +01:00
|
|
|
|
tagged_count->setGeometry(29, 4, 5, 1);
|
2017-09-20 05:44:41 +02:00
|
|
|
|
*tagged_count << 0;
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
2015-11-12 01:33:16 +01:00
|
|
|
|
FLabel* sum = new FLabel (L"Sum:", this);
|
2015-10-29 21:10:50 +01:00
|
|
|
|
sum->setGeometry(21, 5, 7, 3);
|
2015-11-12 01:33:16 +01:00
|
|
|
|
sum->setAlignment (fc::alignRight);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
2015-11-12 01:33:16 +01:00
|
|
|
|
FLabel* sum_count = new FLabel (this);
|
2015-10-29 21:10:50 +01:00
|
|
|
|
sum_count->setGeometry(29, 5, 5, 3);
|
2017-09-20 05:44:41 +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
|
|
|
|
|
2015-11-29 15:58:36 +01:00
|
|
|
|
myLineEdit->addCallback
|
2015-05-23 13:35:12 +02:00
|
|
|
|
(
|
|
|
|
|
"activate", // e.g. on <Enter>
|
2017-04-09 20:08:53 +02:00
|
|
|
|
F_METHOD_CALLBACK (this, &MyDialog::cb_setTitlebar)
|
2015-05-23 13:35:12 +02:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
radio1->addCallback
|
|
|
|
|
(
|
|
|
|
|
"toggled",
|
2017-04-09 20:08:53 +02:00
|
|
|
|
F_METHOD_CALLBACK (this, &MyDialog::cb_activateButton),
|
2017-09-11 03:06:02 +02:00
|
|
|
|
static_cast<FWidget::data_ptr>(MyButton5)
|
2015-05-23 13:35:12 +02:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
myList->addCallback
|
|
|
|
|
(
|
|
|
|
|
"clicked",
|
2017-04-09 20:08:53 +02:00
|
|
|
|
F_METHOD_CALLBACK (this, &MyDialog::cb_setInput),
|
2017-09-11 03:06:02 +02:00
|
|
|
|
static_cast<FWidget::data_ptr>(myLineEdit)
|
2015-05-23 13:35:12 +02:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
myList->addCallback
|
|
|
|
|
(
|
|
|
|
|
"row-selected",
|
2017-04-09 20:08:53 +02:00
|
|
|
|
F_METHOD_CALLBACK (this, &MyDialog::cb_updateNumber),
|
2017-09-11 03:06:02 +02:00
|
|
|
|
static_cast<FWidget::data_ptr>(tagged_count)
|
2015-05-23 13:35:12 +02:00
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-22 23:04:40 +01:00
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
void MyDialog::adjustSize()
|
|
|
|
|
{
|
|
|
|
|
int h = getParentWidget()->getHeight() - 4;
|
|
|
|
|
setHeight (h, false);
|
|
|
|
|
int X = int((getParentWidget()->getWidth() - getWidth()) / 2);
|
|
|
|
|
|
|
|
|
|
if ( X < 1 )
|
|
|
|
|
X = 1;
|
|
|
|
|
|
|
|
|
|
setX (X, false);
|
|
|
|
|
|
|
|
|
|
if ( myList )
|
|
|
|
|
myList->setHeight (getHeight() - 3, false);
|
|
|
|
|
|
|
|
|
|
FDialog::adjustSize();
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
|
//----------------------------------------------------------------------
|
2015-09-24 19:01:27 +02:00
|
|
|
|
void MyDialog::onClose (FCloseEvent* ev)
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
2017-10-30 20:56:00 +01:00
|
|
|
|
FApplication::closeConfirmationDialog (this, ev);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2017-02-24 00:30:07 +01:00
|
|
|
|
void MyDialog::cb_noFunctionMsg (FWidget* widget, data_ptr)
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
|
|
|
|
FButton* button = static_cast<FButton*>(widget);
|
|
|
|
|
FString text = button->getText();
|
|
|
|
|
text = text.replace('&', "");
|
|
|
|
|
FMessageBox::error (this, "The \"" + text + "\" button has\n"
|
|
|
|
|
"no function");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2017-02-24 00:30:07 +01:00
|
|
|
|
void MyDialog::cb_about (FWidget*, data_ptr)
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
2015-12-19 22:01:48 +01:00
|
|
|
|
const char libver[] = F_VERSION;
|
2015-05-23 13:35:12 +02:00
|
|
|
|
FString line(2, wchar_t(fc::BoxDrawingsHorizontal));
|
|
|
|
|
|
2015-09-24 19:01:27 +02:00
|
|
|
|
FMessageBox info ( "About"
|
|
|
|
|
, line + L" The Final Cut " + line + "\n\n"
|
2015-12-19 22:01:48 +01:00
|
|
|
|
L"Version " + libver + "\n\n"
|
2018-01-02 20:38:45 +01:00
|
|
|
|
L"(c) 2018 by Markus Gans"
|
2015-09-24 19:01:27 +02:00
|
|
|
|
, FMessageBox::Ok, 0, 0, this );
|
2015-05-23 13:35:12 +02:00
|
|
|
|
info.setCenterText();
|
|
|
|
|
info.show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2017-02-24 00:30:07 +01:00
|
|
|
|
void MyDialog::cb_terminfo (FWidget*, data_ptr)
|
2015-10-29 21:10:50 +01:00
|
|
|
|
{
|
2017-12-30 21:27:17 +01:00
|
|
|
|
int x = getDesktopWidth();
|
|
|
|
|
int y = getDesktopHeight();
|
2015-10-29 21:10:50 +01:00
|
|
|
|
FMessageBox info1 ( "Environment"
|
2017-09-20 02:51:17 +02:00
|
|
|
|
, FString()
|
|
|
|
|
<< " Type: " << getTermType() << "\n"
|
2018-02-11 23:41:23 +01:00
|
|
|
|
<< " Name: " << getTermFileName() << "\n"
|
2017-11-24 00:28:25 +01:00
|
|
|
|
<< " Mode: " << getEncodingString() << "\n"
|
2017-09-20 02:51:17 +02:00
|
|
|
|
<< " Size: " << x << wchar_t(fc::Times)
|
|
|
|
|
<< y << "\n"
|
|
|
|
|
<< "Colors: " << getMaxColor()
|
2015-10-29 21:10:50 +01:00
|
|
|
|
, FMessageBox::Ok, 0, 0, this );
|
|
|
|
|
info1.setHeadline("Terminal:");
|
|
|
|
|
info1.exec();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2017-02-24 00:30:07 +01:00
|
|
|
|
void MyDialog::cb_drives (FWidget*, data_ptr)
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
2015-09-24 19:01:27 +02:00
|
|
|
|
FMessageBox info2 ( "Drive symbols"
|
|
|
|
|
, "Generic: \n\n"
|
2015-05-23 13:35:12 +02:00
|
|
|
|
"Network: \n\n"
|
2015-09-24 19:01:27 +02:00
|
|
|
|
" CD:"
|
|
|
|
|
, FMessageBox::Ok, 0, 0, this );
|
2015-05-23 13:35:12 +02:00
|
|
|
|
if ( isNewFont() )
|
|
|
|
|
{
|
|
|
|
|
FLabel drive (NF_Drive, &info2);
|
|
|
|
|
drive.setGeometry (11, 2, 4, 1);
|
|
|
|
|
FLabel net (NF_Net_Drive, &info2);
|
|
|
|
|
net.setGeometry (11, 4, 4, 1);
|
|
|
|
|
FLabel cd (NF_CD_ROM, &info2);
|
|
|
|
|
cd.setGeometry (11, 6, 4, 1);
|
|
|
|
|
info2.exec();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FLabel drive (" - ", &info2);
|
|
|
|
|
drive.setGeometry (11, 2, 4, 1);
|
|
|
|
|
FLabel net (" N ", &info2);
|
|
|
|
|
net.setGeometry (11, 4, 4, 1);
|
|
|
|
|
FLabel cd (" CD ", &info2);
|
|
|
|
|
cd.setGeometry (11, 6, 4, 1);
|
2016-07-09 00:01:59 +02:00
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
|
if ( isMonochron() )
|
|
|
|
|
{
|
|
|
|
|
net.setReverseMode();
|
|
|
|
|
drive.setReverseMode();
|
|
|
|
|
cd.setReverseMode();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
net.setForegroundColor (fc::White);
|
|
|
|
|
net.setBackgroundColor (fc::DarkGray);
|
|
|
|
|
drive.setForegroundColor (fc::White);
|
|
|
|
|
drive.setBackgroundColor (fc::DarkGray);
|
|
|
|
|
cd.setForegroundColor (fc::White);
|
|
|
|
|
cd.setBackgroundColor (fc::DarkGray);
|
|
|
|
|
}
|
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
|
|
|
|
//----------------------------------------------------------------------
|
2017-02-24 00:30:07 +01:00
|
|
|
|
void MyDialog::cb_cutClipboard (FWidget*, data_ptr)
|
2015-11-29 15:58:36 +01:00
|
|
|
|
{
|
|
|
|
|
if ( ! myLineEdit )
|
|
|
|
|
return;
|
2016-07-09 00:01:59 +02:00
|
|
|
|
|
2015-11-29 15:58:36 +01:00
|
|
|
|
clipboard = myLineEdit->getText();
|
2017-09-21 07:22:08 +02:00
|
|
|
|
myLineEdit->clear();
|
2015-11-29 15:58:36 +01:00
|
|
|
|
myLineEdit->redraw();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2017-02-24 00:30:07 +01:00
|
|
|
|
void MyDialog::cb_copyClipboard (FWidget*, data_ptr)
|
2015-11-29 15:58:36 +01:00
|
|
|
|
{
|
|
|
|
|
if ( ! myLineEdit )
|
|
|
|
|
return;
|
2016-07-09 00:01:59 +02:00
|
|
|
|
|
2015-11-29 15:58:36 +01:00
|
|
|
|
clipboard = myLineEdit->getText();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2017-02-24 00:30:07 +01:00
|
|
|
|
void MyDialog::cb_pasteClipboard (FWidget*, data_ptr)
|
2015-11-29 15:58:36 +01:00
|
|
|
|
{
|
|
|
|
|
if ( ! myLineEdit )
|
|
|
|
|
return;
|
2016-07-09 00:01:59 +02:00
|
|
|
|
|
2017-09-21 07:22:08 +02:00
|
|
|
|
*myLineEdit = clipboard;
|
2015-11-29 15:58:36 +01:00
|
|
|
|
myLineEdit->redraw();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2017-02-24 00:30:07 +01:00
|
|
|
|
void MyDialog::cb_clearInput (FWidget*, data_ptr)
|
2015-11-29 15:58:36 +01:00
|
|
|
|
{
|
|
|
|
|
if ( ! myLineEdit )
|
|
|
|
|
return;
|
2016-07-09 00:01:59 +02:00
|
|
|
|
|
2015-11-29 15:58:36 +01:00
|
|
|
|
clipboard.clear();
|
2017-09-21 07:22:08 +02:00
|
|
|
|
myLineEdit->clear();
|
2015-11-29 15:58:36 +01:00
|
|
|
|
myLineEdit->redraw();
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
|
//----------------------------------------------------------------------
|
2017-02-24 00:30:07 +01:00
|
|
|
|
void MyDialog::cb_input2buttonText (FWidget* widget, data_ptr data)
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
|
|
|
|
FButton* button = static_cast<FButton*>(widget);
|
2017-02-24 00:30:07 +01:00
|
|
|
|
FLineEdit* lineedit = static_cast<FLineEdit*>(data);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
button->setText( lineedit->getText() );
|
|
|
|
|
button->redraw();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2017-02-24 00:30:07 +01:00
|
|
|
|
void MyDialog::cb_setTitlebar (FWidget* widget, data_ptr)
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
|
|
|
|
FLineEdit* lineedit = static_cast<FLineEdit*>(widget);
|
2017-09-21 07:22:08 +02:00
|
|
|
|
FString title;
|
|
|
|
|
*lineedit >> title;
|
2018-05-20 15:15:42 +02:00
|
|
|
|
setTermTitle (title);
|
|
|
|
|
setText (title);
|
2015-09-24 19:01:27 +02:00
|
|
|
|
redraw();
|
2015-05-23 13:35:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2017-02-24 00:30:07 +01:00
|
|
|
|
void MyDialog::cb_ProgressBar (FWidget*, data_ptr)
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
|
|
|
|
ProgressDialog* p_dgl = new ProgressDialog(this);
|
|
|
|
|
p_dgl->show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2017-02-24 00:30:07 +01:00
|
|
|
|
void MyDialog::cb_updateNumber (FWidget* widget, data_ptr data)
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
|
|
|
|
FListBox* list = static_cast<FListBox*>(widget);
|
2017-02-24 00:30:07 +01:00
|
|
|
|
FLabel* num = static_cast<FLabel*>(data);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
int select_num = 0;
|
2017-09-17 01:50:41 +02:00
|
|
|
|
uInt count = list->getCount();
|
2016-07-09 00:01:59 +02:00
|
|
|
|
|
2017-09-17 01:50:41 +02:00
|
|
|
|
for (uInt n = 1; n <= count; n++)
|
2015-05-23 13:35:12 +02:00
|
|
|
|
if ( list->isSelected(int(n)) )
|
|
|
|
|
select_num++;
|
2016-07-09 00:01:59 +02:00
|
|
|
|
|
2017-09-20 05:44:41 +02:00
|
|
|
|
num->clear();
|
|
|
|
|
*num << select_num;
|
2015-05-23 13:35:12 +02:00
|
|
|
|
num->redraw();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2017-02-24 00:30:07 +01:00
|
|
|
|
void MyDialog::cb_activateButton (FWidget* widget, data_ptr data)
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
|
|
|
|
FRadioButton* rb = static_cast<FRadioButton*>(widget);
|
2017-02-24 00:30:07 +01:00
|
|
|
|
FButton* button = static_cast<FButton*>(data);
|
2016-07-09 00:01:59 +02:00
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
|
if ( rb->isChecked() )
|
|
|
|
|
button->setEnable();
|
|
|
|
|
else
|
|
|
|
|
button->setDisable();
|
2016-07-09 00:01:59 +02:00
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
|
button->redraw();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2017-02-24 00:30:07 +01:00
|
|
|
|
void MyDialog::cb_view (FWidget*, data_ptr data)
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
2015-11-29 15:58:36 +01:00
|
|
|
|
FString file;
|
2017-02-24 00:30:07 +01:00
|
|
|
|
FMenuItem* item = static_cast<FMenuItem*>(data);
|
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
|
|
|
|
|
file = FFileDialog::fileOpenChooser (this);
|
2016-07-09 00:01:59 +02:00
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
|
if ( file.isNull() )
|
|
|
|
|
return;
|
|
|
|
|
|
2016-09-11 16:48:39 +02:00
|
|
|
|
TextWindow* view = new TextWindow(this);
|
2016-07-03 20:08:39 +02:00
|
|
|
|
FString filename(basename(const_cast<char*>(file.c_str())));
|
|
|
|
|
view->setText ("Viewer: " + filename);
|
2017-08-27 09:50:30 +02:00
|
|
|
|
view->setGeometry (1 + int((getRootWidget()->getWidth() - 60) / 2),
|
|
|
|
|
int(getRootWidget()->getHeight() / 6),
|
2015-05-23 13:35:12 +02:00
|
|
|
|
60,
|
2017-08-27 09:50:30 +02:00
|
|
|
|
int(getRootWidget()->getHeight() * 3 / 4));
|
2016-09-11 16:48:39 +02:00
|
|
|
|
view->setResizeable();
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
|
|
std::string line = "";
|
|
|
|
|
std::ifstream infile;
|
|
|
|
|
infile.open(file);
|
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();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2017-02-24 00:30:07 +01:00
|
|
|
|
void MyDialog::cb_setInput (FWidget* widget, data_ptr data)
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
|
|
|
|
FListBox* ListBox = static_cast<FListBox*>(widget);
|
2017-02-24 00:30:07 +01:00
|
|
|
|
FLineEdit* lineedit = static_cast<FLineEdit*>(data);
|
2017-09-21 07:22:08 +02:00
|
|
|
|
*lineedit = ListBox->getItem(ListBox->currentItem()).getText();
|
2015-05-23 13:35:12 +02:00
|
|
|
|
lineedit->redraw();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
// main part
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
int main (int argc, char* argv[])
|
|
|
|
|
{
|
2017-11-02 16:05:34 +01:00
|
|
|
|
FString ver = F_VERSION; // Library version
|
2018-01-02 20:38:45 +01:00
|
|
|
|
FString title = "The FINAL CUT " + ver + " (C) 2018 by Markus Gans";
|
2015-12-19 22:01:48 +01:00
|
|
|
|
|
2017-09-19 06:18:03 +02:00
|
|
|
|
// Create the application object app
|
2015-05-23 13:35:12 +02:00
|
|
|
|
FApplication app(argc, argv);
|
2018-05-20 15:15:42 +02:00
|
|
|
|
app.redefineDefaultColors(true);
|
|
|
|
|
app.setTermTitle (title);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
2017-11-02 16:05:34 +01:00
|
|
|
|
// Force vt100 encoding
|
2015-05-23 13:35:12 +02:00
|
|
|
|
//app.setEncoding("VT100");
|
2017-11-02 16:05:34 +01:00
|
|
|
|
|
|
|
|
|
// Sets the terminal size to 94×30
|
2016-09-25 23:53:48 +02:00
|
|
|
|
//app.setTermSize(94,30);
|
2017-11-02 16:05:34 +01:00
|
|
|
|
|
|
|
|
|
// Enable the final cut graphical font
|
2015-05-23 13:35:12 +02:00
|
|
|
|
//app.setNewFont();
|
|
|
|
|
|
2017-09-19 06:18:03 +02:00
|
|
|
|
// Create main dialog object d
|
2015-05-23 13:35:12 +02:00
|
|
|
|
MyDialog d(&app);
|
2015-12-19 22:01:48 +01:00
|
|
|
|
d.setText (title);
|
2017-08-27 09:50:30 +02:00
|
|
|
|
d.setGeometry (int((app.getWidth() - 56) / 2), 2, 56, app.getHeight() - 4);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
d.setShadow();
|
|
|
|
|
|
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.
|
2015-05-23 13:35:12 +02:00
|
|
|
|
app.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
|
|
|
|
|
|
|
|
|
// Start the application
|
|
|
|
|
// and return the result to the operating system
|
2015-05-23 13:35:12 +02:00
|
|
|
|
return app.exec();
|
|
|
|
|
}
|