New widget FBusyIndicator
This commit is contained in:
parent
0ff67da077
commit
ccb7eeb3c6
|
@ -1,3 +1,7 @@
|
|||
2020-06-11 Markus Gans <guru.mail@muenster.de>
|
||||
* New widget FBusyIndicator to indicate background activity
|
||||
* Added example/busy to demonstrate the functionality of this widget
|
||||
|
||||
2020-06-07 Markus Gans <guru.mail@muenster.de>
|
||||
* The --log-file parameter stores log output to any file. The file
|
||||
can be viewed directly on another terminal with "tail -f".
|
||||
|
|
26
README.md
26
README.md
|
@ -177,11 +177,11 @@ Class digramm
|
|||
: 1┌───────────────┐ │ ┌─────────────┐
|
||||
┌-----------┤ FMouseControl │ ├────┤ FTimerEvent │
|
||||
: └───────────────┘ │ └─────────────┘
|
||||
: 1┌─────────┐ │
|
||||
┌-----------┤ FSystem │ │
|
||||
: └─────────┘ │
|
||||
: *┌─────────┐ │
|
||||
: ┌--------┤ FString │ │ ┌──────────────┐
|
||||
: 1┌─────────┐ │ ┌──────┐ ┌─────────┐
|
||||
┌-----------┤ FSystem │ │ │ FLog │◄──┤ FLogger │
|
||||
: └─────────┘ │ └──┬───┘ └─────────┘
|
||||
: *┌─────────┐ │ :1
|
||||
: ┌--------┤ FString │ │ ┌──┴───────────┐
|
||||
: : └─────────┘ │ ┌────┤ FApplication │
|
||||
: : *┌────────┐ │ │ └──────────────┘
|
||||
: ┌--------┤ FPoint │ │ │ ┌────────┐
|
||||
|
@ -201,11 +201,11 @@ Class digramm
|
|||
│ FVTerm │◄──┐ :1 │ └──────────────┘ │ └──────────────┘
|
||||
└────────┘ │ ┌────┴────┐ │ ┌───────────────┐ │ ┌───────────┐
|
||||
├────┤ FWidget │◄───────┼────┤ FToggleButton │◄─┼──┤ FCheckBox │
|
||||
┌─────────┐ │ └─────────┘ │ └───────────────┘ │ └───────────┘
|
||||
│ FObject │◄──┘ │ ┌──────────────┐ │ ┌─────────┐
|
||||
└─────────┘ ├────┤ FProgressbar │ └──┤ FSwitch │
|
||||
│ └──────────────┘ └─────────┘
|
||||
│ ┌────────────┐
|
||||
┌─────────┐ │ └────┬────┘ │ └───────────────┘ │ └───────────┘
|
||||
│ FObject │◄──┘ :1 │ ┌──────────────┐ │ ┌─────────┐
|
||||
└─────────┘ ┌──────┴────────┐ ├────┤ FProgressbar │ └──┤ FSwitch │
|
||||
│ FWidgetColors │ │ └──────────────┘ └─────────┘
|
||||
└───────────────┘ │ ┌────────────┐
|
||||
├────┤ FScrollbar │
|
||||
│ └────────────┘
|
||||
│ ┌───────────┐
|
||||
|
@ -233,9 +233,9 @@ Class digramm
|
|||
└──┬──┬───┘ └─────────┘ │ ┌─────────────┐
|
||||
▲ ▲ └──┤ FMessageBox │
|
||||
│ │ └─────────────┘
|
||||
│ │ ┌──────────┐
|
||||
│ └──────┤ FToolTip │
|
||||
│ └──────────┘
|
||||
│ │ ┌──────────┐ ┌────────────────┐
|
||||
│ └──────┤ FToolTip │◄─┤ FBusyIndicator │
|
||||
│ └──────────┘ └────────────────┘
|
||||
└───────────────┐ ┌──────────┐
|
||||
│ ┌───┤ FMenuBar │
|
||||
┌───────────┐ └──────┤ └──────────┘
|
||||
|
|
|
@ -37,11 +37,11 @@
|
|||
: 1┌───────────────┐ │ ┌─────────────┐
|
||||
┌-----------┤ FMouseControl │ ├────┤ FTimerEvent │
|
||||
: └───────────────┘ │ └─────────────┘
|
||||
: 1┌─────────┐ │
|
||||
┌-----------┤ FSystem │ │
|
||||
: └─────────┘ │
|
||||
: *┌─────────┐ │
|
||||
: ┌--------┤ FString │ │ ┌──────────────┐
|
||||
: 1┌─────────┐ │ ┌──────┐ ┌─────────┐
|
||||
┌-----------┤ FSystem │ │ │ FLog │◄──┤ FLogger │
|
||||
: └─────────┘ │ └──┬───┘ └─────────┘
|
||||
: *┌─────────┐ │ :1
|
||||
: ┌--------┤ FString │ │ ┌──┴───────────┐
|
||||
: : └─────────┘ │ ┌────┤ FApplication │
|
||||
: : *┌────────┐ │ │ └──────────────┘
|
||||
: ┌--------┤ FPoint │ │ │ ┌────────┐
|
||||
|
@ -61,11 +61,11 @@
|
|||
│ FVTerm │◄──┐ :1 │ └──────────────┘ │ └──────────────┘
|
||||
└────────┘ │ ┌────┴────┐ │ ┌───────────────┐ │ ┌───────────┐
|
||||
├────┤ FWidget │◄───────┼────┤ FToggleButton │◄─┼──┤ FCheckBox │
|
||||
┌─────────┐ │ └─────────┘ │ └───────────────┘ │ └───────────┘
|
||||
│ FObject │◄──┘ │ ┌──────────────┐ │ ┌─────────┐
|
||||
└─────────┘ ├────┤ FProgressbar │ └──┤ FSwitch │
|
||||
│ └──────────────┘ └─────────┘
|
||||
│ ┌────────────┐
|
||||
┌─────────┐ │ └────┬────┘ │ └───────────────┘ │ └───────────┘
|
||||
│ FObject │◄──┘ :1 │ ┌──────────────┐ │ ┌─────────┐
|
||||
└─────────┘ ┌──────┴────────┐ ├────┤ FProgressbar │ └──┤ FSwitch │
|
||||
│ FWidgetColors │ │ └──────────────┘ └─────────┘
|
||||
└───────────────┘ │ ┌────────────┐
|
||||
├────┤ FScrollbar │
|
||||
│ └────────────┘
|
||||
│ ┌───────────┐
|
||||
|
@ -93,9 +93,9 @@
|
|||
└──┬──┬───┘ └─────────┘ │ ┌─────────────┐
|
||||
▲ ▲ └──┤ FMessageBox │
|
||||
│ │ └─────────────┘
|
||||
│ │ ┌──────────┐
|
||||
│ └──────┤ FToolTip │
|
||||
│ └──────────┘
|
||||
│ │ ┌──────────┐ ┌────────────────┐
|
||||
│ └──────┤ FToolTip │◄─┤ FBusyIndicator │
|
||||
│ └──────────┘ └────────────────┘
|
||||
└───────────────┐ ┌──────────┐
|
||||
│ ┌───┤ FMenuBar │
|
||||
┌───────────┐ └──────┤ └──────────┘
|
||||
|
|
|
@ -15,6 +15,7 @@ noinst_PROGRAMS = \
|
|||
fullwidth-character \
|
||||
7segment \
|
||||
choice \
|
||||
busy \
|
||||
listbox \
|
||||
listview \
|
||||
checklist \
|
||||
|
@ -44,6 +45,7 @@ event_log_SOURCES = event-log.cpp
|
|||
fullwidth_character_SOURCES = fullwidth-character.cpp
|
||||
7segment_SOURCES = 7segment.cpp
|
||||
choice_SOURCES = choice.cpp
|
||||
busy_SOURCES = busy.cpp
|
||||
listbox_SOURCES = listbox.cpp
|
||||
listview_SOURCES = listview.cpp
|
||||
checklist_SOURCES = checklist.cpp
|
||||
|
|
|
@ -0,0 +1,210 @@
|
|||
#! /bin/bash
|
||||
|
||||
# busy - temporary wrapper script for .libs/busy
|
||||
# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-2
|
||||
#
|
||||
# The busy program cannot be directly executed until all the libtool
|
||||
# libraries that it depends on are installed.
|
||||
#
|
||||
# This wrapper script should never be moved out of the build directory.
|
||||
# If it is, it will not operate correctly.
|
||||
|
||||
# Sed substitution that helps us do robust quoting. It backslashifies
|
||||
# metacharacters that are still active within double-quoted strings.
|
||||
sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
|
||||
|
||||
# Be Bourne compatible
|
||||
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
|
||||
emulate sh
|
||||
NULLCMD=:
|
||||
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
|
||||
# is contrary to our usage. Disable this feature.
|
||||
alias -g '${1+"$@"}'='"$@"'
|
||||
setopt NO_GLOB_SUBST
|
||||
else
|
||||
case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
|
||||
fi
|
||||
BIN_SH=xpg4; export BIN_SH # for Tru64
|
||||
DUALCASE=1; export DUALCASE # for MKS sh
|
||||
|
||||
# The HP-UX ksh and POSIX shell print the target directory to stdout
|
||||
# if CDPATH is set.
|
||||
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
|
||||
|
||||
relink_command=""
|
||||
|
||||
# This environment variable determines our operation mode.
|
||||
if test "$libtool_install_magic" = "%%%MAGIC variable%%%"; then
|
||||
# install mode needs the following variables:
|
||||
generated_by_libtool_version='2.4.6'
|
||||
notinst_deplibs=' /usr/local/src/MyProgs/finalcut/src/.libs/libfinal.la'
|
||||
else
|
||||
# When we are sourced in execute mode, $file and $ECHO are already set.
|
||||
if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then
|
||||
file="$0"
|
||||
|
||||
# A function that is used when there is no print builtin or printf.
|
||||
func_fallback_echo ()
|
||||
{
|
||||
eval 'cat <<_LTECHO_EOF
|
||||
$1
|
||||
_LTECHO_EOF'
|
||||
}
|
||||
ECHO="printf %s\\n"
|
||||
fi
|
||||
|
||||
# Very basic option parsing. These options are (a) specific to
|
||||
# the libtool wrapper, (b) are identical between the wrapper
|
||||
# /script/ and the wrapper /executable/ that is used only on
|
||||
# windows platforms, and (c) all begin with the string --lt-
|
||||
# (application programs are unlikely to have options that match
|
||||
# this pattern).
|
||||
#
|
||||
# There are only two supported options: --lt-debug and
|
||||
# --lt-dump-script. There is, deliberately, no --lt-help.
|
||||
#
|
||||
# The first argument to this parsing function should be the
|
||||
# script's ../libtool value, followed by no.
|
||||
lt_option_debug=
|
||||
func_parse_lt_options ()
|
||||
{
|
||||
lt_script_arg0=$0
|
||||
shift
|
||||
for lt_opt
|
||||
do
|
||||
case "$lt_opt" in
|
||||
--lt-debug) lt_option_debug=1 ;;
|
||||
--lt-dump-script)
|
||||
lt_dump_D=`$ECHO "X$lt_script_arg0" | /bin/sed -e 's/^X//' -e 's%/[^/]*$%%'`
|
||||
test "X$lt_dump_D" = "X$lt_script_arg0" && lt_dump_D=.
|
||||
lt_dump_F=`$ECHO "X$lt_script_arg0" | /bin/sed -e 's/^X//' -e 's%^.*/%%'`
|
||||
cat "$lt_dump_D/$lt_dump_F"
|
||||
exit 0
|
||||
;;
|
||||
--lt-*)
|
||||
$ECHO "Unrecognized --lt- option: '$lt_opt'" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Print the debug banner immediately:
|
||||
if test -n "$lt_option_debug"; then
|
||||
echo "busy:busy:$LINENO: libtool wrapper (GNU libtool) 2.4.6 Debian-2.4.6-2" 1>&2
|
||||
fi
|
||||
}
|
||||
|
||||
# Used when --lt-debug. Prints its arguments to stdout
|
||||
# (redirection is the responsibility of the caller)
|
||||
func_lt_dump_args ()
|
||||
{
|
||||
lt_dump_args_N=1;
|
||||
for lt_arg
|
||||
do
|
||||
$ECHO "busy:busy:$LINENO: newargv[$lt_dump_args_N]: $lt_arg"
|
||||
lt_dump_args_N=`expr $lt_dump_args_N + 1`
|
||||
done
|
||||
}
|
||||
|
||||
# Core function for launching the target application
|
||||
func_exec_program_core ()
|
||||
{
|
||||
|
||||
if test -n "$lt_option_debug"; then
|
||||
$ECHO "busy:busy:$LINENO: newargv[0]: $progdir/$program" 1>&2
|
||||
func_lt_dump_args ${1+"$@"} 1>&2
|
||||
fi
|
||||
exec "$progdir/$program" ${1+"$@"}
|
||||
|
||||
$ECHO "$0: cannot exec $program $*" 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# A function to encapsulate launching the target application
|
||||
# Strips options in the --lt-* namespace from $@ and
|
||||
# launches target application with the remaining arguments.
|
||||
func_exec_program ()
|
||||
{
|
||||
case " $* " in
|
||||
*\ --lt-*)
|
||||
for lt_wr_arg
|
||||
do
|
||||
case $lt_wr_arg in
|
||||
--lt-*) ;;
|
||||
*) set x "$@" "$lt_wr_arg"; shift;;
|
||||
esac
|
||||
shift
|
||||
done ;;
|
||||
esac
|
||||
func_exec_program_core ${1+"$@"}
|
||||
}
|
||||
|
||||
# Parse options
|
||||
func_parse_lt_options "$0" ${1+"$@"}
|
||||
|
||||
# Find the directory that this script lives in.
|
||||
thisdir=`$ECHO "$file" | /bin/sed 's%/[^/]*$%%'`
|
||||
test "x$thisdir" = "x$file" && thisdir=.
|
||||
|
||||
# Follow symbolic links until we get to the real thisdir.
|
||||
file=`ls -ld "$file" | /bin/sed -n 's/.*-> //p'`
|
||||
while test -n "$file"; do
|
||||
destdir=`$ECHO "$file" | /bin/sed 's%/[^/]*$%%'`
|
||||
|
||||
# If there was a directory component, then change thisdir.
|
||||
if test "x$destdir" != "x$file"; then
|
||||
case "$destdir" in
|
||||
[\\/]* | [A-Za-z]:[\\/]*) thisdir="$destdir" ;;
|
||||
*) thisdir="$thisdir/$destdir" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
file=`$ECHO "$file" | /bin/sed 's%^.*/%%'`
|
||||
file=`ls -ld "$thisdir/$file" | /bin/sed -n 's/.*-> //p'`
|
||||
done
|
||||
|
||||
# Usually 'no', except on cygwin/mingw when embedded into
|
||||
# the cwrapper.
|
||||
WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=no
|
||||
if test "$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR" = "yes"; then
|
||||
# special case for '.'
|
||||
if test "$thisdir" = "."; then
|
||||
thisdir=`pwd`
|
||||
fi
|
||||
# remove .libs from thisdir
|
||||
case "$thisdir" in
|
||||
*[\\/].libs ) thisdir=`$ECHO "$thisdir" | /bin/sed 's%[\\/][^\\/]*$%%'` ;;
|
||||
.libs ) thisdir=. ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Try to get the absolute directory name.
|
||||
absdir=`cd "$thisdir" && pwd`
|
||||
test -n "$absdir" && thisdir="$absdir"
|
||||
|
||||
program='busy'
|
||||
progdir="$thisdir/.libs"
|
||||
|
||||
|
||||
if test -f "$progdir/$program"; then
|
||||
# Add our own library path to LD_LIBRARY_PATH
|
||||
LD_LIBRARY_PATH="/usr/local/src/MyProgs/finalcut/src/.libs:$LD_LIBRARY_PATH"
|
||||
|
||||
# Some systems cannot cope with colon-terminated LD_LIBRARY_PATH
|
||||
# The second colon is a workaround for a bug in BeOS R4 sed
|
||||
LD_LIBRARY_PATH=`$ECHO "$LD_LIBRARY_PATH" | /bin/sed 's/::*$//'`
|
||||
|
||||
export LD_LIBRARY_PATH
|
||||
|
||||
if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then
|
||||
# Run the actual program with our arguments.
|
||||
func_exec_program ${1+"$@"}
|
||||
fi
|
||||
else
|
||||
# The program doesn't exist.
|
||||
$ECHO "$0: error: '$progdir/$program' does not exist" 1>&2
|
||||
$ECHO "This script is just a wrapper for $program." 1>&2
|
||||
$ECHO "See the libtool documentation for more information." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
|
@ -0,0 +1,128 @@
|
|||
/***********************************************************************
|
||||
* busy.cpp - Shows the use of the FBusyIndicator *
|
||||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2020 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
* 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/>. *
|
||||
***********************************************************************/
|
||||
|
||||
#include <final/final.h>
|
||||
using finalcut::FPoint;
|
||||
using finalcut::FRect;
|
||||
using finalcut::FSize;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class Dialog
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class Dialog final : public finalcut::FDialog
|
||||
{
|
||||
public:
|
||||
explicit Dialog (FWidget* parent = nullptr);
|
||||
|
||||
private:
|
||||
void adjustSize() override;
|
||||
|
||||
// Event handler
|
||||
void onTimer (finalcut::FTimerEvent*) override;
|
||||
|
||||
// Callback method
|
||||
void cb_start (const finalcut::FWidget*, const FDataPtr);
|
||||
|
||||
// Data members
|
||||
finalcut::FSpinBox seconds{this};
|
||||
finalcut::FButton start{"&Start", this};
|
||||
finalcut::FButton quit{"&Quit", this};
|
||||
finalcut::FBusyIndicator busy_indicator{this};
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
Dialog::Dialog (FWidget* parent)
|
||||
: finalcut::FDialog{parent}
|
||||
{
|
||||
setText ("Dialog");
|
||||
finalcut::FDialog::setGeometry (FPoint{26, 5}, FSize{28, 10});
|
||||
seconds.setGeometry (FPoint{10, 2}, FSize{10, 1});
|
||||
seconds.setLabelText ("Seconds");
|
||||
seconds.setRange (0, 60);
|
||||
seconds.setValue (3);
|
||||
start.setGeometry (FPoint{2, 6}, FSize{10, 1});
|
||||
quit.setGeometry (FPoint{15, 6}, FSize{10, 1});
|
||||
|
||||
// Add button callbacks
|
||||
seconds.addCallback
|
||||
(
|
||||
"activate",
|
||||
F_METHOD_CALLBACK (this, &Dialog::cb_start)
|
||||
);
|
||||
|
||||
start.addCallback
|
||||
(
|
||||
"clicked",
|
||||
F_METHOD_CALLBACK (this, &Dialog::cb_start)
|
||||
);
|
||||
|
||||
quit.addCallback
|
||||
(
|
||||
"clicked",
|
||||
F_METHOD_CALLBACK (this, &finalcut::FApplication::cb_exitApp)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Dialog::adjustSize()
|
||||
{
|
||||
int X = int((getDesktopWidth() - getWidth()) / 2);
|
||||
const int Y = 5;
|
||||
|
||||
if ( X < 1 )
|
||||
X = 1;
|
||||
|
||||
setPos ({X, Y}, false);
|
||||
finalcut::FDialog::adjustSize();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Dialog::onTimer (finalcut::FTimerEvent*)
|
||||
{
|
||||
delOwnTimer();
|
||||
busy_indicator.stop();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Dialog::cb_start (const finalcut::FWidget*, const FDataPtr)
|
||||
{
|
||||
if ( seconds.getValue() < 1 )
|
||||
return;
|
||||
|
||||
busy_indicator.start();
|
||||
addTimer(seconds.getValue() * 1000);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// main part
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
int main (int argc, char* argv[])
|
||||
{
|
||||
finalcut::FApplication app(argc, argv);
|
||||
Dialog dialog(&app);
|
||||
finalcut::FWidget::setMainWidget(&dialog);
|
||||
dialog.show();
|
||||
return app.exec();
|
||||
}
|
|
@ -1042,8 +1042,7 @@ void MyDialog::cb_setInput (finalcut::FWidget* widget, FDataPtr data)
|
|||
int main (int argc, char* argv[])
|
||||
{
|
||||
const finalcut::FString ver{F_VERSION}; // Library version
|
||||
const finalcut::FString title { "The FINAL CUT "
|
||||
+ ver
|
||||
const finalcut::FString title { "The FINAL CUT " + ver
|
||||
+ " (C) 2020 by Markus Gans" };
|
||||
|
||||
// Create the application object app
|
||||
|
|
|
@ -44,6 +44,7 @@ libfinal_la_SOURCES = \
|
|||
fwindow.cpp \
|
||||
fmessagebox.cpp \
|
||||
ftooltip.cpp \
|
||||
fbusyindicator.cpp \
|
||||
ffiledialog.cpp \
|
||||
fkey_map.cpp \
|
||||
fcharmap.cpp \
|
||||
|
@ -115,6 +116,7 @@ finalcutinclude_HEADERS = \
|
|||
include/final/fmenulist.h \
|
||||
include/final/fmessagebox.h \
|
||||
include/final/ftooltip.h \
|
||||
include/final/fbusyindicator.h \
|
||||
include/final/fobject.h \
|
||||
include/final/fpoint.h \
|
||||
include/final/fsize.h \
|
||||
|
|
|
@ -34,6 +34,7 @@ INCLUDE_HEADERS = \
|
|||
fcheckmenuitem.h \
|
||||
fmessagebox.h \
|
||||
ftooltip.h \
|
||||
fbusyindicator.h \
|
||||
sgr_optimizer.h \
|
||||
foptiattr.h \
|
||||
foptimove.h \
|
||||
|
@ -118,6 +119,7 @@ OBJS = \
|
|||
fcombobox.o \
|
||||
fmessagebox.o \
|
||||
ftooltip.o \
|
||||
fbusyindicator.o \
|
||||
ffiledialog.o \
|
||||
fkey_map.o \
|
||||
fcharmap.o \
|
||||
|
|
|
@ -34,6 +34,7 @@ INCLUDE_HEADERS = \
|
|||
fcheckmenuitem.h \
|
||||
fmessagebox.h \
|
||||
ftooltip.h \
|
||||
fbusyindicator.h \
|
||||
sgr_optimizer.h \
|
||||
foptiattr.h \
|
||||
foptimove.h \
|
||||
|
@ -118,6 +119,7 @@ OBJS = \
|
|||
fcombobox.o \
|
||||
fmessagebox.o \
|
||||
ftooltip.o \
|
||||
fbusyindicator.o \
|
||||
ffiledialog.o \
|
||||
fkey_map.o \
|
||||
fcharmap.o \
|
||||
|
|
|
@ -399,13 +399,13 @@ void FApplication::setTerminalEncoding (const FString& enc_str)
|
|||
//----------------------------------------------------------------------
|
||||
void FApplication::setLogFile (const FString& filename)
|
||||
{
|
||||
// Get the global logger object
|
||||
FLog& log = *FApplication::getLog();
|
||||
auto& log_stream = getStartOptions().logfile_stream;
|
||||
log_stream.open(filename, std::ofstream::out);
|
||||
|
||||
if ( log_stream.is_open() )
|
||||
{
|
||||
// Get the global logger object
|
||||
FLog& log = *FApplication::getLog();
|
||||
log.setOutputStream(log_stream);
|
||||
log.enableTimestamp();
|
||||
log.setLineEnding (finalcut::FLog::LF);
|
||||
|
@ -414,7 +414,7 @@ void FApplication::setLogFile (const FString& filename)
|
|||
{
|
||||
auto ftermdata = FTerm::getFTermData();
|
||||
ftermdata->setExitMessage ( "Could not open log file \""
|
||||
+ FString(optarg) + "\"" );
|
||||
+ filename + "\"" );
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,120 @@
|
|||
/***********************************************************************
|
||||
* fbusyindicator.cpp - Shows background activity *
|
||||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2020 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
* 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/>. *
|
||||
***********************************************************************/
|
||||
|
||||
#include "final/fbusyindicator.h"
|
||||
|
||||
namespace finalcut
|
||||
{
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FBusyIndicator
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// constructors and destructor
|
||||
//----------------------------------------------------------------------
|
||||
FBusyIndicator::FBusyIndicator (FWidget* parent)
|
||||
: FToolTip{parent}
|
||||
{
|
||||
FToolTip::hide();
|
||||
createIndicatorText();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FBusyIndicator::~FBusyIndicator() // destructor
|
||||
{ }
|
||||
|
||||
|
||||
// public methods of FBusyIndicator
|
||||
//----------------------------------------------------------------------
|
||||
void FBusyIndicator::start()
|
||||
{
|
||||
running = true;
|
||||
show();
|
||||
updateTerminal();
|
||||
flush();
|
||||
addTimer(TIMER);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FBusyIndicator::stop()
|
||||
{
|
||||
delOwnTimer();
|
||||
running = false;
|
||||
hide();
|
||||
updateTerminal();
|
||||
flush();
|
||||
}
|
||||
|
||||
|
||||
// private methods of FBusyIndicator
|
||||
//----------------------------------------------------------------------
|
||||
void FBusyIndicator::createIndicatorText()
|
||||
{
|
||||
FString line[4]{};
|
||||
|
||||
if ( FTerm::getEncoding() == fc::UTF8 )
|
||||
{
|
||||
const wchar_t (&p)[8] = uni_pattern;
|
||||
line[0] << " " << p[7] << " " << p[0] << " \n";
|
||||
line[1] << " " << p[6] << " " << p[1] << " \n";
|
||||
line[2] << " " << p[5] << " " << p[2] << " \n";
|
||||
line[3] << " " << p[4] << " " << p[3] << " ";
|
||||
}
|
||||
else
|
||||
{
|
||||
const char (&p)[8] = pattern;
|
||||
line[0] << " " << p[7] << " " << p[0] << " \n";
|
||||
line[1] << " " << p[6] << " " << p[1] << " \n";
|
||||
line[2] << " " << p[5] << " " << p[2] << " \n";
|
||||
line[3] << " " << p[4] << " " << p[3] << " ";
|
||||
}
|
||||
|
||||
FString txt{line[0] + line[1] + line[2] + line[3]};
|
||||
FToolTip::setText(txt);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FBusyIndicator::onTimer (finalcut::FTimerEvent*)
|
||||
{
|
||||
// Rotate pattern
|
||||
if ( FTerm::getEncoding() == fc::UTF8 )
|
||||
{
|
||||
const wchar_t last = uni_pattern[7];
|
||||
std::memmove(uni_pattern + 1, uni_pattern , sizeof(wchar_t) * 7);
|
||||
uni_pattern[0] = last;
|
||||
}
|
||||
else
|
||||
{
|
||||
const char last = pattern[7];
|
||||
std::memmove(pattern + 1, pattern , sizeof(char) * 7);
|
||||
pattern[0] = last;
|
||||
}
|
||||
|
||||
// Redraw the rotated pattern
|
||||
createIndicatorText();
|
||||
redraw();
|
||||
updateTerminal();
|
||||
flush();
|
||||
}
|
||||
|
||||
} // namespace finalcut
|
||||
|
|
@ -317,6 +317,11 @@ void FSpinBox::init()
|
|||
input_field.unsetShadow();
|
||||
input_field << value;
|
||||
input_field.addCallback
|
||||
(
|
||||
"activate",
|
||||
F_METHOD_CALLBACK (this, &FSpinBox::cb_inputFieldActivate)
|
||||
);
|
||||
input_field.addCallback
|
||||
(
|
||||
"changed",
|
||||
F_METHOD_CALLBACK (this, &FSpinBox::cb_inputFieldChange)
|
||||
|
@ -392,6 +397,12 @@ inline void FSpinBox::decreaseValue()
|
|||
delOwnTimer();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FSpinBox::processActivate()
|
||||
{
|
||||
emitCallback("activate");
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FSpinBox::processChanged()
|
||||
{
|
||||
|
@ -416,6 +427,12 @@ void FSpinBox::forceFocus()
|
|||
getStatusBar()->drawMessage();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FSpinBox::cb_inputFieldActivate (finalcut::FWidget*, const FDataPtr)
|
||||
{
|
||||
processActivate();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FSpinBox::cb_inputFieldChange (finalcut::FWidget* w, const FDataPtr)
|
||||
{
|
||||
|
|
|
@ -282,6 +282,8 @@ void FWindow::hide()
|
|||
getVWin()->visible = false;
|
||||
|
||||
FWidget::hide();
|
||||
const auto& t_geometry = getTermGeometryWithShadow();
|
||||
restoreVTerm (t_geometry);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -35,9 +35,13 @@
|
|||
* ▕▁▁▁▁▁▁▁▁▁▏
|
||||
* ▲
|
||||
* │
|
||||
* ▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏1 *▕▔▔▔▔▔▔▔▔▏
|
||||
* ▕ FApplication ▏-┬- - - -▕ FEvent ▏
|
||||
* ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▁▏ : ▕▁▁▁▁▁▁▁▁▏
|
||||
* ▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏1 1▕▔▔▔▔▔▔▏
|
||||
* ▕ FApplication ▏-┬- - - -▕ FLog ▏
|
||||
* ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▁▏ : ▕▁▁▁▁▁▁▏
|
||||
* :
|
||||
* : *▕▔▔▔▔▔▔▔▔▏
|
||||
* :- - - -▕ FEvent ▏
|
||||
* : ▕▁▁▁▁▁▁▁▁▏
|
||||
* :
|
||||
* : *▕▔▔▔▔▔▔▔▔▏
|
||||
* :- - - -▕ FPoint ▏
|
||||
|
|
|
@ -0,0 +1,128 @@
|
|||
/***********************************************************************
|
||||
* fbusyindicator.h - Shows background activity *
|
||||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2020 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
* 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/>. *
|
||||
***********************************************************************/
|
||||
|
||||
/* Inheritance diagram
|
||||
* ═══════════════════
|
||||
*
|
||||
* ▕▔▔▔▔▔▔▔▔▔▏ ▕▔▔▔▔▔▔▔▔▔▏
|
||||
* ▕ FVTerm ▏ ▕ FObject ▏
|
||||
* ▕▁▁▁▁▁▁▁▁▁▏ ▕▁▁▁▁▁▁▁▁▁▏
|
||||
* ▲ ▲
|
||||
* │ │
|
||||
* └─────┬─────┘
|
||||
* │
|
||||
* ▕▔▔▔▔▔▔▔▔▔▏
|
||||
* ▕ FWidget ▏
|
||||
* ▕▁▁▁▁▁▁▁▁▁▏
|
||||
* ▲
|
||||
* │
|
||||
* ▕▔▔▔▔▔▔▔▔▔▏
|
||||
* ▕ FWindow ▏
|
||||
* ▕▁▁▁▁▁▁▁▁▁▏
|
||||
* ▲
|
||||
* │
|
||||
* ▕▔▔▔▔▔▔▔▔▔▔▏
|
||||
* ▕ FToolTip ▏
|
||||
* ▕▁▁▁▁▁▁▁▁▁▁▏
|
||||
* ▲
|
||||
* │
|
||||
* ▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏
|
||||
* ▕ FBusyIndicator ▏
|
||||
* ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▏
|
||||
*/
|
||||
|
||||
#ifndef FBUSYINDICATOR_H
|
||||
#define FBUSYINDICATOR_H
|
||||
|
||||
#if !defined (USE_FINAL_H) && !defined (COMPILE_FINAL_CUT)
|
||||
#error "Only <final/final.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include "final/ftooltip.h"
|
||||
|
||||
namespace finalcut
|
||||
{
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FBusyIndicator
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class FBusyIndicator : public FToolTip
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
explicit FBusyIndicator (FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FBusyIndicator (const FBusyIndicator&) = delete;
|
||||
|
||||
// Destructor
|
||||
~FBusyIndicator();
|
||||
|
||||
// Disable copy assignment operator (=)
|
||||
FBusyIndicator& operator = (const FBusyIndicator&) = delete;
|
||||
|
||||
// Accessors
|
||||
const FString getClassName() const override;
|
||||
|
||||
// Inquiries
|
||||
bool isRunning();
|
||||
|
||||
// Methods
|
||||
void start();
|
||||
void stop();
|
||||
|
||||
private:
|
||||
// Constants
|
||||
static constexpr std::size_t TIMER = 200;
|
||||
|
||||
// Methods
|
||||
void createIndicatorText();
|
||||
|
||||
// Event handler
|
||||
void onTimer (finalcut::FTimerEvent*) override;
|
||||
|
||||
// Callback methods
|
||||
|
||||
// Data members
|
||||
wchar_t uni_pattern[8]{L' ', L' ', L'·', L'·', L'•', L'•', L'●', L'●'};
|
||||
char pattern[8]{L' ', L' ', L'.', L'.', L'+', L'+', L'#', L'#'};
|
||||
bool running{false};
|
||||
};
|
||||
|
||||
|
||||
// FBusyIndicator inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const FString FBusyIndicator::getClassName() const
|
||||
{ return "FBusyIndicator"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FBusyIndicator::isRunning()
|
||||
{
|
||||
return running;
|
||||
}
|
||||
|
||||
} // namespace finalcut
|
||||
|
||||
#endif // FBUSYINDICATOR_H
|
||||
|
||||
|
|
@ -159,6 +159,18 @@ class default16ColorPalette final : public FColorPalette
|
|||
inline const FString default16ColorPalette::getClassName() const
|
||||
{ return "default16ColorPalette"; }
|
||||
|
||||
/* Inheritance diagram
|
||||
* ═══════════════════
|
||||
*
|
||||
* ▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏
|
||||
* ▕ FColorPalette ▏
|
||||
* ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▏
|
||||
* ▲
|
||||
* │
|
||||
* ▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏
|
||||
* ▕ default16DarkColorPalette ▏
|
||||
* ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▏
|
||||
*/
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class default16DarkColorPalette
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <final/fapplication.h>
|
||||
#include <final/fbuttongroup.h>
|
||||
#include <final/fbutton.h>
|
||||
#include <final/fbusyindicator.h>
|
||||
#include <final/fc.h>
|
||||
#include <final/fobject.h>
|
||||
#include <final/fcolorpalette.h>
|
||||
|
|
|
@ -135,10 +135,12 @@ class FSpinBox : public FWidget
|
|||
void updateInputField();
|
||||
void increaseValue();
|
||||
void decreaseValue();
|
||||
void processActivate();
|
||||
void processChanged();
|
||||
void forceFocus();
|
||||
|
||||
// Callback methods
|
||||
void cb_inputFieldActivate (finalcut::FWidget*, const FDataPtr);
|
||||
void cb_inputFieldChange (finalcut::FWidget*, const FDataPtr);
|
||||
|
||||
// Data members
|
||||
|
|
|
@ -66,7 +66,7 @@ namespace finalcut
|
|||
class FToolTip : public FWindow
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
// Constructors
|
||||
explicit FToolTip (FWidget* = nullptr);
|
||||
explicit FToolTip (const FString&, FWidget* = nullptr);
|
||||
|
||||
|
|
|
@ -37,6 +37,10 @@
|
|||
* : 1▕▔▔▔▔▔▔▔▔▔▔▏
|
||||
* :- - - -▕ FMenuBar ▏
|
||||
* : ▕▁▁▁▁▁▁▁▁▁▁▏
|
||||
*
|
||||
* : 1▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏
|
||||
* :- - - -▕ FWidgetColors ▏
|
||||
* : ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▏
|
||||
* :
|
||||
* : *▕▔▔▔▔▔▔▔▔▔▏
|
||||
* :- - - -▕ FString ▏
|
||||
|
|
Loading…
Reference in New Issue