finalcut icon indicating copy to clipboard operation
finalcut copied to clipboard

Users feedback, discussion

Open AlexanderZvyagin opened this issue 8 years ago • 54 comments

Markus Gans, I am really impressed of the work you have done! In comparision with dialog/newt-snack/ncurses/npyscreen it is like a breath of fresh air. Congratulations and please continue.

I think your library will get more attention if there is a place where users (like me) can ask questions, ask for advices, etc. What shall it be? A mail list? A web forum? Probably the easiest solution (it does not require anything to setup) is to use Stackoverflow with [final-cut] tag?!

AlexanderZvyagin avatar Feb 22 '17 08:02 AlexanderZvyagin

Many thanks for your reply and your praise.

The using of an alternative and more established place for the user feedback sounds good. I joined Stack Overflow now. You can find me here: http://stackoverflow.com/users/story/7607413

Unfortunately, I can not create the tag "final-cut" without asking a question.

gansm avatar Feb 22 '17 23:02 gansm

http://stackoverflow.com/questions/42408243/support-for-table-grid-widget-in-final-cut About tag "final-cut": I need to increase my reputation on stackoverflow to be able to create tags.

AlexanderZvyagin avatar Feb 23 '17 06:02 AlexanderZvyagin

Can it work on MacOS?

helmishariff avatar Dec 02 '17 15:12 helmishariff

I don't have a macOS on my computer, but I'm using a compile-run with macOS on Travis-CI. The use of macOS should therefore be possible. Of course, I would appreciate a positive feedback.

https://travis-ci.org/gansm/finalcut/builds/304405079 https://travis-ci.org/gansm/finalcut/jobs/304405082

gansm avatar Dec 02 '17 19:12 gansm

I got this error message when try to compile hello sample. fterm.h:57:12: fatal error: 'gpm.h' file not found #include <gpm.h> (if this is mouse daemon, I can't find for MacOS ver.)

helmishariff avatar Dec 02 '17 22:12 helmishariff

I have checked emac in Macport. This is how they implement the mouse. https://searchcode.com/codesearch/view/27232327/

helmishariff avatar Dec 02 '17 22:12 helmishariff

I have download gpm from github since it can support xterm. Then I compile with g++ -I/Library/finalcut/include -o hellofinal hellofinal.cpp and I get linker error: Undefined symbols for architecture x86_64: "FMessageBox::setText(FString const&)", referenced from: _main in hellofinal-0f9b96.o "FMessageBox::FMessageBox(FWidget*)", referenced from: _main in hellofinal-0f9b96.o "FMessageBox::~FMessageBox()", referenced from: _main in hellofinal-0f9b96.o "FApplication::FApplication(int const&, char**, bool)", referenced from: _main in hellofinal-0f9b96.o "FApplication::~FApplication()", referenced from: _main in hellofinal-0f9b96.o "FDialog::exec()", referenced from: _main in hellofinal-0f9b96.o "FString::FString(char const*)", referenced from: _main in hellofinal-0f9b96.o "FString::~FString()", referenced from: _main in hellofinal-0f9b96.o

Then I tried to compile with g++ -I/Library/finalcut/include -o wtui hellofinal.cpp /Library/finalcut/src/fmessagebox.cpp get this error: error: "Only <final/final.h> can be included directly." #error "Only <final/final.h> can be included directly."

helmishariff avatar Dec 02 '17 23:12 helmishariff

It seems the examples all working when I use make.

helmishariff avatar Dec 02 '17 23:12 helmishariff

When I try to compile manually, error: "_tgetent", referenced from: FTerm::init_termcaps() in fterm.o "_tgetflag", referenced from: FTerm::init_termcaps() in fterm.o FTerm::init_termcaps_booleans() in fterm.o

helmishariff avatar Dec 03 '17 00:12 helmishariff

I confirm that the library works on MacOS.

AlexanderZvyagin avatar Dec 03 '17 00:12 AlexanderZvyagin

Yes I know it is working on MacOS since I can make samples & run it. May I know what is c++ flag to compile it.I tried g++ -I/mylibrary/finalcut/include /mylibrary/finalcut/src/*.o -o hello hello.cpp but no success

helmishariff avatar Dec 03 '17 04:12 helmishariff

Thank you for your feedback. I'm a little bit confused that the configure script has found a gpm.h on your system.

You should try the following commands:

autoreconf -v --install --force
./configure --prefix=/usr
make

If that doesn't help, you can also explicitly disable GPM support:

./configure --prefix=/usr --without-gpm
make

How to use the library (a little example):

#include <final/final.h>

using namespace finalcut;

int main (int argc, char* argv[])
{
  FApplication app(argc, argv);
  // Note: Use Shift+F10 or Ctrl+^ to close the dialog
  FDialog dialog(&app);
  dialog.setText ("A dialog");
  dialog.setGeometry (FPoint(25, 5), FSize(30, 10));
  app.setMainWidget(&dialog);
  dialog.show();
  return app.exec();
}

Compile with: g++ -O2 -lfinal dialog.cpp -o dialog

It is important that you don't forget to include the libfinal via "-lfinal".

gansm avatar Dec 03 '17 19:12 gansm

Yes, thank you. With "-lfinal" flag I'm able to compile my code. Thanks.

helmishariff avatar Dec 04 '17 00:12 helmishariff

Are there any possible this can be ported to Windows?

helmishariff avatar Dec 04 '17 03:12 helmishariff

I have downloaded and make & install on ubuntu 17.04 but can't compile my code with same way I compile on Mac. On Mac, I download gpm first before make & install final cut.

helmishariff avatar Dec 04 '17 04:12 helmishariff

A port to Microsoft Windows isn’t possible, because there are neither POSIX libraries nor a terminal emulator available.

For the compiling under Ubuntu you probably need some development packages.

apt-get update && apt-get install autotools-dev automake autoconf autoconf-archive libtool libglib2.0-dev libncurses5-dev libgpm-dev

gansm avatar Dec 04 '17 08:12 gansm

I added the [finalcut-tui] tag on SO. Your tui doesn't work too well on my arch linux though within lxterminal :) All blinking and stuff.

user1095108 avatar Oct 09 '18 01:10 user1095108

Thanks for your tagging.

LXTerminal is a VTE-based terminal emulator and should not cause any problems. Can you please compile Final Cut with ./build.sh debug and then execute the following command:

examples/termcap | tee /tmp/output ; sed -i -n '/^Terminal/,/`--/p' /tmp/output

Post me the output of cat /tmp/output

Do you also get the libtinfo.so displayed when using the ldd command?

ldd src/.libs/libfinal.so | grep tinfo
	libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007fc734d07000)

What does the environment variable $TERM contain?

If all runs correctly, the file /usr/share/terminfo/g/gnome-256color should be used. Does this file exist on your system?

gansm avatar Oct 09 '18 04:10 gansm

--------
FTermcap
--------

Terminal: cygwin

.------------------- debug -------------------
|               Framebuffer bpp: -1
| after init_256colorTerminal(): gnome-256color
|    after parseAnswerbackMsg(): gnome-256color
|            after parseSecDA(): cygwin
|              The SecDA String: \E[>65;5401;1c 
`------------------- debug -------------------

[Booleans]
FTermcap::background_color_erase: true
FTermcap::automatic_left_margin: false
FTermcap::automatic_right_margin: true
FTermcap::eat_nl_glitch: false
FTermcap::ansi_default_color: false
FTermcap::osc_support: false
FTermcap::no_utf8_acs_chars: true

[Numeric]
FTermcap::max_color: 16
FTermcap::tabstop: 8
FTermcap::attr_without_color: 26

[String]
t_bell: ^G 
t_erase_chars: 
t_clear_screen: \E[H\E[J 
t_clr_eos: \E[J 
t_clr_eol: \E[K 
t_clr_bol: \E[1K 
t_cursor_home: \E[H 
t_cursor_to_ll: 
t_carriage_return: ^M 
t_tab: ^I 
t_back_tab: 
t_insert_padding: 
t_insert_character: \E[@ 
t_parm_ich: \E[%p1%d@ 
t_repeat_char: 
t_initialize_color: \E]4;%p1%d;rgb:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\ 
t_initialize_pair: 
t_set_a_foreground: \E[3%p1%{8}%m%d%?%p1%{7}%>%t;1%e;22%;m 
t_set_a_background: \E[4%p1%{8}%m%d%?%p1%{7}%>%t;5%e;25%;m 
t_set_foreground: 
t_set_background: 
t_set_color_pair: 
t_orig_pair: \E[39;49;25m 
t_orig_colors: 
t_no_color_video: 
t_cursor_address: \E[%i%p1%d;%p2%dH 
t_column_address: \E[%i%p1%dG 
t_row_address: \E[%i%p1%dd 
t_cursor_visible: \E[?25h 
t_cursor_invisible: \E[?25l 
t_cursor_normal: \E[?12l\E[?25h 
t_cursor_up: \E[A 
t_cursor_down: \E[B 
t_cursor_left: ^H 
t_cursor_right: \E[C 
t_parm_up_cursor: \E[%p1%dA 
t_parm_down_cursor: \E[%p1%dB 
t_parm_left_cursor: \E[%p1%dD 
t_parm_right_cursor: \E[%p1%dC 
t_save_cursor: \E7 
t_restore_cursor: \E8 
t_scroll_forward: ^J 
t_scroll_reverse: \EM 
t_enter_ca_mode: \E7\E[?47h 
t_exit_ca_mode: \E[2J\E[?47l\E8 
t_enable_acs: \E(B\E)0 
t_enter_bold_mode: \E[1m 
t_exit_bold_mode: \E[22m 
t_enter_dim_mode: 
t_exit_dim_mode: 
t_enter_italics_mode: 
t_exit_italics_mode: 
t_enter_underline_mode: 
t_exit_underline_mode: 
t_enter_blink_mode: \E[5m 
t_exit_blink_mode: \E[25m 
t_enter_reverse_mode: \E[7m 
t_exit_reverse_mode: \E[27m 
t_enter_standout_mode: \E[7m 
t_exit_standout_mode: \E[27m 
t_enter_secure_mode: \E[8m 
t_exit_secure_mode: 
t_enter_protected_mode: 
t_exit_protected_mode: 
t_enter_crossed_out_mode: 
t_exit_crossed_out_mode: 
t_enter_dbl_underline_mode: 
t_exit_dbl_underline_mode: 
t_set_attributes: \E[0%?%p6%t;1%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t^N%e^O%; 
t_exit_attribute_mode: \E[0m^O 
t_enter_alt_charset_mode: ^N 
t_exit_alt_charset_mode: ^O 
t_enter_pc_charset_mode: \E[11m 
t_exit_pc_charset_mode: \E[10m 
t_enter_insert_mode: \E[4h 
t_exit_insert_mode: \E[4l 
t_enter_am_mode: 
t_exit_am_mode: 
t_acs_chars: +^P,^Q-^X.^Y0\333`^Da\261f\370g\361h\260j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376 
t_keypad_xmit: 
t_keypad_local: 
t_key_mouse:

xterm-256color

-rw-r--r-- 1 root root 3619 Jan 29 2018 /usr/share/terminfo/g/gnome-256color

Screenshot of "ui" (add blinking in your imagination): Screenshot

user1095108 avatar Oct 09 '18 09:10 user1095108

That's interesting. I found out that the VTE project has changed the terminal ID from 1 to 65 since version 0.53.0. I have changed the terminal detection in the current commit.

If it doesn't work, please don't put the whole screen output here again. I only need the part from /tmp/output.

gansm avatar Oct 09 '18 14:10 gansm

It works now.

user1095108 avatar Oct 09 '18 14:10 user1095108

Does the library support Windows, DOS, how about the android console?

user1095108 avatar Oct 12 '18 13:10 user1095108

You need an operating system enviroment that implements a POSIX system call API. Under Windows this can be realized with the Cygwin project.

gansm avatar Oct 12 '18 14:10 gansm

Rather than reimplementing Qt, you should strive to provide features, that Qt does not provide. Perhaps web deployment (emscripten has a curses port available) and declarative language support, that compiles into C++. Qt Quick and the associated bloat are a major issue among embedded Qt devs.

user1095108 avatar Oct 13 '18 11:10 user1095108

I'm not trying to reimplement Qt Framework. The basic class design is influenced from Qt and not a one-to-one Qt clone. A curses library is not required by Final Cut, it has its own cursor optimization and window management. Only a Termcap library with a capability database is required.

termcap: terminal capability database https://www.systutorials.com/docs/linux/man/5-termcap/

gansm avatar Oct 14 '18 18:10 gansm

Hi!

I'm trying to catch the terminal resize event, but don't know how. My first thought was to subclass FWidget and add a onResize(FResizeEvent *event), but it did not work. In the First Steps you explain that most events will be provided by event() of FObject, but all I see is just a call to onTimer() and onUserEvent(). Is there a simple example available about this?

Thanks in advance.

cybin avatar Nov 14 '19 12:11 cybin

FObject is the base class of FWidget that implements the onResize() event for terminal resizing. The resize event is a specific case that only sends events to the application object.

Code example:

#include <final/final.h>

using namespace finalcut;

class FApp : public FApplication
{
  public:
    FApp (const int& _argc, char* _argv[])
      : FApplication(_argc, _argv)
    { }

  private:
    void onResize (FResizeEvent* ev) override
    {
      FTerm::beep();
      FWidget::onResize (ev);
    }
};

int main (int argc, char* argv[])
{
  FApp app(argc, argv);
  FMessageBox mbox(&app);
  mbox.setTitlebarText("Listen...");
  mbox.setText("Beep on resize.");
  mbox.exec();
}

Maybe the method adjustSize() is more what you are looking for: https://github.com/gansm/finalcut/blob/master/doc/first-steps.md#dynamic-layout

gansm avatar Nov 14 '19 22:11 gansm

Yes, that's what I was up to. Thanks a lot.

cybin avatar Nov 15 '19 07:11 cybin

Hi! I've got another question. Since yesterday I'm struggling with a std::thread. Within a subclass of FDialog I want to fill a FListBox with items read by a thread. The thread is created after instantiation. Well, I started with a simple function that just prints that it's been called. But even this thread causes a segmentation fault on thread.join().

void test() { fprintf(stderr, "Test running\n"); }
// void Module::test() { fprintf(stderr, "Test running\n"); }

void Module::revert() {

  std::thread thread_read_communities(test);

  if (thread_read_communities.joinable())
    thread_read_communities.join();
}

Well, Module::test() fails too. To test it, I tried the following simple code snippet:

class test {

public:
        void testfunc() { printf("Thread Running\n"); }

        void main() {

                std::thread foo(&test::testfunc, this);
                foo.join();
        }
};

int main(int arc, char **argv) {

        test bar{};
        bar.main();
        exit(0);
}

This snippet works like charm. I'm not used to C++ so I think I'm missing something important here. Does anyone have got an idea?

Thanks in advance.

cybin avatar Nov 22 '19 10:11 cybin

Unfortunately I don't know your program code, so I can't tell you what could be the reason for the segmentation fault.

This little example might help you:

#include <chrono>
#include <thread>

#include <final/final.h>

using finalcut::FPoint;
using finalcut::FSize;

class ListBoxDialog : public finalcut::FDialog
{
  public:
    ListBoxDialog (FWidget* parent = nullptr) : FDialog(parent)
    {
      setText (L"List copy per thread");
      setGeometry ( FPoint(int(1 + (parent->getWidth() - 41) / 2), 5)
                  , FSize(41, 16) );
      setShadow();
      list1.setGeometry(FPoint(2, 1), FSize(18, 10));
      list1.setText ("Source");
      list1.insert ( {1, 2, 3, 4, 5, 6, 7, 8} );

      list2.setGeometry(FPoint(21, 1), FSize(18, 10));
      list2.setText ("Destination");

      Quit.setGeometry(FPoint(28, 12), FSize(10, 1));
      Quit.setText (L"&Quit");
      Quit.addCallback
      (
        "clicked",
        finalcut::getFApplication(),
        &finalcut::FApplication::cb_exitApp,
        this
      );
    }

    ~ListBoxDialog()
    { }

  private:
    void copy()  // run as thread
    {
      std::this_thread::sleep_for(std::chrono::seconds(2));

      for (std::size_t i = 1; i <= list1.getCount(); i++)
        list2.insert(list1.getItem(i));

      list2.redraw();
      updateTerminal();
    }

    void onShow (finalcut::FShowEvent*)
    {
      std::thread t1(&ListBoxDialog::copy, this);
      t1.detach();
    }

    finalcut::FListBox list1{this};
    finalcut::FListBox list2{this};
    finalcut::FButton  Quit{this};
};

int main (int argc, char* argv[])
{
  finalcut::FApplication app(argc, argv);
  ListBoxDialog dlg(&app);
  app.setMainWidget(&dlg);
  dlg.show();
  return app.exec();
}

Last modified: Code changes for the upcoming release 0.7.0

If you want to learn more about C++, you should take a closer look at these pages.

  • http://www.cplusplus.com/reference/
  • https://en.cppreference.com/w/Main_Page
  • https://isocpp.org/faq
  • https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines.html

gansm avatar Nov 22 '19 17:11 gansm